2014-04-06 17:19:33 +00:00
|
|
|
#include "VFSDefines.h"
|
2012-06-01 15:23:19 +00:00
|
|
|
#include "VFSInternal.h"
|
2014-04-07 02:16:15 +00:00
|
|
|
#include "VFSFileFuncs.h"
|
2012-06-01 15:23:19 +00:00
|
|
|
|
2014-04-07 03:09:40 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2014-04-07 02:16:15 +00:00
|
|
|
VFS_NAMESPACE_START
|
2012-06-01 15:23:19 +00:00
|
|
|
|
|
|
|
// Compile time assertion to make sure things work as expected
|
2014-04-07 02:16:15 +00:00
|
|
|
#if defined(VFS_LARGEFILE_SUPPORT)
|
|
|
|
static void _dummy_()
|
|
|
|
{
|
|
|
|
switch(0) { case 0:; case 4: case sizeof(vfspos): ; }
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
switch(0) { case 0:; case 4: case sizeof(off_t): ; }
|
|
|
|
#endif
|
|
|
|
}
|
2012-06-01 15:23:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void *real_fopen(const char *name, const char *mode)
|
|
|
|
{
|
|
|
|
return fopen(name, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
int real_fclose(void *fh)
|
|
|
|
{
|
|
|
|
return fclose((FILE*)fh);
|
|
|
|
}
|
|
|
|
|
|
|
|
int real_fseek(void *fh, vfspos offset, int origin)
|
|
|
|
{
|
|
|
|
#ifdef VFS_LARGEFILE_SUPPORT
|
|
|
|
# ifdef _MSC_VER
|
|
|
|
return _fseeki64((FILE*)fh, offset, origin);
|
|
|
|
# else
|
|
|
|
return fseeko((FILE*)fh, offset, origin);
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
return fseek((FILE*)fh, offset, origin);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
vfspos real_ftell(void *fh)
|
|
|
|
{
|
|
|
|
#ifdef VFS_LARGEFILE_SUPPORT
|
|
|
|
# ifdef _MSC_VER
|
|
|
|
return _ftelli64((FILE*)fh);
|
|
|
|
# else
|
|
|
|
return ftello((FILE*)fh);
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
return ftell((FILE*)fh);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t real_fread(void *ptr, size_t size, size_t count, void *fh)
|
|
|
|
{
|
|
|
|
return fread(ptr, size, count, (FILE*)fh);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t real_fwrite(const void *ptr, size_t size, size_t count, void *fh)
|
|
|
|
{
|
|
|
|
return fwrite(ptr, size, count, (FILE*)fh);
|
|
|
|
}
|
|
|
|
|
|
|
|
int real_feof(void *fh)
|
|
|
|
{
|
|
|
|
return feof((FILE*)fh);
|
|
|
|
}
|
|
|
|
|
|
|
|
int real_fflush(void *fh)
|
|
|
|
{
|
|
|
|
return fflush((FILE*)fh);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VFS_NAMESPACE_END
|