From ff532f74e8b0cfebfa2eaf3f369551ebe8246011 Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 23 May 2008 17:51:52 +0000 Subject: [PATCH] why in the world did this compile on my computer last night. well maybe now it will compile for other people --- src/drivers/win/netplay.cpp | 4 +- src/fds.cpp | 2 +- src/ines.cpp | 2 +- src/types.h | 1 + src/unif.cpp | 2 +- src/utils/{unzip.c => unzip.cpp} | 127 +++++++++---------------------- vc8/fceux.vcproj | 10 +-- 7 files changed, 42 insertions(+), 106 deletions(-) rename src/utils/{unzip.c => unzip.cpp} (88%) diff --git a/src/drivers/win/netplay.cpp b/src/drivers/win/netplay.cpp index 2cedab57..c302ee35 100644 --- a/src/drivers/win/netplay.cpp +++ b/src/drivers/win/netplay.cpp @@ -261,13 +261,13 @@ int FCEUD_NetworkConnect(void) uint8 md5out[16]; md5_starts(&md5); - md5_update(&md5, GameInfo->MD5, 16); + md5_update(&md5, (uint8*)&GameInfo->MD5.data, 16); md5_update(&md5, (uint8*)netgamekey, strlen(netgamekey)); //mbg merge 7/17/06 added cast md5_finish(&md5, md5out); memcpy(sendbuf + 4, md5out, 16); } else - memcpy(sendbuf + 4, GameInfo->MD5, 16); + memcpy(sendbuf + 4, &GameInfo->MD5, 16); if(netpassword) { diff --git a/src/fds.cpp b/src/fds.cpp index 0d9f2971..706da488 100644 --- a/src/fds.cpp +++ b/src/fds.cpp @@ -723,7 +723,7 @@ static int SubLoad(FCEUFILE *fp) FCEU_fread(diskdata[x],1,65500,fp); md5_update(&md5,diskdata[x],65500); } - md5_finish(&md5,GameInfo->MD5); + md5_finish(&md5,GameInfo->MD5.data); return(1); } diff --git a/src/ines.cpp b/src/ines.cpp index 3d9955da..991820cf 100644 --- a/src/ines.cpp +++ b/src/ines.cpp @@ -630,7 +630,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) md5_update(&md5,VROM,VROM_size<<13); } md5_finish(&md5,iNESCart.MD5); - memcpy(GameInfo->MD5,iNESCart.MD5,sizeof(iNESCart.MD5)); + memcpy(&GameInfo->MD5,&iNESCart.MD5,sizeof(iNESCart.MD5)); iNESCart.CRC32=iNESGameCRC32; diff --git a/src/types.h b/src/types.h index 31dd7e1c..491fb2cd 100644 --- a/src/types.h +++ b/src/types.h @@ -22,6 +22,7 @@ #ifndef __FCEU_TYPES #define __FCEU_TYPES +#include #include #define FCEU_VERSION_NUMERIC 19901 diff --git a/src/unif.cpp b/src/unif.cpp index 1ef5c753..8af71da2 100644 --- a/src/unif.cpp +++ b/src/unif.cpp @@ -555,7 +555,7 @@ int UNIFLoad(const char *name, FCEUFILE *fp) for(x=0;x<16;x++) FCEU_printf("%02x",UNIFCart.MD5[x]); FCEU_printf("\n"); - memcpy(GameInfo->MD5,UNIFCart.MD5,sizeof(UNIFCart.MD5)); + memcpy(&GameInfo->MD5,&UNIFCart.MD5,sizeof(UNIFCart.MD5)); } if(!InitializeBoard()) diff --git a/src/utils/unzip.c b/src/utils/unzip.cpp similarity index 88% rename from src/utils/unzip.c rename to src/utils/unzip.cpp index d70ba3fa..b7539584 100644 --- a/src/utils/unzip.c +++ b/src/utils/unzip.cpp @@ -4,7 +4,7 @@ Read unzip.h for more info */ - +#include #include #include #include @@ -134,9 +134,7 @@ typedef struct */ -local int unzlocal_getByte(fin,pi) - FILE *fin; - int *pi; +local int unzlocal_getByte(FILE * fin,int* pi) { unsigned char c; int err = fread(&c, 1, 1, fin); @@ -158,9 +156,7 @@ local int unzlocal_getByte(fin,pi) /* =========================================================================== Reads a long in LSB order from the given gz_stream. Sets */ -local int unzlocal_getShort (fin,pX) - FILE* fin; - uLong *pX; +local int unzlocal_getShort (FILE* fin,uLong *pX) { uLong x ; int i; @@ -180,9 +176,7 @@ local int unzlocal_getShort (fin,pX) return err; } -local int unzlocal_getLong (fin,pX) - FILE* fin; - uLong *pX; +local int unzlocal_getLong (FILE* fin,uLong *pX) { uLong x ; int i; @@ -212,9 +206,7 @@ local int unzlocal_getLong (fin,pX) /* My own strcmpi / strcasecmp */ -local int strcmpcasenosensitive_internal (fileName1,fileName2) - const char* fileName1; - const char* fileName2; +local int strcmpcasenosensitive_internal (const char* fileName1,const char* fileName2) { for (;;) { @@ -255,10 +247,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2) (like 1 on Unix, 2 on Windows) */ -extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity) - const char* fileName1; - const char* fileName2; - int iCaseSensitivity; +extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,const char* fileName2,int iCaseSensitivity) { if (iCaseSensitivity==0) iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; @@ -275,8 +264,7 @@ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivit Locate the Central directory of a zipfile (at the end, just before the global comment) */ -local uLong unzlocal_SearchCentralDir(fin) - FILE *fin; +local uLong unzlocal_SearchCentralDir(FILE *fin) { unsigned char* buf; uLong uSizeFile; @@ -340,8 +328,7 @@ local uLong unzlocal_SearchCentralDir(fin) Else, the return value is a unzFile Handle, usable with other function of this unzip package. */ -extern unzFile ZEXPORT unzOpen(path) - const char *path; +extern unzFile ZEXPORT unzOpen(const char *path) { unz_s us; unz_s *s; @@ -440,8 +427,7 @@ extern unzFile ZEXPORT unzOpen(path) If there is files inside the .Zip opened with unzipOpenCurrentFile (see later), these files MUST be closed with unzipCloseCurrentFile before call unzipClose. return UNZ_OK if there is no problem. */ -extern int ZEXPORT unzClose (file) - unzFile file; +extern int ZEXPORT unzClose (unzFile file) { unz_s* s; if (file==NULL) @@ -461,9 +447,7 @@ extern int ZEXPORT unzClose (file) Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed return UNZ_OK if there is no problem. */ -extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info) - unzFile file; - unz_global_info *pglobal_info; +extern int ZEXPORT unzGetGlobalInfo (unzFile file,unz_global_info *pglobal_info) { unz_s* s; if (file==NULL) @@ -477,9 +461,7 @@ extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info) /* Translate date/time from Dos format to tm_unz (readable more easilty) */ -local void unzlocal_DosDateToTmuDate (ulDosDate, ptm) - uLong ulDosDate; - tm_unz* ptm; +local void unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz* ptm) { uLong uDate; uDate = (uLong)(ulDosDate>>16); @@ -506,21 +488,12 @@ local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, char *szComment, uLong commentBufferSize)); -local int unzlocal_GetCurrentFileInfoInternal (file, - pfile_info, - pfile_info_internal, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - unz_file_info_internal *pfile_info_internal; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; +local int unzlocal_GetCurrentFileInfoInternal (unzFile file, + unz_file_info *pfile_info, + unz_file_info_internal *pfile_info_internal, + char *szFileName, uLong fileNameBufferSize, + void *extraField, uLong extraFieldBufferSize, + char *szComment, uLong commentBufferSize) { unz_s* s; unz_file_info file_info; @@ -677,19 +650,11 @@ local int unzlocal_GetCurrentFileInfoInternal (file, No preparation of the structure is needed return UNZ_OK if there is no problem. */ -extern int ZEXPORT unzGetCurrentFileInfo (file, - pfile_info, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; +extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, + unz_file_info *pfile_info, + char *szFileName, uLong fileNameBufferSize, + void *extraField, uLong extraFieldBufferSize, + char *szComment, uLong commentBufferSize) { return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, szFileName,fileNameBufferSize, @@ -701,8 +666,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (file, Set the current file of the zipfile to the first file. return UNZ_OK if there is no problem */ -extern int ZEXPORT unzGoToFirstFile (file) - unzFile file; +extern int ZEXPORT unzGoToFirstFile (unzFile file) { int err=UNZ_OK; unz_s* s; @@ -724,8 +688,7 @@ extern int ZEXPORT unzGoToFirstFile (file) return UNZ_OK if there is no problem return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. */ -extern int ZEXPORT unzGoToNextFile (file) - unzFile file; +extern int ZEXPORT unzGoToNextFile (unzFile file) { unz_s* s; int err; @@ -757,10 +720,7 @@ extern int ZEXPORT unzGoToNextFile (file) UNZ_OK if the file is found. It becomes the current file. UNZ_END_OF_LIST_OF_FILE if the file is not found */ -extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) - unzFile file; - const char *szFileName; - int iCaseSensitivity; +extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) { unz_s* s; int err; @@ -810,13 +770,9 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) store in *piSizeVar the size of extra info in local header (filename and size of extra field data) */ -local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, - poffset_local_extrafield, - psize_local_extrafield) - unz_s* s; - uInt* piSizeVar; - uLong *poffset_local_extrafield; - uInt *psize_local_extrafield; +local int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s,uInt* piSizeVar, + uLong *poffset_local_extrafield, + uInt *psize_local_extrafield) { uLong uMagic,uData,uFlags; uLong size_filename; @@ -902,8 +858,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, Open for reading data the current file in the zipfile. If there is no error and the file is opened, the return value is UNZ_OK. */ -extern int ZEXPORT unzOpenCurrentFile (file) - unzFile file; +extern int ZEXPORT unzOpenCurrentFile (unzFile file) { int err=UNZ_OK; int Store; @@ -1003,10 +958,7 @@ extern int ZEXPORT unzOpenCurrentFile (file) return <0 with error code if there is an error (UNZ_ERRNO for IO error, or zLib error for uncompress error) */ -extern int ZEXPORT unzReadCurrentFile (file, buf, len) - unzFile file; - voidp buf; - unsigned len; +extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) { int err=UNZ_OK; uInt iRead = 0; @@ -1130,8 +1082,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) /* Give the current position in uncompressed data */ -extern z_off_t ZEXPORT unztell (file) - unzFile file; +extern z_off_t ZEXPORT unztell (unzFile file) { unz_s* s; file_in_zip_read_info_s* pfile_in_zip_read_info; @@ -1150,8 +1101,7 @@ extern z_off_t ZEXPORT unztell (file) /* return 1 if the end of file was reached, 0 elsewhere */ -extern int ZEXPORT unzeof (file) - unzFile file; +extern int ZEXPORT unzeof (unzFile file) { unz_s* s; file_in_zip_read_info_s* pfile_in_zip_read_info; @@ -1183,10 +1133,7 @@ extern int ZEXPORT unzeof (file) the return value is the number of bytes copied in buf, or (if <0) the error code */ -extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) - unzFile file; - voidp buf; - unsigned len; +extern int ZEXPORT unzGetLocalExtrafield (unzFile file,voidp buf,unsigned len) { unz_s* s; file_in_zip_read_info_s* pfile_in_zip_read_info; @@ -1230,8 +1177,7 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) Close the file in zip opened with unzipOpenCurrentFile Return UNZ_CRCERROR if all the file was read but the CRC is not good */ -extern int ZEXPORT unzCloseCurrentFile (file) - unzFile file; +extern int ZEXPORT unzCloseCurrentFile (unzFile file) { int err=UNZ_OK; @@ -1272,10 +1218,7 @@ extern int ZEXPORT unzCloseCurrentFile (file) uSizeBuf is the size of the szComment buffer. return the number of byte copied or an error code <0 */ -extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) - unzFile file; - char *szComment; - uLong uSizeBuf; +extern int ZEXPORT unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf) { unz_s* s; uLong uReadThis ; diff --git a/vc8/fceux.vcproj b/vc8/fceux.vcproj index 335af180..4698e131 100644 --- a/vc8/fceux.vcproj +++ b/vc8/fceux.vcproj @@ -2136,16 +2136,8 @@ > - - -