]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed a bunch of signed/unsigned mismatch warnings in newer gcc versions (mostly...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 Jun 2003 19:22:31 +0000 (19:22 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 4 Jun 2003 19:22:31 +0000 (19:22 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3065 d7cf8633-e32d-0410-b094-e92efae38249

common.c
fs.c
image.c
net_udp.c
r_shadow.c
vid_glx.c
wad.c

index 8987d7f3f4de81d6c39f13ec552def77cfadef17..875c8d3711aac6dfd3697662d217de585e6fc1ae 100644 (file)
--- a/common.c
+++ b/common.c
@@ -339,7 +339,7 @@ char *MSG_ReadString (void)
 {
        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;
diff --git a/fs.c b/fs.c
index 4aead3ecc81fbfb7976fe5d2118347e3cc4d1c12..d73791214fafb5ccd097cd3e96b2d56f313b0c6c 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -383,7 +383,7 @@ qboolean PK3_GetEndOfCentralDir (const char *packfile, FILE *packhandle, pk3_end
                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;
@@ -475,7 +475,7 @@ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd)
                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;
@@ -538,8 +538,9 @@ pack_t *FS_LoadPackPK3 (const char *packfile)
        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));
@@ -1369,7 +1370,7 @@ int FS_Seek (qfile_t* file, long offset, int whence)
                }
 
                // 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)
@@ -1395,7 +1396,7 @@ int FS_Seek (qfile_t* file, long offset, int whence)
                }
 
                // 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;
@@ -1428,7 +1429,7 @@ int FS_Seek (qfile_t* file, long offset, int whence)
                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)
@@ -1477,7 +1478,7 @@ char* FS_Gets (qfile_t* file, char* buffer, int buffersize)
        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)
diff --git a/image.c b/image.c
index 4c7aa0f6dd26517b7497d0b2a8d7f0b9c80e52d9..c1615d4c4f3c31c9ac9e8115153a78350e023787 100644 (file)
--- a/image.c
+++ b/image.c
@@ -482,7 +482,7 @@ qbyte *LoadWAL (qbyte *f, int matchwidth, int matchheight)
        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;
@@ -498,7 +498,7 @@ qbyte *LoadWAL (qbyte *f, int matchwidth, int matchheight)
        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;
index 353fc7bed32eb6eb5145b6c27ad38bdd23ff52a6..3dbb895757b6c3a72a45b16236a4be8d0211d549 100644 (file)
--- a/net_udp.c
+++ b/net_udp.c
@@ -47,7 +47,7 @@ static int net_controlsocket;
 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;
 
 //=============================================================================
 
index 19e36e7933b010318b65024f63a97965e0369ea6..16cb6edad9c29b58f53c86136fe64c81bdf5078f 100644 (file)
@@ -2088,7 +2088,7 @@ void R_Shadow_SaveWorldLights(void)
        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;
index f6b67a64da796f90b5a9cbc6328c77b7a49c77f3..1ea67984e0c5565c738ce53502f3d9cb6e81feb2 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -471,7 +471,7 @@ static void HandleEvents(void)
                        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:
diff --git a/wad.c b/wad.c
index e5b53c353b39341b0e725f37316d016754b62052..36a5ede26b8a0f43b700eebf8b6d813ff4f11e85 100644 (file)
--- a/wad.c
+++ b/wad.c
@@ -183,7 +183,7 @@ void W_LoadTextureWadFile (char *filename, int complain)
        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++)
@@ -265,7 +265,7 @@ qbyte *W_GetTexture(char *name)
                                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);