1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-05 05:42:18 +00:00

Update ttvfs to new version

This commit is contained in:
fgenesis 2014-04-06 19:19:33 +02:00
commit 8026cdd905
43 changed files with 2124 additions and 2427 deletions

View file

@ -6,12 +6,9 @@
/* --- Config section -- modify as needed --- */
// choose a namespace name, or comment out to disable namespacing completely (not recommended)
#define VFS_NAMESPACE ttvfs
// Define this to allow dealing with files > 4 GB, using non-standard functions.
// This may or may not work with your platform/compiler, good luck.
//#define VFS_LARGEFILE_SUPPORT
#define VFS_LARGEFILE_SUPPORT
// Define this to make all operations case insensitive.
// Windows systems generally don't care much, but for Linux and Mac this can be used
@ -23,25 +20,10 @@
// on disk (see VFSLoader.cpp).
#define VFS_IGNORE_CASE
// Define this to make all VFSFile, VFSDir, VFSHelper operations thread-safe.
// If you do, do not forget to add your own implementation to VFSAtomic.cpp/.h !
// If this is not defined, you can still do manual locking if you know what you're doing,
// performance matters, and you implemented actual locking into the Mutex class.
// If no Mutex implementation is provided, its operations are no-ops, beware!
// Note: This adds a *lot* of overhead. Better ensure thread safety yourself, externally. Really!
// (Also note that this feature is *UNTESTED*. Don't activate.)
//#define VFS_THREADSAFE
// By default, ttvfs uses a std::map to store stuff.
// Uncomment the line below to use an (experimental!) hashmap.
// With std::map, iterating over entries will always deliver them in sorted order.
// The hashmap will deliver entries in random order, but lookup will be much faster
// (especially if VFS_IGNORE_CASE is set!)
//#define VFS_USE_HASHMAP
// These are used for small, temporary memory allocations that can remain on the stack.
// If alloca is available, this is the preferred way.
#include <stdlib.h>
#include <cstdlib>
#ifdef _WIN32
# include <malloc.h> // MSVC/MinGW still need this for alloca. Seems to be windows-specific failure
#endif
@ -54,15 +36,8 @@
/* --- End of config section --- */
#ifdef VFS_NAMESPACE
# define VFS_NAMESPACE_START namespace VFS_NAMESPACE {
# define VFS_NAMESPACE_END }
# define VFS_NAMESPACE_IMPL VFS_NAMESPACE::
#else
# define VFS_NAMESPACE_START
# define VFS_NAMESPACE_END
# define VFS_NAMESPACE_IMPL
#endif
#define VFS_NAMESPACE_START namespace ttvfs {
#define VFS_NAMESPACE_END }
VFS_NAMESPACE_START
@ -70,32 +45,31 @@ VFS_NAMESPACE_START
# if defined(_MSC_VER)
typedef __int64 vfspos;
# else
typedef long long vfspos;
# include <stdint.h>
typedef int64_t vfspos;
# endif
#else
typedef unsigned int vfspos;
#endif
// simple guard wrapper, works also if VFS_THREADSAFE is not defined
#define VFS_GUARD(obj) VFS_NAMESPACE_IMPL Guard __vfs_stack_guard((obj)->mutex())
// defines for optional auto-locking; only if VFS_THREADSAFE is defined
#ifdef VFS_THREADSAFE
# define VFS_GUARD_OPT(obj) VFS_GUARD(obj)
#else
# define VFS_GUARD_OPT(obj)
#endif
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
# define VFS_STRICMP stricmp
# define VFS_STRICMP _stricmp
static const vfspos npos = vfspos(-1i64);
#else
# define VFS_STRICMP strcasecmp
static const vfspos npos = vfspos(-1LL);
#endif
static const vfspos npos = vfspos(-1);
typedef void (*delete_func)(void *);
struct _AbiCheck
{
int structSize;
int vfsposSize;
int largefile;
int nocase;
};
typedef void *(*allocator_func)(size_t);
typedef void (*delete_func)(void*);
VFS_NAMESPACE_END