Removed unneeded whitespace.
This commit is contained in:
@@ -960,7 +960,7 @@ void UpdateSound(void *userdata, Uint8 * stream, int len)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (left <= len)
|
||||
{
|
||||
memcpy(stream, &Buffer[Buffer_head], left);
|
||||
@@ -970,7 +970,7 @@ void UpdateSound(void *userdata, Uint8 * stream, int len)
|
||||
Buffer_fill -= left;
|
||||
}
|
||||
|
||||
if (len)
|
||||
if (len)
|
||||
{
|
||||
memcpy(stream, &Buffer[Buffer_head], len);
|
||||
Buffer_head += len;
|
||||
@@ -1262,28 +1262,28 @@ void spc_sanitize_files() {
|
||||
|
||||
pid_t spc_fork() {
|
||||
pid_t childpid;
|
||||
|
||||
|
||||
if ((childpid = fork()) == -1) return -1;
|
||||
|
||||
|
||||
//If this us the parent proccess nothing more to do
|
||||
if (childpid != 0) return childpid;
|
||||
|
||||
|
||||
//This is the child proccess
|
||||
|
||||
|
||||
spc_sanitize_files();
|
||||
|
||||
|
||||
/*
|
||||
There actually is a bug here which I submitted to the authors of the book -Nach
|
||||
|
||||
|
||||
The bug is as follows:
|
||||
The parent returns the child proccess ID in event of success.
|
||||
The parent returns the child proccess ID in event of success.
|
||||
The child returns 0 on success if and only if it's spc_drop_privileges() call is successful.
|
||||
It is possible that the parent will return with a pid > 0, while the child never returns
|
||||
It is possible that the parent will return with a pid > 0, while the child never returns
|
||||
from spc_fork thus causing a programming error.
|
||||
|
||||
The function should be rewritten that the parent doesn't return till it knows if the
|
||||
The function should be rewritten that the parent doesn't return till it knows if the
|
||||
child is able to return or not. And then return -1 or the child pid.
|
||||
|
||||
|
||||
For out purposes in ZSNES to launch a browser, this bug does not effect us. But
|
||||
be careful if you copy this code to use somewhere else.
|
||||
*/
|
||||
@@ -1291,7 +1291,7 @@ pid_t spc_fork() {
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1304,21 +1304,21 @@ void LaunchBrowser(char *browser)
|
||||
void ZsnesPage()
|
||||
{
|
||||
if (spc_fork()) //If fork failed, or we are the parent
|
||||
{
|
||||
{
|
||||
MouseX = 0;
|
||||
MouseY = 0;
|
||||
MouseY = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//We are now the child proccess
|
||||
|
||||
|
||||
//If any of these LaunchBrowser() calls return that means it failed and we should try the next one
|
||||
LaunchBrowser("mozilla");
|
||||
LaunchBrowser("mozilla-firefox");
|
||||
LaunchBrowser("konqueror");
|
||||
LaunchBrowser("lynx");
|
||||
LaunchBrowser("links");
|
||||
|
||||
|
||||
exit(0); //All browser launches failed, oh well
|
||||
}
|
||||
|
||||
|
||||
@@ -48,17 +48,17 @@ BOOL sw_start(int width, int height, int req_depth, int FullScreen)
|
||||
//int i;
|
||||
Uint32 flags = SDL_DOUBLEBUF | SDL_SWSURFACE;
|
||||
DWORD GBitMask;
|
||||
|
||||
|
||||
flags |= (FullScreen ? SDL_FULLSCREEN : 0);
|
||||
|
||||
|
||||
SurfaceX = width; SurfaceY = height;
|
||||
surface = SDL_SetVideoMode(SurfaceX, SurfaceY, req_depth, flags);
|
||||
if (surface == NULL) {
|
||||
fprintf (stderr, "Could not set %dx%d video mode: %s\n", SurfaceX, SurfaceY, SDL_GetError ());
|
||||
return FALSE;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
SurfaceLocking = SDL_MUSTLOCK(surface);
|
||||
SDL_WarpMouse(SurfaceX/4,SurfaceY/4);
|
||||
|
||||
@@ -173,7 +173,7 @@ void sw_drawwin()
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
copy640x480x16bwin();
|
||||
}
|
||||
@@ -195,7 +195,7 @@ void sw_drawwin()
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
copy640x480x16bwin();
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ DWORD ZOpenFile()
|
||||
{
|
||||
if(ZOpenMode==0)
|
||||
{
|
||||
if (TextFile)
|
||||
if (TextFile)
|
||||
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"rb");
|
||||
else
|
||||
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"rb");
|
||||
@@ -140,11 +140,11 @@ DWORD ZOpenFile()
|
||||
}
|
||||
if(ZOpenMode==1)
|
||||
{
|
||||
if (TextFile)
|
||||
if (TextFile)
|
||||
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"wb");
|
||||
else
|
||||
FILEHANDLE[CurrentHandle]=(FILE *)gzopen(ZOpenFileName,"wb");
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
return(CurrentHandle-1);
|
||||
@@ -153,11 +153,11 @@ DWORD ZOpenFile()
|
||||
}
|
||||
if(ZOpenMode==2)
|
||||
{
|
||||
if (TextFile)
|
||||
if (TextFile)
|
||||
FILEHANDLE[CurrentHandle]=fopen(ZOpenFileName,"r+b");
|
||||
else
|
||||
FILEHANDLE[CurrentHandle]=gzopen(ZOpenFileName,"r+b");
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
if(FILEHANDLE[CurrentHandle]!=NULL)
|
||||
{
|
||||
CurrentHandle+=1;
|
||||
return(CurrentHandle-1);
|
||||
@@ -184,7 +184,7 @@ DWORD ZFileSeek()
|
||||
mode = SEEK_SET;
|
||||
else if (ZFileSeekMode==1) {
|
||||
mode = SEEK_END;
|
||||
if (TextFile==0)
|
||||
if (TextFile==0)
|
||||
printf("Warning : gzseek(SEEK_END) not supported");
|
||||
} else return (0xFFFFFFFF);
|
||||
|
||||
@@ -206,8 +206,8 @@ DWORD ZFileRead()
|
||||
ZFileReadSize,
|
||||
FILEHANDLE[ZFileReadHandle]));
|
||||
else
|
||||
return(gzread(FILEHANDLE[ZFileReadHandle],
|
||||
ZFileReadBlock,
|
||||
return(gzread(FILEHANDLE[ZFileReadHandle],
|
||||
ZFileReadBlock,
|
||||
ZFileReadSize));
|
||||
}
|
||||
|
||||
@@ -221,11 +221,11 @@ DWORD ZFileWrite()
|
||||
ZFileWriteSize,
|
||||
FILEHANDLE[ZFileWriteHandle]);
|
||||
else
|
||||
res = gzwrite(FILEHANDLE[ZFileWriteHandle],
|
||||
ZFileWriteBlock,
|
||||
res = gzwrite(FILEHANDLE[ZFileWriteHandle],
|
||||
ZFileWriteBlock,
|
||||
ZFileWriteSize);
|
||||
|
||||
if (res!=ZFileWriteSize)
|
||||
|
||||
if (res!=ZFileWriteSize)
|
||||
return(0xFFFFFFFF);
|
||||
|
||||
return(0);
|
||||
@@ -262,7 +262,7 @@ DWORD ZFileMKDir()
|
||||
{
|
||||
#ifdef __LINUX__
|
||||
return(mkdir(MKPath, (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)));
|
||||
#else
|
||||
#else
|
||||
return(mkdir(MKPath));
|
||||
#endif
|
||||
}
|
||||
@@ -315,30 +315,30 @@ DWORD ZFileFindNext()
|
||||
|
||||
if (globcur == -1)
|
||||
return -1;
|
||||
|
||||
|
||||
globcur++;
|
||||
if (globcur > globbuf.gl_pathc) /* >= */
|
||||
return -1;
|
||||
|
||||
|
||||
if (globcur == globbuf.gl_pathc) {
|
||||
/* this is the end, so just add it ourselves */
|
||||
*(char *)(DTALocPos + 0x15) = 0x10;
|
||||
strcpy((char *)DTALocPos + 0x1E, "..");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
*(char *)(DTALocPos + 0x15) = 0;
|
||||
|
||||
stat ( globbuf.gl_pathv[globcur], &filetype );
|
||||
|
||||
|
||||
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
||||
if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
||||
|
||||
|
||||
if ( S_ISDIR ( filetype.st_mode ))
|
||||
*(char *)(DTALocPos + 0x15) = 0x10;
|
||||
|
||||
strcpy((char *)DTALocPos + 0x1E, globbuf.gl_pathv[globcur]);
|
||||
|
||||
|
||||
#else
|
||||
TempFind=_findnext(FindFirstHandle,&FindDataStruct);
|
||||
if(TempFind==-1) return(-1);
|
||||
@@ -365,7 +365,7 @@ DWORD ZFileFindFirst()
|
||||
globfree(&globbuf);
|
||||
globcur = -1;
|
||||
}
|
||||
|
||||
|
||||
if (glob(ZFileFindPATH, 0, NULL, &globbuf))
|
||||
return -1;
|
||||
globcur = 0;
|
||||
@@ -378,10 +378,10 @@ DWORD ZFileFindFirst()
|
||||
#endif
|
||||
|
||||
stat ( globbuf.gl_pathv[globcur], &filetype );
|
||||
|
||||
|
||||
if(ZFileFindATTRIB&0x10 && !S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
||||
if(((ZFileFindATTRIB&0x10)==0) && S_ISDIR ( filetype.st_mode )) return(ZFileFindNext());
|
||||
|
||||
|
||||
if ( S_ISDIR ( filetype.st_mode ))
|
||||
*(char *)(DTALocPos + 0x15) = 0x10;
|
||||
|
||||
@@ -482,12 +482,12 @@ void obtaindir()
|
||||
}
|
||||
strcat(zcfgdir, ZCFG_DIR);
|
||||
tmp = opendir(zcfgdir);
|
||||
if (tmp == NULL)
|
||||
if (tmp == NULL)
|
||||
{
|
||||
MKPath = zcfgdir;
|
||||
ZFileMKDir();
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
closedir(tmp);
|
||||
}
|
||||
@@ -495,7 +495,7 @@ void obtaindir()
|
||||
{
|
||||
strcpy(SRAMDir, zcfgdir);
|
||||
}
|
||||
if (*LoadDir == 0)
|
||||
if (*LoadDir == 0)
|
||||
{
|
||||
getcwd(LoadDir, 512);
|
||||
}
|
||||
@@ -515,7 +515,7 @@ void GetFilename()
|
||||
strcpy(&fnamest, tmp);
|
||||
fnamest = size;
|
||||
statefileloc-=(tmp-&fnamest);
|
||||
|
||||
|
||||
tmp = &fnames;
|
||||
*tmp = '/';
|
||||
while (*tmp!=0) tmp++;
|
||||
@@ -532,7 +532,7 @@ void pushdir()
|
||||
{
|
||||
olddir = (char *)malloc(128);
|
||||
getcwd(olddir, 128);
|
||||
}
|
||||
}
|
||||
|
||||
void popdir()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user