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";
unsigned char buf [4];
int res;
if ( fread( buf, 2, 1, file ) > 0 && buf [0] == 0x1F && buf [1] == 0x8B )
{
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];
}
else
@ -51,7 +52,7 @@ static const char* get_gzip_size( const char* path, long* eof )
fseek( file, 0, SEEK_END );
*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 );
return err;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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