mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-04 06:54:39 +00:00
[vfs #1] Add ttvfs, miniz, and minihttp sources
This commit is contained in:
parent
99e3f5ebe2
commit
a90f57afb0
36 changed files with 10047 additions and 0 deletions
78
ExternalLibs/ttvfs/VFSFileFuncs.cpp
Normal file
78
ExternalLibs/ttvfs/VFSFileFuncs.cpp
Normal file
|
@ -0,0 +1,78 @@
|
|||
#include "VFSFileFuncs.h"
|
||||
|
||||
// this is for POSIX - define before including any stdio headers
|
||||
#ifdef VFS_LARGEFILE_SUPPORT
|
||||
# ifndef _MSC_VER
|
||||
# define _FILE_OFFSET_BITS 64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "VFSInternal.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
// Compile time assertion to make sure things work as expected
|
||||
#if defined(VFS_LARGEFILE_SUPPORT) && !defined(_MSC_VER)
|
||||
static void _dummy_() { switch(0) { case 4: case sizeof(off_t): ; } }
|
||||
#endif
|
||||
|
||||
VFS_NAMESPACE_START
|
||||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue