29 #include "../idlib/precompiled.h"
34 #define MAX_PRINT_MSG 4096
56 while ( (*fmt >=
'0' && *fmt <=
'9') ||
57 *fmt ==
'.' || *fmt ==
'-' || *fmt ==
'+' || *fmt ==
'#') {
67 f = va_arg( argPtr,
double );
68 if ( format.
Length() <= 2 ) {
81 i = va_arg( argPtr,
long );
85 u = va_arg( argPtr,
unsigned long );
89 u = va_arg( argPtr,
unsigned long );
93 u = va_arg( argPtr,
unsigned long );
97 u = va_arg( argPtr,
unsigned long );
101 i = va_arg( argPtr,
long );
102 index +=
sprintf( buf+index, format.
c_str(), (char) i );
105 str = va_arg( argPtr,
char * );
121 index +=
sprintf( buf+index,
"\t" );
124 index +=
sprintf( buf+index,
"\v" );
127 index +=
sprintf( buf+index,
"\n" );
130 index +=
sprintf( buf+index,
"\\" );
133 common->
Error(
"FS_WriteFloatString: unknown escape character \'%c\'", *fmt );
139 index +=
sprintf( buf+index,
"%c", *fmt );
265 va_start( argptr, fmt );
286 return Write( buf, length );
299 va_start( argPtr, fmt );
303 return Write( buf, len );
356 return Read( &value,
sizeof( value ) );
365 return Read( &value,
sizeof( value ) );
387 value = c ?
true :
false;
402 string.Fill(
' ', len );
403 result =
Read( &
string[ 0 ], len );
470 return Write( &v,
sizeof( v ) );
480 return Write( &v,
sizeof( v ) );
490 return Write( &v,
sizeof( v ) );
500 return Write( &v,
sizeof( v ) );
509 return Write( &value,
sizeof( value ) );
518 return Write( &value,
sizeof( value ) );
528 return Write( &v,
sizeof( v ) );
549 len = strlen( value );
551 return Write( value, len );
562 return Write( &v,
sizeof( v ) );
573 return Write( &v,
sizeof( v ) );
584 return Write( &v,
sizeof( v ) );
595 return Write( &v,
sizeof( v ) );
606 return Write( &v,
sizeof( v ) );
712 memcpy( buffer,
curPtr, len );
736 char *newPtr = (
char *)
Mem_Alloc( allocated + extra );
738 memcpy( newPtr,
filePtr, allocated );
747 memcpy(
curPtr, buffer, len );
1048 int block, remaining;
1062 buf = (
byte *)buffer;
1066 while( remaining ) {
1068 read =
fread( buf, 1, block,
o );
1077 return len-remaining;
1100 int block, remaining;
1114 buf = (
byte *)buffer;
1118 while( remaining ) {
1120 written =
fwrite( buf, 1, block,
o );
1121 if ( written == 0 ) {
1126 common->
Printf(
"idFile_Permanent::Write: 0 bytes written to %s\n",
name.c_str() );
1131 if ( written == -1 ) {
1132 common->
Printf(
"idFile_Permanent::Write: -1 bytes written to %s\n",
name.c_str() );
1136 remaining -= written;
1152 setvbuf(
o,
NULL, _IONBF, 0 );
1221 return fseek(
o, offset, _origin );
1242 memset( &
z, 0,
sizeof(
z ) );
1284 common->
FatalError(
"idFile_InZip::ForceFlush: cannot flush the zipped file %s",
name.c_str() );
1330 #define ZIP_SEEK_BUF_SIZE (1<<15)
1344 if ( offset <= 0 ) {
1357 return ( res == offset ) ? 0 : -1;
virtual int WriteVec6(const idVec6 &vec)
virtual int Seek(long offset, fsOrigin_t origin)
virtual int ReadUnsignedChar(unsigned char &value)
virtual int WriteUnsignedChar(const unsigned char value)
virtual int ReadShort(short &value)
int GetReadCount(void) const
GLsizei const GLfloat * value
virtual int virtual int ReadInt(int &value)
virtual int Read(void *buffer, int len)
virtual int ReadChar(char &value)
int unzClose(unzFile file)
void SetData(const char *data, int length)
virtual int ReadVec4(idVec4 &vec)
virtual void ForceFlush(void)
virtual void Rewind(void)
GLenum GLsizei GLenum format
virtual int Read(void *buffer, int len)
virtual void ForceFlush(void)
virtual ~idFile_InZip(void)
virtual void MakeReadOnly(void)
void StripTrailing(const char c)
idFileSystem * fileSystem
virtual int Seek(long offset, fsOrigin_t origin)
virtual int Write(const void *buffer, int len)
virtual ID_TIME_T Timestamp(void)
virtual int Read(void *buffer, int len)
int unzSetCurrentFileInfoPosition(unzFile file, unsigned long pos)
virtual int Seek(long offset, fsOrigin_t origin)
long unztell(unzFile file)
virtual int WriteChar(const char value)
virtual int WriteVec4(const idVec4 &vec)
virtual ID_TIME_T Timestamp(void)
virtual int WriteVec2(const idVec2 &vec)
virtual const char * GetName(void)
int ReadData(void *data, int length) const
void WriteData(const void *data, int length)
long Sys_FileTimeStamp(FILE *fp)
virtual ~idFile_Memory(void)
virtual int ReadUnsignedShort(unsigned short &value)
int unzOpenCurrentFile(unzFile file)
virtual int Write(const void *buffer, int len)
virtual int WriteInt(const int value)
virtual void ForceFlush(void)
virtual ~idFile_BitMsg(void)
virtual int WriteString(const char *string)
int unzCloseCurrentFile(unzFile file)
virtual int ReadVec2(idVec2 &vec)
void LittleRevBytes(void *bp, int elsize, int elcount)
GLsizei GLsizei GLenum GLenum const GLvoid * data
virtual int ReadVec3(idVec3 &vec)
virtual void AddToReadCount(int c)=0
virtual void virtual void FatalError(const char *fmt,...) id_attribute((format(printf
virtual int Read(void *buffer, int len)
idFile_BitMsg(idBitMsg &msg)
virtual int Seek(long offset, fsOrigin_t origin)
virtual int WriteFloatString(const char *fmt,...) id_attribute((format(printf
virtual void ForceFlush(void)
#define ZIP_SEEK_BUF_SIZE
virtual void Printf(const char *fmt,...) id_attribute((format(printf
virtual int Seek(long offset, fsOrigin_t origin)
virtual int ReadBool(bool &value)
virtual ID_TIME_T Timestamp(void)
virtual int ReadUnsignedInt(unsigned int &value)
short LittleShort(short l)
int FS_WriteFloatString(char *buf, const char *fmt, va_list argPtr)
int unzReadCurrentFile(unzFile file, void *buf, unsigned len)
static int static int vsnPrintf(char *dest, int size, const char *fmt, va_list argptr)
virtual void Clear(bool freeMemory=true)
virtual int WriteShort(const short value)
virtual int WriteUnsignedInt(const unsigned int value)
virtual ~idFile_Permanent(void)
virtual int WriteFloat(const float value)
virtual int Write(const void *buffer, int len)
virtual ID_TIME_T Timestamp(void)
GLsizei const GLcharARB const GLint * length
const char * c_str(void) const
virtual int WriteMat3(const idMat3 &mat)
float LittleFloat(float l)
virtual int ReadVec6(idVec6 &vec)
void * Mem_Alloc(const int size)
virtual int ReadString(idStr &string)
virtual int ReadMat3(idMat3 &mat)
virtual int ReadFloat(float &value)
virtual int Read(void *buffer, int len)
virtual int WriteBool(const bool value)
virtual int Write(const void *buffer, int len)
virtual int virtual int VPrintf(const char *fmt, va_list arg)
virtual void Error(const char *fmt,...) id_attribute((format(printf
virtual void ForceFlush(void)
void Replace(const char *old, const char *nw)
virtual int WriteUnsignedShort(unsigned short value)
virtual ID_TIME_T Timestamp(void)
virtual int Write(const void *buffer, int len)
int sprintf(idStr &string, const char *fmt,...)
virtual int Printf(const char *fmt,...) id_attribute((format(printf
virtual int WriteVec3(const idVec3 &vec)
virtual const char * GetFullPath(void)