{
static char string[2048];
int l,c;
- for (l = 0;l < sizeof(string) - 1 && (c = MSG_ReadChar()) != -1 && c != 0;l++)
+ for (l = 0;l < (int) sizeof(string) - 1 && (c = MSG_ReadChar()) != -1 && c != 0;l++)
string[l] = c;
string[l] = 0;
return string;
maxsize = ZIP_MAX_COMMENTS_SIZE + ZIP_END_CDIR_SIZE;
buffer = Mem_Alloc (tempmempool, maxsize);
fseek (packhandle, filesize - maxsize, SEEK_SET);
- if (fread (buffer, 1, maxsize, packhandle) != maxsize)
+ if (fread (buffer, 1, maxsize, packhandle) != (unsigned long) maxsize)
{
Mem_Free (buffer);
return false;
if ((ptr[8] & 0x29) == 0 && (ptr[38] & 0x18) == 0)
{
// Still enough bytes for the name?
- if (remaining < namesize || namesize >= sizeof (*pack->files))
+ if ((size_t) remaining < namesize || namesize >= sizeof (*pack->files))
{
Mem_Free (central_dir);
return -1;
if (eocd.disknum != 0 || eocd.cdir_disknum != 0)
Sys_Error ("%s is a multi-volume ZIP archive", packfile);
- if (eocd.nbentries > MAX_FILES_IN_PACK)
- Sys_Error ("%s contains too many files (%hu)", packfile, eocd.nbentries);
+ // LordHavoc: was always false because nbentries is an unsigned short and MAX_FILES_IN_PACK is 65536
+ //if (eocd.nbentries > (unsigned int) MAX_FILES_IN_PACK)
+ // Sys_Error ("%s contains too many files (%hu)", packfile, eocd.nbentries);
// Create a package structure in memory
pack = Mem_Alloc (pak_mempool, sizeof (pack_t));
}
// If we need to go back in the file
- if (offset <= crt_offset)
+ if (offset <= (long) crt_offset)
{
// If we still have the data we need in the output buffer
if (crt_offset - offset <= ztk->out_ind)
}
// Skip all data until we reach the requested offset
- while (crt_offset < offset)
+ while ((long) crt_offset < offset)
{
size_t diff = offset - crt_offset;
size_t count, len;
default:
return -1;
}
- if (offset < 0 || offset > file->length)
+ if (offset < 0 || offset > (long) file->length)
return -1;
if (fseek (file->stream, file->offset + offset, SEEK_SET) == -1)
if (! (file->flags & FS_FLAG_PACKED))
return fgets (buffer, buffersize, file->stream);
- for (ind = 0; ind < buffersize - 1; ind++)
+ for (ind = 0; ind < (size_t) buffersize - 1; ind++)
{
int c = FS_Getc (file);
switch (c)
qbyte *image_rgba;
const q2wal_t *inwal = (const void *)f;
- if (fs_filesize < sizeof(q2wal_t))
+ if (fs_filesize < (int) sizeof(q2wal_t))
{
Con_Printf("LoadWAL: invalid WAL file\n");
return NULL;
if ((matchwidth && image_width != matchwidth) || (matchheight && image_height != matchheight))
return NULL;
- if (fs_filesize < sizeof(q2wal_t) + LittleLong(inwal->offsets[0]) + image_width * image_height)
+ if ((int) fs_filesize < (int) sizeof(q2wal_t) + (int) LittleLong(inwal->offsets[0]) + image_width * image_height)
{
Con_Printf("LoadWAL: invalid WAL file\n");
return NULL;
static int net_broadcastsocket = 0;
static struct qsockaddr broadcastaddr;
-static union {int i;unsigned char d[4];} myAddr;
+static union {unsigned int i;unsigned char d[4];} myAddr;
//=============================================================================
for (light = r_shadow_worldlightchain;light;light = light->next)
{
sprintf(line, "%s%g %g %g %g %g %g %g %d %s\n", light->castshadows ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->lightradius / r_editlights_rtlightssizescale.value, light->light[0] / r_editlights_rtlightscolorscale.value, light->light[1] / r_editlights_rtlightscolorscale.value, light->light[2] / r_editlights_rtlightscolorscale.value, light->style, light->cubemapname ? light->cubemapname : "");
- if (bufchars + strlen(line) > bufmaxchars)
+ if (bufchars + (int) strlen(line) > bufmaxchars)
{
bufmaxchars = bufchars + strlen(line) + 2048;
oldbuf = buf;
break;
case ClientMessage:
// window manager messages
- if ((event.xclient.format == 32) && (event.xclient.data.l[0] == wm_delete_window_atom))
+ if ((event.xclient.format == 32) && ((unsigned int)event.xclient.data.l[0] == wm_delete_window_atom))
Sys_Quit();
break;
case MapNotify:
if (!(lumps = Mem_Alloc(tempmempool, sizeof(lumpinfo_t)*numlumps)))
{Con_Printf ("W_LoadTextureWadFile: unable to allocate temporary memory for lump table");return;}
- if (FS_Read(file, lumps, sizeof(lumpinfo_t) * numlumps) != (int)sizeof(lumpinfo_t) * numlumps)
+ if (FS_Read(file, lumps, sizeof(lumpinfo_t) * numlumps) != sizeof(lumpinfo_t) * (size_t)numlumps)
{Con_Printf ("W_LoadTextureWadFile: unable to read lump table");return;}
for (i=0, lump_p = lumps ; i<numlumps ; i++,lump_p++)
tex = Mem_Alloc(tempmempool, texwadlump[i].size);
if (!tex)
return NULL;
- if (FS_Read(file, tex, texwadlump[i].size) < texwadlump[i].size)
+ if (FS_Read(file, tex, texwadlump[i].size) < (size_t)texwadlump[i].size)
{Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
tex->width = LittleLong(tex->width);