diff options
Diffstat (limited to 'src/gfile/gfile_fs_native.c')
-rw-r--r-- | src/gfile/gfile_fs_native.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gfile/gfile_fs_native.c b/src/gfile/gfile_fs_native.c index 8c12443b..39ebc960 100644 --- a/src/gfile/gfile_fs_native.c +++ b/src/gfile/gfile_fs_native.c @@ -24,14 +24,14 @@ static gBool NativeDel(const char *fname); static gBool NativeExists(const char *fname); -static long int NativeFilesize(const char *fname); +static gFileSize NativeFilesize(const char *fname); static gBool NativeRen(const char *oldname, const char *newname); static gBool NativeOpen(GFILE *f, const char *fname); static void NativeClose(GFILE *f); static int NativeRead(GFILE *f, void *buf, int size); static int NativeWrite(GFILE *f, const void *buf, int size); -static gBool NativeSetpos(GFILE *f, long int pos); -static long int NativeGetsize(GFILE *f); +static gBool NativeSetpos(GFILE *f, gFileSize pos); +static gFileSize NativeGetsize(GFILE *f); static gBool NativeEof(GFILE *f); #if GFILE_NEED_FILELISTS static gfileList *NativeFlOpen(const char *path, gBool dirs); @@ -78,7 +78,7 @@ void _gfileNativeAssignStdio(void) { gfileStdErr = &NativeStdErr; } -static void Native_flags2mode(char *buf, uint16_t flags) { +static void Native_flags2mode(char *buf, gU16 flags) { if (flags & GFILEFLG_MUSTEXIST) *buf = 'r'; else if (flags & GFILEFLG_APPEND) @@ -99,19 +99,19 @@ static gBool NativeDel(const char *fname) { return remove(fname) ? gFalse static void NativeClose(GFILE *f) { fclose((FILE *)f->obj); } static int NativeRead(GFILE *f, void *buf, int size) { return fread(buf, 1, size, (FILE *)f->obj); } static int NativeWrite(GFILE *f, const void *buf, int size) { return fwrite(buf, 1, size, (FILE *)f->obj); } -static gBool NativeSetpos(GFILE *f, long int pos) { return fseek((FILE *)f->obj, pos, SEEK_SET) ? gFalse : gTrue; } +static gBool NativeSetpos(GFILE *f, gFileSize pos) { return fseek((FILE *)f->obj, pos, SEEK_SET) ? gFalse : gTrue; } static gBool NativeEof(GFILE *f) { return feof((FILE *)f->obj) ? gTrue : gFalse; } static gBool NativeRen(const char *oldname, const char *newname) { return rename(oldname, newname) ? gFalse : gTrue; } static gBool NativeExists(const char *fname) { // We define access this way so we don't have to include <unistd.h> which may - // (and does under windows) contain conflicting definitions for types such as uint16_t. + // (and does under windows) contain conflicting definitions for types such as gU16. extern int access(const char *pathname, int mode); return access(fname, 0) ? gFalse : gTrue; } -static long int NativeFilesize(const char *fname) { +static gFileSize NativeFilesize(const char *fname) { struct stat st; - if (stat(fname, &st)) return -1; - return st.st_size; + if (stat(fname, &st)) return (gFileSize)-1; + return (gFileSize)st.st_size; } static gBool NativeOpen(GFILE *f, const char *fname) { FILE *fd; @@ -123,10 +123,10 @@ static gBool NativeOpen(GFILE *f, const char *fname) { f->obj = (void *)fd; return gTrue; } -static long int NativeGetsize(GFILE *f) { +static gFileSize NativeGetsize(GFILE *f) { struct stat st; - if (fstat(fileno((FILE *)f->obj), &st)) return -1; - return st.st_size; + if (fstat(fileno((FILE *)f->obj), &st)) return (gFileSize)-1; + return (gFileSize)st.st_size; } #if GFILE_NEED_FILELISTS |