Fixed a few warnings

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@844 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
bgk 2009-01-01 20:18:09 +00:00
parent c1606970d3
commit 07facf723a
7 changed files with 23 additions and 13 deletions

View File

@ -40,10 +40,11 @@ static const char* get_gzip_size( const char* path, long* eof )
return "Couldn't open file"; return "Couldn't open file";
unsigned char buf [4]; unsigned char buf [4];
int res;
if ( fread( buf, 2, 1, file ) > 0 && buf [0] == 0x1F && buf [1] == 0x8B ) if ( fread( buf, 2, 1, file ) > 0 && buf [0] == 0x1F && buf [1] == 0x8B )
{ {
fseek( file, -4, SEEK_END ); fseek( file, -4, SEEK_END );
fread( buf, 4, 1, file ); res = fread( buf, 4, 1, file );
*eof = buf [3] * 0x1000000 + buf [2] * 0x10000 + buf [1] * 0x100 + buf [0]; *eof = buf [3] * 0x1000000 + buf [2] * 0x10000 + buf [1] * 0x100 + buf [0];
} }
else else
@ -51,7 +52,7 @@ static const char* get_gzip_size( const char* path, long* eof )
fseek( file, 0, SEEK_END ); fseek( file, 0, SEEK_END );
*eof = ftell( file ); *eof = ftell( file );
} }
const char* err = (ferror( file ) || feof( file )) ? "Couldn't get file size" : 0; const char* err = ((res != 1) || ferror( file ) || feof( file )) ? "Couldn't get file size" : 0;
fclose( file ); fclose( file );
return err; return err;
} }

View File

@ -245,8 +245,7 @@ void Bilinear32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u32 *to_odd = (u32 *)(dstPtr + dstPitch); u32 *to_odd = (u32 *)(dstPtr + dstPitch);
int from_width = width; int from_width = width;
if(width+1 < from_width)
from_width = width+1;
u32 *from = (u32 *)srcPtr; u32 *from = (u32 *)srcPtr;
fill_rgb_row_32(from, from_width, rgb_row_cur, width+1); fill_rgb_row_32(from, from_width, rgb_row_cur, width+1);
@ -330,8 +329,7 @@ void BilinearPlus32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u32 *to_odd = (u32 *)(dstPtr + dstPitch); u32 *to_odd = (u32 *)(dstPtr + dstPitch);
int from_width = width; int from_width = width;
if(width+1 < from_width)
from_width = width+1;
u32 *from = (u32 *)srcPtr; u32 *from = (u32 *)srcPtr;
fill_rgb_row_32(from, from_width, rgb_row_cur, width+1); fill_rgb_row_32(from, from_width, rgb_row_cur, width+1);

View File

@ -3852,11 +3852,13 @@ static bool gbReadSaveState(gzFile gzFile)
systemDrawScreen(); systemDrawScreen();
if(version > GBSAVE_GAME_VERSION_1) if(version > GBSAVE_GAME_VERSION_1)
{
if( skipSaveGameCheats ) { if( skipSaveGameCheats ) {
gbCheatsReadGameSkip(gzFile, version); gbCheatsReadGameSkip(gzFile, version);
} else { } else {
gbCheatsReadGame(gzFile, version); gbCheatsReadGame(gzFile, version);
} }
}
if (version<11) if (version<11)
{ {

View File

@ -296,7 +296,7 @@
break; break;
case 0x37: case 0x37:
// SCF // SCF
AF.B.B0 = AF.B.B0 & Z_FLAG | C_FLAG; AF.B.B0 = (AF.B.B0 & Z_FLAG) | C_FLAG;
break; break;
case 0x38: case 0x38:
// JR C,NN // JR C,NN

View File

@ -369,7 +369,7 @@ void BIOS_Diff8bitUnFilterWram()
source += 4; source += 4;
if(((source & 0xe000000) == 0) || if(((source & 0xe000000) == 0) ||
((source + ((header >> 8) & 0x1fffff) & 0xe000000) == 0)) (((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0))
return; return;
int len = header >> 8; int len = header >> 8;

View File

@ -2782,9 +2782,16 @@ bool elfRead(const char *name, int& siz, FILE *f)
long size = ftell(f); long size = ftell(f);
elfFileData = (u8 *)malloc(size); elfFileData = (u8 *)malloc(size);
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);
fread(elfFileData, 1, size, f); int res = fread(elfFileData, 1, size, f);
fclose(f); fclose(f);
if (res < 0)
{
free(elfFileData);
elfFileData = NULL;
return false;
}
ELFHeader *header = (ELFHeader *)elfFileData; ELFHeader *header = (ELFHeader *)elfFileData;
if(READ32LE(&header->magic) != 0x464C457F || if(READ32LE(&header->magic) != 0x464C457F ||

View File

@ -168,10 +168,12 @@ int remotePipeRecv(char *data, int len)
bool remotePipeInit() bool remotePipeInit()
{ {
char dummy; char dummy;
read(0, &dummy, 1); if (read(0, &dummy, 1) == 1)
if(dummy != '+') { {
fprintf(stderr, "ACK not received\n"); if(dummy != '+') {
exit(-1); fprintf(stderr, "ACK not received\n");
exit(-1);
}
} }
return true; return true;