cl.movement_queue[cl.movement_numqueue++] = cl.movement_queue[i];
}
// add to input queue if there is room
- if (cl_movement.integer && cl.movement_numqueue < sizeof(cl.movement_queue)/sizeof(cl.movement_queue[0]) && cl.mtime[0] > cl.mtime[1])
+ if (cl_movement.integer && cl.movement_numqueue < (int)(sizeof(cl.movement_queue)/sizeof(cl.movement_queue[0])) && cl.mtime[0] > cl.mtime[1])
{
// add to input queue
cl.movement_queue[cl.movement_numqueue].sequence = cl.movesequence;
do {
colorindex = colorindex * 10 + (*current - '0');
// only read as long as it makes a valid index
- if( colorindex >= STRING_COLORS_COUNT ) {
+ if( colorindex >= (int)STRING_COLORS_COUNT ) {
// undo the last operation
colorindex /= 10;
break;
// finish the wave file
if (cl_capturevideo_soundfile)
{
- i = FS_Tell (cl_capturevideo_soundfile);
+ i = (int)FS_Tell (cl_capturevideo_soundfile);
//"RIFF", (int) unknown (chunk size), "WAVE",
//"fmt ", (int) 16 (chunk size), (short) format 1 (uncompressed PCM), (short) 2 channels, (int) unknown rate, (int) unknown bytes per second, (short) 4 bytes per sample (channels * bytes per channel), (short) 16 bits per channel
//"data", (int) unknown (chunk size)
}
// store timestamp
for (;*timestamp;index++, timestamp++)
- if (index < sizeof(line) - 2)
+ if (index < (int)sizeof(line) - 2)
line[index] = *timestamp;
}
// append the character
*/
int FS_Print (qfile_t* file, const char *msg)
{
- return FS_Write (file, msg, strlen (msg));
+ return (int)FS_Write (file, msg, strlen (msg));
}
/*
{
// look through all the pak file elements
pak = searchpath->pack;
- for (i = 0;i < pak->numfiles;i++)
+ for (i = 0;i < (size_t)pak->numfiles;i++)
{
strcpy(temp, pak->files[i].name);
while (temp[0])
search = Z_Malloc(sizeof(fssearch_t) + numchars + numfiles * sizeof(char *));
search->filenames = (char **)((char *)search + sizeof(fssearch_t));
search->filenamesbuffer = (char *)((char *)search + sizeof(fssearch_t) + numfiles * sizeof(char *));
- search->numfilenames = numfiles;
+ search->numfilenames = (int)numfiles;
numfiles = 0;
numchars = 0;
for (listtemp = liststart;listtemp;listtemp = listtemp->next)
for (i = 0;i < numfiles;i++)
Con_Printf("%s\n", search->filenames[i]);
FS_FreeSearch(search);
- return numfiles;
+ return (int)numfiles;
}
static void FS_ListDirectoryCmd (const char* cmdname, int oneperline)
text[j++] = 0;
save = host_client;
- for (j = 0, host_client = svs.clients;j < svs.maxclients;j++, host_client++)
+ for (j = 0, host_client = svs.clients;j < (size_t)svs.maxclients;j++, host_client++)
if (host_client->spawned && !strcasecmp(host_client->name, Cmd_Argv(1)))
SV_ClientPrint(text);
host_client = save;
if ((matchwidth && image_width != matchwidth) || (matchheight && image_height != matchheight))
return NULL;
- if (fs_filesize < 8 + image_width * image_height)
+ if (fs_filesize < (size_t)(8 + image_width * image_height))
{
Con_Print("LoadLMP: invalid LMP file\n");
return NULL;
address->addressdata.inet6.family = hostentry->h_addrtype;
address->addressdata.inet6.port = htons((unsigned short)port);
memcpy(address->addressdata.inet6.address, hostentry->h_addr_list[0], sizeof(address->addressdata.inet6.address));
- for (i = 0;i < sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
+ for (i = 0;i < (int)sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
namecache[namecacheposition].address = *address;
address->addressdata.inet4.family = hostentry->h_addrtype;
address->addressdata.inet4.port = htons((unsigned short)port);
memcpy(address->addressdata.inet4.address, hostentry->h_addr_list[0], sizeof(address->addressdata.inet4.address));
- for (i = 0;i < sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
+ for (i = 0;i < (int)sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
namecache[namecacheposition].address = *address;
#ifdef STANDALONETEST
printf("gethostbyname failed on address \"%s\"\n", name);
#endif
- for (i = 0;i < sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
+ for (i = 0;i < (int)sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
namecache[namecacheposition].address.addresstype = LHNETADDRESSTYPE_NONE;
# Compilation
# CFLAGS_COMMON=-MD -Wall -Werror
-CFLAGS_COMMON=-MD -Wall
+CFLAGS_COMMON=-MD -Wall -Wsign-compare
CFLAGS_DEBUG=-ggdb
CFLAGS_PROFILE=-g -pg -ggdb
CFLAGS_RELEASE=
typedef struct
{
- int gameid;
+ gamemode_t gameid;
gamelevels_t *notregistered;
gamelevels_t *registered;
}
data = (qbyte*) FS_LoadFile(litfilename, tempmempool, false);
if (data)
{
- if (fs_filesize == 8 + l->filelen * 3 && data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
+ if (fs_filesize == (size_t)(8 + l->filelen * 3) && data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
{
i = LittleLong(((int *)data)[1]);
if (i == 1)
{
int i;
char bufferA[ 256 ], bufferB[ 256 ]; // should be more than enough
- for (i = 0;i < sizeof(bufferA)-1 && A[i];i++)
+ for (i = 0;i < (int)sizeof(bufferA)-1 && A[i];i++)
bufferA[i] = (A[i] >= 'A' && A[i] <= 'Z') ? (A[i] + 'a' - 'A') : A[i];
bufferA[i] = 0;
- for (i = 0;i < sizeof(bufferB)-1 && B[i];i++)
+ for (i = 0;i < (int)sizeof(bufferB)-1 && B[i];i++)
bufferB[i] = (B[i] >= 'A' && B[i] <= 'Z') ? (B[i] + 'a' - 'A') : B[i];
bufferB[i] = 0;
conn->lastMessageTime = realtime;
conn->timeout = realtime + net_messagetimeout.value;
conn->receiveSequence++;
- if( conn->receiveMessageLength + length <= sizeof( conn->receiveMessage ) ) {
+ if( conn->receiveMessageLength + length <= (int)sizeof( conn->receiveMessage ) ) {
memcpy(conn->receiveMessage + conn->receiveMessageLength, data, length);
conn->receiveMessageLength += length;
} else {
start = e;
while (*e && *e != ' ')
e++;
- if (e - start == len)
- if (!strncasecmp(start, name, len))
- {
- return true;
- }
+ if ((size_t)(e - start) == len && !strncasecmp(start, name, len))
+ return true;
}
return false;
}
*/
qboolean PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s)
{
- size_t i, l;
+ int i, l;
char *new_p;
ddef_t *def;
prvm_eval_t *val;
switch (key->type & ~DEF_SAVEGLOBAL)
{
case ev_string:
- l = strlen(s) + 1;
+ l = (int)strlen(s) + 1;
val->string = PRVM_AllocString(l, &new_p);
for (i = 0;i < l;i++)
{
case ev_entity:
while (*s && *s <= ' ')
s++;
- i = (unsigned int)atoi(s);
+ i = atoi(s);
if (i >= prog->limit_edicts)
Con_Printf("PRVM_ED_ParseEpair: ev_entity reference too large (edict %u >= MAX_EDICTS %u) on %s\n", (unsigned int)i, (unsigned int)MAX_EDICTS, PRVM_NAME);
while (i >= prog->max_edicts)
// if SV_IncreaseEdicts was called the base pointer needs to be updated
if (ent)
val = (prvm_eval_t *)((int *)ent->fields.vp + key->ofs);
- val->edict = PRVM_EDICT_TO_PROG(PRVM_EDICT_NUM(i));
+ val->edict = PRVM_EDICT_TO_PROG(PRVM_EDICT_NUM((int)i));
break;
case ev_field:
prog->stringssize = 0;
for (i = 0;i < prog->progs->numstrings;i++)
{
- if (prog->progs->ofs_strings + prog->stringssize >= fs_filesize)
+ if (prog->progs->ofs_strings + prog->stringssize >= (int)fs_filesize)
PRVM_ERROR ("%s: %s strings go past end of file\n", PRVM_NAME, filename);
prog->stringssize += (int)strlen (prog->strings + prog->stringssize) + 1;
}
{
if (sfx->fetcher != NULL)
{
- size = sfx->mempool->totalsize;
+ size = (int)sfx->mempool->totalsize;
total += size;
Con_Printf ("%c%c%c%c(%2db, %6s) %8i : %s\n",
(sfx->loopstart >= 0) ? 'L' : ' ',
if (sb->offset <= start && sb->offset + sb->length >= start + nbsamples)
return sb;
- newlength = (int)(sb->offset + sb->length) - start;
+ newlength = sb->offset + sb->length - start;
// If we need to skip some data before decompressing the rest, or if the stream has looped
if (newlength < 0 || sb->offset > start)
done += ret;
// Resample in the sfxbuffer
- newlength = ResampleSfx (resampling_buffer, (size_t)done / (size_t)factor, &per_sfx->format, sb->data + sb->length * (size_t)factor, sfx->name);
+ newlength = (int)ResampleSfx (resampling_buffer, (size_t)done / (size_t)factor, &per_sfx->format, sb->data + sb->length * (size_t)factor, sfx->name);
sb->length += newlength;
return sb;
// Decide if we go for a stream or a simple PCM cache
buff_len = ceil (STREAM_BUFFER_DURATION * (shm->format.speed * 2 * vi->channels));
- if (snd_streaming.integer && len > fs_filesize + 3 * buff_len)
+ if (snd_streaming.integer && len > (ogg_int64_t)fs_filesize + 3 * buff_len)
{
ogg_stream_persfx_t* per_sfx;
s->loopstart = -1;
s->flags &= ~SFXFLAG_STREAMED;
- sb->length = ResampleSfx (buff, (size_t)done / (vi->channels * 2), &s->format, sb->data, s->name);
+ sb->length = (unsigned int)ResampleSfx (buff, (size_t)done / (vi->channels * 2), &s->format, sb->data, s->name);
s->format.speed = shm->format.speed;
s->total_length = sb->length;
sb->offset = 0;
Con_DPrintf ("Loading WAV file \"%s\"\n", filename);
- info = GetWavinfo (s->name, data, fs_filesize);
+ info = GetWavinfo (s->name, data, (int)fs_filesize);
// Stereo sounds are allowed (intended for music)
if (info.channels < 1 || info.channels > 2)
{
}
#endif
- sb->length = ResampleSfx (data + info.dataofs, info.samples, &s->format, sb->data, s->name);
+ sb->length = (int)ResampleSfx (data + info.dataofs, info.samples, &s->format, sb->data, s->name);
s->format.speed = shm->format.speed;
s->total_length = sb->length;
sb->offset = 0;
void Mem_PrintStats(void)
{
- int count = 0, size = 0;
+ size_t count = 0, size = 0;
mempool_t *pool;
memheader_t *mem;
Mem_CheckSentinelsGlobal();
count++;
size += pool->totalsize;
}
- Con_Printf("%i memory pools, totalling %i bytes (%.3fMB)\n", count, size, size / 1048576.0);
+ Con_Printf("%lu memory pools, totalling %lu bytes (%.3fMB)\n", (unsigned long)count, (unsigned long)size, size / 1048576.0);
for (pool = poolchain;pool;pool = pool->next)
{
if ((pool->flags & POOLFLAG_TEMP) && pool->chain)
{
- Con_Printf("Memory pool %p has sprung a leak totalling %i bytes (%.3fMB)! Listing contents...\n", pool, pool->totalsize, pool->totalsize / 1048576.0);
+ Con_Printf("Memory pool %p has sprung a leak totalling %lu bytes (%.3fMB)! Listing contents...\n", pool, (unsigned long)pool->totalsize, pool->totalsize / 1048576.0);
for (mem = pool->chain;mem;mem = mem->next)
- Con_Printf("%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline);
+ Con_Printf("%10lu bytes allocated at %s:%i\n", (unsigned long)mem->size, mem->filename, mem->fileline);
}
}
}
"size name\n");
for (pool = poolchain;pool;pool = pool->next)
{
- Con_Printf("%10ik (%10ik actual) %s (%+i byte change) %s\n", (pool->totalsize + 1023) / 1024, (pool->realsize + 1023) / 1024, pool->name, pool->totalsize - pool->lastchecksize, (pool->flags & POOLFLAG_TEMP) ? "TEMP" : "");
+ Con_Printf("%10luk (%10luk actual) %s (%+li byte change) %s\n", (unsigned long) ((pool->totalsize + 1023) / 1024), (unsigned long)((pool->realsize + 1023) / 1024), pool->name, (long)pool->totalsize - pool->lastchecksize, (pool->flags & POOLFLAG_TEMP) ? "TEMP" : "");
pool->lastchecksize = pool->totalsize;
if (listallocations)
for (mem = pool->chain;mem;mem = mem->next)
- Con_Printf("%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline);
+ Con_Printf("%10lu bytes allocated at %s:%i\n", (unsigned long)mem->size, mem->filename, mem->fileline);
}
}