fix simple warnings

This commit is contained in:
Garux 2020-01-24 02:47:33 +03:00
parent 5848e22f0a
commit e5d040a770
55 changed files with 384 additions and 447 deletions

View File

@ -76,7 +76,7 @@ const char* getCommandTitleList(){
return "";
}
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
char *message = NULL;
const char *message = NULL;
if ( string_equal( command, "About" ) ) {
GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
"UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About",

View File

@ -130,7 +130,7 @@ void get_team_count( const char *classname, int *count, int *team ){
/**
* @brief Some default values to worldspawn like maxlevel and so on
*/
void assign_default_values_to_worldspawn( bool override, char **returnMsg ){
void assign_default_values_to_worldspawn( bool override, const char **returnMsg ){
static char message[1024];
Entity* worldspawn;
int teams = 0;
@ -190,7 +190,7 @@ int check_entity_flags( const char *classname, const char *flag ){
* @brief Will check e.g. the map entities for valid values
* @todo: check for maxlevel
*/
void check_map_values( char **returnMsg ){
void check_map_values( const char **returnMsg ){
static char message[1024];
int count = 0;
int teams = 0;

View File

@ -19,8 +19,8 @@
#if !defined( INCLUDED_UFOAI_LEVEL_H )
#define INCLUDED_UFOAI_LEVEL_H
void assign_default_values_to_worldspawn( bool override, char **returnMsg );
void check_map_values( char **returnMsg );
void assign_default_values_to_worldspawn( bool override, const char **returnMsg );
void check_map_values( const char **returnMsg );
void get_team_count( const char *classname, int *count, int *team );
#endif

View File

@ -503,7 +503,7 @@ void PC_PrintDefineHashTable(define_t **definehash)
int PC_NameHash(char *name)
{
int register hash, i;
int hash, i;
hash = 0;
for (i = 0; name[i] != '\0'; i++)
@ -1023,7 +1023,7 @@ int PC_ReadLine(source_t *source, token_t *token)
do
{
if (!PC_ReadSourceToken(source, token)) return qfalse;
if (token->linescrossed > crossline)
{
PC_UnreadSourceToken(source, token);
@ -1697,7 +1697,7 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
AllocValue(v);
#if DEFINEHASHING
if (PC_FindHashedDefine(source->definehash, t->string))
#else
#else
if (PC_FindDefine(source->defines, t->string))
#endif //DEFINEHASHING
{
@ -1825,7 +1825,7 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
break;
} //end if
} //end case
case P_MUL:
case P_DIV:
case P_MOD:

View File

@ -115,7 +115,7 @@ punctuation_t default_punctuations[] =
#ifdef DOLLAR
{"$",P_DOLLAR, NULL},
#endif //DOLLAR
{NULL, 0}
{NULL, 0, NULL}
};
char basefolder[MAX_PATH];

View File

@ -38,53 +38,53 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//bounding box definition
fielddef_t bbox_fields[] =
{
{"presencetype", BBOX_OFS(presencetype), FT_INT},
{"flags", BBOX_OFS(flags), FT_INT},
{"mins", BBOX_OFS(mins), FT_FLOAT|FT_ARRAY, 3},
{"maxs", BBOX_OFS(maxs), FT_FLOAT|FT_ARRAY, 3},
{NULL, 0, 0, 0}
{"presencetype", BBOX_OFS(presencetype), FT_INT, 0, 0, 0, NULL},
{"flags", BBOX_OFS(flags), FT_INT, 0, 0, 0, NULL},
{"mins", BBOX_OFS(mins), FT_FLOAT|FT_ARRAY, 3, 0, 0, NULL},
{"maxs", BBOX_OFS(maxs), FT_FLOAT|FT_ARRAY, 3, 0, 0, NULL},
{NULL, 0, 0, 0, 0, 0, NULL}
};
fielddef_t cfg_fields[] =
{
{"phys_gravitydirection", CFG_OFS(phys_gravitydirection), FT_FLOAT|FT_ARRAY, 3},
{"phys_friction", CFG_OFS(phys_friction), FT_FLOAT},
{"phys_stopspeed", CFG_OFS(phys_stopspeed), FT_FLOAT},
{"phys_gravity", CFG_OFS(phys_gravity), FT_FLOAT},
{"phys_waterfriction", CFG_OFS(phys_waterfriction), FT_FLOAT},
{"phys_watergravity", CFG_OFS(phys_watergravity), FT_FLOAT},
{"phys_maxvelocity", CFG_OFS(phys_maxvelocity), FT_FLOAT},
{"phys_maxwalkvelocity", CFG_OFS(phys_maxwalkvelocity), FT_FLOAT},
{"phys_maxcrouchvelocity", CFG_OFS(phys_maxcrouchvelocity), FT_FLOAT},
{"phys_maxswimvelocity", CFG_OFS(phys_maxswimvelocity), FT_FLOAT},
{"phys_walkaccelerate", CFG_OFS(phys_walkaccelerate), FT_FLOAT},
{"phys_airaccelerate", CFG_OFS(phys_airaccelerate), FT_FLOAT},
{"phys_swimaccelerate", CFG_OFS(phys_swimaccelerate), FT_FLOAT},
{"phys_maxstep", CFG_OFS(phys_maxstep), FT_FLOAT},
{"phys_maxsteepness", CFG_OFS(phys_maxsteepness), FT_FLOAT},
{"phys_maxwaterjump", CFG_OFS(phys_maxwaterjump), FT_FLOAT},
{"phys_maxbarrier", CFG_OFS(phys_maxbarrier), FT_FLOAT},
{"phys_jumpvel", CFG_OFS(phys_jumpvel), FT_FLOAT},
{"phys_falldelta5", CFG_OFS(phys_falldelta5), FT_FLOAT},
{"phys_falldelta10", CFG_OFS(phys_falldelta10), FT_FLOAT},
{"rs_waterjump", CFG_OFS(rs_waterjump), FT_FLOAT},
{"rs_teleport", CFG_OFS(rs_teleport), FT_FLOAT},
{"rs_barrierjump", CFG_OFS(rs_barrierjump), FT_FLOAT},
{"rs_startcrouch", CFG_OFS(rs_startcrouch), FT_FLOAT},
{"rs_startgrapple", CFG_OFS(rs_startgrapple), FT_FLOAT},
{"rs_startwalkoffledge", CFG_OFS(rs_startwalkoffledge), FT_FLOAT},
{"rs_startjump", CFG_OFS(rs_startjump), FT_FLOAT},
{"rs_rocketjump", CFG_OFS(rs_rocketjump), FT_FLOAT},
{"rs_bfgjump", CFG_OFS(rs_bfgjump), FT_FLOAT},
{"rs_jumppad", CFG_OFS(rs_jumppad), FT_FLOAT},
{"rs_aircontrolledjumppad", CFG_OFS(rs_aircontrolledjumppad), FT_FLOAT},
{"rs_funcbob", CFG_OFS(rs_funcbob), FT_FLOAT},
{"rs_startelevator", CFG_OFS(rs_startelevator), FT_FLOAT},
{"rs_falldamage5", CFG_OFS(rs_falldamage5), FT_FLOAT},
{"rs_falldamage10", CFG_OFS(rs_falldamage10), FT_FLOAT},
{"rs_maxfallheight", CFG_OFS(rs_maxfallheight), FT_FLOAT},
{"rs_maxjumpfallheight", CFG_OFS(rs_maxjumpfallheight), FT_FLOAT},
{NULL, 0, 0, 0}
{"phys_gravitydirection", CFG_OFS(phys_gravitydirection), FT_FLOAT|FT_ARRAY, 3, 0, 0, NULL},
{"phys_friction", CFG_OFS(phys_friction), FT_FLOAT, 0, 0, 0, NULL},
{"phys_stopspeed", CFG_OFS(phys_stopspeed), FT_FLOAT, 0, 0, 0, NULL},
{"phys_gravity", CFG_OFS(phys_gravity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_waterfriction", CFG_OFS(phys_waterfriction), FT_FLOAT, 0, 0, 0, NULL},
{"phys_watergravity", CFG_OFS(phys_watergravity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxvelocity", CFG_OFS(phys_maxvelocity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxwalkvelocity", CFG_OFS(phys_maxwalkvelocity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxcrouchvelocity", CFG_OFS(phys_maxcrouchvelocity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxswimvelocity", CFG_OFS(phys_maxswimvelocity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_walkaccelerate", CFG_OFS(phys_walkaccelerate), FT_FLOAT, 0, 0, 0, NULL},
{"phys_airaccelerate", CFG_OFS(phys_airaccelerate), FT_FLOAT, 0, 0, 0, NULL},
{"phys_swimaccelerate", CFG_OFS(phys_swimaccelerate), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxstep", CFG_OFS(phys_maxstep), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxsteepness", CFG_OFS(phys_maxsteepness), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxwaterjump", CFG_OFS(phys_maxwaterjump), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxbarrier", CFG_OFS(phys_maxbarrier), FT_FLOAT, 0, 0, 0, NULL},
{"phys_jumpvel", CFG_OFS(phys_jumpvel), FT_FLOAT, 0, 0, 0, NULL},
{"phys_falldelta5", CFG_OFS(phys_falldelta5), FT_FLOAT, 0, 0, 0, NULL},
{"phys_falldelta10", CFG_OFS(phys_falldelta10), FT_FLOAT, 0, 0, 0, NULL},
{"rs_waterjump", CFG_OFS(rs_waterjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_teleport", CFG_OFS(rs_teleport), FT_FLOAT, 0, 0, 0, NULL},
{"rs_barrierjump", CFG_OFS(rs_barrierjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startcrouch", CFG_OFS(rs_startcrouch), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startgrapple", CFG_OFS(rs_startgrapple), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startwalkoffledge", CFG_OFS(rs_startwalkoffledge), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startjump", CFG_OFS(rs_startjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_rocketjump", CFG_OFS(rs_rocketjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_bfgjump", CFG_OFS(rs_bfgjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_jumppad", CFG_OFS(rs_jumppad), FT_FLOAT, 0, 0, 0, NULL},
{"rs_aircontrolledjumppad", CFG_OFS(rs_aircontrolledjumppad), FT_FLOAT, 0, 0, 0, NULL},
{"rs_funcbob", CFG_OFS(rs_funcbob), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startelevator", CFG_OFS(rs_startelevator), FT_FLOAT, 0, 0, 0, NULL},
{"rs_falldamage5", CFG_OFS(rs_falldamage5), FT_FLOAT, 0, 0, 0, NULL},
{"rs_falldamage10", CFG_OFS(rs_falldamage10), FT_FLOAT, 0, 0, 0, NULL},
{"rs_maxfallheight", CFG_OFS(rs_maxfallheight), FT_FLOAT, 0, 0, 0, NULL},
{"rs_maxjumpfallheight", CFG_OFS(rs_maxjumpfallheight), FT_FLOAT, 0, 0, 0, NULL},
{NULL, 0, 0, 0, 0, 0, NULL}
};
structdef_t bbox_struct =

View File

@ -467,7 +467,7 @@ void CreateAASFilesForAllBSPFiles(char *quakepath)
quakefile_t *GetArgumentFiles(int argc, char *argv[], int *i, char *ext)
{
quakefile_t *qfiles, *lastqf, *qf;
int j;
size_t j;
char buf[1024];
qfiles = NULL;

View File

@ -247,7 +247,7 @@ int FastChecksum(void *buffer, int bytes)
int checksum = 0, i;
char *buf;
// while( bytes-- )
// while( bytes-- )
// checksum = (checksum << 4) ^ *((char *)buffer)++;
buf = (char *) buffer;
@ -268,10 +268,10 @@ int HL_CompressVis(byte *vis, byte *dest)
int rep;
int visrow;
byte *dest_p;
dest_p = dest;
visrow = (hl_numleafs + 7)>>3;
for (j=0 ; j<visrow ; j++)
{
*dest_p++ = vis[j];
@ -287,7 +287,7 @@ int HL_CompressVis(byte *vis, byte *dest)
*dest_p++ = rep;
j--;
}
return dest_p - dest;
}
@ -303,7 +303,7 @@ void HL_DecompressVis (byte *in, byte *decompressed)
byte *out;
int row;
row = (hl_numleafs+7)>>3;
row = (hl_numleafs+7)>>3;
out = decompressed;
do
@ -313,7 +313,7 @@ void HL_DecompressVis (byte *in, byte *decompressed)
*out++ = *in++;
continue;
}
c = in[1];
in += 2;
while (c)
@ -339,8 +339,8 @@ void HL_SwapBSPFile (qboolean todisk)
hl_dmodel_t *d;
hl_dmiptexlump_t *mtl;
// models
// models
for (i = 0; i < hl_nummodels; i++)
{
d = &hl_dmodels[i];
@ -351,7 +351,7 @@ void HL_SwapBSPFile (qboolean todisk)
d->visleafs = LittleLong(d->visleafs);
d->firstface = LittleLong(d->firstface);
d->numfaces = LittleLong(d->numfaces);
for (j = 0; j < 3; j++)
{
d->mins[j] = LittleFloat(d->mins[j]);
@ -368,10 +368,10 @@ void HL_SwapBSPFile (qboolean todisk)
for (j = 0; j < 3; j++)
hl_dvertexes[i].point[j] = LittleFloat (hl_dvertexes[i].point[j]);
}
//
// planes
//
//
for (i=0 ; i<hl_numplanes ; i++)
{
for (j=0 ; j<3 ; j++)
@ -379,10 +379,10 @@ void HL_SwapBSPFile (qboolean todisk)
hl_dplanes[i].dist = LittleFloat (hl_dplanes[i].dist);
hl_dplanes[i].type = LittleLong (hl_dplanes[i].type);
}
//
// texinfos
//
//
for (i=0 ; i<hl_numtexinfo ; i++)
{
for (j=0 ; j<2 ; j++)
@ -395,7 +395,7 @@ void HL_SwapBSPFile (qboolean todisk)
hl_texinfo[i].miptex = LittleLong (hl_texinfo[i].miptex);
hl_texinfo[i].flags = LittleLong (hl_texinfo[i].flags);
}
//
// faces
//
@ -467,7 +467,7 @@ void HL_SwapBSPFile (qboolean todisk)
for (i=0 ; i<c ; i++)
mtl->dataofs[i] = LittleLong(mtl->dataofs[i]);
}
//
// marksurfaces
//
@ -500,7 +500,7 @@ int HL_CopyLump (int lump, void *dest, int size, int maxsize)
length = hl_header->lumps[lump].filelen;
ofs = hl_header->lumps[lump].fileofs;
if (length % size) {
Error ("LoadBSPFile: odd lump size");
}
@ -529,15 +529,13 @@ HL_LoadBSPFile
*/
void HL_LoadBSPFile (char *filename, int offset, int length)
{
int i;
//
// load the file header
//
hl_fileLength = LoadFile (filename, (void **)&hl_header, offset, length);
// swap the header
for (i=0 ; i< sizeof(hl_dheader_t)/4 ; i++)
for (size_t i=0 ; i< sizeof(hl_dheader_t)/4 ; i++)
((int *)hl_header)[i] = LittleLong ( ((int *)hl_header)[i]);
if (hl_header->version != HL_BSPVERSION)
@ -561,10 +559,10 @@ void HL_LoadBSPFile (char *filename, int offset, int length)
hl_entdatasize = HL_CopyLump (HL_LUMP_ENTITIES, hl_dentdata, 1, HL_MAX_MAP_ENTSTRING );
FreeMemory(hl_header); // everything has been copied out
//
// swap everything
//
//
HL_SwapBSPFile (false);
hl_dmodels_checksum = FastChecksum( hl_dmodels, hl_nummodels*sizeof(hl_dmodels[0]) );
@ -595,7 +593,7 @@ void HL_AddLump (int lumpnum, void *data, int len)
hl_lump_t *lump;
lump = &hl_header->lumps[lumpnum];
lump->fileofs = LittleLong( ftell(wadfile) );
lump->filelen = LittleLong(len);
SafeWrite (wadfile, data, (len+3)&~3);
@ -609,14 +607,14 @@ Swaps the bsp file in place, so it should not be referenced again
=============
*/
void HL_WriteBSPFile (char *filename)
{
{
hl_header = &outheader;
memset (hl_header, 0, sizeof(hl_dheader_t));
HL_SwapBSPFile (true);
hl_header->version = LittleLong (HL_BSPVERSION);
wadfile = SafeOpenWrite (filename);
SafeWrite (wadfile, hl_header, sizeof(hl_dheader_t)); // overwritten later
@ -636,10 +634,10 @@ void HL_WriteBSPFile (char *filename)
HL_AddLump (HL_LUMP_VISIBILITY, hl_dvisdata, hl_visdatasize);
HL_AddLump (HL_LUMP_ENTITIES, hl_dentdata, hl_entdatasize);
HL_AddLump (HL_LUMP_TEXTURES, hl_dtexdata, hl_texdatasize);
fseek (wadfile, 0, SEEK_SET);
SafeWrite (wadfile, hl_header, sizeof(hl_dheader_t));
fclose (wadfile);
fclose (wadfile);
}
//============================================================================
@ -651,7 +649,7 @@ int ArrayUsage( char *szItem, int items, int maxitems, int itemsize )
{
float percentage = maxitems ? items * 100.0 / maxitems : 0.0;
qprintf("%-12s %7i/%-7i %7i/%-7i (%4.1f%%)",
qprintf("%-12s %7i/%-7i %7i/%-7i (%4.1f%%)",
szItem, items, maxitems, items * itemsize, maxitems * itemsize, percentage );
if ( percentage > 80.0 )
qprintf( "VERY FULL!\n" );
@ -668,7 +666,7 @@ int GlobUsage( char *szItem, int itemstorage, int maxstorage )
{
float percentage = maxstorage ? itemstorage * 100.0 / maxstorage : 0.0;
qprintf("%-12s [variable] %7i/%-7i (%4.1f%%)",
qprintf("%-12s [variable] %7i/%-7i (%4.1f%%)",
szItem, itemstorage, maxstorage, percentage );
if ( percentage > 80.0 )
qprintf( "VERY FULL!\n" );
@ -726,10 +724,10 @@ ParseEpair
epair_t *ParseEpair (void)
{
epair_t *e;
e = malloc (sizeof(epair_t));
memset (e, 0, sizeof(epair_t));
if (strlen(token) >= MAX_KEY-1)
Error ("ParseEpar: token too long");
e->key = copystring(token);
@ -757,7 +755,7 @@ qboolean ParseEntity (void)
if (strcmp (token, "{") )
Error ("ParseEntity: { not found");
if (num_entities == HL_MAX_MAP_ENTITIES)
Error ("num_entities == HL_MAX_MAP_ENTITIES");
@ -774,7 +772,7 @@ qboolean ParseEntity (void)
e->next = mapent->epairs;
mapent->epairs = e;
} while (1);
return true;
} //*/
@ -815,20 +813,20 @@ void HL_UnparseEntities (void)
epair_t *ep;
char line[2048];
int i;
buf = hl_dentdata;
end = buf;
*end = 0;
for (i=0 ; i<num_entities ; i++)
{
ep = entities[i].epairs;
if (!ep)
continue; // ent got removed
strcat (end,"{\n");
end += 2;
for (ep = entities[i].epairs ; ep ; ep=ep->next)
{
sprintf (line, "\"%s\" \"%s\"\n", ep->key, ep->value);
@ -849,7 +847,7 @@ void HL_UnparseEntities (void)
void SetKeyValue (entity_t *ent, char *key, char *value)
{
epair_t *ep;
for (ep=ent->epairs ; ep ; ep=ep->next)
if (!strcmp (ep->key, key) )
{
@ -867,7 +865,7 @@ void SetKeyValue (entity_t *ent, char *key, char *value)
char *ValueForKey (entity_t *ent, char *key)
{
epair_t *ep;
for (ep=ent->epairs ; ep ; ep=ep->next)
if (!strcmp (ep->key, key) )
return ep->value;
@ -877,7 +875,7 @@ char *ValueForKey (entity_t *ent, char *key)
vec_t FloatForKey (entity_t *ent, char *key)
{
char *k;
k = ValueForKey (ent, key);
return atof(k);
}

View File

@ -231,8 +231,8 @@ void Q1_SwapBSPFile (qboolean todisk)
q1_dmodel_t *d;
q1_dmiptexlump_t *mtl;
// models
// models
for (i=0 ; i<q1_nummodels ; i++)
{
d = &q1_dmodels[i];
@ -243,7 +243,7 @@ void Q1_SwapBSPFile (qboolean todisk)
d->visleafs = LittleLong (d->visleafs);
d->firstface = LittleLong (d->firstface);
d->numfaces = LittleLong (d->numfaces);
for (j=0 ; j<3 ; j++)
{
d->mins[j] = LittleFloat(d->mins[j]);
@ -260,10 +260,10 @@ void Q1_SwapBSPFile (qboolean todisk)
for (j=0 ; j<3 ; j++)
q1_dvertexes[i].point[j] = LittleFloat(q1_dvertexes[i].point[j]);
}
//
// planes
//
//
for (i=0 ; i<q1_numplanes ; i++)
{
for (j=0 ; j<3 ; j++)
@ -271,10 +271,10 @@ void Q1_SwapBSPFile (qboolean todisk)
q1_dplanes[i].dist = LittleFloat(q1_dplanes[i].dist);
q1_dplanes[i].type = LittleLong(q1_dplanes[i].type);
}
//
// texinfos
//
//
for (i=0 ; i<q1_numtexinfo ; i++)
{
for (j=0 ; j<2 ; j++)
@ -287,7 +287,7 @@ void Q1_SwapBSPFile (qboolean todisk)
q1_texinfo[i].miptex = LittleLong(q1_texinfo[i].miptex);
q1_texinfo[i].flags = LittleLong(q1_texinfo[i].flags);
}
//
// faces
//
@ -359,7 +359,7 @@ void Q1_SwapBSPFile (qboolean todisk)
for (i=0 ; i<c ; i++)
mtl->dataofs[i] = LittleLong(mtl->dataofs[i]);
}
//
// marksurfaces
//
@ -392,7 +392,7 @@ int Q1_CopyLump (int lump, void *dest, int size, int maxsize)
length = q1_header->lumps[lump].filelen;
ofs = q1_header->lumps[lump].fileofs;
if (length % size) {
Error ("LoadBSPFile: odd lump size");
}
@ -421,19 +421,17 @@ Q1_LoadBSPFile
*/
void Q1_LoadBSPFile(char *filename, int offset, int length)
{
int i;
//
// load the file header
//
q1_fileLength = LoadFile(filename, (void **)&q1_header, offset, length);
// swap the header
for (i=0 ; i< sizeof(q1_dheader_t)/4 ; i++)
for (size_t i=0 ; i< sizeof(q1_dheader_t)/4 ; i++)
((int *)q1_header)[i] = LittleLong ( ((int *)q1_header)[i]);
if (q1_header->version != Q1_BSPVERSION)
Error ("%s is version %i, not %i", filename, i, Q1_BSPVERSION);
Error ("%s is version %i, not %i", filename, q1_header->version, Q1_BSPVERSION);
q1_nummodels = Q1_CopyLump (Q1_LUMP_MODELS, q1_dmodels, sizeof(q1_dmodel_t), Q1_MAX_MAP_MODELS );
q1_numvertexes = Q1_CopyLump (Q1_LUMP_VERTEXES, q1_dvertexes, sizeof(q1_dvertex_t), Q1_MAX_MAP_VERTS );
@ -453,10 +451,10 @@ void Q1_LoadBSPFile(char *filename, int offset, int length)
q1_entdatasize = Q1_CopyLump (Q1_LUMP_ENTITIES, q1_dentdata, 1, Q1_MAX_MAP_ENTSTRING );
FreeMemory(q1_header); // everything has been copied out
//
// swap everything
//
//
Q1_SwapBSPFile (false);
}
@ -470,7 +468,7 @@ void Q1_AddLump (int lumpnum, void *data, int len)
q1_lump_t *lump;
lump = &q1_header->lumps[lumpnum];
lump->fileofs = LittleLong(ftell(q1_wadfile));
lump->filelen = LittleLong(len);
SafeWrite(q1_wadfile, data, (len+3)&~3);
@ -484,14 +482,14 @@ Swaps the bsp file in place, so it should not be referenced again
=============
*/
void Q1_WriteBSPFile (char *filename)
{
{
q1_header = &q1_outheader;
memset (q1_header, 0, sizeof(q1_dheader_t));
Q1_SwapBSPFile (true);
q1_header->version = LittleLong (Q1_BSPVERSION);
q1_wadfile = SafeOpenWrite (filename);
SafeWrite (q1_wadfile, q1_header, sizeof(q1_dheader_t)); // overwritten later
@ -511,10 +509,10 @@ void Q1_WriteBSPFile (char *filename)
Q1_AddLump (Q1_LUMP_VISIBILITY, q1_dvisdata, q1_visdatasize);
Q1_AddLump (Q1_LUMP_ENTITIES, q1_dentdata, q1_entdatasize);
Q1_AddLump (Q1_LUMP_TEXTURES, q1_dtexdata, q1_texdatasize);
fseek (q1_wadfile, 0, SEEK_SET);
SafeWrite (q1_wadfile, q1_header, sizeof(q1_dheader_t));
fclose (q1_wadfile);
fclose (q1_wadfile);
}
//============================================================================
@ -595,20 +593,20 @@ char *Q1_UnparseEntities(int *size)
epair_t *ep;
char line[2048];
int i;
buf = q1_dentdata;
end = buf;
*end = 0;
for (i=0 ; i<num_entities ; i++)
{
ep = entities[i].epairs;
if (!ep)
continue; // ent got removed
strcat (end,"{\n");
end += 2;
for (ep = entities[i].epairs ; ep ; ep=ep->next)
{
sprintf (line, "\"%s\" \"%s\"\n", ep->key, ep->value);

View File

@ -431,7 +431,7 @@ winding_t *Q2_BrushSideWinding(dbrush_t *brush, dbrushside_t *baseside)
dplane_t *baseplane, *plane;
winding_t *w;
dbrushside_t *side;
//create a winding for the brush side with the given planenumber
baseplane = &dplanes[baseside->planenum];
w = BaseWindingForPlane(baseplane->normal, baseplane->dist);
@ -571,11 +571,11 @@ int Q2_CompressVis (byte *vis, byte *dest)
int rep;
int visrow;
byte *dest_p;
dest_p = dest;
// visrow = (r_numvisleafs + 7)>>3;
visrow = (dvis->numclusters + 7)>>3;
for (j=0 ; j<visrow ; j++)
{
*dest_p++ = vis[j];
@ -591,7 +591,7 @@ int Q2_CompressVis (byte *vis, byte *dest)
*dest_p++ = rep;
j--;
}
return dest_p - dest;
}
@ -607,8 +607,8 @@ void Q2_DecompressVis (byte *in, byte *decompressed)
byte *out;
int row;
// row = (r_numvisleafs+7)>>3;
row = (dvis->numclusters+7)>>3;
// row = (r_numvisleafs+7)>>3;
row = (dvis->numclusters+7)>>3;
out = decompressed;
do
@ -618,7 +618,7 @@ void Q2_DecompressVis (byte *in, byte *decompressed)
*out++ = *in++;
continue;
}
c = in[1];
if (!c)
Error ("DecompressVis: 0 repeat");
@ -645,8 +645,8 @@ void Q2_SwapBSPFile (qboolean todisk)
int i, j, k;
dmodel_t *d;
// models
// models
for (i=0 ; i<nummodels ; i++)
{
d = &dmodels[i];
@ -654,7 +654,7 @@ void Q2_SwapBSPFile (qboolean todisk)
d->firstface = LittleLong (d->firstface);
d->numfaces = LittleLong (d->numfaces);
d->headnode = LittleLong (d->headnode);
for (j=0 ; j<3 ; j++)
{
d->mins[j] = LittleFloat(d->mins[j]);
@ -671,10 +671,10 @@ void Q2_SwapBSPFile (qboolean todisk)
for (j=0 ; j<3 ; j++)
dvertexes[i].point[j] = LittleFloat (dvertexes[i].point[j]);
}
//
// planes
//
//
for (i=0 ; i<numplanes ; i++)
{
for (j=0 ; j<3 ; j++)
@ -682,10 +682,10 @@ void Q2_SwapBSPFile (qboolean todisk)
dplanes[i].dist = LittleFloat (dplanes[i].dist);
dplanes[i].type = LittleLong (dplanes[i].type);
}
//
// texinfos
//
//
for (i=0 ; i<numtexinfo ; i++)
{
for (j=0 ; j<2 ; j++)
@ -699,7 +699,7 @@ void Q2_SwapBSPFile (qboolean todisk)
texinfo[i].value = LittleLong (texinfo[i].value);
texinfo[i].nexttexinfo = LittleLong (texinfo[i].nexttexinfo);
}
//
// faces
//
@ -838,7 +838,7 @@ int Q2_CopyLump (int lump, void *dest, int size, int maxsize)
length = header->lumps[lump].filelen;
ofs = header->lumps[lump].fileofs;
if (length % size)
Error ("LoadBSPFile: odd lump size");
@ -857,15 +857,13 @@ LoadBSPFile
*/
void Q2_LoadBSPFile(char *filename, int offset, int length)
{
int i;
//
// load the file header
//
LoadFile (filename, (void **)&header, offset, length);
// swap the header
for (i=0 ; i< sizeof(dheader_t)/4 ; i++)
for (size_t i=0 ; i< sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (header->ident != IDBSPHEADER)
@ -896,10 +894,10 @@ void Q2_LoadBSPFile(char *filename, int offset, int length)
Q2_CopyLump (LUMP_POP, dpop, 1, MAX_MAP_DPOP);
FreeMemory(header); // everything has been copied out
//
// swap everything
//
//
Q2_SwapBSPFile (false);
Q2_FixTextureReferences();
@ -915,7 +913,6 @@ Only loads the texinfo lump, so qdata can scan for textures
*/
void Q2_LoadBSPFileTexinfo (char *filename)
{
int i;
FILE *f;
int length, ofs;
@ -925,7 +922,7 @@ void Q2_LoadBSPFileTexinfo (char *filename)
fread (header, sizeof(dheader_t), 1, f);
// swap the header
for (i=0 ; i< sizeof(dheader_t)/4 ; i++)
for (size_t i=0 ; i< sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (header->ident != IDBSPHEADER)
@ -944,7 +941,7 @@ void Q2_LoadBSPFileTexinfo (char *filename)
numtexinfo = length / sizeof(texinfo_t);
FreeMemory(header); // everything has been copied out
Q2_SwapBSPFile (false);
} //end of the function Q2_LoadBSPFileTexinfo
@ -959,7 +956,7 @@ void Q2_AddLump (int lumpnum, void *data, int len)
lump_t *lump;
lump = &header->lumps[lumpnum];
lump->fileofs = LittleLong( ftell(wadfile) );
lump->filelen = LittleLong(len);
SafeWrite (wadfile, data, (len+3)&~3);
@ -973,15 +970,15 @@ Swaps the bsp file in place, so it should not be referenced again
=============
*/
void Q2_WriteBSPFile (char *filename)
{
{
header = &outheader;
memset (header, 0, sizeof(dheader_t));
Q2_SwapBSPFile (true);
header->ident = LittleLong (IDBSPHEADER);
header->version = LittleLong (BSPVERSION);
wadfile = SafeOpenWrite (filename);
SafeWrite (wadfile, header, sizeof(dheader_t)); // overwritten later
@ -1005,10 +1002,10 @@ void Q2_WriteBSPFile (char *filename)
Q2_AddLump (LUMP_VISIBILITY, dvisdata, visdatasize);
Q2_AddLump (LUMP_ENTITIES, dentdata, entdatasize);
Q2_AddLump (LUMP_POP, dpop, sizeof(dpop));
fseek (wadfile, 0, SEEK_SET);
SafeWrite (wadfile, header, sizeof(dheader_t));
fclose (wadfile);
fclose (wadfile);
} //end of the function Q2_WriteBSPFile
//============================================================================
@ -1107,23 +1104,23 @@ char *Q2_UnparseEntities(int *size)
buf = dentdata;
end = buf;
*end = 0;
for (i=0 ; i<num_entities ; i++)
{
ep = entities[i].epairs;
if (!ep)
continue; // ent got removed
strcat (end,"{\n");
end += 2;
for (ep = entities[i].epairs ; ep ; ep=ep->next)
{
strcpy (key, ep->key);
StripTrailing (key);
strcpy (value, ep->value);
StripTrailing (value);
sprintf (line, "\"%s\" \"%s\"\n", key, value);
strcat (end, line);
end += strlen(line);

View File

@ -334,7 +334,7 @@ winding_t *Sin_BrushSideWinding(sin_dbrush_t *brush, sin_dbrushside_t *baseside)
sin_dplane_t *baseplane, *plane;
sin_dbrushside_t *side;
winding_t *w;
//create a winding for the brush side with the given planenumber
baseplane = &sin_dplanes[baseside->planenum];
w = BaseWindingForPlane(baseplane->normal, baseplane->dist);
@ -471,11 +471,11 @@ int Sin_CompressVis (byte *vis, byte *dest)
int rep;
int visrow;
byte *dest_p;
dest_p = dest;
// visrow = (r_numvisleafs + 7)>>3;
visrow = (sin_dvis->numclusters + 7)>>3;
for (j=0 ; j<visrow ; j++)
{
*dest_p++ = vis[j];
@ -491,7 +491,7 @@ int Sin_CompressVis (byte *vis, byte *dest)
*dest_p++ = rep;
j--;
}
return dest_p - dest;
} //end of the function Sin_CompressVis
@ -507,8 +507,8 @@ void Sin_DecompressVis (byte *in, byte *decompressed)
byte *out;
int row;
// row = (r_numvisleafs+7)>>3;
row = (sin_dvis->numclusters+7)>>3;
// row = (r_numvisleafs+7)>>3;
row = (sin_dvis->numclusters+7)>>3;
out = decompressed;
do
@ -518,7 +518,7 @@ void Sin_DecompressVis (byte *in, byte *decompressed)
*out++ = *in++;
continue;
}
c = in[1];
if (!c)
Error ("DecompressVis: 0 repeat");
@ -545,8 +545,8 @@ void Sin_SwapBSPFile (qboolean todisk)
int i, j, k;
sin_dmodel_t *d;
// models
// models
for (i=0 ; i<sin_nummodels ; i++)
{
d = &sin_dmodels[i];
@ -554,7 +554,7 @@ void Sin_SwapBSPFile (qboolean todisk)
d->firstface = LittleLong (d->firstface);
d->numfaces = LittleLong (d->numfaces);
d->headnode = LittleLong (d->headnode);
for (j=0 ; j<3 ; j++)
{
d->mins[j] = LittleFloat(d->mins[j]);
@ -571,10 +571,10 @@ void Sin_SwapBSPFile (qboolean todisk)
for (j=0 ; j<3 ; j++)
sin_dvertexes[i].point[j] = LittleFloat (sin_dvertexes[i].point[j]);
}
//
// planes
//
//
for (i=0 ; i<sin_numplanes ; i++)
{
for (j=0 ; j<3 ; j++)
@ -582,10 +582,10 @@ void Sin_SwapBSPFile (qboolean todisk)
sin_dplanes[i].dist = LittleFloat (sin_dplanes[i].dist);
sin_dplanes[i].type = LittleLong (sin_dplanes[i].type);
}
//
// sin_texinfos
//
//
for (i = 0; i < sin_numtexinfo; i++)
{
for (j=0 ; j<2 ; j++)
@ -596,13 +596,13 @@ void Sin_SwapBSPFile (qboolean todisk)
}
}
#ifdef SIN
sin_texinfo[i].trans_mag = LittleFloat( sin_texinfo[i].trans_mag );
sin_texinfo[i].trans_angle = LittleLong( sin_texinfo[i].trans_angle );
sin_texinfo[i].animtime = LittleFloat( sin_texinfo[i].animtime );
sin_texinfo[i].nonlit = LittleFloat( sin_texinfo[i].nonlit );
sin_texinfo[i].translucence = LittleFloat( sin_texinfo[i].translucence );
sin_texinfo[i].friction = LittleFloat( sin_texinfo[i].friction );
sin_texinfo[i].restitution = LittleFloat( sin_texinfo[i].restitution );
sin_texinfo[i].trans_mag = LittleFloat( sin_texinfo[i].trans_mag );
sin_texinfo[i].trans_angle = LittleLong( sin_texinfo[i].trans_angle );
sin_texinfo[i].animtime = LittleFloat( sin_texinfo[i].animtime );
sin_texinfo[i].nonlit = LittleFloat( sin_texinfo[i].nonlit );
sin_texinfo[i].translucence = LittleFloat( sin_texinfo[i].translucence );
sin_texinfo[i].friction = LittleFloat( sin_texinfo[i].friction );
sin_texinfo[i].restitution = LittleFloat( sin_texinfo[i].restitution );
sin_texinfo[i].flags = LittleUnsigned (sin_texinfo[i].flags);
#else
sin_texinfo[i].value = LittleLong (sin_texinfo[i].value);
@ -614,7 +614,7 @@ void Sin_SwapBSPFile (qboolean todisk)
#ifdef SIN
//
// lightinfos
//
//
for (i = 0; i < sin_numlightinfo; i++)
{
for (j=0 ; j<3 ; j++)
@ -622,12 +622,12 @@ void Sin_SwapBSPFile (qboolean todisk)
sin_lightinfo[i].color[j] = LittleFloat (sin_lightinfo[i].color[j]);
}
sin_lightinfo[i].value = LittleLong (sin_lightinfo[i].value);
sin_lightinfo[i].direct = LittleFloat( sin_lightinfo[i].direct );
sin_lightinfo[i].directangle = LittleFloat( sin_lightinfo[i].directangle );
sin_lightinfo[i].directstyle = LittleFloat( sin_lightinfo[i].directstyle );
sin_lightinfo[i].direct = LittleFloat( sin_lightinfo[i].direct );
sin_lightinfo[i].directangle = LittleFloat( sin_lightinfo[i].directangle );
sin_lightinfo[i].directstyle = LittleFloat( sin_lightinfo[i].directstyle );
}
#endif
//
// faces
//
@ -794,13 +794,13 @@ int Sin_CopyLump (int lump, void *dest, int size, int maxsize)
length = header->lumps[lump].filelen;
ofs = header->lumps[lump].fileofs;
if (length % size)
Error ("Sin_LoadBSPFile: odd lump size");
if ((length/size) > maxsize)
Error ("Sin_LoadBSPFile: exceeded max size for lump %d size %d > maxsize %d\n", lump, (length/size), maxsize );
memcpy (dest, (byte *)header + ofs, length);
return length / size;
@ -812,10 +812,10 @@ int Sin_CopyLump (int lump, void *dest, int size)
length = header->lumps[lump].filelen;
ofs = header->lumps[lump].fileofs;
if (length % size)
Error ("Sin_LoadBSPFile: odd lump size");
memcpy (dest, (byte *)header + ofs, length);
return length / size;
@ -829,15 +829,13 @@ Sin_LoadBSPFile
*/
void Sin_LoadBSPFile(char *filename, int offset, int length)
{
int i;
//
// load the file header
//
LoadFile (filename, (void **)&header, offset, length);
// swap the header
for (i=0 ; i< sizeof(sin_dheader_t)/4 ; i++)
for (size_t i=0 ; i< sizeof(sin_dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (header->ident != SIN_BSPHEADER && header->ident != SINGAME_BSPHEADER)
@ -893,10 +891,10 @@ void Sin_LoadBSPFile(char *filename, int offset, int length)
#endif
FreeMemory(header); // everything has been copied out
//
// swap everything
//
//
Sin_SwapBSPFile (false);
} //end of the function Sin_LoadBSPFile
@ -909,7 +907,6 @@ Only loads the sin_texinfo lump, so qdata can scan for textures
*/
void Sin_LoadBSPFileTexinfo (char *filename)
{
int i;
FILE *f;
int length, ofs;
@ -919,7 +916,7 @@ void Sin_LoadBSPFileTexinfo (char *filename)
fread (header, sizeof(sin_dheader_t), 1, f);
// swap the header
for (i=0 ; i< sizeof(sin_dheader_t)/4 ; i++)
for (size_t i=0 ; i< sizeof(sin_dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (header->ident != SIN_BSPHEADER && header->ident != SINGAME_BSPHEADER)
@ -938,7 +935,7 @@ void Sin_LoadBSPFileTexinfo (char *filename)
sin_numtexinfo = length / sizeof(sin_texinfo_t);
FreeMemory(header); // everything has been copied out
Sin_SwapBSPFile (false);
} //end of the function Sin_LoadBSPFilesTexinfo
@ -960,7 +957,7 @@ void Sin_AddLump (int lumpnum, void *data, int len, int size, int maxsize)
Error ("Sin_WriteBSPFile: exceeded max size for lump %d size %d > maxsize %d\n", lumpnum, len, maxsize );
lump = &header->lumps[lumpnum];
lump->fileofs = LittleLong( ftell(wadfile) );
lump->filelen = LittleLong(totallength);
SafeWrite (wadfile, data, (totallength+3)&~3);
@ -971,7 +968,7 @@ void Sin_AddLump (int lumpnum, void *data, int len)
sin_lump_t *lump;
lump = &header->lumps[lumpnum];
lump->fileofs = LittleLong( ftell(wadfile) );
lump->filelen = LittleLong(len);
SafeWrite (wadfile, data, (len+3)&~3);
@ -985,15 +982,15 @@ Swaps the bsp file in place, so it should not be referenced again
=============
*/
void Sin_WriteBSPFile (char *filename)
{
{
header = &outheader;
memset (header, 0, sizeof(sin_dheader_t));
Sin_SwapBSPFile (true);
header->ident = LittleLong (SIN_BSPHEADER);
header->version = LittleLong (SIN_BSPVERSION);
wadfile = SafeOpenWrite (filename);
SafeWrite (wadfile, header, sizeof(sin_dheader_t)); // overwritten later
@ -1041,10 +1038,10 @@ void Sin_WriteBSPFile (char *filename)
Sin_AddLump (SIN_LUMP_ENTITIES, sin_dentdata, sin_entdatasize);
Sin_AddLump (SIN_LUMP_POP, sin_dpop, sizeof(sin_dpop));
#endif
fseek (wadfile, 0, SEEK_SET);
SafeWrite (wadfile, header, sizeof(sin_dheader_t));
fclose (wadfile);
fclose (wadfile);
}
//============================================================================
@ -1094,23 +1091,23 @@ void Sin_UnparseEntities (void)
buf = sin_dentdata;
end = buf;
*end = 0;
for (i=0 ; i<num_entities ; i++)
{
ep = entities[i].epairs;
if (!ep)
continue; // ent got removed
strcat (end,"{\n");
end += 2;
for (ep = entities[i].epairs ; ep ; ep=ep->next)
{
strcpy (key, ep->key);
StripTrailing (key);
strcpy (value, ep->value);
StripTrailing (value);
sprintf (line, "\"%s\" \"%s\"\n", key, value);
strcat (end, line);
end += strlen(line);

View File

@ -358,9 +358,9 @@ I_FloatTime
double I_FloatTime (void)
{
time_t t;
time (&t);
return t;
#if 0
// more precise, less portable
@ -369,13 +369,13 @@ double I_FloatTime (void)
static int secbase;
gettimeofday(&tp, &tzp);
if (!secbase)
{
secbase = tp.tv_sec;
return tp.tv_usec/1000000.0;
}
return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
#endif
}
@ -391,7 +391,9 @@ void Q_getwd (char *out)
#endif
}
#ifdef WIN32
#include <direct.h>
#endif
void Q_mkdir (char *path)
{
#ifdef WIN32
@ -415,10 +417,10 @@ returns -1 if not present
int FileTime (char *path)
{
struct stat buf;
if (stat (path,&buf) == -1)
return -1;
return buf.st_mtime;
}
@ -435,13 +437,13 @@ char *COM_Parse (char *data)
{
int c;
int len;
len = 0;
com_token[0] = 0;
if (!data)
return NULL;
// skip whitespace
skipwhite:
while ( (c = *data) <= ' ')
@ -453,7 +455,7 @@ skipwhite:
}
data++;
}
// skip // comments
if (c=='/' && data[1] == '/')
{
@ -461,7 +463,7 @@ skipwhite:
data++;
goto skipwhite;
}
// handle quoted strings specially
if (c == '\"')
@ -499,7 +501,7 @@ skipwhite:
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
break;
} while (c>32);
com_token[len] = 0;
return data;
}
@ -508,7 +510,7 @@ skipwhite:
int Q_strncasecmp (char *s1, char *s2, int n)
{
int c1, c2;
do
{
c1 = *s1++;
@ -516,7 +518,7 @@ int Q_strncasecmp (char *s1, char *s2, int n)
if (!n--)
return 0; // strings are equal until end point
if (c1 != c2)
{
if (c1 >= 'a' && c1 <= 'z')
@ -527,7 +529,7 @@ int Q_strncasecmp (char *s1, char *s2, int n)
return -1; // strings not equal
}
} while (c1);
return 0; // strings are equal
}
@ -935,13 +937,13 @@ int BigLong (int l)
float LittleFloat (float l)
{
union {byte b[4]; float f;} in, out;
in.f = l;
out.b[0] = in.b[3];
out.b[1] = in.b[2];
out.b[2] = in.b[1];
out.b[3] = in.b[0];
return out.f;
}
@ -1024,13 +1026,13 @@ int LittleLong (int l)
float BigFloat (float l)
{
union {byte b[4]; float f;} in, out;
in.f = l;
out.b[0] = in.b[3];
out.b[1] = in.b[2];
out.b[2] = in.b[1];
out.b[3] = in.b[0];
return out.f;
}

View File

@ -246,7 +246,6 @@ quakefile_t *FindQuakeFilesInZip(char *zipfile, char *filter)
unz_global_info gi;
char filename_inzip[MAX_PATH];
unz_file_info file_info;
int i;
quakefile_t *qfiles, *lastqf, *qf;
uf = unzOpen(zipfile);
@ -258,7 +257,7 @@ quakefile_t *FindQuakeFilesInZip(char *zipfile, char *filter)
qfiles = NULL;
lastqf = NULL;
for (i = 0; i < gi.number_entry; i++)
for (size_t i = 0; i < gi.number_entry; i++)
{
err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL,0,NULL,0);
if (err != UNZ_OK) break;

View File

@ -181,7 +181,7 @@ void CMod_LoadNodes( lump_t *l ) {
int child;
cNode_t *out;
int i, j, count;
in = (void *)(cmod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
@ -272,7 +272,7 @@ void CMod_LoadLeafs (lump_t *l)
cLeaf_t *out;
dleaf_t *in;
int count;
in = (void *)(cmod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
@ -284,7 +284,7 @@ void CMod_LoadLeafs (lump_t *l)
cm.leafs = Hunk_Alloc( ( BOX_LEAFS + count ) * sizeof( *cm.leafs ), h_high );
cm.numLeafs = count;
out = cm.leafs;
out = cm.leafs;
for ( i=0 ; i<count ; i++, in++, out++)
{
out->cluster = LittleLong (in->cluster);
@ -316,7 +316,7 @@ void CMod_LoadPlanes (lump_t *l)
dplane_t *in;
int count;
int bits;
in = (void *)(cmod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
@ -327,7 +327,7 @@ void CMod_LoadPlanes (lump_t *l)
cm.planes = Hunk_Alloc( ( BOX_PLANES + count ) * sizeof( *cm.planes ), h_high );
cm.numPlanes = count;
out = cm.planes;
out = cm.planes;
for ( i=0 ; i<count ; i++, in++, out++)
{
@ -356,7 +356,7 @@ void CMod_LoadLeafBrushes (lump_t *l)
int *out;
int *in;
int count;
in = (void *)(cmod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
@ -383,7 +383,7 @@ void CMod_LoadLeafSurfaces( lump_t *l )
int *out;
int *in;
int count;
in = (void *)(cmod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
@ -421,7 +421,7 @@ void CMod_LoadBrushSides (lump_t *l)
cm.brushsides = Hunk_Alloc( ( BOX_SIDES + count ) * sizeof( *cm.brushsides ), h_high );
cm.numBrushSides = count;
out = cm.brushsides;
out = cm.brushsides;
for ( i=0 ; i<count ; i++, in++, out++) {
num = LittleLong( in->planeNum );
@ -572,7 +572,6 @@ void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
int *i;
void *v;
} buf;
int i;
dheader_t header;
int length;
static unsigned last_checksum;
@ -623,7 +622,7 @@ void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
*checksum = last_checksum;
header = *(dheader_t *) buf.i;
for (i=0 ; i<sizeof(dheader_t)/4 ; i++) {
for (size_t i=0 ; i<sizeof(dheader_t)/4 ; i++) {
((int *)&header)[i] = LittleLong ( ((int *)&header)[i]);
}
@ -687,7 +686,7 @@ cmodel_t *CM_ClipHandleToModel( clipHandle_t handle ) {
return &box_model;
}
if ( handle < MAX_SUBMODELS ) {
Com_Error( ERR_DROP, "CM_ClipHandleToModel: bad handle %i < %i < %i",
Com_Error( ERR_DROP, "CM_ClipHandleToModel: bad handle %i < %i < %i",
cm.numSubModels, handle, MAX_SUBMODELS );
}
Com_Error( ERR_DROP, "CM_ClipHandleToModel: bad handle %i", handle + MAX_SUBMODELS );
@ -787,7 +786,7 @@ void CM_InitBoxHull (void)
p->normal[i>>1] = -1;
SetPlaneSignbits( p );
}
}
}
/*

View File

@ -215,8 +215,9 @@ void SwapBSPFile( qboolean todisk ){
//
for ( i = 0 ; i < numtexinfo ; i++ )
{
for ( j = 0 ; j < 8 ; j++ )
texinfo[i].vecs[0][j] = LittleFloat( texinfo[i].vecs[0][j] );
for ( j = 0 ; j < 2 ; j++ )
for ( int k = 0 ; k < 4 ; k++ )
texinfo[i].vecs[j][k] = LittleFloat( texinfo[i].vecs[j][k] );
texinfo[i].flags = LittleLong( texinfo[i].flags );
texinfo[i].value = LittleLong( texinfo[i].value );
texinfo[i].nexttexinfo = LittleLong( texinfo[i].nexttexinfo );
@ -377,15 +378,13 @@ int CopyLump( int lump, void *dest, int size ){
=============
*/
void LoadBSPFile( char *filename ){
int i;
//
// load the file header
//
LoadFile( filename, (void **)&header );
// swap the header
for ( i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
for ( size_t i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
( (int *)header )[i] = LittleLong( ( (int *)header )[i] );
if ( header->ident != IDBSPHEADER ) {
@ -434,7 +433,6 @@ void LoadBSPFile( char *filename ){
=============
*/
void LoadBSPFileTexinfo( char *filename ){
int i;
FILE *f;
int length, ofs;
@ -444,7 +442,7 @@ void LoadBSPFileTexinfo( char *filename ){
fread( header, sizeof( dheader_t ), 1, f );
// swap the header
for ( i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
for ( size_t i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
( (int *)header )[i] = LittleLong( ( (int *)header )[i] );
if ( header->ident != IDBSPHEADER ) {

View File

@ -177,8 +177,6 @@ void SetQdirFromPath( const char *path ){
len = strlen( basedirname );
for ( c = path + strlen( path ) - 1 ; c != path ; c-- )
{
int i;
if ( !Q_strncasecmp( c, basedirname, len ) ) {
//
//strncpy (qdir, path, c+len+2-path);
@ -194,7 +192,7 @@ void SetQdirFromPath( const char *path ){
}
strncpy( qdir, path, c + len + count - path );
Sys_FPrintf( SYS_VRB, "qdir: %s\n", qdir );
for ( i = 0; i < strlen( qdir ); i++ )
for ( size_t i = 0; i < strlen( qdir ); i++ )
{
if ( qdir[i] == '\\' ) {
qdir[i] = '/';
@ -207,7 +205,7 @@ void SetQdirFromPath( const char *path ){
if ( *c == '/' || *c == '\\' ) {
strncpy( gamedir, path, c + 1 - path );
for ( i = 0; i < strlen( gamedir ); i++ )
for ( size_t i = 0; i < strlen( gamedir ); i++ )
{
if ( gamedir[i] == '\\' ) {
gamedir[i] = '/';
@ -250,7 +248,7 @@ char *ExpandArg( const char *path ){
char *ExpandPath( const char *path ){
static char full[1024];
if ( !qdir ) {
if ( !qdir[0] ) {
Error( "ExpandPath called without qdir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
@ -263,7 +261,7 @@ char *ExpandPath( const char *path ){
char *ExpandGamePath( const char *path ){
static char full[1024];
if ( !qdir ) {
if ( !qdir[0] ) {
Error( "ExpandGamePath called without qdir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {

View File

@ -32,7 +32,7 @@
#include <time.h>
#include <stdarg.h>
#ifdef WIN32
#ifdef _MSC_VER
#ifdef NDEBUG // Don't show in a Release build
#pragma warning(disable : 4305) // truncate from double to float
#pragma warning(disable : 4244) // conversion from double to float
@ -40,7 +40,7 @@
#endif
#endif
#ifdef WIN32
#ifdef _MSC_VER
#pragma intrinsic( memset, memcpy )
#endif

View File

@ -66,8 +66,8 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
char buf[1024];
sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, "point" );
xmlNodeAddContent( ret, buf );
ret = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( ret, (const xmlChar*)buf );
return ret;
}
@ -76,8 +76,8 @@ void xml_SendNode( xmlNodePtr node ){
xmlBufferPtr xml_buf;
char xmlbuf[MAX_NETMESSAGE]; // we have to copy content from the xmlBufferPtr into an aux buffer .. that sucks ..
// this index loops through the node buffer
int pos = 0;
int size;
size_t pos = 0;
size_t size;
xmlAddChild( doc->children, node );
@ -144,15 +144,15 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, "select" );
xmlNodeAddContent( node, buf );
node = xmlNewNode( NULL, (const xmlChar*)"select" );
xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, "brush" );
xmlNodeAddContent( select, buf );
select = xmlNewNode( NULL, (const xmlChar*)"brush" );
xmlNodeAddContent( select, (const xmlChar*)buf );
xmlAddChild( node, select );
xml_SendNode( node );
@ -171,15 +171,15 @@ void xml_Point( char *msg, vec3_t pt ){
char buf[1024];
char level[2];
node = xmlNewNode( NULL, "pointmsg" );
xmlNodeAddContent( node, msg );
node = xmlNewNode( NULL, (const xmlChar*)"pointmsg" );
xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, "point" );
xmlNodeAddContent( point, buf );
point = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( point, (const xmlChar*)buf );
xmlAddChild( node, point );
xml_SendNode( node );
@ -195,11 +195,11 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
char level[2];
int i;
node = xmlNewNode( NULL, "windingmsg" );
xmlNodeAddContent( node, msg );
node = xmlNewNode( NULL, (const xmlChar*)"windingmsg" );
xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'winding' node
sprintf( buf, "%i ", numpoints );
for ( i = 0; i < numpoints; i++ )
@ -212,8 +212,8 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
strcat( buf, smlbuf );
}
winding = xmlNewNode( NULL, "winding" );
xmlNodeAddContent( winding, buf );
winding = xmlNewNode( NULL, (const xmlChar*)"winding" );
xmlNodeAddContent( winding, (const xmlChar*)buf );
xmlAddChild( node, winding );
xml_SendNode( node );
@ -235,7 +235,7 @@ void Broadcast_Setup( const char *dest ){
char sMsg[1024];
Net_Setup();
Net_StringToAddress( (char *)dest, &address );
Net_StringToAddress( dest, &address );
brdcst_socket = Net_Connect( &address, 0 );
if ( brdcst_socket ) {
// send in a header
@ -277,15 +277,15 @@ void FPrintf( int flag, char *buf ){
*/
if ( !bGotXML ) {
// initialize
doc = xmlNewDoc( "1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, "q3map_feedback", NULL );
doc = xmlNewDoc( (const xmlChar*)"1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, (const xmlChar*)"q3map_feedback", NULL );
bGotXML = true;
}
node = xmlNewNode( NULL, "message" );
xmlNodeAddContent( node, buf );
node = xmlNewNode( NULL, (const xmlChar*)"message" );
xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + flag;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
xml_SendNode( node );
}

View File

@ -322,8 +322,8 @@ void InitPaths( int *argc, char **argv ){
/* remove processed arguments */
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
{
for ( j; j < *argc && argv[ j ] == NULL; j++ ) ;
argv[ i ] = argv[ j ];
for ( ; j < *argc && argv[ j ] == NULL; j++ );
argv[ i ] = argv[ j ];
if ( argv[ i ] != NULL ) {
k++;
}

View File

@ -160,7 +160,6 @@ void ThreadUnlock( void ){
=============
*/
void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
int threadid[MAX_THREADS];
HANDLE threadhandle[MAX_THREADS];
int i;
int start, end;
@ -194,7 +193,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
(LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr,
(LPVOID)i, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate,
&threadid[i] );
NULL );
}
for ( i = 0 ; i < numthreads ; i++ )

View File

@ -56,9 +56,7 @@ typedef struct {
void ByteSwapTri( tf_triangle *tri ){
int i;
for ( i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
for ( size_t i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
{
( (int *)tri )[i] = BigLong( ( (int *)tri )[i] );
}

View File

@ -765,13 +765,11 @@ side_t *SelectSplitSide( bspbrush_t *brushes, node_t *node ){
int s;
int front, back, both, facing, splits;
int bsplits;
int bestsplits;
int epsilonbrush;
qboolean hintsplit;
bestside = NULL;
bestvalue = -99999;
bestsplits = 0;
// the search order goes: visible-structural, visible-detail,
// nonvisible-structural, nonvisible-detail.
@ -879,7 +877,7 @@ side_t *SelectSplitSide( bspbrush_t *brushes, node_t *node ){
if ( value > bestvalue ) {
bestvalue = value;
bestside = side;
bestsplits = splits;
// bestsplits = splits;
for ( test = brushes ; test ; test = test->next )
test->side = test->testside;
}

View File

@ -134,7 +134,7 @@ xmlNodePtr LeakFile( tree_t *tree ){
Error( "Couldn't open %s\n", filename );
}
xml_node = xmlNewNode( NULL, "polyline" );
xml_node = xmlNewNode( NULL, (const xmlChar*)"polyline" );
count = 0;
node = &tree->outside_node;

View File

@ -326,7 +326,7 @@ void AddPointToTriangulation( patch_t *patch, triangulation_t *trian ){
void LerpTriangle( triangulation_t *trian, triangle_t *t, vec3_t point, vec3_t color ){
patch_t *p1, *p2, *p3;
vec3_t base, d1, d2;
float x, y, x1, y1, x2, y2;
float x, y, y1, x2;
p1 = trian->points[t->edges[0]->p0];
p2 = trian->points[t->edges[1]->p0];
@ -339,11 +339,11 @@ void LerpTriangle( triangulation_t *trian, triangle_t *t, vec3_t point, vec3_
x = DotProduct( point, t->edges[0]->normal ) - t->edges[0]->dist;
y = DotProduct( point, t->edges[2]->normal ) - t->edges[2]->dist;
x1 = 0;
// x1 = 0;
y1 = DotProduct( p2->origin, t->edges[2]->normal ) - t->edges[2]->dist;
x2 = DotProduct( p3->origin, t->edges[0]->normal ) - t->edges[0]->dist;
y2 = 0;
// y2 = 0;
if ( fabs( y1 ) < ON_EPSILON || fabs( x2 ) < ON_EPSILON ) {
VectorCopy( base, color );
@ -787,7 +787,7 @@ void CreateDirectLights( void ){
//
// surfaces
//
for ( i = 0, p = patches ; i < (int) num_patches ; i++, p++ )
for ( i = 0, p = patches ; i < num_patches ; i++, p++ )
{
if ( p->totallight[0] < DIRECT_LIGHT
&& p->totallight[1] < DIRECT_LIGHT

View File

@ -828,7 +828,6 @@ qboolean ParseMapEntity( void ){
epair_t *e;
side_t *s;
int i, j;
int startbrush, startsides;
vec_t newdist;
mapbrush_t *b;
@ -844,9 +843,6 @@ qboolean ParseMapEntity( void ){
Error( "num_entities == MAX_MAP_ENTITIES" );
}
startbrush = nummapbrushes;
startsides = nummapbrushsides;
mapent = &entities[num_entities];
num_entities++;
memset( mapent, 0, sizeof( *mapent ) );

View File

@ -241,12 +241,12 @@ void ProcessWorldModel( void ){
Sys_FPrintf( SYS_NOXML, "******* leaked *******\n" );
Sys_FPrintf( SYS_NOXML, "**********************\n" );
polyline = LeakFile( tree );
leaknode = xmlNewNode( NULL, "message" );
xmlNodeAddContent( leaknode, "MAP LEAKED\n" );
leaknode = xmlNewNode( NULL, (const xmlChar*)"message" );
xmlNodeAddContent( leaknode, (const xmlChar*)"MAP LEAKED\n" );
xmlAddChild( leaknode, polyline );
level[0] = (int) '0' + SYS_ERR;
level[1] = 0;
xmlSetProp( leaknode, "level", (char*) &level );
xmlSetProp( leaknode, (const xmlChar*)"level", (const xmlChar*)level );
xml_SendNode( leaknode );
if ( leaktest ) {
Sys_Printf( "--- MAP LEAKED, ABORTING LEAKTEST ---\n" );

View File

@ -36,7 +36,7 @@
patch_t *face_patches[MAX_MAP_FACES];
entity_t *face_entity[MAX_MAP_FACES];
patch_t patches[MAX_PATCHES];
unsigned num_patches;
int num_patches;
vec3_t radiosity[MAX_PATCHES]; // light leaving a patch
vec3_t illumination[MAX_PATCHES]; // light arriving at a patch
@ -201,7 +201,7 @@ void MakeTransfers( int i ){
float total;
dplane_t plane;
vec3_t origin;
float transfers[MAX_PATCHES], *all_transfers;
float transfers[MAX_PATCHES];
int s;
int itotal;
byte pvs[( MAX_MAP_LEAFS + 7 ) / 8];
@ -220,7 +220,6 @@ void MakeTransfers( int i ){
// find out which patch2s will collect light
// from patch
all_transfers = transfers;
patch->numtransfers = 0;
for ( j = 0, patch2 = patches ; j < num_patches ; j++, patch2++ )
{

View File

@ -115,7 +115,7 @@ extern patch_t *face_patches[MAX_MAP_FACES];
extern entity_t *face_entity[MAX_MAP_FACES];
extern vec3_t face_offset[MAX_MAP_FACES]; // for rotating bmodels
extern patch_t patches[MAX_PATCHES];
extern unsigned num_patches;
extern int num_patches;
extern int leafparents[MAX_MAP_LEAFS];
extern int nodeparents[MAX_MAP_NODES];

View File

@ -123,10 +123,10 @@ void prl( leaf_t *l ){
=============
*/
int PComp( const void *a, const void *b ){
if ( ( *(portal_t **)a )->nummightsee == ( *(portal_t **)b )->nummightsee ) {
if ( ( *(portal_t * const *)a )->nummightsee == ( *(portal_t * const *)b )->nummightsee ) {
return 0;
}
if ( ( *(portal_t **)a )->nummightsee < ( *(portal_t **)b )->nummightsee ) {
if ( ( *(portal_t * const *)a )->nummightsee < ( *(portal_t * const *)b )->nummightsee ) {
return -1;
}
return 1;
@ -386,8 +386,8 @@ void LoadPortals( char *name ){
if ( numpoints > MAX_POINTS_ON_WINDING ) {
Error( "LoadPortals: portal %i has too many points", i );
}
if ( (unsigned)leafnums[0] > portalclusters
|| (unsigned)leafnums[1] > portalclusters ) {
if ( leafnums[0] > portalclusters
|| leafnums[1] > portalclusters ) {
Error( "LoadPortals: reading portal %i", i );
}

View File

@ -46,13 +46,11 @@ void EmitPlanes( void ){
int i;
dplane_t *dp;
plane_t *mp;
int planetranslate[MAX_MAP_PLANES];
mp = mapplanes;
for ( i = 0 ; i < nummapplanes ; i++, mp++ )
{
dp = &dplanes[numplanes];
planetranslate[i] = numplanes;
VectorCopy( mp->normal, dp->normal );
dp->dist = mp->dist;
dp->type = mp->type;

View File

@ -410,11 +410,9 @@ byte AveragePixels( int count ){
int pix;
int bestcolor;
byte *pal;
int fullbright;
vis = 0;
r = g = b = 0;
fullbright = 0;
for ( i = 0 ; i < count ; i++ )
{
pix = pixdata[i];

View File

@ -128,14 +128,11 @@ void H_printf( char *fmt, ... ){
============
*/
void WriteModelFile( FILE *modelouthandle ){
int i;
dmdl_t modeltemp;
int j, k;
frame_t *in;
daliasframe_t *out;
byte buffer[MAX_VERTS * 4 + 128];
float v;
int c_on, c_off;
model.ident = IDALIASHEADER;
model.version = ALIAS_VERSION;
@ -151,7 +148,7 @@ void WriteModelFile( FILE *modelouthandle ){
//
// write out the model header
//
for ( i = 0 ; i < sizeof( dmdl_t ) / 4 ; i++ )
for ( size_t i = 0 ; i < sizeof( dmdl_t ) / 4 ; i++ )
( (int *)&modeltemp )[i] = LittleLong( ( (int *)&model )[i] );
SafeWrite( modelouthandle, &modeltemp, sizeof( modeltemp ) );
@ -164,8 +161,7 @@ void WriteModelFile( FILE *modelouthandle ){
//
// write out the texture coordinates
//
c_on = c_off = 0;
for ( i = 0 ; i < model.num_st ; i++ )
for ( int i = 0 ; i < model.num_st ; i++ )
{
base_st[i].s = LittleShort( base_st[i].s );
base_st[i].t = LittleShort( base_st[i].t );
@ -176,12 +172,11 @@ void WriteModelFile( FILE *modelouthandle ){
//
// write out the triangles
//
for ( i = 0 ; i < model.num_tris ; i++ )
for ( int i = 0 ; i < model.num_tris ; i++ )
{
int j;
dtriangle_t tri;
for ( j = 0 ; j < 3 ; j++ )
for ( int j = 0 ; j < 3 ; j++ )
{
tri.index_xyz[j] = LittleShort( triangles[i].index_xyz[j] );
tri.index_st[j] = LittleShort( triangles[i].index_st[j] );
@ -193,24 +188,24 @@ void WriteModelFile( FILE *modelouthandle ){
//
// write out the frames
//
for ( i = 0 ; i < model.num_frames ; i++ )
for ( int i = 0 ; i < model.num_frames ; i++ )
{
in = &g_frames[i];
out = (daliasframe_t *)buffer;
strcpy( out->name, in->name );
for ( j = 0 ; j < 3 ; j++ )
for ( int j = 0 ; j < 3 ; j++ )
{
out->scale[j] = ( in->maxs[j] - in->mins[j] ) / 255;
out->translate[j] = in->mins[j];
}
for ( j = 0 ; j < model.num_xyz ; j++ )
for ( int j = 0 ; j < model.num_xyz ; j++ )
{
// all of these are byte values, so no need to deal with endianness
out->verts[j].lightnormalindex = in->v[j].lightnormalindex;
for ( k = 0 ; k < 3 ; k++ )
for ( int k = 0 ; k < 3 ; k++ )
{
// scale to byte values & min/max check
v = Q_rint( ( in->v[j].v[k] - out->translate[k] ) / out->scale[k] );
@ -226,7 +221,7 @@ void WriteModelFile( FILE *modelouthandle ){
}
}
for ( j = 0 ; j < 3 ; j++ )
for ( int j = 0 ; j < 3 ; j++ )
{
out->scale[j] = LittleFloat( out->scale[j] );
out->translate[j] = LittleFloat( out->translate[j] );

View File

@ -45,7 +45,7 @@ void Cmd_Spritename( void );
*/
void FinishSprite( void ){
FILE *spriteouthandle;
int i, curframe;
int i;
dsprite_t spritetemp;
char savename[1024];
@ -87,8 +87,6 @@ void FinishSprite( void ){
//
// write out the frames
//
curframe = 0;
for ( i = 0 ; i < sprite.numframes ; i++ )
{
frames[i].width = LittleLong( frames[i].width );
@ -136,7 +134,7 @@ void Cmd_Load( void ){
===============
*/
void Cmd_SpriteFrame( void ){
int y,xl,yl,xh,yh,w,h;
int y,xl,yl,w,h;
dsprframe_t *pframe;
int ox, oy;
byte *cropped;
@ -172,9 +170,6 @@ void Cmd_SpriteFrame( void ){
Error( "Sprite has a dimension longer than 256" );
}
xh = xl + w;
yh = yl + h;
if ( sprite.numframes >= MAX_SPRFRAMES ) {
Error( "Too many frames; increase MAX_SPRFRAMES\n" );
}

View File

@ -93,7 +93,7 @@ void FindNextChunk( char *name ){
// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
data_p -= 8;
last_chunk = data_p + 8 + ( ( iff_chunk_len + 1 ) & ~1 );
if ( !strncmp( data_p, name, 4 ) ) {
if ( !strncmp( (const char*)data_p, name, 4 ) ) {
return;
}
}
@ -142,7 +142,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
// find "RIFF" chunk
FindChunk( "RIFF" );
if ( !( data_p && !strncmp( data_p + 8, "WAVE", 4 ) ) ) {
if ( !( data_p && !strncmp( (const char*)( data_p + 8 ), "WAVE", 4 ) ) ) {
printf( "Missing RIFF/WAVE chunks\n" );
return info;
}
@ -178,7 +178,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
// if the next chunk is a LIST chunk, look for a cue length marker
FindNextChunk( "LIST" );
if ( data_p ) {
if ( !strncmp( data_p + 28, "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit...
if ( !strncmp( (const char*)( data_p + 28 ), "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit...
data_p += 24;
i = GetLittleLong(); // samples in loop
info.samples = info.loopstart + i;
@ -344,8 +344,8 @@ int bwtCompare( const void *elem1, const void *elem2 ){
int i1, i2;
int b1, b2;
i1 = *(int *)elem1;
i2 = *(int *)elem2;
i1 = *(const int *)elem1;
i2 = *(const int *)elem2;
for ( i = 0 ; i < bwt_size ; i++ )
{
@ -490,7 +490,7 @@ cblock_t Huffman( cblock_t in ){
unsigned bits;
byte *out_p;
cblock_t out;
int max, maxchar;
int max;
// count
memset( hnodes, 0, sizeof( hnodes ) );
@ -499,12 +499,10 @@ cblock_t Huffman( cblock_t in ){
// normalize counts
max = 0;
maxchar = 0;
for ( i = 0 ; i < 256 ; i++ )
{
if ( hnodes[i].count > max ) {
max = hnodes[i].count;
maxchar = i;
}
}
if ( max == 0 ) {
@ -659,7 +657,7 @@ cblock_t LZSS( cblock_t in ){
int bestlength, beststart;
int outbits;
if ( in.count >= sizeof( lzss_next ) / 4 ) {
if ( in.count >= (int)sizeof( lzss_next ) / 4 ) {
Error( "LZSS: too big" );
}
@ -1256,7 +1254,7 @@ void Cmd_Video( void ){
command = 2;
fwrite( &command, 1, 4, output );
printf( "Total size: %i\n", ftell( output ) );
printf( "Total size: %ld\n", ftell( output ) );
fclose( output );

View File

@ -152,7 +152,7 @@ void AnimCompressDoit(){
}
void AnimCompressToBytes( float *trans,float *scale,char *mat,char *ccomp,unsigned char *cbase,float *cscale,float *coffset,float *bmin,float *bmax ){
int k,l,nv,j;
int k,l,j;
float maxdev;
float avedev;
float tmp;
@ -161,8 +161,6 @@ void AnimCompressToBytes( float *trans,float *scale,char *mat,char *ccomp,unsign
float *ans;
nv = MatWidth / 3;
trans[0] = 1E30f;
scale[0] = -1E30f;
trans[1] = 1E30f;

View File

@ -216,8 +216,9 @@ void SwapBSPFile( qboolean todisk ){
//
for ( i = 0 ; i < numtexinfo ; i++ )
{
for ( j = 0 ; j < 8 ; j++ )
texinfo[i].vecs[0][j] = LittleFloat( texinfo[i].vecs[0][j] );
for ( j = 0 ; j < 2 ; j++ )
for ( int k = 0 ; k < 4 ; k++ )
texinfo[i].vecs[j][k] = LittleFloat( texinfo[i].vecs[j][k] );
texinfo[i].flags = LittleLong( texinfo[i].flags );
texinfo[i].value = LittleLong( texinfo[i].value );
texinfo[i].nexttexinfo = LittleLong( texinfo[i].nexttexinfo );
@ -379,15 +380,13 @@ int CopyLump( int lump, void *dest, int size ){
=============
*/
void LoadBSPFile( char *filename ){
int i;
//
// load the file header
//
LoadFile( filename, (void **)&header );
// swap the header
for ( i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
for ( size_t i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
( (int *)header )[i] = LittleLong( ( (int *)header )[i] );
if ( header->ident != IDBSPHEADER ) {
@ -436,7 +435,6 @@ void LoadBSPFile( char *filename ){
=============
*/
void LoadBSPFileTexinfo( char *filename ){
int i;
FILE *f;
int length, ofs;
@ -446,7 +444,7 @@ void LoadBSPFileTexinfo( char *filename ){
fread( header, sizeof( dheader_t ), 1, f );
// swap the header
for ( i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
for ( size_t i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
( (int *)header )[i] = LittleLong( ( (int *)header )[i] );
if ( header->ident != IDBSPHEADER ) {

View File

@ -182,8 +182,6 @@ void SetQdirFromPath( const char *path ){
len = strlen( BASEDIRNAME );
for ( c = path + strlen( path ) - 1 ; c != path ; c-- )
{
int i;
if ( !Q_strncasecmp( c, BASEDIRNAME, len ) ) {
//
//strncpy (qdir, path, c+len+2-path);
@ -199,7 +197,7 @@ void SetQdirFromPath( const char *path ){
}
strncpy( qdir, path, c + len + count - path );
Sys_Printf( "qdir: %s\n", qdir );
for ( i = 0; i < strlen( qdir ); i++ )
for ( size_t i = 0; i < strlen( qdir ); i++ )
{
if ( qdir[i] == '\\' ) {
qdir[i] = '/';
@ -212,7 +210,7 @@ void SetQdirFromPath( const char *path ){
if ( *c == '/' || *c == '\\' ) {
strncpy( gamedir, path, c + 1 - path );
for ( i = 0; i < strlen( gamedir ); i++ )
for ( size_t i = 0; i < strlen( gamedir ); i++ )
{
if ( gamedir[i] == '\\' ) {
gamedir[i] = '/';
@ -255,7 +253,7 @@ char *ExpandArg( const char *path ){
char *ExpandPath( const char *path ){
static char full[1024];
if ( !qdir ) {
if ( !qdir[0] ) {
Error( "ExpandPath called without qdir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
@ -268,7 +266,7 @@ char *ExpandPath( const char *path ){
char *ExpandGamePath( const char *path ){
static char full[1024];
if ( !qdir ) {
if ( !qdir[0] ) {
Error( "ExpandGamePath called without qdir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {

View File

@ -24,7 +24,7 @@
#ifndef __CMDLIB__
#define __CMDLIB__
#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning(disable : 4244) // MIPS
#pragma warning(disable : 4136) // X86
#pragma warning(disable : 4051) // ALPHA
@ -44,7 +44,7 @@
#include <time.h>
#include <stdarg.h>
#ifdef _WIN32
#ifdef _MSC_VER
#pragma intrinsic( memset, memcpy )

View File

@ -66,8 +66,8 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
char buf[1024];
sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, "point" );
xmlNodeAddContent( ret, buf );
ret = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( ret, (const xmlChar*)buf );
return ret;
}
@ -76,8 +76,8 @@ void xml_SendNode( xmlNodePtr node ){
xmlBufferPtr xml_buf;
char xmlbuf[MAX_NETMESSAGE]; // we have to copy content from the xmlBufferPtr into an aux buffer .. that sucks ..
// this index loops through the node buffer
int pos = 0;
int size;
size_t pos = 0;
size_t size;
xmlAddChild( doc->children, node );
@ -144,15 +144,15 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, "select" );
xmlNodeAddContent( node, buf );
node = xmlNewNode( NULL, (const xmlChar*)"select" );
xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, "brush" );
xmlNodeAddContent( select, buf );
select = xmlNewNode( NULL, (const xmlChar*)"brush" );
xmlNodeAddContent( select, (const xmlChar*)buf );
xmlAddChild( node, select );
xml_SendNode( node );
@ -171,15 +171,15 @@ void xml_Point( char *msg, vec3_t pt ){
char buf[1024];
char level[2];
node = xmlNewNode( NULL, "pointmsg" );
xmlNodeAddContent( node, msg );
node = xmlNewNode( NULL, (const xmlChar*)"pointmsg" );
xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, "point" );
xmlNodeAddContent( point, buf );
point = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( point, (const xmlChar*)buf );
xmlAddChild( node, point );
xml_SendNode( node );
@ -195,11 +195,11 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
char level[2];
int i;
node = xmlNewNode( NULL, "windingmsg" );
xmlNodeAddContent( node, msg );
node = xmlNewNode( NULL, (const xmlChar*)"windingmsg" );
xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'winding' node
sprintf( buf, "%i ", numpoints );
for ( i = 0; i < numpoints; i++ )
@ -212,8 +212,8 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
strcat( buf, smlbuf );
}
winding = xmlNewNode( NULL, "winding" );
xmlNodeAddContent( winding, buf );
winding = xmlNewNode( NULL, (const xmlChar*)"winding" );
xmlNodeAddContent( winding, (const xmlChar*)buf );
xmlAddChild( node, winding );
xml_SendNode( node );
@ -235,7 +235,7 @@ void Broadcast_Setup( const char *dest ){
char sMsg[1024];
Net_Setup();
Net_StringToAddress( (char *)dest, &address );
Net_StringToAddress( dest, &address );
brdcst_socket = Net_Connect( &address, 0 );
if ( brdcst_socket ) {
// send in a header
@ -277,15 +277,15 @@ void FPrintf( int flag, char *buf ){
*/
if ( !bGotXML ) {
// initialize
doc = xmlNewDoc( "1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, "q3map_feedback", NULL );
doc = xmlNewDoc( (const xmlChar*)"1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, (const xmlChar*)"q3map_feedback", NULL );
bGotXML = true;
}
node = xmlNewNode( NULL, "message" );
xmlNodeAddContent( node, buf );
node = xmlNewNode( NULL, (const xmlChar*)"message" );
xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + flag;
level[1] = 0;
xmlSetProp( node, "level", (char *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
xml_SendNode( node );
}

View File

@ -94,9 +94,6 @@ void _VectorScale( vec3_t v, vec_t scale, vec3_t out ){
out[2] = v[2] * scale;
}
#pragma optimize("g", off) // went back to turning optimization off,
// the bug_fix thing stopped working
vec_t VectorNormalize( vec3_t in, vec3_t out ){
vec_t length, ilength;
@ -136,8 +133,6 @@ vec_t ColorNormalize( vec3_t in, vec3_t out ){
return max;
}
#pragma optimize("", on)
void VectorInverse( vec3_t v ){
v[0] = -v[0];
v[1] = -v[1];

View File

@ -323,8 +323,8 @@ void InitPaths( int *argc, char **argv ){
/* remove processed arguments */
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
{
for ( j; j < *argc && argv[ j ] == NULL; j++ ) ;
argv[ i ] = argv[ j ];
for ( ; j < *argc && argv[ j ] == NULL; j++ );
argv[ i ] = argv[ j ];
if ( argv[ i ] != NULL ) {
k++;
}

View File

@ -159,7 +159,6 @@ void ThreadUnlock( void ){
=============
*/
void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
int threadid[MAX_THREADS];
HANDLE threadhandle[MAX_THREADS];
int i;
int start, end;
@ -193,7 +192,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
(LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr,
(LPVOID)i, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate,
&threadid[i] );
NULL );
}
for ( i = 0 ; i < numthreads ; i++ )

View File

@ -71,9 +71,7 @@ typedef struct {
void ByteSwapTri( tf_triangle *tri ){
int i;
for ( i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
for ( size_t i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
{
( (int *)tri )[i] = BigLong( ( (int *)tri )[i] );
}

View File

@ -226,7 +226,6 @@ static void WriteModelFile( FILE *modelouthandle ){
fmaliasframe_t *out;
byte buffer[MAX_FM_VERTS * 4 + 128];
float v;
int c_on, c_off;
IntListNode_t *current, *toFree;
qboolean framesWritten = false;
size_t temp,size = 0;
@ -256,7 +255,6 @@ static void WriteModelFile( FILE *modelouthandle ){
//
// write out the texture coordinates
//
c_on = c_off = 0;
for ( i = 0 ; i < fmheader.num_st ; i++ )
{
base_st[i].s = LittleShort( base_st[i].s );
@ -1322,7 +1320,7 @@ static void BuildGlCmds( void ){
int best_st[1024];
int best_tris[1024];
int type;
int trans_check;
unsigned trans_check;
int bit,pos;
//

View File

@ -257,7 +257,7 @@ void GL_MipMap8P( byte *out, byte *in, int width, int height, palette_t *palette
miptex_t *CreateMip( byte *data, unsigned width, unsigned height, byte *palette, int *FinalSize, qboolean mip ){
int scaled_width, scaled_height;
unsigned scaled_width, scaled_height;
int i,j,r,g,b;
byte intensitytable[256];
byte scaled[256 * 256];
@ -265,7 +265,7 @@ miptex_t *CreateMip( byte *data, unsigned width, unsigned height, byte *palette,
int miplevel;
miptex_t *mp;
byte *pos;
int size;
unsigned size;
for ( i = 0 ; i < 256 ; i++ )
{
@ -422,13 +422,13 @@ void GL_MipMap( byte *out, byte *in, int width, int height ){
}
miptex32_t *CreateMip32( unsigned *data, unsigned width, unsigned height, int *FinalSize, qboolean mip ){
int scaled_width, scaled_height;
unsigned scaled_width, scaled_height;
unsigned scaled[MAX_IMAGE_SIZE * MAX_IMAGE_SIZE];
unsigned out[MAX_IMAGE_SIZE * MAX_IMAGE_SIZE];
int miplevel;
miptex32_t *mp;
byte *pos;
int size;
unsigned size;
paletteRGBA_t *test;
for ( scaled_width = 1 ; scaled_width < width ; scaled_width <<= 1 )
@ -872,11 +872,9 @@ byte AveragePixels( int count ){
int pix;
int bestcolor;
byte *pal;
int fullbright;
vis = 0;
r = g = b = 0;
fullbright = 0;
for ( i = 0 ; i < count ; i++ )
{
pix = pixdata[i];

View File

@ -171,7 +171,6 @@ static void LoadHRCJointList( char *fileName, QDataJoint_t *jointList, int skelT
vec3_t curTranslation[MAX_STACK], curRotation[MAX_STACK], curScale[MAX_STACK];
int curCorrespondingJoint[MAX_STACK];
int currentStack = 0, stackSize;
int baseJoint;
float cx, sx, cy, sy, cz, sz;
float rx, ry, rz;
float x2, y2, z2;
@ -338,8 +337,6 @@ static void LoadHRCJointList( char *fileName, QDataJoint_t *jointList, int skelT
jointList[i].placement.up[2] += jointList[i].placement.origin[2];
}
baseJoint = NUM_JOINTS_RAVEN;
for ( i = stackSize /*NUM_JOINTS_RAVEN*/ - 1; i > 0; --i )
{

View File

@ -170,7 +170,6 @@ void WriteCommonModelFile( FILE *modelouthandle, PartialAliasFrame_t *outFrames
daliasframe_t *out;
byte buffer[MAX_VERTS * 4 + 128];
float v;
int c_on, c_off;
model.version = ALIAS_VERSION;
model.framesize = (int)&( (daliasframe_t *)0 )->verts[model.num_xyz];
@ -184,7 +183,7 @@ void WriteCommonModelFile( FILE *modelouthandle, PartialAliasFrame_t *outFrames
//
// write out the model header
//
for ( i = 0 ; i < sizeof( dmdl_t ) / 4 ; i++ )
for ( i = 0 ; i < (int)sizeof( dmdl_t ) / 4 ; i++ )
( (int *)&modeltemp )[i] = LittleLong( ( (int *)&model )[i] );
SafeWrite( modelouthandle, &modeltemp, sizeof( modeltemp ) );
@ -197,7 +196,6 @@ void WriteCommonModelFile( FILE *modelouthandle, PartialAliasFrame_t *outFrames
//
// write out the texture coordinates
//
c_on = c_off = 0;
for ( i = 0 ; i < model.num_st ; i++ )
{
base_st[i].s = LittleShort( base_st[i].s );

View File

@ -72,4 +72,6 @@
#define SHORT_TO_ANGLE ( 360.0 / 65536 )
#ifdef _MSC_VER
#pragma warning(disable : 4305) // 'initializing' : truncation from 'const double ' to 'float '
#endif

View File

@ -53,7 +53,7 @@ extern char *g_outputDir;
*/
void FinishSprite( void ){
FILE *spriteouthandle;
int i, curframe;
int i;
dsprite_t spritetemp;
char savename[1024];
@ -95,8 +95,6 @@ void FinishSprite( void ){
//
// write out the frames
//
curframe = 0;
for ( i = 0 ; i < sprite.numframes ; i++ )
{
frames[i].width = LittleLong( frames[i].width );

View File

@ -241,7 +241,7 @@ int SaveScript( char *name ){
int i, j;
glxy_t buff;
if ( fp = fopen( name, "wb" ) ) {
if ( ( fp = fopen( name, "wb" ) ) ) {
for ( j = 0; j < filenum; j++ )
{
for ( i = 0; i < filenum; i++ )
@ -281,7 +281,7 @@ int GetScriptInfo( char *name ){
printf( "Opening script file %s.\n", name );
if ( fp = fopen( name, "r" ) ) {
if ( ( fp = fopen( name, "r" ) ) ) {
while ( fgets( buffer, 256, fp ) )
{
if ( strncmp( buffer, "//", 2 ) && strncmp( buffer, "\n", 1 ) ) {

View File

@ -63,8 +63,8 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
char buf[1024];
sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, (xmlChar*)"point" );
xmlNodeAddContent( ret, (xmlChar*)buf );
ret = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( ret, (const xmlChar*)buf );
return ret;
}
@ -147,15 +147,15 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, (xmlChar*)"select" );
xmlNodeAddContent( node, (xmlChar*)buf );
node = xmlNewNode( NULL, (const xmlChar*)"select" );
xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar *)level );
// a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, (xmlChar*)"brush" );
xmlNodeAddContent( select, (xmlChar*)buf );
select = xmlNewNode( NULL, (const xmlChar*)"brush" );
xmlNodeAddContent( select, (const xmlChar*)buf );
xmlAddChild( node, select );
xml_SendNode( node );
@ -173,15 +173,15 @@ void xml_Point( char *msg, vec3_t pt ){
char buf[1024];
char level[2];
node = xmlNewNode( NULL, (xmlChar*)"pointmsg" );
xmlNodeAddContent( node, (xmlChar*)msg );
node = xmlNewNode( NULL, (const xmlChar*)"pointmsg" );
xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar *)level );
// a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, (xmlChar*)"point" );
xmlNodeAddContent( point, (xmlChar*)buf );
point = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( point, (const xmlChar*)buf );
xmlAddChild( node, point );
xml_SendNode( node );
@ -197,11 +197,11 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
char level[2];
int i;
node = xmlNewNode( NULL, (xmlChar*)"windingmsg" );
xmlNodeAddContent( node, (xmlChar*)msg );
node = xmlNewNode( NULL, (const xmlChar*)"windingmsg" );
xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
xmlSetProp( node, (xmlChar*)"level", (const xmlChar *)level );
// a 'winding' node
sprintf( buf, "%i ", numpoints );
for ( i = 0; i < numpoints; i++ )
@ -214,8 +214,8 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
strcat( buf, smlbuf );
}
winding = xmlNewNode( NULL, (xmlChar*)"winding" );
xmlNodeAddContent( winding, (xmlChar*)buf );
winding = xmlNewNode( NULL, (const xmlChar*)"winding" );
xmlNodeAddContent( winding, (const xmlChar*)buf );
xmlAddChild( node, winding );
xml_SendNode( node );
@ -295,18 +295,18 @@ void xml_message_flush(){
if( mesege_len == 0 )
return;
xmlNodePtr node;
node = xmlNewNode( NULL, (xmlChar*)"message" );
node = xmlNewNode( NULL, (const xmlChar*)"message" );
{
mesege[mesege_len] = '\0';
mesege_len = 0;
gchar* utf8 = g_locale_to_utf8( mesege, -1, NULL, NULL, NULL );
xmlNodeAddContent( node, (xmlChar*)utf8 );
xmlNodeAddContent( node, (const xmlChar*)utf8 );
g_free( utf8 );
}
char level[2];
level[0] = (int)'0' + mesege_flag;
level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
xmlSetProp( node, (const xmlChar*)"level", (const xmlChar *)level );
xml_SendNode( node );
}
@ -356,8 +356,8 @@ void FPrintf( int flag, char *buf ){
*/
if ( !bGotXML ) {
// initialize
doc = xmlNewDoc( (xmlChar*)"1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, (xmlChar*)"q3map_feedback", NULL );
doc = xmlNewDoc( (const xmlChar*)"1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, (const xmlChar*)"q3map_feedback", NULL );
bGotXML = qtrue;
}
xml_message_push( flag & ~( SYS_NOXMLflag | SYS_VRBflag ), buf, strlen( buf ) );

View File

@ -106,7 +106,7 @@ void FindNextChunk( char *name ){
// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
data_p -= 8;
last_chunk = data_p + 8 + ( ( iff_chunk_len + 1 ) & ~1 );
if ( !memcmp( data_p, name, 4 ) ) {
if ( !strncmp( (const char*)data_p, name, 4 ) ) {
return;
}
}
@ -155,7 +155,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
// find "RIFF" chunk
FindChunk( "RIFF" );
if ( !( data_p && !memcmp( data_p + 8, "WAVE", 4 ) ) ) {
if ( !( data_p && !strncmp( (const char*)( data_p + 8 ), "WAVE", 4 ) ) ) {
printf( "Missing RIFF/WAVE chunks\n" );
return info;
}
@ -191,7 +191,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
// if the next chunk is a LIST chunk, look for a cue length marker
FindNextChunk( "LIST" );
if ( data_p ) {
if ( !memcmp( data_p + 28, "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit...
if ( !strncmp( (const char*)( data_p + 28 ), "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit...
data_p += 24;
i = GetLittleLong(); // samples in loop
info.samples = info.loopstart + i;

View File

@ -398,12 +398,12 @@ void ProcessWorldModel( void ){
Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "******* leaked *******\n" );
Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" );
polyline = LeakFile( tree );
leaknode = xmlNewNode( NULL, (xmlChar*)"message" );
xmlNodeAddContent( leaknode, (xmlChar*)"MAP LEAKED\n" );
leaknode = xmlNewNode( NULL, (const xmlChar*)"message" );
xmlNodeAddContent( leaknode, (const xmlChar*)"MAP LEAKED\n" );
xmlAddChild( leaknode, polyline );
level[0] = (int) '0' + SYS_ERR;
level[1] = 0;
xmlSetProp( leaknode, (xmlChar*)"level", (xmlChar*) &level );
xmlSetProp( leaknode, (xmlChar*)"level", (const xmlChar*)level );
xml_SendNode( leaknode );
if ( leaktest ) {
Sys_FPrintf( SYS_WRN, "--- MAP LEAKED, ABORTING LEAKTEST ---\n" );

View File

@ -82,7 +82,7 @@ xmlNodePtr LeakFile( tree_t *tree ){
Error( "Couldn't open %s\n", filename );
}
xml_node = xmlNewNode( NULL, (xmlChar*)"polyline" );
xml_node = xmlNewNode( NULL, (const xmlChar*)"polyline" );
count = 0;
node = &tree->outside_node;

View File

@ -490,7 +490,7 @@ void InitPaths( int *argc, char **argv ){
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
{
for ( ; j < *argc && argv[ j ] == NULL; j++ ) ;
argv[ i ] = argv[ j ];
argv[ i ] = argv[ j ];
if ( argv[ i ] != NULL ) {
k++;
}