diff options
Diffstat (limited to 'src/files.h')
-rw-r--r-- | src/files.h | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/files.h b/src/files.h index 926d59a..c8ae0e7 100644 --- a/src/files.h +++ b/src/files.h @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -77,96 +77,96 @@ typedef struct file_info_s { // #define MAX_LOADFILE 0x1000000 -#define FS_Malloc( size ) Z_TagMalloc( size, TAG_FILESYSTEM ) -#define FS_Mallocz( size ) Z_TagMallocz( size, TAG_FILESYSTEM ) -#define FS_CopyString( string ) Z_TagCopyString( string, TAG_FILESYSTEM ) -#define FS_LoadFile( path, buf ) FS_LoadFileEx( path, buf, 0, TAG_FILESYSTEM ) -#define FS_FreeFile( buf ) Z_Free( buf ) +#define FS_Malloc(size) Z_TagMalloc(size, TAG_FILESYSTEM) +#define FS_Mallocz(size) Z_TagMallocz(size, TAG_FILESYSTEM) +#define FS_CopyString(string) Z_TagCopyString(string, TAG_FILESYSTEM) +#define FS_LoadFile(path, buf) FS_LoadFileEx(path, buf, 0, TAG_FILESYSTEM) +#define FS_FreeFile(buf) Z_Free(buf) // just regular malloc for now -#define FS_AllocTempMem( size ) FS_Malloc( size ) -#define FS_FreeTempMem( buf ) Z_Free( buf ) +#define FS_AllocTempMem(size) FS_Malloc(size) +#define FS_FreeTempMem(buf) Z_Free(buf) // just regular caseless string comparsion #define FS_pathcmp Q_strcasecmp #define FS_pathcmpn Q_strncasecmp -#define FS_HashPath( s, size ) Com_HashStringLen( s, SIZE_MAX, size ) -#define FS_HashPathLen( s, len, size ) Com_HashStringLen( s, len, size ) +#define FS_HashPath(s, size) Com_HashStringLen(s, SIZE_MAX, size) +#define FS_HashPathLen(s, len, size) Com_HashStringLen(s, len, size) -void FS_Init( void ); -void FS_Shutdown( void ); -void FS_Restart( qboolean total ); +void FS_Init(void); +void FS_Shutdown(void); +void FS_Restart(qboolean total); #if USE_CLIENT -qerror_t FS_RenameFile( const char *from, const char *to ); +qerror_t FS_RenameFile(const char *from, const char *to); #endif -qerror_t FS_CreatePath( char *path ); +qerror_t FS_CreatePath(char *path); -char *FS_CopyExtraInfo( const char *name, const file_info_t *info ); +char *FS_CopyExtraInfo(const char *name, const file_info_t *info); -ssize_t FS_FOpenFile( const char *filename, qhandle_t *f, unsigned mode ); -void FS_FCloseFile( qhandle_t f ); -qhandle_t FS_EasyOpenFile( char *buf, size_t size, unsigned mode, - const char *dir, const char *name, const char *ext ); +ssize_t FS_FOpenFile(const char *filename, qhandle_t *f, unsigned mode); +void FS_FCloseFile(qhandle_t f); +qhandle_t FS_EasyOpenFile(char *buf, size_t size, unsigned mode, + const char *dir, const char *name, const char *ext); // nasty hack to check if file has valid gzip header: // first 4 bytes of header are interpreted as 32-bit magic value. // this value is checked to contain gzip ident bytes (0x1f, 0x8b), // Z_DEFLATED compression byte (0x08), reserved options must be unset #define CHECK_GZIP_HEADER(magic) \ - ((LittleLong(magic)&0xe0ffffff)==0x00088b1f) + ((LittleLong(magic) & 0xe0ffffff) == 0x00088b1f) -qerror_t FS_FilterFile( qhandle_t f ); +qerror_t FS_FilterFile(qhandle_t f); -#define FS_FileExistsEx( path, flags ) \ - ( FS_LoadFileEx( path, NULL, flags, TAG_FREE ) != Q_ERR_NOENT ) -#define FS_FileExists( path ) \ - FS_FileExistsEx( path, 0 ) +#define FS_FileExistsEx(path, flags) \ + (FS_LoadFileEx(path, NULL, flags, TAG_FREE) != Q_ERR_NOENT) +#define FS_FileExists(path) \ + FS_FileExistsEx(path, 0) -ssize_t FS_LoadFileEx( const char *path, void **buffer, unsigned flags, memtag_t tag ); +ssize_t FS_LoadFileEx(const char *path, void **buffer, unsigned flags, memtag_t tag); // a NULL buffer will just return the file length without loading // length < 0 indicates error -qerror_t FS_WriteFile( const char *path, const void *data, size_t len ); +qerror_t FS_WriteFile(const char *path, const void *data, size_t len); -qboolean FS_EasyWriteFile( char *buf, size_t size, unsigned mode, - const char *dir, const char *name, const char *ext, - const void *data, size_t len ); +qboolean FS_EasyWriteFile(char *buf, size_t size, unsigned mode, + const char *dir, const char *name, const char *ext, + const void *data, size_t len); -ssize_t FS_Read( void *buffer, size_t len, qhandle_t f ); -ssize_t FS_Write( const void *buffer, size_t len, qhandle_t f ); +ssize_t FS_Read(void *buffer, size_t len, qhandle_t f); +ssize_t FS_Write(const void *buffer, size_t len, qhandle_t f); // properly handles partial reads -ssize_t FS_FPrintf( qhandle_t f, const char *format, ... ) q_printf( 2, 3 ); -ssize_t FS_ReadLine( qhandle_t f, char *buffer, size_t size ); +ssize_t FS_FPrintf(qhandle_t f, const char *format, ...) q_printf(2, 3); +ssize_t FS_ReadLine(qhandle_t f, char *buffer, size_t size); -void FS_Flush( qhandle_t f ); +void FS_Flush(qhandle_t f); -ssize_t FS_Tell( qhandle_t f ); -qerror_t FS_Seek( qhandle_t f, off_t offset ); +ssize_t FS_Tell(qhandle_t f); +qerror_t FS_Seek(qhandle_t f, off_t offset); -ssize_t FS_Length( qhandle_t f ); +ssize_t FS_Length(qhandle_t f); -qboolean FS_WildCmp( const char *filter, const char *string ); -qboolean FS_ExtCmp( const char *extension, const char *string ); +qboolean FS_WildCmp(const char *filter, const char *string); +qboolean FS_ExtCmp(const char *extension, const char *string); -void **FS_ListFiles( const char *path, const char *filter, unsigned flags, int *count_p ); -void **FS_CopyList( void **list, int count ); -file_info_t *FS_CopyInfo( const char *name, size_t size, time_t ctime, time_t mtime ); -void FS_FreeList( void **list ); +void **FS_ListFiles(const char *path, const char *filter, unsigned flags, int *count_p); +void **FS_CopyList(void **list, int count); +file_info_t *FS_CopyInfo(const char *name, size_t size, time_t ctime, time_t mtime); +void FS_FreeList(void **list); -size_t FS_NormalizePath( char *out, const char *in ); -size_t FS_NormalizePathBuffer( char *out, const char *in, size_t size ); +size_t FS_NormalizePath(char *out, const char *in); +size_t FS_NormalizePathBuffer(char *out, const char *in, size_t size); -qboolean FS_ValidatePath( const char *s ); +qboolean FS_ValidatePath(const char *s); #ifdef _WIN32 -char *FS_ReplaceSeparators( char *s, int separator ); +char *FS_ReplaceSeparators(char *s, int separator); #endif -void FS_File_g( const char *path, const char *ext, unsigned flags, genctx_t *ctx ); +void FS_File_g(const char *path, const char *ext, unsigned flags, genctx_t *ctx); extern cvar_t *fs_game; |