Low hanging fruit: bring the number of compiler warnings down from 264 to 33.

This commit is contained in:
jdolan 2013-05-03 02:57:29 -04:00
parent 043398589d
commit a269593afe
54 changed files with 175 additions and 160 deletions

View file

@ -57,7 +57,7 @@ const char* brushEntityList[] = {
// Construction/Destruction // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
DEntity::DEntity( char *classname, int ID ){ DEntity::DEntity( const char *classname, int ID ){
SetClassname( classname ); SetClassname( classname );
m_nID = ID; m_nID = ID;
QER_Entity = NULL; QER_Entity = NULL;
@ -469,7 +469,7 @@ int DEntity::GetIDMax( void ) {
return max + 1; return max + 1;
} }
void DEntity::SetClassname( char *classname ) { void DEntity::SetClassname( const char *classname ) {
m_Classname = classname; m_Classname = classname;
} }

View file

@ -41,7 +41,7 @@ entity_t* QER_Entity;
int m_nID; int m_nID;
// Constrcution/Destruction // Constrcution/Destruction
DEntity( char* classname = "worldspawn", int ID = -1 ); // sets classname DEntity( const char* classname = "worldspawn", int ID = -1 ); // sets classname
virtual ~DEntity(); virtual ~DEntity();
// --------------------------------------------- // ---------------------------------------------
@ -55,7 +55,7 @@ DEPair* FindEPairByKey( const char* keyname );
// random functions........ // random functions........
bool ResetTextures( const char* textureName, float fScale[2], float fShift[2], int rotation, const char* newTextureName, int bResetTextureName, int bResetScale[2], int bResetShift[2], int bResetRotation, bool rebuild ); bool ResetTextures( const char* textureName, float fScale[2], float fShift[2], int rotation, const char* newTextureName, int bResetTextureName, int bResetScale[2], int bResetShift[2], int bResetRotation, bool rebuild );
void SaveToFile( FILE* pFile ); void SaveToFile( FILE* pFile );
void SetClassname( char* classname ); void SetClassname( const char* classname );
int GetIDMax(); int GetIDMax();
void BuildInRadiant( bool allowDestruction ); void BuildInRadiant( bool allowDestruction );

View file

@ -38,7 +38,7 @@ DMap::~DMap(){
ClearEntities(); ClearEntities();
} }
DEntity* DMap::AddEntity( char *classname, int ID ){ DEntity* DMap::AddEntity( const char *classname, int ID ){
DEntity* newEntity; DEntity* newEntity;
if ( ID == -1 ) { if ( ID == -1 ) {
newEntity = new DEntity( classname, m_nNextEntity++ ); newEntity = new DEntity( classname, m_nNextEntity++ );

View file

@ -42,8 +42,8 @@ int m_nNextEntity;
DEntity* GetWorldSpawn(); DEntity* GetWorldSpawn();
void ClearEntities(); void ClearEntities();
DEntity* DMap::GetEntityForID( int ID ); DEntity* GetEntityForID( int ID );
DEntity* AddEntity( char* classname = "worldspawn", int ID = -1 ); DEntity* AddEntity( const char* classname = "worldspawn", int ID = -1 );
list<DEntity*> entityList; list<DEntity*> entityList;

View file

@ -109,7 +109,7 @@ static void dialog_button_callback_settex( GtkWidget *widget, gpointer data ){
Data validation Routines Data validation Routines
---------------------------------*/ ---------------------------------*/
bool ValidateTextFloat( const char* pData, char* error_title, float* value ){ bool ValidateTextFloat( const char* pData, const char* error_title, float* value ){
if ( pData ) { if ( pData ) {
float testNum = (float)atof( pData ); float testNum = (float)atof( pData );
@ -128,7 +128,7 @@ bool ValidateTextFloat( const char* pData, char* error_title, float* value ){
return FALSE; return FALSE;
} }
bool ValidateTextFloatRange( const char* pData, float min, float max, char* error_title, float* value ){ bool ValidateTextFloatRange( const char* pData, float min, float max, const char* error_title, float* value ){
char error_buffer[256]; char error_buffer[256];
sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max ); sprintf( error_buffer, "Please Enter A Floating Point Number Between %.3f and %.3f", min, max );
@ -172,7 +172,7 @@ bool ValidateTextIntRange( const char* pData, int min, int max, const char* erro
return FALSE; return FALSE;
} }
bool ValidateTextInt( const char* pData, char* error_title, int* value ){ bool ValidateTextInt( const char* pData, const char* error_title, int* value ){
if ( pData ) { if ( pData ) {
int testNum = atoi( pData ); int testNum = atoi( pData );
@ -588,7 +588,7 @@ int DoBuildStairsBox( BuildStairsRS* rs ){
loop = 1; loop = 1;
char *text = "Please set a value in the boxes below and press 'OK' to build the stairs"; const char *text = "Please set a value in the boxes below and press 'OK' to build the stairs";
window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); window = gtk_window_new( GTK_WINDOW_TOPLEVEL );

View file

@ -319,7 +319,7 @@ void Build_StairStep_Wedge( int dir, vec3_t min, vec3_t max, const char* mainTex
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// internal use only, to get a box without finishing construction // internal use only, to get a box without finishing construction
brush_t* Build_Get_BoundingCube_Selective( vec3_t min, vec3_t max, char* texture, bool* useFaces ){ brush_t* Build_Get_BoundingCube_Selective( vec3_t min, vec3_t max, const char* texture, bool* useFaces ){
brush_t* newBrush = (brush_t*)g_FuncTable.m_pfnCreateBrushHandle(); brush_t* newBrush = (brush_t*)g_FuncTable.m_pfnCreateBrushHandle();
//----- Build Outer Bounds --------- //----- Build Outer Bounds ---------

View file

@ -768,7 +768,7 @@ void MakeBrushes( int NumTris, NODE *Node, TRI *Tri,bool surf,
// if texture2 is identical to texture0, there's no need to // if texture2 is identical to texture0, there's no need to
// check surface angle // check surface angle
if ( !g_strcasecmp( texture0,texture2 ) || !strlen( texture2 ) ) { if ( !g_ascii_strcasecmp( texture0,texture2 ) || !strlen( texture2 ) ) {
CheckAngle = FALSE; CheckAngle = FALSE;
} }
else else

View file

@ -293,7 +293,7 @@ void MapBrushes(){
// if surftext2 is identical to surftext, there's no need to // if surftext2 is identical to surftext, there's no need to
// check surface angle // check surface angle
if ( !g_strcasecmp( surftext,surftext2 ) ) { if ( !g_ascii_strcasecmp( surftext,surftext2 ) ) {
CheckAngle = FALSE; CheckAngle = FALSE;
} }
else else

View file

@ -117,7 +117,7 @@ bool GenSurfInit(){
basepath = g_FuncTable.m_pfnReadProjectKey("basepath"); basepath = g_FuncTable.m_pfnReadProjectKey("basepath");
if (basepath) if (basepath)
{ {
g_strdown (basepath); Q_strlwr (basepath);
if (strstr(basepath,"baseq3")) if (strstr(basepath,"baseq3"))
Game = QUAKE3; Game = QUAKE3;
else if (strstr (basepath,"baseq2")) else if (strstr (basepath,"baseq2"))

View file

@ -75,7 +75,7 @@ int GetDefSurfaceProps( char *Tex ){
if (NULL != (fpak = fopen(pakfile[Game], "rb"))) if (NULL != (fpak = fopen(pakfile[Game], "rb")))
{ {
sprintf(path,"textures/%s.m8",Tex); sprintf(path,"textures/%s.m8",Tex);
g_strdown(path); Q_strlwr(path);
num=fread(&pakheader,1,sizeof(pak_header_t),fpak); num=fread(&pakheader,1,sizeof(pak_header_t),fpak);
if((size_t)num < sizeof(pak_header_t)) if((size_t)num < sizeof(pak_header_t))
{ {
@ -116,7 +116,7 @@ int GetDefSurfaceProps( char *Tex ){
// Assume .map will be output to gamedir/maps, then back up // Assume .map will be output to gamedir/maps, then back up
// to the gamedir and append /textures. Ugly but it should work // to the gamedir and append /textures. Ugly but it should work
strcpy(path,gszMapFile); strcpy(path,gszMapFile);
g_strdown(path); Q_strlwr(path);
p = strstr(path,"maps"); p = strstr(path,"maps");
if(!p) return 0; if(!p) return 0;
p[0] = '\0'; p[0] = '\0';

View file

@ -51,7 +51,7 @@ typedef qboolean ( *PFN_TOKENAVAILABLE )();
typedef char* ( *PFN_COM_PARSE )( char *data ); typedef char* ( *PFN_COM_PARSE )( char *data );
typedef char* ( *PFN_GET_COM_TOKEN )(); typedef char* ( *PFN_GET_COM_TOKEN )();
// Hydra: added support for GetTokenExtra() // Hydra: added support for GetTokenExtra()
typedef qboolean ( *PFN_GETTOKENEXTRA )( qboolean crossline,char *delimiters,qboolean keepdelimiter ); typedef qboolean ( *PFN_GETTOKENEXTRA )( qboolean crossline,const char *delimiters,qboolean keepdelimiter );
struct _QERScripLibTable struct _QERScripLibTable
{ {

View file

@ -51,7 +51,7 @@ void WinPrint( char *str, ... ){
vsprintf( text, str, argptr ); vsprintf( text, str, argptr );
va_end( argptr ); va_end( argptr );
printf( text ); printf("%s", text );
} }
#else #else
void WinPrint( char *str, ... ){ void WinPrint( char *str, ... ){
@ -81,7 +81,7 @@ int Net_AddressCompare( address_t *addr1, address_t *addr2 ){
#ifdef _WIN32 #ifdef _WIN32
return stricmp( addr1->ip, addr2->ip ); return stricmp( addr1->ip, addr2->ip );
#endif #endif
#ifdef __linux__ #if __linux__ || __APPLE__
return strcasecmp( addr1->ip, addr2->ip ); return strcasecmp( addr1->ip, addr2->ip );
#endif #endif
} //end of the function Net_AddressCompare } //end of the function Net_AddressCompare

View file

@ -365,7 +365,7 @@ int WINS_Listen( int socket ){
// Changes Globals: - // Changes Globals: -
//=========================================================================== //===========================================================================
int WINS_Accept( int socket, struct sockaddr_s *addr ){ int WINS_Accept( int socket, struct sockaddr_s *addr ){
int addrlen = sizeof( struct sockaddr_s ); socklen_t addrlen = sizeof( struct sockaddr_s );
int newsocket; int newsocket;
qboolean _true = 1; qboolean _true = 1;
@ -494,7 +494,7 @@ int WINS_CheckNewConnections( void ){
// Changes Globals: - // Changes Globals: -
//=========================================================================== //===========================================================================
int WINS_Read( int socket, byte *buf, int len, struct sockaddr_s *addr ){ int WINS_Read( int socket, byte *buf, int len, struct sockaddr_s *addr ){
int addrlen = sizeof( struct sockaddr_s ); socklen_t addrlen = sizeof( struct sockaddr_s );
int ret; int ret;
if ( addr ) { if ( addr ) {
@ -659,7 +659,7 @@ int WINS_StringToAddr( char *string, struct sockaddr_s *addr ){
// Changes Globals: - // Changes Globals: -
//=========================================================================== //===========================================================================
int WINS_GetSocketAddr( int socket, struct sockaddr_s *addr ){ int WINS_GetSocketAddr( int socket, struct sockaddr_s *addr ){
int addrlen = sizeof( struct sockaddr_s ); socklen_t addrlen = sizeof( struct sockaddr_s );
unsigned int a; unsigned int a;
memset( addr, 0, sizeof( struct sockaddr_s ) ); memset( addr, 0, sizeof( struct sockaddr_s ) );

View file

@ -20,8 +20,8 @@
void lwFreeClip( lwClip *clip ){ void lwFreeClip( lwClip *clip ){
if ( clip ) { if ( clip ) {
lwListFree( (void*) clip->ifilter, lwFreePlugin ); lwListFree( (void*) clip->ifilter, (ListFreeFunc) lwFreePlugin );
lwListFree( (void*) clip->pfilter, lwFreePlugin ); lwListFree( (void*) clip->pfilter, (ListFreeFunc) lwFreePlugin );
_pico_free( clip ); _pico_free( clip );
} }
} }
@ -196,11 +196,11 @@ lwClip *lwGetClip( picoMemStream_t *fp, int cksize ){
filt->data = getbytes( fp, sz - rlen ); filt->data = getbytes( fp, sz - rlen );
if ( id == ID_IFLT ) { if ( id == ID_IFLT ) {
lwListAdd( &clip->ifilter, filt ); lwListAdd( (void **) &clip->ifilter, filt );
clip->nifilters++; clip->nifilters++;
} }
else { else {
lwListAdd( &clip->pfilter, filt ); lwListAdd( (void **) &clip->pfilter, filt );
clip->npfilters++; clip->npfilters++;
} }
break; break;

View file

@ -23,7 +23,7 @@ void lwFreeEnvelope( lwEnvelope *env ){
_pico_free( env->name ); _pico_free( env->name );
} }
lwListFree( env->key, _pico_free ); lwListFree( env->key, _pico_free );
lwListFree( env->cfilter, lwFreePlugin ); lwListFree( env->cfilter, (ListFreeFunc) lwFreePlugin );
_pico_free( env ); _pico_free( env );
} }
} }
@ -105,7 +105,7 @@ lwEnvelope *lwGetEnvelope( picoMemStream_t *fp, int cksize ){
} }
key->time = getF4( fp ); key->time = getF4( fp );
key->value = getF4( fp ); key->value = getF4( fp );
lwListInsert( &env->key, key, compare_keys ); lwListInsert( (void **) &env->key, key, (ListCompareFunc) compare_keys );
env->nkeys++; env->nkeys++;
break; break;
@ -148,7 +148,7 @@ lwEnvelope *lwGetEnvelope( picoMemStream_t *fp, int cksize ){
plug->flags = getU2( fp ); plug->flags = getU2( fp );
plug->data = getbytes( fp, sz - get_flen() ); plug->data = getbytes( fp, sz - get_flen() );
lwListAdd( &env->cfilter, plug ); lwListAdd( (void **) &env->cfilter, plug );
env->ncfilters++; env->ncfilters++;
break; break;

View file

@ -18,13 +18,13 @@
Free the items in a list. Free the items in a list.
====================================================================== */ ====================================================================== */
void lwListFree( void *list, void ( *freeNode )( void * ) ){ void lwListFree( void *list, ListFreeFunc freefunc ){
lwNode *node, *next; lwNode *node, *next;
node = ( lwNode * ) list; node = ( lwNode * ) list;
while ( node ) { while ( node ) {
next = node->next; next = node->next;
freeNode( node ); freefunc( node );
node = next; node = next;
} }
} }
@ -61,7 +61,7 @@ void lwListAdd( void **list, void *node ){
Insert a node into a list in sorted order. Insert a node into a list in sorted order.
====================================================================== */ ====================================================================== */
void lwListInsert( void **vlist, void *vitem, int ( *compare )( void *, void * ) ){ void lwListInsert( void **vlist, void *vitem, ListCompareFunc compare ){
lwNode **list, *item, *node, *prev; lwNode **list, *item, *node, *prev;
if ( !*vlist ) { if ( !*vlist ) {

View file

@ -451,7 +451,7 @@ char *sgetS0( unsigned char **bp ){
return NULL; return NULL;
} }
len = strlen( buf ) + 1; len = strlen( (char *) buf ) + 1;
if ( len == 1 ) { if ( len == 1 ) {
flen += 2; flen += 2;
*bp += 2; *bp += 2;

View file

@ -30,7 +30,7 @@ void lwFreeLayer( lwLayer *layer ){
} }
lwFreePoints( &layer->point ); lwFreePoints( &layer->point );
lwFreePolygons( &layer->polygon ); lwFreePolygons( &layer->polygon );
lwListFree( layer->vmap, lwFreeVMap ); lwListFree( layer->vmap, (ListFreeFunc) lwFreeVMap );
_pico_free( layer ); _pico_free( layer );
} }
} }
@ -45,10 +45,10 @@ void lwFreeLayer( lwLayer *layer ){
void lwFreeObject( lwObject *object ){ void lwFreeObject( lwObject *object ){
if ( object ) { if ( object ) {
lwListFree( object->layer, lwFreeLayer ); lwListFree( object->layer, (ListFreeFunc) lwFreeLayer );
lwListFree( object->env, lwFreeEnvelope ); lwListFree( object->env, (ListFreeFunc) lwFreeEnvelope );
lwListFree( object->clip, lwFreeClip ); lwListFree( object->clip, (ListFreeFunc) lwFreeClip );
lwListFree( object->surf, lwFreeSurface ); lwListFree( object->surf, (ListFreeFunc) lwFreeSurface );
lwFreeTags( &object->taglist ); lwFreeTags( &object->taglist );
_pico_free( object ); _pico_free( object );
} }
@ -154,7 +154,7 @@ lwObject *lwGetObject( char *filename, picoMemStream_t *fp, unsigned int *failID
if ( !layer ) { if ( !layer ) {
goto Fail; goto Fail;
} }
lwListAdd( &object->layer, layer ); lwListAdd( (void **) &object->layer, layer );
} }
object->nlayers++; object->nlayers++;
@ -199,7 +199,7 @@ lwObject *lwGetObject( char *filename, picoMemStream_t *fp, unsigned int *failID
if ( !node ) { if ( !node ) {
goto Fail; goto Fail;
} }
lwListAdd( &layer->vmap, node ); lwListAdd( (void **) &layer->vmap, node );
layer->nvmaps++; layer->nvmaps++;
break; break;
@ -234,7 +234,7 @@ lwObject *lwGetObject( char *filename, picoMemStream_t *fp, unsigned int *failID
if ( !node ) { if ( !node ) {
goto Fail; goto Fail;
} }
lwListAdd( &object->env, node ); lwListAdd( (void **) &object->env, node );
object->nenvs++; object->nenvs++;
break; break;
@ -243,7 +243,7 @@ lwObject *lwGetObject( char *filename, picoMemStream_t *fp, unsigned int *failID
if ( !node ) { if ( !node ) {
goto Fail; goto Fail;
} }
lwListAdd( &object->clip, node ); lwListAdd( (void **) &object->clip, node );
object->nclips++; object->nclips++;
break; break;
@ -252,7 +252,7 @@ lwObject *lwGetObject( char *filename, picoMemStream_t *fp, unsigned int *failID
if ( !node ) { if ( !node ) {
goto Fail; goto Fail;
} }
lwListAdd( &object->surf, node ); lwListAdd( (void **) &object->surf, node );
object->nsurfs++; object->nsurfs++;
break; break;

View file

@ -605,10 +605,11 @@ int lwValidateObject5( char *filename, picoMemStream_t *fp, unsigned int *failID
/* list.c */ /* list.c */
void lwListFree( void *list, void ( *freeNode )( void * ) ); typedef void (*ListFreeFunc)(void *);
void lwListFree( void *list, ListFreeFunc freefunc );
void lwListAdd( void **list, void *node ); void lwListAdd( void **list, void *node );
void lwListInsert( void **vlist, void *vitem, typedef int (*ListCompareFunc)(void *, void *);
int ( *compare )( void *, void * ) ); void lwListInsert( void **vlist, void *vitem, ListCompareFunc comparefunc );
/* vecmath.c */ /* vecmath.c */

View file

@ -85,7 +85,7 @@ static int add_clip( char *s, lwClip **clist, int *nclips ){
( *nclips )++; ( *nclips )++;
clip->index = *nclips; clip->index = *nclips;
lwListAdd( clist, clip ); lwListAdd( (void **) clist, clip );
return clip->index; return clip->index;
} }
@ -132,7 +132,7 @@ static int add_tvel( float pos[], float vel[], lwEnvelope **elist, int *nenvs ){
env->behavior[ 0 ] = BEH_LINEAR; env->behavior[ 0 ] = BEH_LINEAR;
env->behavior[ 1 ] = BEH_LINEAR; env->behavior[ 1 ] = BEH_LINEAR;
lwListAdd( elist, env ); lwListAdd( (void **) elist, env );
} }
*nenvs += 3; *nenvs += 3;
@ -340,43 +340,43 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
case ID_BTEX: case ID_BTEX:
s = getbytes( fp, sz ); s = getbytes( fp, sz );
tex = get_texture( s ); tex = get_texture( s );
lwListAdd( &surf->bump.tex, tex ); lwListAdd( (void **) &surf->bump.tex, tex );
break; break;
case ID_CTEX: case ID_CTEX:
s = getbytes( fp, sz ); s = getbytes( fp, sz );
tex = get_texture( s ); tex = get_texture( s );
lwListAdd( &surf->color.tex, tex ); lwListAdd( (void **) &surf->color.tex, tex );
break; break;
case ID_DTEX: case ID_DTEX:
s = getbytes( fp, sz ); s = getbytes( fp, sz );
tex = get_texture( s ); tex = get_texture( s );
lwListAdd( &surf->diffuse.tex, tex ); lwListAdd( (void **) &surf->diffuse.tex, tex );
break; break;
case ID_LTEX: case ID_LTEX:
s = getbytes( fp, sz ); s = getbytes( fp, sz );
tex = get_texture( s ); tex = get_texture( s );
lwListAdd( &surf->luminosity.tex, tex ); lwListAdd( (void **) &surf->luminosity.tex, tex );
break; break;
case ID_RTEX: case ID_RTEX:
s = getbytes( fp, sz ); s = getbytes( fp, sz );
tex = get_texture( s ); tex = get_texture( s );
lwListAdd( &surf->reflection.val.tex, tex ); lwListAdd( (void **) &surf->reflection.val.tex, tex );
break; break;
case ID_STEX: case ID_STEX:
s = getbytes( fp, sz ); s = getbytes( fp, sz );
tex = get_texture( s ); tex = get_texture( s );
lwListAdd( &surf->specularity.tex, tex ); lwListAdd( (void **) &surf->specularity.tex, tex );
break; break;
case ID_TTEX: case ID_TTEX:
s = getbytes( fp, sz ); s = getbytes( fp, sz );
tex = get_texture( s ); tex = get_texture( s );
lwListAdd( &surf->transparency.val.tex, tex ); lwListAdd( (void **) &surf->transparency.val.tex, tex );
break; break;
case ID_TFLG: case ID_TFLG:
@ -489,7 +489,7 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
goto Fail; goto Fail;
} }
shdr->name = getbytes( fp, sz ); shdr->name = getbytes( fp, sz );
lwListAdd( &surf->shader, shdr ); lwListAdd( (void **) &surf->shader, shdr );
surf->nshaders++; surf->nshaders++;
break; break;
@ -734,7 +734,7 @@ lwObject *lwGetObject5( char *filename, picoMemStream_t *fp, unsigned int *failI
if ( !node ) { if ( !node ) {
goto Fail; goto Fail;
} }
lwListAdd( &object->surf, node ); lwListAdd( (void **) &object->surf, node );
object->nsurfs++; object->nsurfs++;
break; break;

View file

@ -396,7 +396,7 @@ int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist,
return 0; return 0;
} }
strcpy( s[ index ]->name, tlist->tag[ index ] ); strcpy( s[ index ]->name, tlist->tag[ index ] );
lwListAdd( surf, s[ index ] ); lwListAdd( (void **) surf, s[ index ] );
*nsurfs = *nsurfs + 1; *nsurfs = *nsurfs + 1;
} }
polygon->pol[ i ].surf = s[ index ]; polygon->pol[ i ].surf = s[ index ];

View file

@ -90,18 +90,18 @@ void lwFreeSurface( lwSurface *surf ){
_pico_free( surf->srcname ); _pico_free( surf->srcname );
} }
lwListFree( surf->shader, lwFreePlugin ); lwListFree( surf->shader, (ListFreeFunc) lwFreePlugin );
lwListFree( surf->color.tex, lwFreeTexture ); lwListFree( surf->color.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->luminosity.tex, lwFreeTexture ); lwListFree( surf->luminosity.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->diffuse.tex, lwFreeTexture ); lwListFree( surf->diffuse.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->specularity.tex, lwFreeTexture ); lwListFree( surf->specularity.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->glossiness.tex, lwFreeTexture ); lwListFree( surf->glossiness.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->reflection.val.tex, lwFreeTexture ); lwListFree( surf->reflection.val.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->transparency.val.tex, lwFreeTexture ); lwListFree( surf->transparency.val.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->eta.tex, lwFreeTexture ); lwListFree( surf->eta.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->translucency.tex, lwFreeTexture ); lwListFree( surf->translucency.tex, (ListFreeFunc) lwFreeTexture );
lwListFree( surf->bump.tex, lwFreeTexture ); lwListFree( surf->bump.tex, (ListFreeFunc) lwFreeTexture );
_pico_free( surf ); _pico_free( surf );
} }
@ -814,7 +814,7 @@ static int add_texture( lwSurface *surf, lwTexture *tex ){
default: return 0; default: return 0;
} }
lwListInsert( list, tex, compare_textures ); lwListInsert( (void **) list, tex, (ListCompareFunc) compare_textures );
return 1; return 1;
} }
@ -1054,7 +1054,7 @@ lwSurface *lwGetSurface( picoMemStream_t *fp, int cksize ){
if ( !shdr ) { if ( !shdr ) {
goto Fail; goto Fail;
} }
lwListInsert( &surf->shader, shdr, compare_shaders ); lwListInsert( (void **) &surf->shader, shdr, (ListCompareFunc) compare_shaders );
++surf->nshaders; ++surf->nshaders;
set_flen( 4 + get_flen() ); set_flen( 4 + get_flen() );
break; break;

View file

@ -350,7 +350,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
texCoord->t = _pico_little_short( texCoord[i].t ); texCoord->t = _pico_little_short( texCoord[i].t );
} }
// set Skin Name // set Skin Name
strncpy( skinname, (unsigned char *) fm.fm_skin, FM_SKINPATHSIZE ); strncpy( skinname, (char *) fm.fm_skin, FM_SKINPATHSIZE );
#ifdef FM_VERBOSE_DBG #ifdef FM_VERBOSE_DBG
// Print out md2 values // Print out md2 values

View file

@ -431,7 +431,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
} }
// set Skin Name // set Skin Name
strncpy( skinname, ( bb + md2->ofsSkins ), MD2_MAX_SKINNAME ); strncpy( skinname, (char *) ( bb + md2->ofsSkins ), MD2_MAX_SKINNAME );
// Print out md2 values // Print out md2 values
_pico_printf( PICO_VERBOSE,"Skins: %d Verts: %d STs: %d Triangles: %d Frames: %d\nSkin Name \"%s\"\n", md2->numSkins, md2->numXYZ, md2->numST, md2->numTris, md2->numFrames, skinname ); _pico_printf( PICO_VERBOSE,"Skins: %d Verts: %d STs: %d Triangles: %d Frames: %d\nSkin Name \"%s\"\n", md2->numSkins, md2->numXYZ, md2->numST, md2->numTris, md2->numFrames, skinname );

View file

@ -29,7 +29,9 @@
#include <time.h> #include <time.h>
#include <ctype.h> #include <ctype.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#define LERP_DELTA 1e-6 #define LERP_DELTA 1e-6

View file

@ -697,7 +697,10 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ... ) {
va_start( argptr,fmt ); va_start( argptr,fmt );
len = vsprintf( bigbuffer,fmt,argptr ); len = vsprintf( bigbuffer,fmt,argptr );
va_end( argptr ); va_end( argptr );
if ( len >= sizeof( bigbuffer ) ) { if ( len < 0 ) {
Com_Error( ERR_FATAL, "Com_sprintf: failed to write bigbuffer" );
}
if ( (unsigned) len >= sizeof( bigbuffer ) ) {
Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" ); Com_Error( ERR_FATAL, "Com_sprintf: overflowed bigbuffer" );
} }
if ( len >= size ) { if ( len >= size ) {
@ -716,7 +719,7 @@ void QDECL Com_sprintf( char *dest, int size, const char *fmt, ... ) {
FIXME: make this buffer size safe someday FIXME: make this buffer size safe someday
============ ============
*/ */
char * QDECL va( char *format, ... ) { char * QDECL va( const char *format, ... ) {
va_list argptr; va_list argptr;
static char string[2][32000]; // in case va is called by nested functions static char string[2][32000]; // in case va is called by nested functions
static int index = 0; static int index = 0;
@ -758,7 +761,7 @@ char *Info_ValueForKey( const char *s, const char *key ) {
char *o; char *o;
if ( !s || !key ) { if ( !s || !key ) {
return ""; return const_cast<char*>("");
} }
if ( strlen( s ) >= MAX_INFO_STRING ) { if ( strlen( s ) >= MAX_INFO_STRING ) {
@ -775,7 +778,7 @@ char *Info_ValueForKey( const char *s, const char *key ) {
while ( *s != '\\' ) while ( *s != '\\' )
{ {
if ( !*s ) { if ( !*s ) {
return ""; return const_cast<char*>("");
} }
*o++ = *s++; *o++ = *s++;
} }
@ -800,7 +803,7 @@ char *Info_ValueForKey( const char *s, const char *key ) {
s++; s++;
} }
return ""; return const_cast<char*>("");
} }

View file

@ -642,7 +642,7 @@ float BigFloat( float l );
float LittleFloat( float l ); float LittleFloat( float l );
void Swap_Init( void ); void Swap_Init( void );
char * QDECL va( char *format, ... ); char * QDECL va( const char *format, ... );
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -750,6 +750,8 @@ void idCameraDef::buildCamera() {
break; break;
*/ */
} }
default:
break;
} }
} }

View file

@ -187,7 +187,7 @@ const char* CSynapseClientFGD::GetInfo(){
#define CLASS_POINTCLASS 2 #define CLASS_POINTCLASS 2
#define CLASS_SOLIDCLASS 3 #define CLASS_SOLIDCLASS 3
char *classnames[] = {"NOT DEFINED","BaseClass","PointClass","SolidClass"}; const char *classnames[] = {"NOT DEFINED","BaseClass","PointClass","SolidClass"};
#define OPTION_NOOPTION 0 #define OPTION_NOOPTION 0
#define OPTION_STRING 1 #define OPTION_STRING 1
@ -195,7 +195,7 @@ char *classnames[] = {"NOT DEFINED","BaseClass","PointClass","SolidClass"};
#define OPTION_INTEGER 3 #define OPTION_INTEGER 3
#define OPTION_FLAGS 4 #define OPTION_FLAGS 4
char *optionnames[] = {"NOT DEFINED","String","Choices","Integer","Flags"}; const char *optionnames[] = {"NOT DEFINED","String","Choices","Integer","Flags"};
typedef struct choice_s { typedef struct choice_s {
int value; int value;
@ -244,7 +244,7 @@ char *strlower( char *start ){
return start; return start;
} }
char *addstr( char *dest,char *source ){ char *addstr( char *dest,const char *source ){
if ( dest ) { if ( dest ) {
char *ptr; char *ptr;
int len = strlen( dest ); int len = strlen( dest );

View file

@ -743,17 +743,17 @@ void LoadImage( const char *name, byte ** pic, int *width, int *height ){
return; return;
} }
if ( !g_strcasecmp( name + len - 4, ".tga" ) ) { if ( !g_ascii_strcasecmp( name + len - 4, ".tga" ) ) {
LoadTGA( name, pic, width, height ); LoadTGA( name, pic, width, height );
} }
else if ( !g_strcasecmp( name + len - 4, ".pcx" ) ) { else if ( !g_ascii_strcasecmp( name + len - 4, ".pcx" ) ) {
LoadPCX32( name, pic, width, height ); LoadPCX32( name, pic, width, height );
} }
else if ( !g_strcasecmp( name + len - 4, ".bmp" ) ) { else if ( !g_ascii_strcasecmp( name + len - 4, ".bmp" ) ) {
LoadBMP( name, pic, width, height ); LoadBMP( name, pic, width, height );
} }
/* /*
else if (!g_strcasecmp (name + len - 4, ".jpg")) else if (!g_ascii_strcasecmp (name + len - 4, ".jpg"))
{ {
LoadJPG (name, pic, width, height); LoadJPG (name, pic, width, height);
} }

View file

@ -586,19 +586,19 @@ void LoadImage( const char *name, byte ** pic, int *width, int *height ){
} }
#ifdef USE_HLW #ifdef USE_HLW
if ( *pic == NULL && !g_strcasecmp( name + len - 4, ".hlw" ) ) { if ( *pic == NULL && !g_ascii_strcasecmp( name + len - 4, ".hlw" ) ) {
LoadHLW( name, pic, width, height ); LoadHLW( name, pic, width, height );
} }
#endif #endif
#ifdef USE_MIP #ifdef USE_MIP
if ( *pic == NULL && !g_strcasecmp( name + len - 4, ".mip" ) ) { if ( *pic == NULL && !g_ascii_strcasecmp( name + len - 4, ".mip" ) ) {
LoadMIP( name, pic, width, height ); LoadMIP( name, pic, width, height );
} }
#endif #endif
#ifdef USE_IDSP #ifdef USE_IDSP
if ( *pic == NULL && !g_strcasecmp( name + len - 4, ".spr" ) ) { if ( *pic == NULL && !g_ascii_strcasecmp( name + len - 4, ".spr" ) ) {
LoadIDSP( name, pic, width, height ); LoadIDSP( name, pic, width, height );
} }
#endif #endif

View file

@ -54,7 +54,7 @@ void LoadM8( const char *name, unsigned char **pic, int *width, int *height ){
} }
} }
strcat( text_buf, ".m8" ); strcat( text_buf, ".m8" );
if ( length = vfsLoadFile( (char *) text_buf, (void **) &m8_file_buffer, 0 ) == (unsigned int) -1 ) { if ( ( length = vfsLoadFile( (char *) text_buf, (void **) &m8_file_buffer, 0 ) ) == (unsigned int) -1 ) {
Sys_Printf( "Unable to open file %s\n",name ); Sys_Printf( "Unable to open file %s\n",name );
return; return;
} }

View file

@ -47,7 +47,7 @@ CPicoModel( const Str& name );
CPicoModel( const Str& name, const int frame ); CPicoModel( const Str& name, const int frame );
CPicoModel( const char *name, const int frame ); CPicoModel( const char *name, const int frame );
~CPicoModel(); ~CPicoModel();
void CPicoModel::load( const char *name, const int frame ); void load( const char *name, const int frame );
void IncRef(){ void IncRef(){
++m_refcount; ++m_refcount;

View file

@ -240,7 +240,7 @@ char *ShaderNameLookup( patchMesh_t * patch ){
} }
} }
Sys_Printf( "ERROR: failed to lookup name in ShaderNameLookup??\n" ); Sys_Printf( "ERROR: failed to lookup name in ShaderNameLookup??\n" );
return SHADER_NOT_FOUND; return const_cast<char*>(SHADER_NOT_FOUND);
} }
//++timo end clean //++timo end clean

View file

@ -828,7 +828,7 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool
if ( !g_pToolWnd ) { if ( !g_pToolWnd ) {
g_pToolWnd = g_UITable.m_pfnCreateGLWindow(); g_pToolWnd = g_UITable.m_pfnCreateGLWindow();
g_pToolWnd->setSizeParm( 300,300 ); g_pToolWnd->setSizeParm( 300,300 );
g_pToolWnd->setName( "TexTool" ); g_pToolWnd->setName( const_cast<char*>("TexTool") );
// g_Listener is a static class, we need to bump the refCount to avoid premature release problems // g_Listener is a static class, we need to bump the refCount to avoid premature release problems
g_Listen.IncRef(); g_Listen.IncRef();
// setListener will incRef on the listener too // setListener will incRef on the listener too

View file

@ -164,7 +164,7 @@ static void vfsInitPakFile( const char *filename ){
// fix filename // fix filename
vfsFixDOSName( file->entry.filename ); vfsFixDOSName( file->entry.filename );
g_strdown( file->entry.filename ); strlwr( file->entry.filename );
//g_FuncTable.m_pfnSysPrintf("vfs file from pak: %s\n", file->entry.filename); //g_FuncTable.m_pfnSysPrintf("vfs file from pak: %s\n", file->entry.filename);
} }
} }
@ -183,7 +183,7 @@ static GSList* vfsGetListInternal( const char *dir, const char *ext, bool direct
dirname[0] = '\0'; dirname[0] = '\0';
if ( dir != NULL ) { if ( dir != NULL ) {
strcat( dirname, dir ); strcat( dirname, dir );
g_strdown( dirname ); strlwr( dirname );
vfsFixDOSName( dirname ); vfsFixDOSName( dirname );
vfsAddSlash( dirname ); vfsAddSlash( dirname );
Sys_Printf( "vfs dirname_1: %s\n", dirname ); Sys_Printf( "vfs dirname_1: %s\n", dirname );
@ -198,7 +198,7 @@ static GSList* vfsGetListInternal( const char *dir, const char *ext, bool direct
else{ else{
extension[0] = '\0'; extension[0] = '\0';
} }
g_strdown( extension ); strlwr( extension );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {
@ -261,7 +261,7 @@ static GSList* vfsGetListInternal( const char *dir, const char *ext, bool direct
{ {
strcpy( dirname, g_strDirs[i] ); strcpy( dirname, g_strDirs[i] );
strcat( dirname, dir ); strcat( dirname, dir );
g_strdown( dirname ); strlwr( dirname );
vfsFixDOSName( dirname ); vfsFixDOSName( dirname );
vfsAddSlash( dirname ); vfsAddSlash( dirname );
@ -291,7 +291,7 @@ static GSList* vfsGetListInternal( const char *dir, const char *ext, bool direct
dirlist = g_strdup( name ); dirlist = g_strdup( name );
g_strdown( dirlist ); strlwr( dirlist );
char *ptr_ext = strrchr( dirlist, '.' ); char *ptr_ext = strrchr( dirlist, '.' );
if ( ext == NULL if ( ext == NULL
@ -473,7 +473,7 @@ int vfsGetFileCount( const char *filename, int flag ){
strcpy( fixed, filename ); strcpy( fixed, filename );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {
@ -505,7 +505,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
*bufferptr = NULL; *bufferptr = NULL;
strcpy( fixed, filename ); strcpy( fixed, filename );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( i = 0; i < g_numDirs; i++ ) for ( i = 0; i < g_numDirs; i++ )
{ {
@ -703,7 +703,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
strcpy( fixed, in ); strcpy( fixed, in );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {

View file

@ -144,7 +144,7 @@ static void vfsInitPakFile( const char *filename ){
g_pakFiles = g_slist_append( g_pakFiles, file ); g_pakFiles = g_slist_append( g_pakFiles, file );
vfsFixDOSName( filename_inzip ); vfsFixDOSName( filename_inzip );
g_strdown( filename_inzip ); strlwr( filename_inzip );
file->name = g_strdup( filename_inzip ); file->name = g_strdup( filename_inzip );
file->size = file_info.uncompressed_size; file->size = file_info.uncompressed_size;
@ -173,7 +173,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
if ( refdir != NULL ) { if ( refdir != NULL ) {
strcpy( dirname, refdir ); strcpy( dirname, refdir );
g_strdown( dirname ); strlwr( dirname );
vfsFixDOSName( dirname ); vfsFixDOSName( dirname );
vfsAddSlash( dirname ); vfsAddSlash( dirname );
} }
@ -188,7 +188,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
else{ else{
extension[0] = '\0'; extension[0] = '\0';
} }
g_strdown( extension ); strlwr( extension );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {
@ -278,7 +278,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
dirlist = g_strdup( name ); dirlist = g_strdup( name );
g_strdown( dirlist ); strlwr( dirlist );
char *ptr_ext = strrchr( dirlist, '.' ); char *ptr_ext = strrchr( dirlist, '.' );
if ( ext == NULL if ( ext == NULL
@ -534,7 +534,7 @@ int vfsGetFileCount( const char *filename, int flag ){
strcpy( fixed, filename ); strcpy( fixed, filename );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
if ( !flag || ( flag & VFS_SEARCH_PAK ) ) { if ( !flag || ( flag & VFS_SEARCH_PAK ) ) {
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
@ -598,7 +598,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
*bufferptr = NULL; *bufferptr = NULL;
strcpy( fixed, filename ); strcpy( fixed, filename );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( i = 0; i < g_numDirs; i++ ) for ( i = 0; i < g_numDirs; i++ )
{ {
@ -788,7 +788,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
strcpy( fixed, in ); strcpy( fixed, in );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {

View file

@ -144,7 +144,7 @@ static void vfsInitPakFile( const char *filename ){
g_pakFiles = g_slist_append( g_pakFiles, file ); g_pakFiles = g_slist_append( g_pakFiles, file );
vfsFixDOSName( filename_inzip ); vfsFixDOSName( filename_inzip );
g_strdown( filename_inzip ); strlwr( filename_inzip );
file->name = g_strdup( filename_inzip ); file->name = g_strdup( filename_inzip );
file->size = file_info.uncompressed_size; file->size = file_info.uncompressed_size;
@ -173,7 +173,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
if ( refdir != NULL ) { if ( refdir != NULL ) {
strcpy( dirname, refdir ); strcpy( dirname, refdir );
g_strdown( dirname ); strlwr( dirname );
vfsFixDOSName( dirname ); vfsFixDOSName( dirname );
vfsAddSlash( dirname ); vfsAddSlash( dirname );
} }
@ -188,7 +188,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
else{ else{
extension[0] = '\0'; extension[0] = '\0';
} }
g_strdown( extension ); strlwr( extension );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {
@ -278,7 +278,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
dirlist = g_strdup( name ); dirlist = g_strdup( name );
g_strdown( dirlist ); strlwr( dirlist );
char *ptr_ext = strrchr( dirlist, '.' ); char *ptr_ext = strrchr( dirlist, '.' );
if ( ext == NULL if ( ext == NULL
@ -534,7 +534,7 @@ int vfsGetFileCount( const char *filename, int flag ){
strcpy( fixed, filename ); strcpy( fixed, filename );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
if ( !flag || ( flag & VFS_SEARCH_PAK ) ) { if ( !flag || ( flag & VFS_SEARCH_PAK ) ) {
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
@ -598,7 +598,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
*bufferptr = NULL; *bufferptr = NULL;
strcpy( fixed, filename ); strcpy( fixed, filename );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( i = 0; i < g_numDirs; i++ ) for ( i = 0; i < g_numDirs; i++ )
{ {
@ -788,7 +788,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
strcpy( fixed, in ); strcpy( fixed, in );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {

View file

@ -185,7 +185,7 @@ static void vfsInitPakFile( const char *filename ){
g_pakFiles = g_slist_append( g_pakFiles, file ); g_pakFiles = g_slist_append( g_pakFiles, file );
vfsFixDOSName( filename_inwad ); vfsFixDOSName( filename_inwad );
g_strdown( filename_inwad ); strlwr( filename_inwad );
// texturenames in wad files don't have an extensions or paths, so we must add them! // texturenames in wad files don't have an extensions or paths, so we must add them!
if ( wf->lpLump->type == WAD2_TYPE_MIP ) { if ( wf->lpLump->type == WAD2_TYPE_MIP ) {
@ -221,7 +221,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
if ( refdir != NULL ) { if ( refdir != NULL ) {
strcpy( dirname, refdir ); strcpy( dirname, refdir );
g_strdown( dirname ); strlwr( dirname );
vfsFixDOSName( dirname ); vfsFixDOSName( dirname );
vfsAddSlash( dirname ); vfsAddSlash( dirname );
} }
@ -236,7 +236,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
else{ else{
extension[0] = '\0'; extension[0] = '\0';
} }
g_strdown( extension ); strlwr( extension );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {
@ -326,7 +326,7 @@ static GSList* vfsGetListInternal( const char *refdir, const char *ext, bool dir
char* direntry = g_strdup( name ); char* direntry = g_strdup( name );
g_strdown( direntry ); strlwr( direntry );
char *ptr_ext = strrchr( direntry, '.' ); char *ptr_ext = strrchr( direntry, '.' );
@ -451,7 +451,7 @@ int vfsGetFileCount( const char *filename, int flag ){
strcpy( fixed, filename ); strcpy( fixed, filename );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
if ( !flag || ( flag & VFS_SEARCH_PAK ) ) { if ( !flag || ( flag & VFS_SEARCH_PAK ) ) {
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
@ -515,7 +515,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
*bufferptr = NULL; *bufferptr = NULL;
strcpy( fixed, filename ); strcpy( fixed, filename );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( i = 0; i < g_numDirs; i++ ) for ( i = 0; i < g_numDirs; i++ )
{ {
@ -695,7 +695,7 @@ char* vfsGetFullPath( const char *in, int index, int flag ){
strcpy( fixed, in ); strcpy( fixed, in );
vfsFixDOSName( fixed ); vfsFixDOSName( fixed );
g_strdown( fixed ); strlwr( fixed );
for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) ) for ( lst = g_pakFiles; lst != NULL; lst = g_slist_next( lst ) )
{ {

View file

@ -321,7 +321,7 @@ void CDbgDlg::BuildDialog(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }

View file

@ -1261,7 +1261,7 @@ void GroupDlg::Create(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
@ -1362,13 +1362,13 @@ void GroupDlg::Create(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 1, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 1, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }

View file

@ -564,7 +564,7 @@ void DoProjectSettings(){
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) ); GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
@ -1328,14 +1328,14 @@ void DoMapInfo(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Entity" ), renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Entity" ), renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 0 ); gtk_tree_view_column_set_sort_column_id( column, 0 );
} }
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Count" ), renderer, "text", 1, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Count" ), renderer, "text", 1, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
gtk_tree_view_column_set_sort_column_id( column, 1 ); gtk_tree_view_column_set_sort_column_id( column, 1 );
} }
@ -1521,7 +1521,7 @@ void DoEntityList(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
@ -1608,13 +1608,13 @@ void DoEntityList(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Key" ), renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Key" ), renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Value" ), renderer, "text", 1, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Value" ), renderer, "text", 1, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
@ -2718,13 +2718,13 @@ void DoCommandListDlg(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Command" ), renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Command" ), renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Key" ), renderer, "text", 1, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Key" ), renderer, "text", 1, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
@ -2860,7 +2860,7 @@ void DoTextureListDlg(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }
@ -3125,7 +3125,7 @@ void DoScriptsDlg(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }

View file

@ -199,14 +199,19 @@ unsigned char *load_bitmap_file( const char* filename, guint16 *width, guint16 *
size_t rc; size_t rc;
rc = fread( &m1, 1, 1, fp ); rc = fread( &m1, 1, 1, fp );
m_bytesRead++; if ( rc != 1 ) {
if ( rc == -1 ) {
fclose( fp ); fclose( fp );
return NULL; return NULL;
} }
m_bytesRead++;
rc = fread( &m2, 1, 1, fp ); rc = fread( &m2, 1, 1, fp );
if ( rc != 1) {
fclose( fp );
return NULL;
}
m_bytesRead++; m_bytesRead++;
if ( ( m1 != 'B' ) || ( m2 != 'M' ) ) { if ( ( m1 != 'B' ) || ( m2 != 'M' ) ) {
fclose( fp ); fclose( fp );
return NULL; return NULL;
@ -1518,14 +1523,14 @@ const char* file_dialog( void *parent, gboolean open, const char* title, const c
GTK_RESPONSE_CANCEL, GTK_RESPONSE_CANCEL,
open ? GTK_STOCK_OPEN : GTK_STOCK_SAVE, open ? GTK_STOCK_OPEN : GTK_STOCK_SAVE,
GTK_RESPONSE_ACCEPT, GTK_RESPONSE_ACCEPT,
NULL ); (char *) NULL );
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), new_path ); gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), new_path );
delete[] new_path; delete[] new_path;
// Setting the file chooser dialog to modal and centering it on the parent is done automatically. // Setting the file chooser dialog to modal and centering it on the parent is done automatically.
if ( pattern != NULL ) { if ( pattern != NULL ) {
GtkFileFilter *allTypesFilter = gtk_file_filter_new(); //GtkFileFilter *allTypesFilter = gtk_file_filter_new();
// http://www.gtkforums.com/viewtopic.php?p=6044 // http://www.gtkforums.com/viewtopic.php?p=6044
//gtk_file_filter_set_name( allTypesFilter, "All supported types" ); //gtk_file_filter_set_name( allTypesFilter, "All supported types" );
for ( int i = 0; i < typelist.GetNumTypes(); i++ ) { for ( int i = 0; i < typelist.GetNumTypes(); i++ ) {
@ -1634,7 +1639,7 @@ char* WINAPI dir_dialog( void *parent, const char* title, const char* path ){
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
NULL ); (char *) NULL );
if ( path != NULL ) { if ( path != NULL ) {
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), path ); gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( file_sel ), path );

View file

@ -222,7 +222,7 @@ void loki_initpaths( char *argv0 ){
home = loki_gethomedir(); home = loki_gethomedir();
if ( home == NULL ) { if ( home == NULL ) {
home = "."; home = const_cast<char*>(".");
} }
if ( *game_name == 0 ) { /* Game name defaults to argv[0] */ if ( *game_name == 0 ) { /* Game name defaults to argv[0] */
@ -412,7 +412,8 @@ void error_redirect( const gchar *domain, GLogLevelFlags log_level, const gchar
#define LOCALEDIR "lang" #define LOCALEDIR "lang"
int main( int argc, char* argv[] ) { int main( int argc, char* argv[] ) {
char *libgl, *ptr; const char *libgl;
char *ptr;
int i, j, k; int i, j, k;
@ -1170,7 +1171,7 @@ void RunBsp( char *command ){
Error( "CreateProcess failed" ); Error( "CreateProcess failed" );
break; break;
case 0: case 0:
execlp( batpath, batpath, NULL ); execlp( batpath, batpath, (char *) NULL );
printf( "execlp error !" ); printf( "execlp error !" );
_exit( 0 ); _exit( 0 );
break; break;

View file

@ -3060,6 +3060,7 @@ void RefreshModelSkin( GSList **pModels, entitymodel_t *model ){
#endif #endif
// and also keeping it so we have an actual count of empty models // and also keeping it so we have an actual count of empty models
// jdolan: FIXME uhm, shouldn't we track the return value from this append?
g_slist_append( *pModels, model ); g_slist_append( *pModels, model );
return; return;
} }

View file

@ -44,11 +44,11 @@ const int RAD_PRESS = 0x08;
struct SCommandInfo struct SCommandInfo
{ {
char* m_strCommand; const char* m_strCommand;
unsigned int m_nKey; unsigned int m_nKey;
unsigned int m_nModifiers; unsigned int m_nModifiers;
unsigned int m_nCommand; unsigned int m_nCommand;
char* m_strMenu; const char* m_strMenu;
}; };
struct SKeyInfo struct SKeyInfo

View file

@ -27,7 +27,7 @@ char* script_p;
int scriptline; int scriptline;
// Hydra: added support for GetTokenExtra() // Hydra: added support for GetTokenExtra()
char *currentdelimiters; const char *currentdelimiters;
qboolean script_keepdelimiter; qboolean script_keepdelimiter;
void StartTokenParsing( char *data ){ void StartTokenParsing( char *data ){
@ -179,9 +179,9 @@ void UngetToken( void ){
GetToken(false); // contains "2" GetToken(false); // contains "2"
============== ==============
*/ */
qboolean GetTokenExtra( qboolean crossline,char *delimiters, qboolean keepdelimiter ){ qboolean GetTokenExtra( qboolean crossline,const char *delimiters, qboolean keepdelimiter ){
qboolean result; qboolean result;
char *olddelimiters = currentdelimiters; // store it const char *olddelimiters = currentdelimiters; // store it
currentdelimiters = delimiters; // change the delimiters currentdelimiters = delimiters; // change the delimiters
script_keepdelimiter = keepdelimiter; // change the global flag script_keepdelimiter = keepdelimiter; // change the global flag

View file

@ -31,4 +31,4 @@ void StartTokenParsing( char *data );
qboolean GetToken( qboolean crossline ); qboolean GetToken( qboolean crossline );
void UngetToken( void ); void UngetToken( void );
qboolean TokenAvailable( void ); qboolean TokenAvailable( void );
qboolean GetTokenExtra( qboolean crossline,char *delimiters,qboolean keepdelimiter ); // Hydra: added support for GetTokenExtra() qboolean GetTokenExtra( qboolean crossline,const char *delimiters,qboolean keepdelimiter ); // Hydra: added support for GetTokenExtra()

View file

@ -226,5 +226,5 @@ void CPointfile::saxCharacters( message_info_t *ctx, const xmlChar *ch, int len
} }
char * CPointfile::getName(){ char * CPointfile::getName(){
return "Map is leaked"; return const_cast<char*>("Map is leaked");
} }

View file

@ -1583,7 +1583,7 @@ void PrefsDlg::BuildDialog(){
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Preferences" ), renderer, "text", 0, NULL ); GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( _( "Preferences" ), renderer, "text", 0, (char *) NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
} }

View file

@ -1083,7 +1083,7 @@ char *argv[MAX_NUM_ARGVS];
*/ */
void ParseCommandLine( char *lpCmdLine ){ void ParseCommandLine( char *lpCmdLine ){
argc = 1; argc = 1;
argv[0] = "programname"; argv[0] = const_cast<char*>("programname");
while ( *lpCmdLine && ( argc < MAX_NUM_ARGVS ) ) while ( *lpCmdLine && ( argc < MAX_NUM_ARGVS ) )
{ {
@ -1741,7 +1741,7 @@ extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) {
tag = standard_tag; tag = standard_tag;
break; break;
} }
gtk_text_buffer_insert_with_tags( buffer, &iter, buf, length, tag, NULL ); gtk_text_buffer_insert_with_tags( buffer, &iter, buf, length, tag, (char *) NULL );
gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( g_qeglobals_gui.d_edit ), end ); gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( g_qeglobals_gui.d_edit ), end );

View file

@ -1118,10 +1118,10 @@ const GLubyte* WINAPI gluErrorString( GLenum errCode ){
for ( search = 0; glu_errlist[search].errstr; search++ ) for ( search = 0; glu_errlist[search].errstr; search++ )
{ {
if ( errCode == glu_errlist[search].errnum ) { if ( errCode == glu_errlist[search].errnum ) {
return (const char *)glu_errlist[search].errstr; return (GLubyte *) glu_errlist[search].errstr;
} }
} //end for } //end for
return "Unknown error"; return (GLubyte *) "Unknown error";
} }
#ifdef ATIHACK_812 #ifdef ATIHACK_812

View file

@ -611,7 +611,7 @@ void FillTextureMenu( GSList** pArray ){
ExtractFileName( (char*)l_shaderfiles->data, shaderfile ); ExtractFileName( (char*)l_shaderfiles->data, shaderfile );
StripExtension( shaderfile ); StripExtension( shaderfile );
g_strdown( shaderfile ); strlwr( shaderfile );
for ( GSList *tmp = texdirs; tmp; tmp = g_slist_next( tmp ) ) for ( GSList *tmp = texdirs; tmp; tmp = g_slist_next( tmp ) )
if ( !strcasecmp( (char*)tmp->data, shaderfile ) ) { if ( !strcasecmp( (char*)tmp->data, shaderfile ) ) {

View file

@ -437,7 +437,7 @@ void CreateEntityFromName( const char* name, const vec3_t origin ){
} }
} }
void CreateRightClickEntity( XYWnd* pWnd, int x, int y, char* pName ){ void CreateRightClickEntity( XYWnd* pWnd, int x, int y, const char* pName ){
int height = pWnd->GetWidget()->allocation.height; int height = pWnd->GetWidget()->allocation.height;
vec3_t point; vec3_t point;
pWnd->SnapToPoint( x, height - 1 - y, point ); pWnd->SnapToPoint( x, height - 1 - y, point );
@ -918,7 +918,7 @@ void XYWnd::SetPointMode( bool b ){
void XYWnd::SetViewType( int n ){ void XYWnd::SetViewType( int n ){
m_nViewType = n; m_nViewType = n;
if ( g_pParentWnd->CurrentStyle() == MainFrame::eFloating ) { if ( g_pParentWnd->CurrentStyle() == MainFrame::eFloating ) {
char* str = "YZ Side"; const char* str = "YZ Side";
if ( m_nViewType == XY ) { if ( m_nViewType == XY ) {
str = "XY Top"; str = "XY Top";
} }