switch to size_t

This commit is contained in:
dborth 2009-10-03 19:10:34 +00:00
parent e095de4e0f
commit 43430622dd
3 changed files with 20 additions and 20 deletions

View File

@ -504,7 +504,7 @@ int BrowserLoadSz()
int BrowserLoadFile() int BrowserLoadFile()
{ {
char filepath[1024]; char filepath[1024];
int filesize = 0; size_t filesize = 0;
romLoaded = false; romLoaded = false;
int device; int device;

View File

@ -649,10 +649,10 @@ FreeSaveBuffer ()
* Loads the selected file # from the specified 7z into rbuffer * Loads the selected file # from the specified 7z into rbuffer
* Returns file size * Returns file size
***************************************************************************/ ***************************************************************************/
u32 size_t
LoadSzFile(char * filepath, unsigned char * rbuffer) LoadSzFile(char * filepath, unsigned char * rbuffer)
{ {
u32 size = 0; size_t size = 0;
// stop checking if devices were removed/inserted // stop checking if devices were removed/inserted
// since we're loading a file // since we're loading a file
@ -681,12 +681,12 @@ LoadSzFile(char * filepath, unsigned char * rbuffer)
/**************************************************************************** /****************************************************************************
* LoadFile * LoadFile
***************************************************************************/ ***************************************************************************/
u32 size_t
LoadFile (char * rbuffer, char *filepath, u32 length, bool silent) LoadFile (char * rbuffer, char *filepath, size_t length, bool silent)
{ {
char zipbuffer[2048]; char zipbuffer[2048];
u32 size = 0; size_t size = 0;
u32 readsize = 0; size_t readsize = 0;
int retry = 1; int retry = 1;
int device; int device;
@ -737,8 +737,8 @@ LoadFile (char * rbuffer, char *filepath, u32 length, bool silent)
memcpy (rbuffer, zipbuffer, readsize); // copy what we already read memcpy (rbuffer, zipbuffer, readsize); // copy what we already read
u32 offset = readsize; size_t offset = readsize;
u32 nextread = 0; size_t nextread = 0;
while(offset < size) while(offset < size)
{ {
if(size - offset > 4*1024) nextread = 4*1024; if(size - offset > 4*1024) nextread = 4*1024;
@ -783,7 +783,7 @@ LoadFile (char * rbuffer, char *filepath, u32 length, bool silent)
return size; return size;
} }
u32 LoadFile(char * filepath, bool silent) size_t LoadFile(char * filepath, bool silent)
{ {
return LoadFile((char *)savebuffer, filepath, 0, silent); return LoadFile((char *)savebuffer, filepath, 0, silent);
} }
@ -792,10 +792,10 @@ u32 LoadFile(char * filepath, bool silent)
* SaveFile * SaveFile
* Write buffer to file * Write buffer to file
***************************************************************************/ ***************************************************************************/
u32 size_t
SaveFile (char * buffer, char *filepath, u32 datasize, bool silent) SaveFile (char * buffer, char *filepath, size_t datasize, bool silent)
{ {
u32 written = 0; size_t written = 0;
int retry = 1; int retry = 1;
int device; int device;
@ -824,7 +824,7 @@ SaveFile (char * buffer, char *filepath, u32 datasize, bool silent)
if (file > 0) if (file > 0)
{ {
u32 writesize, nextwrite; size_t writesize, nextwrite;
while(written < datasize) while(written < datasize)
{ {
if(datasize - written > 4*1024) nextwrite=4*1024; if(datasize - written > 4*1024) nextwrite=4*1024;
@ -855,7 +855,7 @@ SaveFile (char * buffer, char *filepath, u32 datasize, bool silent)
return written; return written;
} }
u32 SaveFile(char * filepath, u32 datasize, bool silent) size_t SaveFile(char * filepath, size_t datasize, bool silent)
{ {
return SaveFile((char *)savebuffer, filepath, datasize, silent); return SaveFile((char *)savebuffer, filepath, datasize, silent);
} }

View File

@ -35,11 +35,11 @@ void CreateAppPath(char * origpath);
int ParseDirectory(bool waitParse = false); int ParseDirectory(bool waitParse = false);
void AllocSaveBuffer(); void AllocSaveBuffer();
void FreeSaveBuffer(); void FreeSaveBuffer();
u32 LoadFile(char * rbuffer, char *filepath, u32 length, bool silent); size_t LoadFile(char * rbuffer, char *filepath, size_t length, bool silent);
u32 LoadFile(char * filepath, bool silent); size_t LoadFile(char * filepath, bool silent);
u32 LoadSzFile(char * filepath, unsigned char * rbuffer); size_t LoadSzFile(char * filepath, unsigned char * rbuffer);
u32 SaveFile(char * buffer, char *filepath, u32 datasize, bool silent); size_t SaveFile(char * buffer, char *filepath, size_t datasize, bool silent);
u32 SaveFile(char * filepath, u32 datasize, bool silent); size_t SaveFile(char * filepath, size_t datasize, bool silent);
extern unsigned char savebuffer[]; extern unsigned char savebuffer[];
extern FILE * file; extern FILE * file;