mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Using size_t for lengths (also remove most warnings when compiling for x64)
This commit is contained in:
parent
a0f2dccd07
commit
85b7ac3ed5
53 changed files with 814 additions and 514 deletions
|
@ -222,8 +222,8 @@ typedef struct {
|
|||
char sv_dlURL[MAX_CVAR_VALUE_STRING];
|
||||
int downloadNumber;
|
||||
int downloadBlock; // block we are waiting for
|
||||
int downloadCount; // how many bytes we got
|
||||
int downloadSize; // how many bytes we got
|
||||
size_t downloadCount; // how many bytes we got
|
||||
size_t downloadSize; // how many bytes we got
|
||||
char downloadList[MAX_INFO_STRING]; // list of paks we need to download
|
||||
qboolean downloadRestart; // if true, we need to do another FS_Restart because we downloaded a pak
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ int DM_Manager::compareScores( const void *elem1, const void *elem2 )
|
|||
|
||||
void DM_Manager::InsertEntry( const char *entry )
|
||||
{
|
||||
int len = strlen( entry );
|
||||
size_t len = strlen( entry );
|
||||
|
||||
if( scoreLength + len < MAX_STRING_CHARS )
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ private:
|
|||
|
||||
// scoreboard data
|
||||
char scoreString[ MAX_STRING_CHARS ];
|
||||
int scoreLength;
|
||||
size_t scoreLength;
|
||||
int scoreEntries;
|
||||
|
||||
private:
|
||||
|
|
|
@ -1155,7 +1155,7 @@ qboolean G_ArchiveLevel
|
|||
Archiver arc;
|
||||
gentity_t *edict;
|
||||
char szSaveName[ MAX_STRING_TOKENS ];
|
||||
char *pszSaveName;
|
||||
const char *pszSaveName;
|
||||
cvar_t *cvar;
|
||||
|
||||
COM_StripExtension( filename, szSaveName, sizeof( szSaveName ) );
|
||||
|
|
|
@ -729,7 +729,7 @@ qboolean G_Push
|
|||
Vector mins, maxs;
|
||||
Vector save;
|
||||
pushed_t *p;
|
||||
Vector org, org2, move2;
|
||||
Vector org, org2, move2, neworg;
|
||||
Vector norm;
|
||||
float mat[ 3 ][ 3 ];
|
||||
pushed_t *pusher_p;
|
||||
|
@ -891,7 +891,10 @@ qboolean G_Push
|
|||
|
||||
move2 += org2 - org;
|
||||
|
||||
// L: This one seems to be better
|
||||
neworg = move2 + check->origin;
|
||||
|
||||
/*
|
||||
// This one seems to be better for the bind command
|
||||
if( G_TestEntityPosition( check, check->origin ) )
|
||||
{
|
||||
trace_t trace;
|
||||
|
@ -907,8 +910,9 @@ qboolean G_Push
|
|||
|
||||
move2 = trace.endpos - check->origin;
|
||||
}
|
||||
*/
|
||||
|
||||
/*if( G_TestEntityPosition( check, check->origin ) )
|
||||
if( G_TestEntityPosition( check, neworg ) )
|
||||
{
|
||||
trace_t trace;
|
||||
Vector end;
|
||||
|
@ -932,16 +936,16 @@ qboolean G_Push
|
|||
{
|
||||
if( check->IsSubclassOfPlayer() )
|
||||
{
|
||||
trace = G_Trace( Vector( trace.endpos ), check->mins, check->maxs, move2 + check->origin, check, check->edict->clipmask, true, "G_Push" );
|
||||
trace = G_Trace( Vector( trace.endpos ), check->mins, check->maxs, neworg, check, check->edict->clipmask, true, "G_Push" );
|
||||
}
|
||||
else
|
||||
{
|
||||
trace = G_Trace( Vector( trace.endpos ), check->mins, check->maxs, move2 + check->origin, check, check->edict->clipmask, false, "G_Push" );
|
||||
trace = G_Trace( Vector( trace.endpos ), check->mins, check->maxs, neworg, check, check->edict->clipmask, false, "G_Push" );
|
||||
}
|
||||
|
||||
move2 = trace.endpos - check->origin;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
check->addOrigin( check->getParentVector( move2 ) );
|
||||
|
||||
|
|
|
@ -237,12 +237,12 @@ typedef struct gameImport_s
|
|||
void ( *AddCommand )( const char *cmdName, xcommand_t cmdFunction );
|
||||
int ( *FS_ReadFile )( const char *qpath, void **buffer, qboolean quiet );
|
||||
void ( *FS_FreeFile )( void *buffer );
|
||||
int ( *FS_WriteFile )( const char *qpath, const void *buffer, int size );
|
||||
size_t( *FS_WriteFile )( const char *qpath, const void *buffer, size_t size );
|
||||
fileHandle_t ( *FS_FOpenFileWrite )( const char *fileName );
|
||||
fileHandle_t ( *FS_FOpenFileAppend )( const char *fileName );
|
||||
const char *( *FS_PrepFileWrite )( const char *fileName );
|
||||
int( *FS_Write )( void *buffer, int size, fileHandle_t fileHandle );
|
||||
int ( *FS_Read )( void *buffer, int len, fileHandle_t fileHandle );
|
||||
size_t( *FS_Write )( void *buffer, size_t size, fileHandle_t fileHandle );
|
||||
size_t( *FS_Read )( void *buffer, size_t len, fileHandle_t fileHandle );
|
||||
void ( *FS_FCloseFile )( fileHandle_t fileHandle );
|
||||
int ( *FS_Tell )( fileHandle_t fileHandle );
|
||||
int ( *FS_Seek )( fileHandle_t fileHandle, long int offset, fsOrigin_t origin );
|
||||
|
|
|
@ -4503,7 +4503,7 @@ void Player::InitModel
|
|||
char *model_replace;
|
||||
|
||||
strcpy( model_name, model.c_str() );
|
||||
int len = strlen( model_name );
|
||||
size_t len = strlen( model_name );
|
||||
|
||||
model_replace = model_name + len - 4;
|
||||
|
||||
|
|
|
@ -629,7 +629,7 @@ Sentient::Sentient()
|
|||
m_fDamageMultipliers[ 18 ] = 0.5f;
|
||||
|
||||
m_PrevSentient = NULL;
|
||||
m_NextSentient = level.m_HeadSentient[ 1 ];
|
||||
m_NextSentient = level.m_HeadSentient[ m_Team ];
|
||||
|
||||
if( m_NextSentient )
|
||||
{
|
||||
|
@ -656,7 +656,7 @@ Sentient::~Sentient()
|
|||
}
|
||||
else
|
||||
{
|
||||
level.m_HeadSentient[ m_Team ] = this;
|
||||
level.m_HeadSentient[ m_Team ] = m_NextSentient;
|
||||
}
|
||||
|
||||
m_PrevSentient = NULL;
|
||||
|
@ -3701,7 +3701,7 @@ void Sentient::CheckAnimations
|
|||
}
|
||||
else if ( !Q_stricmpn( c, cs, strlen( cs ) ) ) // partial match
|
||||
{
|
||||
int state_len = strlen( cs );
|
||||
size_t state_len = strlen( cs );
|
||||
|
||||
// Animation in tik file is longer than the state machine's anim
|
||||
if ( strlen( c ) > state_len )
|
||||
|
@ -4136,7 +4136,7 @@ void Sentient::EventGerman
|
|||
m_NextSentient = level.m_HeadSentient[ TEAM_GERMAN ];
|
||||
if( m_NextSentient )
|
||||
{
|
||||
m_PrevSentient = this;
|
||||
m_NextSentient->m_PrevSentient = this;
|
||||
}
|
||||
|
||||
level.m_HeadSentient[ m_Team ] = this;
|
||||
|
@ -4183,13 +4183,13 @@ void Sentient::EventAmerican
|
|||
}
|
||||
|
||||
m_NextSentient = NULL;
|
||||
m_Team = TEAM_AMERICAN;
|
||||
m_PrevSentient = NULL;
|
||||
m_Team = TEAM_AMERICAN;
|
||||
|
||||
m_NextSentient = level.m_HeadSentient[ TEAM_AMERICAN ];
|
||||
if( m_NextSentient )
|
||||
{
|
||||
m_PrevSentient = this;
|
||||
m_NextSentient->m_PrevSentient = this;
|
||||
}
|
||||
|
||||
level.m_HeadSentient[ m_Team ] = this;
|
||||
|
|
|
@ -1424,7 +1424,7 @@ void SoundManager::Save
|
|||
Entity *ent;
|
||||
str buf;
|
||||
str filename;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
// get the name of the sound file from the world
|
||||
filename = "maps/";
|
||||
|
@ -1756,7 +1756,7 @@ void SoundManager::Load
|
|||
)
|
||||
{
|
||||
str filename;
|
||||
int i;
|
||||
intptr_t i;
|
||||
|
||||
// get the name of the sound file from the world
|
||||
filename = "maps/";
|
||||
|
|
|
@ -701,7 +701,7 @@ void Archiver::Archive##func \
|
|||
ARCHIVE( Vector, Vector );
|
||||
ARCHIVE( Integer, int );
|
||||
ARCHIVE( Unsigned, unsigned );
|
||||
ARCHIVE( Size, size_t );
|
||||
ARCHIVE( Size, long );
|
||||
ARCHIVE( Byte, byte );
|
||||
ARCHIVE( Char, char );
|
||||
ARCHIVE( Short, short );
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
void ArchiveQuat( Quat * quat );
|
||||
void ArchiveInteger( int * num );
|
||||
void ArchiveUnsigned( unsigned * unum );
|
||||
void ArchiveSize( size_t * unum );
|
||||
void ArchiveSize( long * unum );
|
||||
void ArchiveByte( byte * num );
|
||||
void ArchiveChar( char * ch );
|
||||
void ArchiveShort( short * num );
|
||||
|
|
|
@ -215,7 +215,6 @@ unsigned int numclassesallocated = 0;
|
|||
bool classInited = false;
|
||||
|
||||
#ifndef _DEBUG_MEM
|
||||
|
||||
void *Class::operator new( size_t s )
|
||||
{
|
||||
size_t *p;
|
||||
|
|
|
@ -1739,7 +1739,7 @@ int yyerror( const char *msg )
|
|||
return 1;
|
||||
}
|
||||
|
||||
unsigned int ScriptCompiler::Parse( GameScript *gameScript, char *sourceBuffer )
|
||||
size_t ScriptCompiler::Parse( GameScript *gameScript, char *sourceBuffer )
|
||||
{
|
||||
parsedata = yyparsedata();
|
||||
|
||||
|
@ -1786,9 +1786,9 @@ unsigned int ScriptCompiler::Parse( GameScript *gameScript, char *sourceBuffer )
|
|||
return parsedata.total_length;
|
||||
}
|
||||
|
||||
unsigned int ScriptCompiler::Compile( GameScript *gameScript, unsigned char *progBuffer )
|
||||
size_t ScriptCompiler::Compile( GameScript *gameScript, unsigned char *progBuffer )
|
||||
{
|
||||
int length;
|
||||
size_t length;
|
||||
|
||||
if( progBuffer == NULL )
|
||||
{
|
||||
|
|
|
@ -162,8 +162,8 @@ public:
|
|||
|
||||
char *Preprocess( char *sourceBuffer );
|
||||
void Preclean( char *processedBuffer );
|
||||
unsigned int Parse( GameScript *m_GameScript, char *sourceBuffer );
|
||||
unsigned int Compile( GameScript *m_GameScript, unsigned char *progBuffer );
|
||||
size_t Parse( GameScript *m_GameScript, char *sourceBuffer );
|
||||
size_t Compile( GameScript *m_GameScript, unsigned char *progBuffer );
|
||||
void Optimize( unsigned char *progBuffer );
|
||||
|
||||
static str GetLine( str content, int line );
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
void InsertObjectAt( int index, const Type& obj );
|
||||
int MaxObjects( void ) const;
|
||||
int NumObjects( void ) const;
|
||||
Type& ObjectAt( const int index ) const;
|
||||
Type& ObjectAt( const size_t index ) const;
|
||||
bool ObjectInList( const Type& obj );
|
||||
void RemoveObjectAt( int index );
|
||||
void RemoveObject( const Type& obj );
|
||||
|
@ -319,7 +319,7 @@ int Container<Type>::NumObjects( void ) const
|
|||
}
|
||||
|
||||
template< class Type >
|
||||
Type& Container<Type>::ObjectAt( int index ) const
|
||||
Type& Container<Type>::ObjectAt( const size_t index ) const
|
||||
{
|
||||
if( ( index <= 0 ) || ( index > numobjects ) ) {
|
||||
CONTAINER_Error( ERR_DROP, "Container::ObjectAt : index out of range" );
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
int IndexOfObject( const Type& obj ) { return value.IndexOfObject( obj ); }
|
||||
void InsertObjectAt( int index, const Type& obj ) { return value.InsertObjectAt( index, obj ); }
|
||||
int NumObjects( void ) const { return value.NumObjects(); }
|
||||
Type& ObjectAt( const int index ) const { return value.ObjectAt( index ); }
|
||||
Type& ObjectAt( const size_t index ) const { return value.ObjectAt( index ); }
|
||||
bool ObjectInList( const Type& obj ) { return value.ObjectInList( obj ); }
|
||||
void RemoveObjectAt( int index ) { return value.RemoveObjectAt( index ); }
|
||||
void RemoveObject( const Type& obj ) { return value.RemoveObject( obj ); }
|
||||
|
|
|
@ -39,7 +39,7 @@ const_str AbstractScript::ConstFilename( void )
|
|||
return m_Filename;
|
||||
}
|
||||
|
||||
bool AbstractScript::GetSourceAt( unsigned int sourcePos, str &sourceLine, int &column, int &line )
|
||||
bool AbstractScript::GetSourceAt( size_t sourcePos, str &sourceLine, int &column, int &line )
|
||||
{
|
||||
if( !m_SourceBuffer || sourcePos >= m_SourceLength ) {
|
||||
return false;
|
||||
|
@ -99,7 +99,7 @@ void AbstractScript::PrintSourcePos( sourceinfo_t *sourcePos, bool dev )
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractScript::PrintSourcePos( unsigned int sourcePos, bool dev )
|
||||
void AbstractScript::PrintSourcePos( size_t sourcePos, bool dev )
|
||||
{
|
||||
int line;
|
||||
int column;
|
||||
|
@ -462,7 +462,7 @@ void GameScript::Archive( Archiver& arc )
|
|||
const_str s;
|
||||
command_t *c, cmd;
|
||||
|
||||
arc.ArchiveUnsigned( &m_ProgLength );
|
||||
arc.ArchiveSize( ( long * )&m_ProgLength );
|
||||
|
||||
if( arc.Saving() )
|
||||
{
|
||||
|
@ -700,9 +700,9 @@ void GameScript::Close( void )
|
|||
m_bPrecompiled = false;
|
||||
}
|
||||
|
||||
void GameScript::Load( const void *sourceBuffer, int sourceLength )
|
||||
void GameScript::Load( const void *sourceBuffer, size_t sourceLength )
|
||||
{
|
||||
int nodeLength;
|
||||
size_t nodeLength;
|
||||
char *m_PreprocessedBuffer;
|
||||
|
||||
m_SourceBuffer = ( char * )glbs.Malloc( sourceLength + 1 );
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
// File variables
|
||||
const_str m_Filename;
|
||||
char *m_SourceBuffer;
|
||||
unsigned int m_SourceLength;
|
||||
size_t m_SourceLength;
|
||||
|
||||
// Developper variable
|
||||
con_set< uchar *, sourceinfo_t > *m_ProgToSource;
|
||||
|
@ -61,9 +61,9 @@ public:
|
|||
|
||||
str& Filename( void );
|
||||
const_str ConstFilename( void );
|
||||
bool GetSourceAt( unsigned int sourcePos, str &sourceLine, int &column, int &line );
|
||||
bool GetSourceAt( size_t sourcePos, str &sourceLine, int &column, int &line );
|
||||
void PrintSourcePos( sourceinfo_t *sourcePos, bool dev );
|
||||
void PrintSourcePos( unsigned int sourcePos, bool dev );
|
||||
void PrintSourcePos( size_t sourcePos, bool dev );
|
||||
void PrintSourcePos( unsigned char *m_pCodePos, bool dev );
|
||||
void PrintSourcePos( str sourceLine, int column, int line, bool dev );
|
||||
};
|
||||
|
@ -112,7 +112,7 @@ public:
|
|||
// program variables
|
||||
StateScript m_State;
|
||||
unsigned char *m_ProgBuffer;
|
||||
unsigned int m_ProgLength;
|
||||
size_t m_ProgLength;
|
||||
|
||||
// compile variables
|
||||
bool successCompile;
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
void ArchiveCodePos( Archiver& arc, unsigned char **codePos );
|
||||
|
||||
void Close( void );
|
||||
void Load( const void *sourceBuffer, int sourceLength );
|
||||
void Load( const void *sourceBuffer, size_t sourceLength );
|
||||
|
||||
|
||||
bool GetCodePos( unsigned char *codePos, str& filename, int& pos );
|
||||
|
|
|
@ -320,10 +320,10 @@ md5_init(md5_state_t *pms)
|
|||
}
|
||||
|
||||
void
|
||||
md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
|
||||
md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes)
|
||||
{
|
||||
const md5_byte_t *p = data;
|
||||
int left = nbytes;
|
||||
size_t left = nbytes;
|
||||
int offset = (pms->count[0] >> 3) & 63;
|
||||
md5_word_t nbits = (md5_word_t)(nbytes << 3);
|
||||
|
||||
|
@ -338,7 +338,7 @@ md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
|
|||
|
||||
/* Process an initial partial block. */
|
||||
if (offset) {
|
||||
int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
|
||||
size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
|
||||
|
||||
memcpy(pms->buf + offset, p, copy);
|
||||
if (offset + copy < 64)
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
typedef unsigned char md5_byte_t; /* 8-bit byte */
|
||||
typedef unsigned int md5_word_t; /* 32-bit word */
|
||||
typedef size_t md5_word_t; /* 32-bit word */
|
||||
|
||||
/* Define the state of the MD5 Algorithm. */
|
||||
typedef struct md5_state_s {
|
||||
|
@ -79,7 +79,7 @@ extern "C"
|
|||
void md5_init(md5_state_t *pms);
|
||||
|
||||
/* Append a string to the message. */
|
||||
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
|
||||
void md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes);
|
||||
|
||||
/* Finish the message and return the digest. */
|
||||
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
|
||||
|
|
|
@ -35,9 +35,9 @@ char *str_replace( char *orig, char *rep, char *with ) {
|
|||
char *result; // the return string
|
||||
char *ins; // the next insert point
|
||||
char *tmp; // varies
|
||||
int len_rep; // length of rep
|
||||
int len_with; // length of with
|
||||
int len_front; // distance between rep and end of last rep
|
||||
size_t len_rep; // length of rep
|
||||
size_t len_with; // length of with
|
||||
size_t len_front; // distance between rep and end of last rep
|
||||
int count; // number of replacements
|
||||
|
||||
if( !orig )
|
||||
|
@ -90,7 +90,7 @@ void parsetree_init()
|
|||
parsedata.total_length = 0;
|
||||
}
|
||||
|
||||
int parsetree_length()
|
||||
size_t parsetree_length()
|
||||
{
|
||||
return parsedata.total_length;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ typedef struct {
|
|||
|
||||
void parsetree_freeall();
|
||||
void parsetree_init();
|
||||
int parsetree_length();
|
||||
size_t parsetree_length();
|
||||
char *parsetree_malloc( size_t s );
|
||||
|
||||
int node_compare( void *pe1, void *pe2 );
|
||||
|
@ -128,7 +128,7 @@ struct yyexception {
|
|||
};
|
||||
|
||||
struct yyparsedata {
|
||||
int total_length;
|
||||
size_t total_length;
|
||||
|
||||
int braces_count;
|
||||
int line_count;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
#define yyHEADER_H 1
|
||||
#define yyIN_HEADER 1
|
||||
|
||||
#line 6 "../../../code/globalcpp/parser/yyLexer.h"
|
||||
#line 5 "../../../code/globalcpp/parser/yyLexer.h"
|
||||
|
||||
#line 8 "../../../code/globalcpp/parser/yyLexer.h"
|
||||
#line 7 "../../../code/globalcpp/parser/yyLexer.h"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
|
@ -12,12 +12,90 @@
|
|||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 37
|
||||
#define YY_FLEX_MINOR_VERSION 6
|
||||
#define YY_FLEX_SUBMINOR_VERSION 3
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
||||
#define yy_create_buffer yy_create_buffer
|
||||
|
||||
#define yy_delete_buffer yy_delete_buffer
|
||||
|
||||
#define yy_scan_buffer yy_scan_buffer
|
||||
|
||||
#define yy_scan_string yy_scan_string
|
||||
|
||||
#define yy_scan_bytes yy_scan_bytes
|
||||
|
||||
#define yy_init_buffer yy_init_buffer
|
||||
|
||||
#define yy_flush_buffer yy_flush_buffer
|
||||
|
||||
#define yy_load_buffer_state yy_load_buffer_state
|
||||
|
||||
#define yy_switch_to_buffer yy_switch_to_buffer
|
||||
|
||||
#define yypush_buffer_state yypush_buffer_state
|
||||
|
||||
#define yypop_buffer_state yypop_buffer_state
|
||||
|
||||
#define yyensure_buffer_stack yyensure_buffer_stack
|
||||
|
||||
#define yylex yylex
|
||||
|
||||
#define yyrestart yyrestart
|
||||
|
||||
#define yylex_init yylex_init
|
||||
|
||||
#define yylex_init_extra yylex_init_extra
|
||||
|
||||
#define yylex_destroy yylex_destroy
|
||||
|
||||
#define yyget_debug yyget_debug
|
||||
|
||||
#define yyset_debug yyset_debug
|
||||
|
||||
#define yyget_extra yyget_extra
|
||||
|
||||
#define yyset_extra yyset_extra
|
||||
|
||||
#define yyget_in yyget_in
|
||||
|
||||
#define yyset_in yyset_in
|
||||
|
||||
#define yyget_out yyget_out
|
||||
|
||||
#define yyset_out yyset_out
|
||||
|
||||
#define yyget_leng yyget_leng
|
||||
|
||||
#define yyget_text yyget_text
|
||||
|
||||
#define yyget_lineno yyget_lineno
|
||||
|
||||
#define yyset_lineno yyset_lineno
|
||||
|
||||
#define yywrap yywrap
|
||||
|
||||
#define yyalloc yyalloc
|
||||
|
||||
#define yyrealloc yyrealloc
|
||||
|
||||
#define yyfree yyfree
|
||||
|
||||
#define yytext yytext
|
||||
|
||||
#define yyleng yyleng
|
||||
|
||||
#define yyin yyin
|
||||
|
||||
#define yyout yyout
|
||||
|
||||
#define yy_flex_debug yy_flex_debug
|
||||
|
||||
#define yylineno yylineno
|
||||
|
||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
||||
|
||||
/* begin standard C headers. */
|
||||
|
@ -92,30 +170,26 @@ typedef unsigned int flex_uint32_t;
|
|||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* The "const" storage-class-modifier is valid. */
|
||||
#define YY_USE_CONST
|
||||
|
||||
#else /* ! __cplusplus */
|
||||
|
||||
/* C99 requires __STDC__ to be defined as 1. */
|
||||
#if defined (__STDC__)
|
||||
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* defined (__STDC__) */
|
||||
#endif /* ! __cplusplus */
|
||||
|
||||
#ifdef YY_USE_CONST
|
||||
/* TODO: this is always defined, so inline it */
|
||||
#define yyconst const
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
#define yynoreturn __attribute__((__noreturn__))
|
||||
#else
|
||||
#define yyconst
|
||||
#define yynoreturn
|
||||
#endif
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
||||
|
@ -128,7 +202,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
extern yy_size_t yyleng;
|
||||
extern int yyleng;
|
||||
|
||||
extern FILE *yyin, *yyout;
|
||||
|
||||
|
@ -144,12 +218,12 @@ struct yy_buffer_state
|
|||
/* Size of input buffer in bytes, not including room for EOB
|
||||
* characters.
|
||||
*/
|
||||
yy_size_t yy_buf_size;
|
||||
int yy_buf_size;
|
||||
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
yy_size_t yy_n_chars;
|
||||
int yy_n_chars;
|
||||
|
||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
||||
* and can realloc() it to grow it, and should free() it to
|
||||
|
@ -172,7 +246,7 @@ struct yy_buffer_state
|
|||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
|
@ -183,30 +257,33 @@ struct yy_buffer_state
|
|||
};
|
||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||
|
||||
void yyrestart (FILE *input_file );
|
||||
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
|
||||
YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
|
||||
void yy_delete_buffer (YY_BUFFER_STATE b );
|
||||
void yy_flush_buffer (YY_BUFFER_STATE b );
|
||||
void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
|
||||
void yypop_buffer_state (void );
|
||||
void yyrestart ( FILE *input_file );
|
||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
void yy_flush_buffer ( YY_BUFFER_STATE b );
|
||||
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
|
||||
void yypop_buffer_state ( void );
|
||||
|
||||
YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
|
||||
YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
|
||||
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
|
||||
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
|
||||
YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
|
||||
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
|
||||
|
||||
void *yyalloc (yy_size_t );
|
||||
void *yyrealloc (void *,yy_size_t );
|
||||
void yyfree (void * );
|
||||
void *yyalloc ( yy_size_t );
|
||||
void *yyrealloc ( void *, yy_size_t );
|
||||
void yyfree ( void * );
|
||||
|
||||
/* Begin user sect3 */
|
||||
|
||||
#define yywrap() 1
|
||||
#define yywrap() (/*CONSTCOND*/1)
|
||||
#define YY_SKIP_YYWRAP
|
||||
|
||||
extern int yylineno;
|
||||
|
||||
extern char *yytext;
|
||||
#ifdef yytext_ptr
|
||||
#undef yytext_ptr
|
||||
#endif
|
||||
#define yytext_ptr yytext
|
||||
|
||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
||||
|
@ -233,31 +310,31 @@ extern char *yytext;
|
|||
/* Accessor methods to globals.
|
||||
These are made visible to non-reentrant scanners for convenience. */
|
||||
|
||||
int yylex_destroy (void );
|
||||
int yylex_destroy ( void );
|
||||
|
||||
int yyget_debug (void );
|
||||
int yyget_debug ( void );
|
||||
|
||||
void yyset_debug (int debug_flag );
|
||||
void yyset_debug ( int debug_flag );
|
||||
|
||||
YY_EXTRA_TYPE yyget_extra (void );
|
||||
YY_EXTRA_TYPE yyget_extra ( void );
|
||||
|
||||
void yyset_extra (YY_EXTRA_TYPE user_defined );
|
||||
void yyset_extra ( YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *yyget_in (void );
|
||||
FILE *yyget_in ( void );
|
||||
|
||||
void yyset_in (FILE * in_str );
|
||||
void yyset_in ( FILE * _in_str );
|
||||
|
||||
FILE *yyget_out (void );
|
||||
FILE *yyget_out ( void );
|
||||
|
||||
void yyset_out (FILE * out_str );
|
||||
void yyset_out ( FILE * _out_str );
|
||||
|
||||
yy_size_t yyget_leng (void );
|
||||
int yyget_leng ( void );
|
||||
|
||||
char *yyget_text (void );
|
||||
char *yyget_text ( void );
|
||||
|
||||
int yyget_lineno (void );
|
||||
int yyget_lineno ( void );
|
||||
|
||||
void yyset_lineno (int line_number );
|
||||
void yyset_lineno ( int _line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
|
@ -265,18 +342,18 @@ void yyset_lineno (int line_number );
|
|||
|
||||
#ifndef YY_SKIP_YYWRAP
|
||||
#ifdef __cplusplus
|
||||
extern "C" int yywrap (void );
|
||||
extern "C" int yywrap ( void );
|
||||
#else
|
||||
extern int yywrap (void );
|
||||
extern int yywrap ( void );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int );
|
||||
static void yy_flex_strncpy ( char *, const char *, int );
|
||||
#endif
|
||||
|
||||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen (yyconst char * );
|
||||
static int yy_flex_strlen ( const char * );
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
|
@ -285,7 +362,12 @@ static int yy_flex_strlen (yyconst char * );
|
|||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Number of entries by which start-condition stack grows. */
|
||||
|
@ -318,9 +400,9 @@ extern int yylex (void);
|
|||
#undef YY_DECL
|
||||
#endif
|
||||
|
||||
#line 282 "..\\..\\..\\code\\globalcpp\\parser\\yyLexer.l"
|
||||
#line 283 "..\\..\\..\\code\\globalcpp\\parser\\yyLexer.l"
|
||||
|
||||
|
||||
#line 325 "../../../code/globalcpp/parser/yyLexer.h"
|
||||
#line 406 "../../../code/globalcpp/parser/yyLexer.h"
|
||||
#undef yyIN_HEADER
|
||||
#endif /* yyHEADER_H */
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "compiler.h"
|
||||
#include "yyParser.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void fprintf2( FILE *f, const char *format, ... )
|
||||
|
@ -59,7 +59,7 @@ void yylexerror( const char *msg )
|
|||
assert( 0 );
|
||||
}
|
||||
|
||||
static void TextEscapeValue( char *str, int len )
|
||||
static void TextEscapeValue( char *str, size_t len )
|
||||
{
|
||||
char *to = parsetree_malloc( len + 1 );
|
||||
|
||||
|
@ -106,7 +106,7 @@ static void TextEscapeValue( char *str, int len )
|
|||
}
|
||||
|
||||
|
||||
static void TextValue( char *str, int len )
|
||||
static void TextValue( char *str, size_t len )
|
||||
{
|
||||
yylval.s.val.stringValue = parsetree_malloc( len + 1 );
|
||||
strncpy( yylval.s.val.stringValue, str, len );
|
||||
|
|
|
@ -3170,6 +3170,7 @@ void ScriptMaster::RegisterAliasInternal
|
|||
{
|
||||
str s;
|
||||
|
||||
// MOHAA doesn't check that
|
||||
if( ev->IsListenerAt( i ) )
|
||||
{
|
||||
Listener *l = ev->GetListener( i );
|
||||
|
@ -3284,14 +3285,25 @@ ScriptThread::ScriptThread( ScriptClass *scriptClass, unsigned char *pCodePos )
|
|||
|
||||
ScriptThread::~ScriptThread()
|
||||
{
|
||||
if( !m_ScriptVM )
|
||||
ScriptVM* vm = m_ScriptVM;
|
||||
if( !vm )
|
||||
{
|
||||
ScriptError( "Attempting to delete a dead thread." );
|
||||
}
|
||||
|
||||
Stop();
|
||||
m_ScriptVM = NULL;
|
||||
if( vm->ThreadState() == THREAD_WAITING )
|
||||
{
|
||||
vm->m_ThreadState = THREAD_RUNNING;
|
||||
Director.RemoveTiming( this );
|
||||
}
|
||||
else if( vm->ThreadState() == THREAD_SUSPENDED )
|
||||
{
|
||||
vm->m_ThreadState = THREAD_RUNNING;
|
||||
CancelWaitingAll();
|
||||
}
|
||||
|
||||
m_ScriptVM->NotifyDelete();
|
||||
vm->NotifyDelete();
|
||||
}
|
||||
|
||||
void ScriptThread::CreateReturnThread
|
||||
|
@ -3836,8 +3848,8 @@ void ScriptThread::FileReadAll
|
|||
FILE *f = NULL;
|
||||
char *ret = NULL;
|
||||
long currentPos = 0;
|
||||
long size = 0;
|
||||
long sizeRead = 0;
|
||||
size_t size = 0;
|
||||
size_t sizeRead = 0;
|
||||
|
||||
numArgs = ev->NumArgs();
|
||||
|
||||
|
@ -3879,7 +3891,7 @@ void ScriptThread::FileSaveAll
|
|||
int id = 0;
|
||||
int numArgs = 0;
|
||||
FILE *f = NULL;
|
||||
long sizeWrite = 0;
|
||||
size_t sizeWrite = 0;
|
||||
str text;
|
||||
|
||||
numArgs = ev->NumArgs();
|
||||
|
@ -3901,7 +3913,7 @@ void ScriptThread::FileSaveAll
|
|||
|
||||
sizeWrite = fwrite( text, 1, strlen( text ), f );
|
||||
|
||||
ev->AddInteger( sizeWrite );
|
||||
ev->AddInteger( ( int )sizeWrite );
|
||||
}
|
||||
|
||||
void ScriptThread::FileRemove
|
||||
|
@ -3973,7 +3985,7 @@ void ScriptThread::FileCopy
|
|||
)
|
||||
|
||||
{
|
||||
unsigned int n = 0;
|
||||
size_t n = 0;
|
||||
int numArgs = 0;
|
||||
unsigned int ret = 0;
|
||||
str filename, copyfilename;
|
||||
|
@ -4361,9 +4373,9 @@ void ScriptThread::PregMatch
|
|||
{
|
||||
slre_cap sl_cap[ 32 ];
|
||||
int i, j;
|
||||
int iMaxLength;
|
||||
int iLength;
|
||||
int iFoundLength = 0;
|
||||
size_t iMaxLength;
|
||||
size_t iLength;
|
||||
size_t iFoundLength = 0;
|
||||
str pattern, subject;
|
||||
ScriptVariable index, value, subindex, subvalue;
|
||||
ScriptVariable array, subarray;
|
||||
|
|
|
@ -194,8 +194,10 @@ private:
|
|||
public:
|
||||
CLASS_PROTOTYPE( ScriptThread );
|
||||
|
||||
#ifndef _DEBUG_MEM
|
||||
void *operator new( size_t size );
|
||||
void operator delete( void *ptr );
|
||||
#endif
|
||||
|
||||
virtual void Archive( Archiver &arc );
|
||||
void ArchiveInternal( Archiver& arc );
|
||||
|
|
|
@ -333,7 +333,7 @@ void ScriptClass::RemoveThread( ScriptVM *m_ScriptVM )
|
|||
{
|
||||
m_Threads = m_ScriptVM->next;
|
||||
|
||||
if( m_ScriptVM->next == NULL ) {
|
||||
if( m_Threads == NULL ) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
@ -1912,7 +1912,7 @@ __execMethodInternal:
|
|||
break;
|
||||
|
||||
case OP_UN_SIZE:
|
||||
pTop->setIntValue( pTop->size() );
|
||||
pTop->setIntValue( ( int )pTop->size() );
|
||||
break;
|
||||
|
||||
case OP_UN_TARGETNAME:
|
||||
|
|
|
@ -172,8 +172,10 @@ public:
|
|||
public:
|
||||
CLASS_PROTOTYPE( ScriptClass );
|
||||
|
||||
#ifndef _DEBUG_MEM
|
||||
void *operator new( size_t size );
|
||||
void operator delete( void *ptr );
|
||||
#endif
|
||||
|
||||
ScriptClass( GameScript *gameScript, Listener *self );
|
||||
ScriptClass();
|
||||
|
@ -288,9 +290,10 @@ private:
|
|||
void HandleScriptException( ScriptException& exc );
|
||||
|
||||
public:
|
||||
|
||||
#ifndef _DEBUG_MEM
|
||||
void *operator new( size_t size );
|
||||
void operator delete( void *ptr );
|
||||
#endif
|
||||
|
||||
ScriptVM( ScriptClass *scriptClass, unsigned char *pCodePos, ScriptThread *thread );
|
||||
~ScriptVM();
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
|
||||
struct bracket_pair {
|
||||
const char *ptr; /* Points to the first char after '(' in regex */
|
||||
int len; /* Length of the text between '(' and ')' */
|
||||
size_t len; /* Length of the text between '(' and ')' */
|
||||
int branches; /* Index in the branches array for this pair */
|
||||
int num_branches; /* Number of '|' in this bracket pair */
|
||||
unsigned int num_branches; /* Number of '|' in this bracket pair */
|
||||
};
|
||||
|
||||
struct branch {
|
||||
|
@ -82,8 +82,8 @@ static int op_len(const char *re) {
|
|||
return re[0] == '\\' && re[1] == 'x' ? 4 : re[0] == '\\' ? 2 : 1;
|
||||
}
|
||||
|
||||
static int set_len(const char *re, int re_len) {
|
||||
int len = 0;
|
||||
static size_t set_len(const char *re, size_t re_len) {
|
||||
size_t len = 0;
|
||||
|
||||
while (len < re_len && re[len] != ']') {
|
||||
len += op_len(re + len);
|
||||
|
@ -92,7 +92,7 @@ static int set_len(const char *re, int re_len) {
|
|||
return len <= re_len ? len + 1 : -1;
|
||||
}
|
||||
|
||||
static int get_op_len(const char *re, int re_len) {
|
||||
static size_t get_op_len(const char *re, size_t re_len) {
|
||||
return re[0] == '[' ? set_len(re + 1, re_len - 1) + 1 : op_len(re);
|
||||
}
|
||||
|
||||
|
@ -156,9 +156,10 @@ static int match_op(const unsigned char *re, const unsigned char *s,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int match_set(const char *re, int re_len, const char *s,
|
||||
static int match_set(const char *re, size_t re_len, const char *s,
|
||||
struct regex_info *info) {
|
||||
int len = 0, result = -1, invert = re[0] == '^';
|
||||
size_t len = 0;
|
||||
int result = -1, invert = re[0] == '^';
|
||||
|
||||
if (invert) re++, re_len--;
|
||||
|
||||
|
@ -178,12 +179,12 @@ static int match_set(const char *re, int re_len, const char *s,
|
|||
return (!invert && result > 0) || (invert && result <= 0) ? 1 : -1;
|
||||
}
|
||||
|
||||
static int doh(const char *s, int s_len, struct regex_info *info, int bi);
|
||||
static size_t doh(const char *s, size_t s_len, struct regex_info *info, int bi);
|
||||
|
||||
static int bar(const char *re, int re_len, const char *s, int s_len,
|
||||
static size_t bar(const char *re, size_t re_len, const char *s, size_t s_len,
|
||||
struct regex_info *info, int bi) {
|
||||
/* i is offset in re, j is offset in s, bi is brackets index */
|
||||
int i, j, n, step;
|
||||
size_t i, j, n, step;
|
||||
|
||||
for (i = j = 0; i < re_len && j <= s_len; i += step) {
|
||||
|
||||
|
@ -201,11 +202,11 @@ static int bar(const char *re, int re_len, const char *s, int s_len,
|
|||
DBG(("QUANTIFIER: [%.*s]%c [%.*s]\n", step, re + i,
|
||||
re[i + step], s_len - j, s + j));
|
||||
if (re[i + step] == '?') {
|
||||
int result = bar(re + i, step, s + j, s_len - j, info, bi);
|
||||
size_t result = bar(re + i, step, s + j, s_len - j, info, bi);
|
||||
j += result > 0 ? result : 0;
|
||||
i++;
|
||||
} else if (re[i + step] == '+' || re[i + step] == '*') {
|
||||
int j2 = j, nj = j, n1, n2 = -1, ni, non_greedy = 0;
|
||||
size_t j2 = j, nj = j, n1, n2 = -1, ni, non_greedy = 0;
|
||||
|
||||
/* Points to the regexp code after the quantifier */
|
||||
ni = i + step + 1;
|
||||
|
@ -269,7 +270,7 @@ static int bar(const char *re, int re_len, const char *s, int s_len,
|
|||
/* Nothing follows brackets */
|
||||
n = doh(s + j, s_len - j, info, bi);
|
||||
} else {
|
||||
int j2;
|
||||
size_t j2;
|
||||
for (j2 = 0; j2 <= s_len - j; j2++) {
|
||||
if ((n = doh(s + j, s_len - (j + j2), info, bi)) >= 0 &&
|
||||
bar(re + i + step, re_len - (i + step),
|
||||
|
@ -300,16 +301,16 @@ static int bar(const char *re, int re_len, const char *s, int s_len,
|
|||
}
|
||||
|
||||
/* Process branch points */
|
||||
static int doh(const char *s, int s_len, struct regex_info *info, int bi) {
|
||||
static size_t doh(const char *s, size_t s_len, struct regex_info *info, int bi) {
|
||||
const struct bracket_pair *b = &info->brackets[bi];
|
||||
int i = 0, len, result;
|
||||
size_t i = 0, len, result;
|
||||
const char *p;
|
||||
|
||||
do {
|
||||
p = i == 0 ? b->ptr : info->branches[b->branches + i - 1].schlong + 1;
|
||||
len = b->num_branches == 0 ? b->len :
|
||||
i == b->num_branches ? (int) (b->ptr + b->len - p) :
|
||||
(int) (info->branches[b->branches + i].schlong - p);
|
||||
i == b->num_branches ? (b->ptr + b->len - p) :
|
||||
(info->branches[b->branches + i].schlong - p);
|
||||
DBG(("%s %d %d [%.*s] [%.*s]\n", __func__, bi, i, len, p, s_len, s));
|
||||
result = bar(p, len, s, s_len, info, bi);
|
||||
DBG(("%s <- %d\n", __func__, result));
|
||||
|
@ -318,8 +319,10 @@ static int doh(const char *s, int s_len, struct regex_info *info, int bi) {
|
|||
return result;
|
||||
}
|
||||
|
||||
static int baz(const char *s, int s_len, struct regex_info *info) {
|
||||
int i, result = -1, is_anchored = info->brackets[0].ptr[0] == '^';
|
||||
static size_t baz(const char *s, size_t s_len, struct regex_info *info) {
|
||||
size_t i;
|
||||
int is_anchored = info->brackets[0].ptr[0] == '^';
|
||||
size_t result = -1;
|
||||
|
||||
for (i = 0; i <= s_len; i++) {
|
||||
result = doh(s + i, s_len - i, info, 0);
|
||||
|
@ -362,9 +365,11 @@ static void setup_branch_points(struct regex_info *info) {
|
|||
}
|
||||
}
|
||||
|
||||
static int foo(const char *re, int re_len, const char *s, int s_len,
|
||||
static size_t foo(const char *re, size_t re_len, const char *s, size_t s_len,
|
||||
struct regex_info *info) {
|
||||
int i, step, depth = 0;
|
||||
size_t i;
|
||||
size_t step;
|
||||
int depth = 0;
|
||||
|
||||
/* First bracket captures everything */
|
||||
info->brackets[0].ptr = re;
|
||||
|
@ -422,7 +427,7 @@ static int foo(const char *re, int re_len, const char *s, int s_len,
|
|||
return baz(s, s_len, info);
|
||||
}
|
||||
|
||||
int slre_match(const char *regexp, const char *s, int s_len,
|
||||
size_t slre_match(const char *regexp, const char *s, size_t s_len,
|
||||
struct slre_cap *caps, int num_caps, int flags) {
|
||||
struct regex_info info;
|
||||
|
||||
|
@ -433,5 +438,5 @@ int slre_match(const char *regexp, const char *s, int s_len,
|
|||
info.caps = caps;
|
||||
|
||||
DBG(("========================> [%s] [%.*s]\n", regexp, s_len, s));
|
||||
return foo(regexp, (int) strlen(regexp), s, s_len, &info);
|
||||
return foo(regexp, strlen(regexp), s, s_len, &info);
|
||||
}
|
||||
|
|
|
@ -31,11 +31,11 @@ extern "C" {
|
|||
|
||||
struct slre_cap {
|
||||
const char *ptr;
|
||||
int len;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
|
||||
int slre_match(const char *regexp, const char *buf, int buf_len,
|
||||
size_t slre_match(const char *regexp, const char *buf, size_t buf_len,
|
||||
struct slre_cap *caps, int num_caps, int flags);
|
||||
|
||||
/* Possible flags for slre_match() */
|
||||
|
|
|
@ -232,7 +232,6 @@ void CMod_LoadNodes( gamelump_t *l ) {
|
|||
out->children[j] = child;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -616,6 +615,7 @@ void CMod_LoadPatches( gamelump_t *surfs, gamelump_t *verts, int *shaderSubdivis
|
|||
Com_Error( ERR_DROP, "CM_LoadMap: funny lump size in %s", cm.name );
|
||||
cm.numSurfaces = count = surfs->length / sizeof(*in);
|
||||
cm.surfaces = Hunk_Alloc( cm.numSurfaces * sizeof( cm.surfaces[0] ) );
|
||||
memset( cm.surfaces, 0, cm.numSurfaces * sizeof( cm.surfaces[ 0 ] ) );
|
||||
|
||||
dv = ( drawVert_t * )verts->buffer;
|
||||
if( verts->length % sizeof( *dv ) )
|
||||
|
|
|
@ -120,7 +120,7 @@ Adds a \n to the text
|
|||
*/
|
||||
void Cbuf_InsertText( const char *text ) {
|
||||
size_t len;
|
||||
size_t i;
|
||||
intptr_t i;
|
||||
|
||||
len = strlen( text ) + 1;
|
||||
if ( len + cmd_text.cursize > cmd_text.maxsize ) {
|
||||
|
|
|
@ -727,6 +727,7 @@ CopyString
|
|||
char *CopyString( const char *in ) {
|
||||
char *out;
|
||||
|
||||
#ifndef _DEBUG_MEM
|
||||
if (!in[0]) {
|
||||
return ( char * )Z_EmptyStringPointer();
|
||||
}
|
||||
|
@ -735,6 +736,7 @@ char *CopyString( const char *in ) {
|
|||
return ( char * )Z_NumberStringPointer( *in );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
out = ( char * )Z_Malloc( strlen( in ) + 1 );
|
||||
strcpy( out, in );
|
||||
|
|
|
@ -45,10 +45,10 @@ Configurator::~Configurator()
|
|||
Close();
|
||||
}
|
||||
|
||||
int Configurator::GetLine( char *dest, const char *data, int size )
|
||||
size_t Configurator::GetLine( char *dest, const char *data, size_t size )
|
||||
{
|
||||
const char *p = data;
|
||||
int i = 0;
|
||||
size_t i = 0;
|
||||
|
||||
while( *p == '\n' )
|
||||
p++;
|
||||
|
@ -109,7 +109,7 @@ configSection_t *Configurator::CreateSection( const char *section )
|
|||
int Configurator::GetKeyArray( char *key )
|
||||
{
|
||||
int count;
|
||||
int len;
|
||||
size_t len;
|
||||
int arrayindex = -1;
|
||||
char *p1, *p2;
|
||||
|
||||
|
@ -138,7 +138,7 @@ int Configurator::GetKeyArray( char *key )
|
|||
int Configurator::GetKeyArray( str& key )
|
||||
{
|
||||
int count;
|
||||
int len;
|
||||
size_t len;
|
||||
int arrayindex = -1;
|
||||
str arrayval;
|
||||
char *p1, *p2;
|
||||
|
@ -248,7 +248,7 @@ int Configurator::CutLine( char *data )
|
|||
return p - data;
|
||||
}
|
||||
|
||||
bool Configurator::SetupLine( char *line, int& lineno, int& len, int& last )
|
||||
bool Configurator::SetupLine( char *line, int& lineno, size_t& len, size_t& last )
|
||||
{
|
||||
lineno++;
|
||||
len = ( int )strlen( line ) - 1;
|
||||
|
@ -282,7 +282,7 @@ bool Configurator::SetupLine( char *line, int& lineno, int& len, int& last )
|
|||
return true;
|
||||
}
|
||||
|
||||
void Configurator::WriteData( char **data, int *size )
|
||||
void Configurator::WriteData( char **data, size_t *size )
|
||||
{
|
||||
configSection_t *section;
|
||||
configKey_t *key;
|
||||
|
@ -290,9 +290,10 @@ void Configurator::WriteData( char **data, int *size )
|
|||
str value;
|
||||
char *oldData = *data;
|
||||
char *currentData = *data;
|
||||
int currentSize = *size;
|
||||
int len, tlen = 0;
|
||||
int i, j, k, offset, offset2;
|
||||
size_t currentSize = *size;
|
||||
size_t len, tlen = 0;
|
||||
int i, j, k;
|
||||
size_t offset, offset2;
|
||||
bool bFound;
|
||||
|
||||
for( i = 1; i <= m_reverseSections.NumObjects(); i++ )
|
||||
|
@ -411,7 +412,7 @@ void Configurator::WriteData( char **data, int *size )
|
|||
*size = currentSize;
|
||||
}
|
||||
|
||||
void Configurator::WriteData2( char **data, int *size )
|
||||
void Configurator::WriteData2( char **data, size_t *size )
|
||||
{
|
||||
configSection_t *section;
|
||||
configKey_t *key;
|
||||
|
@ -419,9 +420,9 @@ void Configurator::WriteData2( char **data, int *size )
|
|||
str value;
|
||||
char *oldData = *data;
|
||||
char *currentData = *data;
|
||||
int currentSize = *size;
|
||||
size_t currentSize = *size;
|
||||
char *p = currentData;
|
||||
int tlen = 0;
|
||||
size_t tlen = 0;
|
||||
int i, j, k;
|
||||
|
||||
for( i = 1; i <= m_reverseSections.NumObjects(); i++ )
|
||||
|
@ -532,17 +533,17 @@ void Configurator::WriteData2( char **data, int *size )
|
|||
*size = tlen;
|
||||
}
|
||||
|
||||
bool Configurator::FindData( int type, const char *s, const char *k, int *offset, const char *data, int size )
|
||||
bool Configurator::FindData( int type, const char *s, const char *k, size_t *offset, const char *data, size_t size )
|
||||
{
|
||||
static char line[ MAX_STRING_TOKENS + 1 ];
|
||||
static char section[ MAX_STRING_TOKENS + 1 ];
|
||||
static char key[ MAX_STRING_TOKENS + 1 ];
|
||||
static char val[ MAX_STRING_TOKENS + 1 ];
|
||||
|
||||
int last = 0;
|
||||
int len;
|
||||
int olen = 0;
|
||||
int tlen = 0;
|
||||
size_t last = 0;
|
||||
size_t len;
|
||||
size_t olen = 0;
|
||||
size_t tlen = 0;
|
||||
int lineno = 0;
|
||||
int arrayindex;
|
||||
|
||||
|
@ -603,16 +604,16 @@ bool Configurator::FindData( int type, const char *s, const char *k, int *offset
|
|||
return false;
|
||||
}
|
||||
|
||||
void Configurator::ParseData( const char *data, int size )
|
||||
void Configurator::ParseData( const char *data, size_t size )
|
||||
{
|
||||
static char line[ MAX_STRING_TOKENS + 1 ];
|
||||
static char section[ MAX_STRING_TOKENS + 1 ];
|
||||
static char key[ MAX_STRING_TOKENS + 1 ];
|
||||
static char val[ MAX_STRING_TOKENS + 1 ];
|
||||
|
||||
int last = 0;
|
||||
int len;
|
||||
int tlen = 0;
|
||||
size_t last = 0;
|
||||
size_t len;
|
||||
size_t tlen = 0;
|
||||
int lineno = 0;
|
||||
unsigned int index = 0;
|
||||
|
||||
|
@ -667,7 +668,7 @@ __error:
|
|||
|
||||
int Configurator::ParseLine( char *line, char *section, char *key, char *value )
|
||||
{
|
||||
int len;
|
||||
size_t len;
|
||||
int result;
|
||||
|
||||
len = strlen( line );
|
||||
|
@ -873,7 +874,7 @@ void Configurator::SetWrite( bool bWrite )
|
|||
void Configurator::Parse( const char *filename )
|
||||
{
|
||||
FILE *file;
|
||||
int size;
|
||||
size_t size;
|
||||
char *buffer;
|
||||
|
||||
m_bNoWrite = false;
|
||||
|
@ -907,7 +908,8 @@ void Configurator::Close( void )
|
|||
{
|
||||
FILE *file;
|
||||
char *buffer;
|
||||
int i, size;
|
||||
int i;
|
||||
size_t size;
|
||||
|
||||
if( !m_filename.length() || !m_bNeedWrite )
|
||||
{
|
||||
|
|
|
@ -65,16 +65,16 @@ private:
|
|||
Container< configSection_t * > m_reverseSections;
|
||||
|
||||
private:
|
||||
int GetLine( char *dest, const char *data, int size );
|
||||
size_t GetLine( char *dest, const char *data, size_t size );
|
||||
str GetValue( const char *section, const char *key, str defaultValue, int index = -1 );
|
||||
configKey_t *GetKey( const char *section, const char *key, int index = -1 );
|
||||
|
||||
int CutLine( char *data );
|
||||
bool SetupLine( char *line, int& lineno, int& len, int& last );
|
||||
bool FindData( int type, const char *section, const char *key, int *offset, const char *data, int size );
|
||||
void ParseData( const char *data, int size );
|
||||
void WriteData( char **data, int *size );
|
||||
void WriteData2( char **data, int *size );
|
||||
bool SetupLine( char *line, int& lineno, size_t& len, size_t& last );
|
||||
bool FindData( int type, const char *section, const char *key, size_t *offset, const char *data, size_t size );
|
||||
void ParseData( const char *data, size_t size );
|
||||
void WriteData( char **data, size_t *size );
|
||||
void WriteData2( char **data, size_t *size );
|
||||
int ParseLine( char *line, char *section, char *key, char *value );
|
||||
|
||||
configSection_t *CreateSection( const char *section );
|
||||
|
|
|
@ -63,7 +63,7 @@ cLocalization::cLocalization()
|
|||
int iFileCount;
|
||||
char **ppszFiles;
|
||||
char szFilename[ MAX_QPATH ];
|
||||
int iBasePos;
|
||||
size_t iBasePos;
|
||||
|
||||
ppszFiles = FS_ListFilteredFiles( "global", "txt", "localization*.txt", qfalse, &iFileCount );
|
||||
strcpy( szFilename, "global/" );
|
||||
|
@ -92,8 +92,8 @@ void cLocalization::LoadFile( const char *name )
|
|||
const char *token;
|
||||
loc_entry_t new_entry;
|
||||
const char *p, *p2;
|
||||
int rl;
|
||||
int ll;
|
||||
size_t rl;
|
||||
size_t ll;
|
||||
|
||||
Com_Printf( "Loading Localization File %s\n", name );
|
||||
|
||||
|
@ -215,7 +215,7 @@ void cLocalization::LoadFile( const char *name )
|
|||
Com_Printf( "Loaded %d localization entries\n", m_entries.NumObjects() );
|
||||
}
|
||||
|
||||
static int bjb_strnscmp( const char *a, const char *b, int n )
|
||||
static int bjb_strnscmp( const char *a, const char *b, size_t n )
|
||||
{
|
||||
while( 1 )
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ static int bjb_strnscmp( const char *a, const char *b, int n )
|
|||
return *a - *b;
|
||||
}
|
||||
|
||||
static void bjb_rebreak( const char *var, char *buf, int max )
|
||||
static void bjb_rebreak( const char *var, char *buf, size_t max )
|
||||
{
|
||||
const char *nl;
|
||||
char *rb, *rb1, *rb2;
|
||||
|
@ -305,15 +305,16 @@ _new_line_set:
|
|||
|
||||
const char *cLocalization::ConvertString( const char *var )
|
||||
{
|
||||
int i, l, m, n, o;
|
||||
int nArg1;
|
||||
size_t l;
|
||||
intptr_t i, m, n, o;
|
||||
intptr_t nArg1;
|
||||
const char *pArg1, *pArg2;
|
||||
const char *pRef;
|
||||
const char *pVar;
|
||||
const char *pAfter;
|
||||
const char *pSrc;
|
||||
int nAfter, nBefore;
|
||||
int n1, n2;
|
||||
intptr_t nAfter, nBefore;
|
||||
intptr_t n1, n2;
|
||||
loc_entry_t *entry;
|
||||
str s1, s2;
|
||||
|
||||
|
|
|
@ -33,14 +33,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include <container.h>
|
||||
|
||||
typedef struct {
|
||||
str m_refName;
|
||||
str m_locName;
|
||||
int m_r1_rep;
|
||||
int m_r2_rep;
|
||||
int m_r3_rep;
|
||||
int m_l1_rep;
|
||||
int m_l2_rep;
|
||||
int m_l3_rep;
|
||||
str m_refName;
|
||||
str m_locName;
|
||||
intptr_t m_r1_rep;
|
||||
intptr_t m_r2_rep;
|
||||
intptr_t m_r3_rep;
|
||||
intptr_t m_l1_rep;
|
||||
intptr_t m_l2_rep;
|
||||
intptr_t m_l3_rep;
|
||||
} loc_entry_t;
|
||||
|
||||
class cLocalization {
|
||||
|
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define __MEM_BLOCKALLOC_H__
|
||||
|
||||
#include <linklist.h>
|
||||
#include "dbgheap.h"
|
||||
|
||||
#define MEM_BLOCKSIZE char[ 256 ]
|
||||
|
||||
|
@ -38,12 +39,16 @@ class MEM_BlockAlloc_enum;
|
|||
template< typename aclass, typename blocksize >
|
||||
class block_s {
|
||||
public:
|
||||
#ifndef _DEBUG_MEMBLOCK
|
||||
unsigned char data[ sizeof( blocksize ) ][ sizeof( aclass ) + 8 ];
|
||||
unsigned char prev_data[ sizeof( blocksize ) ];
|
||||
unsigned char next_data[ sizeof( blocksize ) ];
|
||||
|
||||
short int free_data;
|
||||
short int used_data;
|
||||
#else
|
||||
unsigned char data[ sizeof( aclass ) ];
|
||||
#endif
|
||||
|
||||
block_s< aclass, blocksize > *prev_block;
|
||||
block_s< aclass, blocksize > *next_block;
|
||||
|
@ -53,6 +58,7 @@ template< typename aclass, typename blocksize >
|
|||
class MEM_BlockAlloc {
|
||||
friend class MEM_BlockAlloc_enum< aclass, blocksize >;
|
||||
|
||||
#ifndef _DEBUG_MEMBLOCK
|
||||
// Free block list [not usable], avoid slow down by using gi.Free
|
||||
block_s< aclass, blocksize > *m_FreeBlock;
|
||||
|
||||
|
@ -61,6 +67,10 @@ class MEM_BlockAlloc {
|
|||
|
||||
// Full block list [not usable], no space available for further memory allocation
|
||||
block_s< aclass, blocksize > *m_StartFullBlock;
|
||||
#else
|
||||
block_s< aclass, blocksize > *m_Block;
|
||||
#endif
|
||||
|
||||
unsigned int m_BlockCount;
|
||||
|
||||
private:
|
||||
|
@ -82,8 +92,10 @@ class MEM_BlockAlloc_enum {
|
|||
protected:
|
||||
MEM_BlockAlloc< aclass, blocksize > *m_Owner;
|
||||
block_s< aclass, blocksize > *m_CurrentBlock;
|
||||
#ifndef _DEBUG_MEMBLOCK
|
||||
unsigned char m_CurrentData;
|
||||
int m_CurrentBlockType;
|
||||
#endif
|
||||
|
||||
public:
|
||||
MEM_BlockAlloc_enum( MEM_BlockAlloc< aclass, blocksize >& owner );
|
||||
|
@ -95,27 +107,42 @@ public:
|
|||
template< typename a, typename b >
|
||||
MEM_BlockAlloc< a, b >::MEM_BlockAlloc( void )
|
||||
{
|
||||
#ifndef _DEBUG_MEMBLOCK
|
||||
m_FreeBlock = NULL;
|
||||
m_StartUsedBlock = NULL;
|
||||
m_StartFullBlock = NULL;
|
||||
m_BlockCount = 0;
|
||||
#else
|
||||
m_Block = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename a, typename b >
|
||||
void *MEM_BlockAlloc< a, b >::Alloc( void )
|
||||
{
|
||||
#ifdef _DEBUG_MEMBLOCK
|
||||
block_s<a, b> *block = ( block_s<a, b> * )malloc( sizeof( block_s <a, b> ) );
|
||||
|
||||
LL_SafeAddFirst( m_Block, block, next_block, prev_block );
|
||||
|
||||
m_BlockCount++;
|
||||
return ( void * )block->data;
|
||||
#else
|
||||
unsigned char i;
|
||||
block_s< a, b > *block;
|
||||
unsigned char free_data;
|
||||
block_s< a, b > *used_block;
|
||||
short int free_data;
|
||||
short int used_data;
|
||||
unsigned char prev_data;
|
||||
unsigned char next_data;
|
||||
|
||||
block = m_StartUsedBlock;
|
||||
|
||||
if( block )
|
||||
{
|
||||
free_data = block->free_data;
|
||||
next_data = block->next_data[ free_data ];
|
||||
used_block = m_StartUsedBlock;
|
||||
|
||||
free_data = used_block->free_data;
|
||||
next_data = used_block->next_data[ free_data ];
|
||||
|
||||
if( next_data == free_data )
|
||||
{
|
||||
|
@ -123,9 +150,9 @@ void *MEM_BlockAlloc< a, b >::Alloc( void )
|
|||
m_StartUsedBlock = block->next_block;
|
||||
|
||||
LL_SafeRemove( block, next_block, prev_block );
|
||||
LL_SafeAddFirst( m_StartFullBlock, block, next_block, prev_block );
|
||||
LL_SafeAddFirst( m_StartFullBlock, used_block, next_block, prev_block );
|
||||
|
||||
block->free_data = -1;
|
||||
used_block->free_data = -1;
|
||||
|
||||
goto _ret;
|
||||
}
|
||||
|
@ -133,76 +160,93 @@ void *MEM_BlockAlloc< a, b >::Alloc( void )
|
|||
else
|
||||
{
|
||||
block = m_FreeBlock;
|
||||
|
||||
if( block )
|
||||
{
|
||||
m_FreeBlock = NULL;
|
||||
used_block = block;
|
||||
free_data = block->free_data;
|
||||
next_data = block->next_data[ free_data ];
|
||||
}
|
||||
else
|
||||
{
|
||||
m_BlockCount++;
|
||||
i = -1;
|
||||
block = ( block_s< a, b > * )MEM_Alloc( sizeof( block_s< a, b > ) );
|
||||
used_block = ( block_s< a, b > * )MEM_Alloc( sizeof( block_s< a, b > ) );
|
||||
|
||||
for( i = -1; i; i-- )
|
||||
for( i = sizeof( b ) - 1; i; i-- )
|
||||
{
|
||||
block->data[ i - 1 ][ 0 ] = -82;
|
||||
block->data[ i - 1 ][ 1 ] = i - 1;
|
||||
*( short * )( &block->data[ i - 1 ][ 2 ] ) = sizeof( a );
|
||||
block->prev_data[ i ] = i;
|
||||
block->next_data[ i - 1 ] = i + 1;
|
||||
unsigned char prev = i - 1;
|
||||
unsigned char next = prev + 1;
|
||||
used_block->data[ prev ][ 0 ] = -82;
|
||||
used_block->data[ prev ][ 1 ] = prev;
|
||||
*( short * )( &used_block->data[ prev ][ 2 ] ) = sizeof( a );
|
||||
used_block->prev_data[ next ] = prev;
|
||||
used_block->next_data[ prev ] = next;
|
||||
}
|
||||
|
||||
block->data[ sizeof( b ) - 1 ][ 0 ] = -82;
|
||||
block->data[ sizeof( b ) - 1 ][ 1 ] = -1;
|
||||
*( short * )( &block->data[ sizeof( b ) - 1 ][ 2 ] ) = sizeof( a );
|
||||
block->prev_data[ 0 ] = -1;
|
||||
block->next_data[ sizeof( b ) - 1 ] = 0;
|
||||
block->free_data = 0;
|
||||
block->used_data = -1;
|
||||
used_block->data[ sizeof( b ) - 1 ][ 0 ] = -82;
|
||||
used_block->data[ sizeof( b ) - 1 ][ 1 ] = -1;
|
||||
*( short * )( &used_block->data[ sizeof( b ) - 1 ][ 2 ] ) = sizeof( a );
|
||||
used_block->prev_data[ 0 ] = -1;
|
||||
used_block->next_data[ sizeof( b ) - 1 ] = 0;
|
||||
used_block->free_data = 0;
|
||||
used_block->used_data = -1;
|
||||
|
||||
free_data = 0;
|
||||
next_data = 1;
|
||||
}
|
||||
|
||||
LL_SafeAddFirst( m_StartUsedBlock, block, next_block, prev_block );
|
||||
LL_SafeAddFirst( m_StartUsedBlock, used_block, next_block, prev_block );
|
||||
}
|
||||
|
||||
prev_data = block->prev_data[ free_data ];
|
||||
block->next_data[ prev_data ] = next_data;
|
||||
block->prev_data[ next_data ] = prev_data;
|
||||
block->free_data = next_data;
|
||||
prev_data = used_block->prev_data[ free_data ];
|
||||
used_block->next_data[ prev_data ] = next_data;
|
||||
used_block->prev_data[ next_data ] = prev_data;
|
||||
used_block->free_data = next_data;
|
||||
|
||||
if( block->used_data < 0 )
|
||||
if( used_block->used_data < 0 )
|
||||
{
|
||||
block->used_data = free_data;
|
||||
block->next_data[ free_data ] = free_data;
|
||||
block->prev_data[ free_data ] = free_data;
|
||||
return ( void * )&block->data[ free_data ][ 8 ];
|
||||
used_block->used_data = free_data;
|
||||
used_block->next_data[ free_data ] = free_data;
|
||||
used_block->prev_data[ free_data ] = free_data;
|
||||
return ( void * )&used_block->data[ free_data ][ 8 ];
|
||||
}
|
||||
|
||||
_ret:
|
||||
next_data = block->used_data;
|
||||
prev_data = block->prev_data[ next_data ];
|
||||
block->prev_data[ next_data ] = free_data;
|
||||
block->next_data[ prev_data ] = free_data;
|
||||
block->prev_data[ free_data ] = prev_data;
|
||||
block->next_data[ free_data ] = next_data;
|
||||
return ( void * )&block->data[ free_data ][ 8 ];
|
||||
used_data = used_block->used_data;
|
||||
prev_data = used_block->prev_data[ used_data ];
|
||||
used_block->prev_data[ used_data ] = free_data;
|
||||
used_block->next_data[ prev_data ] = free_data;
|
||||
used_block->prev_data[ free_data ] = prev_data;
|
||||
used_block->next_data[ free_data ] = used_data;
|
||||
return ( void * )&used_block->data[ free_data ][ 8 ];
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename a, typename b >
|
||||
void MEM_BlockAlloc< a, b >::Free( void *ptr )
|
||||
{
|
||||
#ifdef _DEBUG_MEMBLOCK
|
||||
block_s<a, b> *block = ( block_s<a, b> * )ptr;
|
||||
|
||||
assert( m_Block );
|
||||
LL_SafeRemove( block, next_block, prev_block );
|
||||
|
||||
if( m_Block == block )
|
||||
{
|
||||
m_Block = block->next_block;
|
||||
}
|
||||
|
||||
m_BlockCount--;
|
||||
free( block );
|
||||
#else
|
||||
block_s< a, b > *block;
|
||||
unsigned char used_data;
|
||||
//unsigned char prev_data;
|
||||
short int free_data;
|
||||
short int used_data;
|
||||
unsigned char prev_data;
|
||||
unsigned char next_data;
|
||||
|
||||
used_data = ( ( char * )ptr )[ -7 ];
|
||||
block = ( block_s< a, b > * )( ( char * )ptr - ( used_data * ( ( ( char * )ptr )[ -6 ] + 8 ) ) - 8 );
|
||||
used_data = *( ( unsigned char * )ptr - 7 );
|
||||
block = ( block_s< a, b > * )( ( unsigned char * )ptr + -( used_data * ( *( ( unsigned short * )ptr - 3 ) + 8 ) ) - 8 );
|
||||
next_data = block->next_data[ used_data ];
|
||||
if( next_data == used_data )
|
||||
{
|
||||
|
@ -223,24 +267,32 @@ void MEM_BlockAlloc< a, b >::Free( void *ptr )
|
|||
m_FreeBlock = block;
|
||||
block->used_data = -1;
|
||||
|
||||
block->next_data[ used_data ] = block->free_data;
|
||||
block->prev_data[ used_data ] = block->prev_data[ block->free_data ];
|
||||
block->next_data[ block->prev_data[ block->free_data ] ] = used_data;
|
||||
block->prev_data[ block->free_data ] = used_data;
|
||||
free_data = block->free_data;
|
||||
prev_data = block->prev_data[ free_data ];
|
||||
|
||||
block->next_data[ prev_data ] = used_data;
|
||||
block->prev_data[ free_data ] = used_data;
|
||||
block->next_data[ used_data ] = free_data;
|
||||
block->prev_data[ used_data ] = prev_data;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
block->next_data[ block->prev_data[ used_data ] ] = next_data;
|
||||
block->prev_data[ next_data ] = block->prev_data[ used_data ];
|
||||
prev_data = block->prev_data[ used_data ];
|
||||
|
||||
block->next_data[ prev_data ] = next_data;
|
||||
block->prev_data[ next_data ] = prev_data;
|
||||
block->used_data = next_data;
|
||||
|
||||
if( block->free_data >= 0 )
|
||||
{
|
||||
block->next_data[ used_data ] = block->free_data;
|
||||
block->prev_data[ used_data ] = block->prev_data[ block->free_data ];
|
||||
block->next_data[ block->prev_data[ block->free_data ] ] = used_data;
|
||||
block->prev_data[ block->free_data ] = used_data;
|
||||
free_data = block->free_data;
|
||||
prev_data = block->prev_data[ free_data ];
|
||||
|
||||
block->next_data[ prev_data ] = used_data;
|
||||
block->prev_data[ free_data ] = used_data;
|
||||
block->next_data[ used_data ] = free_data;
|
||||
block->prev_data[ used_data ] = prev_data;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -255,11 +307,25 @@ void MEM_BlockAlloc< a, b >::Free( void *ptr )
|
|||
block->prev_data[ used_data ] = used_data;
|
||||
block->next_data[ used_data ] = used_data;
|
||||
block->free_data = used_data;
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename a, typename b >
|
||||
void MEM_BlockAlloc< a, b >::FreeAll( void )
|
||||
{
|
||||
#ifdef _DEBUG_MEMBLOCK
|
||||
block_s<a, b> *block;
|
||||
block_s<a, b> *next = m_Block;
|
||||
for( block = m_Block; next != NULL; block = next )
|
||||
{
|
||||
next = block->next_block;
|
||||
m_BlockCount--;
|
||||
a *ptr = ( a * )block->data;
|
||||
ptr->~a();
|
||||
free( block );
|
||||
}
|
||||
m_Block = NULL;
|
||||
#else
|
||||
block_s< a, b > *block;
|
||||
|
||||
block = m_StartFullBlock;
|
||||
|
@ -290,12 +356,20 @@ void MEM_BlockAlloc< a, b >::FreeAll( void )
|
|||
MEM_Free( m_FreeBlock );
|
||||
m_FreeBlock = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename a, typename b >
|
||||
unsigned int MEM_BlockAlloc< a, b >::Count( block_s< a, b > *block )
|
||||
{
|
||||
int count = 0;
|
||||
#ifdef _DEBUG_MEMBLOCK
|
||||
for( ; block != NULL; block = block->next_block )
|
||||
{
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
#else
|
||||
unsigned char used_data;
|
||||
unsigned char current_used_data;
|
||||
|
||||
|
@ -318,12 +392,17 @@ unsigned int MEM_BlockAlloc< a, b >::Count( block_s< a, b > *block )
|
|||
}
|
||||
|
||||
return count;
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename a, typename b >
|
||||
unsigned int MEM_BlockAlloc< a, b >::Count( void )
|
||||
{
|
||||
#ifdef _DEBUG_MEMBLOCK
|
||||
return Count( m_Block );
|
||||
#else
|
||||
return Count( m_StartFullBlock ) + Count( m_StartUsedBlock );
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename a, typename b >
|
||||
|
@ -344,12 +423,25 @@ MEM_BlockAlloc_enum< a, b >::MEM_BlockAlloc_enum( MEM_BlockAlloc< a, b >& owner
|
|||
{
|
||||
m_Owner = &owner;
|
||||
m_CurrentBlock = NULL;
|
||||
#ifndef _DEBUG_MEMBLOCK
|
||||
m_CurrentBlockType = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename a, typename b >
|
||||
a *MEM_BlockAlloc_enum< a, b >::NextElement( void )
|
||||
{
|
||||
#ifdef _DEBUG_MEMBLOCK
|
||||
if( !m_CurrentBlock )
|
||||
{
|
||||
m_CurrentBlock = m_Owner->m_Block;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CurrentBlock = m_CurrentBlock->next_block;
|
||||
}
|
||||
return ( a * )m_CurrentBlock;
|
||||
#else
|
||||
block_s< a, b > *block;
|
||||
block_s< a, b > *next;
|
||||
|
||||
|
@ -406,6 +498,7 @@ a *MEM_BlockAlloc_enum< a, b >::NextElement( void )
|
|||
}
|
||||
|
||||
return ( a * )&block->data[ m_CurrentData ][ 8 ];
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename a, typename b >
|
||||
|
|
|
@ -97,7 +97,7 @@ void Z_Free( void *ptr )
|
|||
}
|
||||
|
||||
// check the memory trash tester
|
||||
if( *( int * )( ( byte * )block + block->size - 4 ) != ZONEID ) {
|
||||
if( *( int * )( ( byte * )block + block->size - sizeof( int ) ) != ZONEID ) {
|
||||
Com_Error( ERR_FATAL, "Z_Free: memory block wrote past end" );
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ void *Z_TagMalloc( size_t size, int tag )
|
|||
}
|
||||
|
||||
size += sizeof( memblock_t ); // account for size of block header
|
||||
size += 4; // space for memory trash tester
|
||||
size += sizeof( int ); // space for memory trash tester
|
||||
size = PAD( size, sizeof( intptr_t ) ); // align to 32/64 bit boundary
|
||||
|
||||
block = ( memblock_t * )malloc( size );
|
||||
|
@ -167,7 +167,7 @@ void *Z_TagMalloc( size_t size, int tag )
|
|||
mem_blocks[ tag ].prev = block;
|
||||
|
||||
// marker for memory trash testing
|
||||
*( int * )( ( byte * )block + block->size - 4 ) = ZONEID;
|
||||
*( int * )( ( byte * )block + block->size - sizeof( int ) ) = ZONEID;
|
||||
|
||||
return ( void * )( ( byte * )block + sizeof( memblock_t ) );
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ Z_InitMemory
|
|||
void Z_InitMemory( void ) {
|
||||
int k;
|
||||
|
||||
memset( &mem_blocks, 0, 0x100 );
|
||||
memset( &mem_blocks, 0, sizeof( mem_blocks ) );
|
||||
|
||||
for( k = 0; k < 16; k++ )
|
||||
{
|
||||
|
|
|
@ -1374,20 +1374,26 @@ void MSG_WriteSounds (msg_t *msg, server_sound_t *sounds, int snapshot_number_of
|
|||
MSG_WriteBits( msg, sounds[i].channel, 7 );
|
||||
MSG_WriteBits( msg, sounds[i].sound_index, 9 );
|
||||
|
||||
if ( -1.0f >= sounds[i].volume ){ //volume ranges from -1.0 to -infty??
|
||||
if( sounds[ i ].volume != -1.0f ) {
|
||||
MSG_WriteBits( msg, 1, 1 );
|
||||
MSG_WriteFloat( msg, sounds[i].volume );
|
||||
} else MSG_WriteBits( msg, 0, 1 );
|
||||
} else {
|
||||
MSG_WriteBits( msg, 0, 1 );
|
||||
}
|
||||
|
||||
if ( -1.0f >= sounds[i].min_dist ){
|
||||
if ( sounds[i].min_dist != -1.0f ){
|
||||
MSG_WriteBits( msg, 1, 1 );
|
||||
MSG_WriteFloat( msg, sounds[i].min_dist );
|
||||
} else MSG_WriteBits( msg, 0, 1 );
|
||||
} else {
|
||||
MSG_WriteBits( msg, 0, 1 );
|
||||
}
|
||||
|
||||
if ( -1.0f >= sounds[i].pitch ){
|
||||
if ( sounds[i].pitch != -1.0f ){
|
||||
MSG_WriteBits( msg, 1, 1 );
|
||||
MSG_WriteFloat( msg, sounds[i].min_dist );
|
||||
} else MSG_WriteBits( msg, 0, 1 );
|
||||
MSG_WriteFloat( msg, sounds[i].pitch );
|
||||
} else {
|
||||
MSG_WriteBits( msg, 0, 1 );
|
||||
}
|
||||
|
||||
MSG_WriteFloat( msg, sounds[i].maxDist );
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ Send one fragment of the current message
|
|||
void Netchan_TransmitNextFragment( netchan_t *chan ) {
|
||||
msg_t send;
|
||||
byte send_buf[MAX_PACKETLEN];
|
||||
int fragmentLength;
|
||||
size_t fragmentLength;
|
||||
|
||||
// write the packet header
|
||||
MSG_InitOOB (&send, send_buf, sizeof(send_buf)); // <-- only do the oob here
|
||||
|
@ -207,8 +207,8 @@ void Netchan_TransmitNextFragment( netchan_t *chan ) {
|
|||
fragmentLength = chan->unsentLength - chan->unsentFragmentStart;
|
||||
}
|
||||
|
||||
MSG_WriteLong( &send, chan->unsentFragmentStart );
|
||||
MSG_WriteShort( &send, fragmentLength );
|
||||
MSG_WriteLong( &send, (int)chan->unsentFragmentStart );
|
||||
MSG_WriteShort( &send, (short)fragmentLength );
|
||||
MSG_WriteData( &send, chan->unsentBuffer + chan->unsentFragmentStart, fragmentLength );
|
||||
|
||||
// send the datagram
|
||||
|
@ -243,7 +243,7 @@ Sends a message to a connection, fragmenting if necessary
|
|||
A 0 length will still generate a packet.
|
||||
================
|
||||
*/
|
||||
void Netchan_Transmit( netchan_t *chan, int length, const byte *data ) {
|
||||
void Netchan_Transmit( netchan_t *chan, size_t length, const byte *data ) {
|
||||
msg_t send;
|
||||
byte send_buf[MAX_PACKETLEN];
|
||||
|
||||
|
@ -543,7 +543,7 @@ LOOPBACK BUFFERS FOR LOCAL PLAYER
|
|||
|
||||
typedef struct {
|
||||
byte data[MAX_PACKETLEN];
|
||||
int datalen;
|
||||
size_t datalen;
|
||||
} loopmsg_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -579,7 +579,7 @@ qboolean NET_GetLoopPacket (netsrc_t sock, netadr_t *net_from, msg_t *net_messag
|
|||
}
|
||||
|
||||
|
||||
void NET_SendLoopPacket (netsrc_t sock, int length, const void *data, netadr_t to)
|
||||
void NET_SendLoopPacket (netsrc_t sock, size_t length, const void *data, netadr_t to)
|
||||
{
|
||||
int i;
|
||||
loopback_t *loop;
|
||||
|
@ -597,7 +597,7 @@ void NET_SendLoopPacket (netsrc_t sock, int length, const void *data, netadr_t t
|
|||
|
||||
typedef struct packetQueue_s {
|
||||
struct packetQueue_s *next;
|
||||
int length;
|
||||
size_t length;
|
||||
byte *data;
|
||||
netadr_t to;
|
||||
int release;
|
||||
|
@ -605,7 +605,7 @@ typedef struct packetQueue_s {
|
|||
|
||||
packetQueue_t *packetQueue = NULL;
|
||||
|
||||
static void NET_QueuePacket( int length, const void *data, netadr_t to,
|
||||
static void NET_QueuePacket( size_t length, const void *data, netadr_t to,
|
||||
int offset )
|
||||
{
|
||||
packetQueue_t *new, *next = packetQueue;
|
||||
|
@ -652,7 +652,7 @@ void NET_FlushPacketQueue(void)
|
|||
}
|
||||
}
|
||||
|
||||
void NET_SendPacket( netsrc_t sock, int length, const void *data, netadr_t to ) {
|
||||
void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to ) {
|
||||
|
||||
// sequenced packets are shown in netchan, so just show oob
|
||||
if ( showpackets->integer && *(int *)data == -1 ) {
|
||||
|
|
|
@ -330,8 +330,8 @@ unsigned char *gsseckey(
|
|||
y,
|
||||
num,
|
||||
num2,
|
||||
size,
|
||||
keysz;
|
||||
size;
|
||||
size_t keysz;
|
||||
unsigned char enctmp[256],
|
||||
*p;
|
||||
const static unsigned char enctype1_data[256] = /* pre-built */
|
||||
|
@ -486,7 +486,7 @@ qboolean NETGS_SendMasterRequest( void ) {
|
|||
gsseckey( encodedstring, string2encode, GS_MOHAAKEY, 0 );
|
||||
|
||||
Q_snprintf( requestString, sizeof(requestString), "\\gamename\\%s\\gamever\\%s\\location\\0\\validate\\%s\\final\\\\queryid\\1.1\\", GS_GAMENAME, GS_GAMEVER, encodedstring );
|
||||
if (send(tcpsock, requestString, strlen(requestString), 0) == -1 ) {
|
||||
if (send(tcpsock, requestString, (int)strlen(requestString), 0) == -1 ) {
|
||||
close( tcpsock );
|
||||
return qfalse;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ qboolean NETGS_SendMasterRequest( void ) {
|
|||
// see "\\where\\"
|
||||
// PS: I really wonder what "cmp" stands for. "groups" and "info2" may also be used. i have no idea!
|
||||
Q_snprintf( requestString, sizeof(requestString), "\\list\\%s\\gamename\\%s\\final\\", "cmp", GS_GAMENAME );
|
||||
if (send(tcpsock, requestString, strlen(requestString), 0) == -1 ) {
|
||||
if (send(tcpsock, requestString, (int)strlen(requestString), 0) == -1 ) {
|
||||
close( tcpsock );
|
||||
return qfalse;
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message ) {
|
|||
#ifdef _DEBUG
|
||||
recvfromCount++; // performance check
|
||||
#endif
|
||||
ret = recvfrom( ip_socket, net_message->data, net_message->maxsize, 0, (struct sockaddr *)&from, &fromlen );
|
||||
ret = recvfrom( ip_socket, net_message->data, (int)net_message->maxsize, 0, (struct sockaddr *)&from, &fromlen );
|
||||
if (ret == SOCKET_ERROR)
|
||||
{
|
||||
err = socketError;
|
||||
|
@ -632,7 +632,7 @@ static char socksBuf[4096];
|
|||
Sys_SendPacket
|
||||
==================
|
||||
*/
|
||||
void Sys_SendPacket( int length, const void *data, netadr_t to ) {
|
||||
void Sys_SendPacket( size_t length, const void *data, netadr_t to ) {
|
||||
int ret;
|
||||
struct sockaddr addr;
|
||||
|
||||
|
@ -655,10 +655,10 @@ void Sys_SendPacket( int length, const void *data, netadr_t to ) {
|
|||
*(int *)&socksBuf[4] = ((struct sockaddr_in *)&addr)->sin_addr.s_addr;
|
||||
*(short *)&socksBuf[8] = ((struct sockaddr_in *)&addr)->sin_port;
|
||||
memcpy( &socksBuf[10], data, length );
|
||||
ret = sendto( ip_socket, socksBuf, length+10, 0, &socksRelayAddr, sizeof(socksRelayAddr) );
|
||||
ret = sendto( ip_socket, socksBuf, (int)(length+10), 0, &socksRelayAddr, sizeof(socksRelayAddr) );
|
||||
}
|
||||
else {
|
||||
ret = sendto( ip_socket, data, length, 0, &addr, sizeof(addr) );
|
||||
ret = sendto( ip_socket, data, (int)length, 0, &addr, sizeof(addr) );
|
||||
}
|
||||
if( ret == SOCKET_ERROR ) {
|
||||
int err = socketError;
|
||||
|
@ -923,25 +923,25 @@ void NET_OpenSocks( int port ) {
|
|||
|
||||
// do username/password authentication if needed
|
||||
if ( buf[1] == 2 ) {
|
||||
int ulen;
|
||||
int plen;
|
||||
size_t ulen;
|
||||
size_t plen;
|
||||
|
||||
// build the request
|
||||
ulen = strlen( net_socksUsername->string );
|
||||
plen = strlen( net_socksPassword->string );
|
||||
|
||||
buf[0] = 1; // username/password authentication version
|
||||
buf[1] = ulen;
|
||||
buf[1] = (unsigned char)ulen;
|
||||
if ( ulen ) {
|
||||
memcpy( &buf[2], net_socksUsername->string, ulen );
|
||||
}
|
||||
buf[2 + ulen] = plen;
|
||||
buf[2 + ulen] = (unsigned char)plen;
|
||||
if ( plen ) {
|
||||
memcpy( &buf[3 + ulen], net_socksPassword->string, plen );
|
||||
}
|
||||
|
||||
// send it
|
||||
if ( send( socks_socket, buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) {
|
||||
if ( send( socks_socket, buf, (int)(3 + ulen + plen), 0 ) == SOCKET_ERROR ) {
|
||||
err = socketError;
|
||||
Com_Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() );
|
||||
return;
|
||||
|
|
|
@ -163,9 +163,9 @@ float Com_Clamp( float min, float max, float value ) {
|
|||
COM_SkipPath
|
||||
============
|
||||
*/
|
||||
char *COM_SkipPath (const char *pathname)
|
||||
const char *COM_SkipPath (const char *pathname)
|
||||
{
|
||||
char *last;
|
||||
const char *last;
|
||||
|
||||
last = pathname;
|
||||
while (*pathname)
|
||||
|
|
|
@ -1067,7 +1067,7 @@ unsigned long long rdtsc( void );
|
|||
|
||||
float Com_Clamp( float min, float max, float value );
|
||||
|
||||
char *COM_SkipPath( const char *pathname );
|
||||
const char *COM_SkipPath( const char *pathname );
|
||||
const char *COM_GetExtension( const char *name );
|
||||
void COM_StripExtension(const char *in, char *out, int destsize);
|
||||
void COM_DefaultExtension( char *path, int maxSize, const char *extension );
|
||||
|
|
|
@ -190,7 +190,7 @@ void NET_Shutdown( void );
|
|||
void NET_Restart( void );
|
||||
void NET_Config( qboolean enableNetworking );
|
||||
void NET_FlushPacketQueue(void);
|
||||
void NET_SendPacket (netsrc_t sock, int length, const void *data, netadr_t to);
|
||||
void NET_SendPacket (netsrc_t sock, size_t length, const void *data, netadr_t to);
|
||||
void QDECL NET_OutOfBandPrint( netsrc_t net_socket, netadr_t adr, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
void QDECL NET_OutOfBandData( netsrc_t sock, netadr_t adr, byte *format, int len );
|
||||
|
||||
|
@ -234,15 +234,15 @@ typedef struct {
|
|||
// outgoing fragment buffer
|
||||
// we need to space out the sending of large fragmented messages
|
||||
qboolean unsentFragments;
|
||||
int unsentFragmentStart;
|
||||
int unsentLength;
|
||||
size_t unsentFragmentStart;
|
||||
size_t unsentLength;
|
||||
byte unsentBuffer[MAX_MSGLEN];
|
||||
} netchan_t;
|
||||
|
||||
void Netchan_Init( int qport );
|
||||
void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport );
|
||||
|
||||
void Netchan_Transmit( netchan_t *chan, int length, const byte *data );
|
||||
void Netchan_Transmit( netchan_t *chan, size_t length, const byte *data );
|
||||
void Netchan_TransmitNextFragment( netchan_t *chan );
|
||||
|
||||
qboolean Netchan_Process( netchan_t *chan, msg_t *msg );
|
||||
|
@ -1361,7 +1361,7 @@ cpuFeatures_t Sys_GetProcessorFeatures( void );
|
|||
|
||||
void Sys_SetErrorText( const char *text );
|
||||
|
||||
void Sys_SendPacket( int length, const void *data, netadr_t to );
|
||||
void Sys_SendPacket( size_t length, const void *data, netadr_t to );
|
||||
qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message );
|
||||
|
||||
qboolean Sys_StringToAdr( const char *s, netadr_t *a );
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef struct {
|
|||
// order, otherwise the delta compression will fail
|
||||
int messageSent; // time the message was transmitted
|
||||
int messageAcked; // time the message was acked
|
||||
int messageSize; // used to rate drop packets
|
||||
size_t messageSize; // used to rate drop packets
|
||||
} clientSnapshot_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -147,13 +147,13 @@ typedef struct client_s {
|
|||
// downloading
|
||||
char downloadName[MAX_QPATH]; // if not empty string, we are downloading
|
||||
fileHandle_t download; // file being downloaded
|
||||
int downloadSize; // total bytes (can't use EOF because of paks)
|
||||
int downloadCount; // bytes sent
|
||||
size_t downloadSize; // total bytes (can't use EOF because of paks)
|
||||
size_t downloadCount; // bytes sent
|
||||
int downloadClientBlock; // last block we sent to the client, awaiting ack
|
||||
int downloadCurrentBlock; // current block number
|
||||
int downloadXmitBlock; // last block we xmited
|
||||
unsigned char *downloadBlocks[MAX_DOWNLOAD_WINDOW]; // the buffers for the download blocks
|
||||
int downloadBlockSize[MAX_DOWNLOAD_WINDOW];
|
||||
size_t downloadBlockSize[MAX_DOWNLOAD_WINDOW];
|
||||
qboolean downloadEOF; // We have sent the EOF block
|
||||
int downloadSendTime; // time we last got an ack from the client
|
||||
|
||||
|
|
|
@ -511,7 +511,8 @@ SV_Status_f
|
|||
================
|
||||
*/
|
||||
static void SV_Status_f( void ) {
|
||||
int i, j, l;
|
||||
int i;
|
||||
size_t j, l;
|
||||
client_t *cl;
|
||||
playerState_t *ps;
|
||||
const char *s;
|
||||
|
|
|
@ -951,9 +951,9 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
|
|||
|
||||
// block zero is special, contains file size
|
||||
if ( cl->downloadXmitBlock == 0 )
|
||||
MSG_WriteLong( msg, cl->downloadSize );
|
||||
MSG_WriteLong( msg, (int)cl->downloadSize );
|
||||
|
||||
MSG_WriteShort( msg, cl->downloadBlockSize[curindex] );
|
||||
MSG_WriteShort( msg, ( short )cl->downloadBlockSize[curindex] );
|
||||
|
||||
// Write the block
|
||||
if ( cl->downloadBlockSize[curindex] ) {
|
||||
|
@ -1166,7 +1166,7 @@ void SV_UserinfoChanged( client_t *cl ) {
|
|||
char *val;
|
||||
char *ip;
|
||||
int i;
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
// name for C code
|
||||
Q_strncpyz( cl->name, Info_ValueForKey (cl->userinfo, "name"), sizeof(cl->name) );
|
||||
|
|
|
@ -278,8 +278,8 @@ void PF_MSG_WriteFloat (float f)
|
|||
void PF_MSG_WriteString (const char *s)
|
||||
{
|
||||
cgm_t *pCGM;
|
||||
int i,j;
|
||||
int l;
|
||||
int i;
|
||||
size_t j, l;
|
||||
l = strlen(s);
|
||||
l+=1; // include trailing zero
|
||||
pCGM = g_CGMessages;
|
||||
|
@ -1320,11 +1320,16 @@ void SV_AddGameCommand( const char *cmdName, xcommand_t function ) {
|
|||
SV_Malloc
|
||||
===============
|
||||
*/
|
||||
void *SV_Malloc( int size )
|
||||
void *SV_Malloc( size_t size )
|
||||
{
|
||||
return Z_TagMalloc( size, TAG_GAME );
|
||||
}
|
||||
|
||||
void SV_Free( void* ptr )
|
||||
{
|
||||
Z_Free( ptr );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
SV_ShutdownGameProgs
|
||||
|
@ -1506,7 +1511,7 @@ void SV_InitGameProgs( void ) {
|
|||
import.SetUserinfo = SV_SetUserinfo;
|
||||
|
||||
import.Malloc = SV_Malloc;
|
||||
import.Free = Z_Free;
|
||||
import.Free = SV_Free;
|
||||
|
||||
import.Cvar_Get = Cvar_Get;
|
||||
import.Cvar_Set = Cvar_Set;
|
||||
|
|
|
@ -72,7 +72,8 @@ SV_SetConfigstring
|
|||
===============
|
||||
*/
|
||||
void SV_SetConfigstring (int index, const char *val) {
|
||||
int len, i;
|
||||
int i;
|
||||
size_t len;
|
||||
client_t *client;
|
||||
|
||||
if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
|
||||
|
@ -259,13 +260,13 @@ given client
|
|||
static void SV_SendConfigstring(client_t *client, int index)
|
||||
{
|
||||
int maxChunkSize = MAX_STRING_CHARS - 24;
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
len = strlen(sv.configstrings[index]);
|
||||
|
||||
if( len >= maxChunkSize ) {
|
||||
int sent = 0;
|
||||
int remaining = len;
|
||||
size_t remaining = len;
|
||||
char *cmd;
|
||||
char buf[MAX_STRING_CHARS];
|
||||
|
||||
|
|
|
@ -331,8 +331,8 @@ void SVC_Status( netadr_t from ) {
|
|||
int i;
|
||||
client_t *cl;
|
||||
playerState_t *ps;
|
||||
int statusLength;
|
||||
int playerLength;
|
||||
size_t statusLength;
|
||||
size_t playerLength;
|
||||
char infostring[MAX_INFO_STRING];
|
||||
|
||||
// ignore if we are in single player
|
||||
|
|
|
@ -40,7 +40,7 @@ static int qconsole_history_oldest = 0;
|
|||
|
||||
// current edit buffer
|
||||
static char qconsole_line[ MAX_EDIT_LINE ];
|
||||
static int qconsole_linelen = 0;
|
||||
static size_t qconsole_linelen = 0;
|
||||
|
||||
static HANDLE qconsole_hout;
|
||||
static HANDLE qconsole_hin;
|
||||
|
@ -312,7 +312,7 @@ char *CON_Input( void )
|
|||
|
||||
if( key == VK_BACK )
|
||||
{
|
||||
int pos = ( qconsole_linelen > 0 ) ?
|
||||
size_t pos = ( qconsole_linelen > 0 ) ?
|
||||
qconsole_linelen - 1 : 0;
|
||||
|
||||
qconsole_line[ pos ] = '\0';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue