static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) { int fseek_origin=0; long ret; (void) opaque; switch (origin) { case ZLIB_FILEFUNC_SEEK_CUR : fseek_origin = SEEK_CUR; break; case ZLIB_FILEFUNC_SEEK_END : fseek_origin = SEEK_END; break; case ZLIB_FILEFUNC_SEEK_SET : fseek_origin = SEEK_SET; break; default: return -1; } ret = 0; if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0) ret = -1; return ret; }
int is_large_file(const char* filename) { ZPOS64_T pos = 0; FILE* pFile = FOPEN_FUNC(filename, "rb"); if (pFile == NULL) return 0; FSEEKO_FUNC(pFile, 0, SEEK_END); pos = FTELLO_FUNC(pFile); fclose(pFile); printf("File : %s is %lld bytes\n", filename, pos); return (pos >= 0xffffffff); }
int isLargeFile(const char* filename) { int largeFile = 0; ZPOS64_T pos = 0; FILE* pFile = FOPEN_FUNC(filename, "rb"); if(pFile != NULL) { int n = FSEEKO_FUNC(pFile, 0, SEEK_END); pos = FTELLO_FUNC(pFile); if(pos >= 0xffffffff) largeFile = 1; fclose(pFile); } return largeFile; }