Fixed more GCC warnings, alot of 64bit portability things mostly. Minor PNG header fix. Changed instances of errno to strerror(errno).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3805 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
8464020053
commit
21860bd9dc
14 changed files with 31 additions and 21 deletions
|
@ -573,7 +573,7 @@ void (PNGAPI *qpng_read_end) PNGARG((png_structp png_ptr, png_infop info_ptr)) P
|
||||||
void (PNGAPI *qpng_read_image) PNGARG((png_structp png_ptr, png_bytepp image)) PSTATIC(png_read_image);
|
void (PNGAPI *qpng_read_image) PNGARG((png_structp png_ptr, png_bytepp image)) PSTATIC(png_read_image);
|
||||||
png_byte (PNGAPI *qpng_get_bit_depth) PNGARG((png_structp png_ptr, png_infop info_ptr)) PSTATIC(png_get_bit_depth);
|
png_byte (PNGAPI *qpng_get_bit_depth) PNGARG((png_structp png_ptr, png_infop info_ptr)) PSTATIC(png_get_bit_depth);
|
||||||
png_byte (PNGAPI *qpng_get_channels) PNGARG((png_structp png_ptr, png_infop info_ptr)) PSTATIC(png_get_channels);
|
png_byte (PNGAPI *qpng_get_channels) PNGARG((png_structp png_ptr, png_infop info_ptr)) PSTATIC(png_get_channels);
|
||||||
png_size_t (PNGAPI *qpng_get_rowbytes) PNGARG((png_structp png_ptr, png_infop info_ptr)) PSTATIC(png_get_rowbytes);
|
png_uint_32 (PNGAPI *qpng_get_rowbytes) PNGARG((png_structp png_ptr, png_infop info_ptr)) PSTATIC(png_get_rowbytes);
|
||||||
void (PNGAPI *qpng_read_update_info) PNGARG((png_structp png_ptr, png_infop info_ptr)) PSTATIC(png_read_update_info);
|
void (PNGAPI *qpng_read_update_info) PNGARG((png_structp png_ptr, png_infop info_ptr)) PSTATIC(png_read_update_info);
|
||||||
void (PNGAPI *qpng_set_strip_16) PNGARG((png_structp png_ptr)) PSTATIC(png_set_strip_16);
|
void (PNGAPI *qpng_set_strip_16) PNGARG((png_structp png_ptr)) PSTATIC(png_set_strip_16);
|
||||||
void (PNGAPI *qpng_set_expand) PNGARG((png_structp png_ptr)) PSTATIC(png_set_expand);
|
void (PNGAPI *qpng_set_expand) PNGARG((png_structp png_ptr)) PSTATIC(png_set_expand);
|
||||||
|
|
|
@ -2027,7 +2027,7 @@ static void MSD_Unlock (soundcardinfo_t *sc, void *buffer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static int MSD_GetDMAPos(soundcardinfo_t *sc)
|
static unsigned int MSD_GetDMAPos(soundcardinfo_t *sc)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
See the GNU General Public License for more details.
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
@ -111,7 +111,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#if defined(AVAIL_PNGLIB) && defined(PNG_SUCKS_WITH_SETJMP) && !defined(SERVERONLY)
|
#if defined(AVAIL_PNGLIB) && defined(PNG_SUCKS_WITH_SETJMP) && !defined(SERVERONLY)
|
||||||
#include <png.h>
|
#if defined(MINGW)
|
||||||
|
#include "./mingw-libs/png.h"
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
#include "png.h"
|
||||||
|
#else
|
||||||
|
#include <png.h>
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -809,7 +809,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)
|
||||||
result = fread(data, 1, com_filesize, f); //do something with result
|
result = fread(data, 1, com_filesize, f); //do something with result
|
||||||
|
|
||||||
if (result != com_filesize)
|
if (result != com_filesize)
|
||||||
Con_SafePrintf("S_LoadSound() fread: Filename: %s, expected %i, result was %i (%i)\n",name,com_filesize,result,errno);
|
Con_SafePrintf("S_LoadSound() fread: Filename: %s, expected %i, result was %u (%s)\n",name,com_filesize,(unsigned int)result,strerror(errno));
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,7 +357,7 @@ int Sys_DebugLog(char *file, char *fmt, ...)
|
||||||
result = write(fd, data, strlen(data)); // do something with result
|
result = write(fd, data, strlen(data)); // do something with result
|
||||||
|
|
||||||
if (result != strlen(data))
|
if (result != strlen(data))
|
||||||
Con_SafePrintf("Sys_DebugLog() write: Filename: %s, expected %i, result was %i (%i)\n",file,strlen(data),result,errno);
|
Con_SafePrintf("Sys_DebugLog() write: Filename: %s, expected %lu, result was %lu (%s)\n",file,(unsigned long)strlen(data),(unsigned long)result,strerror(errno));
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2391,7 +2391,7 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer)
|
||||||
version = LittleLong(pq1inmodel->version);
|
version = LittleLong(pq1inmodel->version);
|
||||||
if (version == QTESTALIAS_VERSION)
|
if (version == QTESTALIAS_VERSION)
|
||||||
{
|
{
|
||||||
hdrsize = (unsigned int)&((dmdl_t*)NULL)->flags;
|
hdrsize = (size_t)&((dmdl_t*)NULL)->flags;
|
||||||
qtest = true;
|
qtest = true;
|
||||||
}
|
}
|
||||||
else if (version == 50)
|
else if (version == 50)
|
||||||
|
|
|
@ -3035,7 +3035,7 @@ void COM_InitArgv (int argc, const char **argv) //not allowed to tprint
|
||||||
result = fread(buffer, 1, len, f); // do something with result
|
result = fread(buffer, 1, len, f); // do something with result
|
||||||
|
|
||||||
if (result != len)
|
if (result != len)
|
||||||
Con_Printf("COM_InitArgv() fread: Filename: %s, expected %i, result was %i (%i)\n",va("%s_p.txt", argv[0]),len,result,errno);
|
Con_Printf("COM_InitArgv() fread: Filename: %s, expected %i, result was %u (%s)\n",va("%s_p.txt", argv[0]),len,(unsigned int)result,strerror(errno));
|
||||||
|
|
||||||
buffer[len] = '\0';
|
buffer[len] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ static void FSSTDIO_ReadFile(void *handle, flocation_t *loc, char *buffer)
|
||||||
result = fread(buffer, 1, loc->len, f); // do soemthing with result
|
result = fread(buffer, 1, loc->len, f); // do soemthing with result
|
||||||
|
|
||||||
if (result != loc->len)
|
if (result != loc->len)
|
||||||
Con_Printf("FSSTDIO_ReadFile() fread: Filename: %s, expected %i, result was %i (%i)\n",loc->rawname,loc->len,result,errno);
|
Con_Printf("FSSTDIO_ReadFile() fread: Filename: %s, expected %i, result was %u (%s)\n",loc->rawname,loc->len,(unsigned int)result,strerror(errno));
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5666,7 +5666,7 @@ void CM_ReadPortalState (FILE *f)
|
||||||
result = fread (portalopen, 1, sizeof(portalopen), f); // do something with result
|
result = fread (portalopen, 1, sizeof(portalopen), f); // do something with result
|
||||||
|
|
||||||
if (result != sizeof(portalopen))
|
if (result != sizeof(portalopen))
|
||||||
Con_Printf("CM_ReadPortalState() fread: expected %i, result was %i (%i)\n",sizeof(portalopen),result,errno);
|
Con_Printf("CM_ReadPortalState() fread: expected %lu, result was %u (%s)\n",(long unsigned int)sizeof(portalopen),(unsigned int)result,strerror(errno));
|
||||||
|
|
||||||
FloodAreaConnections ();
|
FloodAreaConnections ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,11 @@ int Plug_SystemCallsVM(void *offset, quintptr_t mask, int fn, const int *arg)
|
||||||
fn = fn+1;
|
fn = fn+1;
|
||||||
|
|
||||||
if (fn>=0 && fn < numplugbuiltins && plugbuiltins[fn].func!=NULL)
|
if (fn>=0 && fn < numplugbuiltins && plugbuiltins[fn].func!=NULL)
|
||||||
return plugbuiltins[fn].func(offset, mask, (const long*)args);
|
#ifdef _M_AMD64
|
||||||
|
return plugbuiltins[fn].func(offset, mask, (const long long int*)args);
|
||||||
|
#else
|
||||||
|
return plugbuiltins[fn].func(offset, mask, (const long int*)args);
|
||||||
|
#endif
|
||||||
#undef args
|
#undef args
|
||||||
Sys_Error("QVM Plugin tried calling invalid builtin %i", fn);
|
Sys_Error("QVM Plugin tried calling invalid builtin %i", fn);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -585,7 +585,7 @@ void TL_LoadLanguage (char *name, char *shortname, int num) //this is one of the
|
||||||
result = fread(buffer, 1, size, f); // do something with result
|
result = fread(buffer, 1, size, f); // do something with result
|
||||||
|
|
||||||
if (result != size)
|
if (result != size)
|
||||||
Con_Printf("TL_LoadLanguage() fread: Filename: %s, expected %i, result was %i (%i)\n",va("%s.trl", shortname),size,result,errno);
|
Con_Printf("TL_LoadLanguage() fread: Filename: %s, expected %i, result was %u (%s)\n",va("%s.trl", shortname),size,(unsigned int)result,strerror(errno));
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
See the GNU General Public License for more details.
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ void *allocbuf(char **p, int elements, int elementsize)
|
||||||
{
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
*p += elementsize - 1;
|
*p += elementsize - 1;
|
||||||
*p -= (unsigned int)*p & (elementsize-1);
|
*p -= (size_t)*p & (elementsize-1);
|
||||||
ret = *p;
|
ret = *p;
|
||||||
*p += elements*elementsize;
|
*p += elements*elementsize;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -312,12 +312,12 @@ void GLBE_UploadAllLightmaps(void)
|
||||||
switch (lightmap_bytes)
|
switch (lightmap_bytes)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
qglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8,
|
qglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8,
|
||||||
LMBLOCK_WIDTH, LMBLOCK_WIDTH, 0, (lightmap_bgra?GL_BGRA_EXT:GL_RGBA), GL_UNSIGNED_INT_8_8_8_8_REV,
|
LMBLOCK_WIDTH, LMBLOCK_WIDTH, 0, (lightmap_bgra?GL_BGRA_EXT:GL_RGBA), GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||||
lightmap[i]->lightmaps);
|
lightmap[i]->lightmaps);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
qglTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
|
qglTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
|
||||||
LMBLOCK_WIDTH, LMBLOCK_WIDTH, 0, (lightmap_bgra?GL_BGR_EXT:GL_RGB), GL_UNSIGNED_BYTE,
|
LMBLOCK_WIDTH, LMBLOCK_WIDTH, 0, (lightmap_bgra?GL_BGR_EXT:GL_RGB), GL_UNSIGNED_BYTE,
|
||||||
lightmap[i]->lightmaps);
|
lightmap[i]->lightmaps);
|
||||||
break;
|
break;
|
||||||
|
@ -338,7 +338,7 @@ void GLBE_UploadAllLightmaps(void)
|
||||||
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
qglTexImage2D (GL_TEXTURE_2D, 0, 3
|
qglTexImage2D (GL_TEXTURE_2D, 0, 3
|
||||||
, LMBLOCK_WIDTH, LMBLOCK_HEIGHT, 0,
|
, LMBLOCK_WIDTH, LMBLOCK_HEIGHT, 0,
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, lightmap[i]->deluxmaps);
|
GL_RGB, GL_UNSIGNED_BYTE, lightmap[i]->deluxmaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void inline READ_PLAYERSTATS(int x, rankstats_t *os)
|
||||||
result = fread(os, sizeof(rankstats_t), 1, rankfile);
|
result = fread(os, sizeof(rankstats_t), 1, rankfile);
|
||||||
|
|
||||||
if (result != sizeof(rankstats_t))
|
if (result != sizeof(rankstats_t))
|
||||||
Con_Printf("READ_PLAYERSTATS() fread: expected %i, result was %i (%i)\n",sizeof(rankstats_t),result,errno);
|
Con_Printf("READ_PLAYERSTATS() fread: expected %lu, result was %u (%s)\n",(long unsigned int)sizeof(rankstats_t),(unsigned int)result,strerror(errno));
|
||||||
|
|
||||||
os->kills = swaplong(os->kills);
|
os->kills = swaplong(os->kills);
|
||||||
os->deaths = swaplong(os->deaths);
|
os->deaths = swaplong(os->deaths);
|
||||||
|
@ -85,7 +85,7 @@ void inline READ_PLAYERHEADER(int x, rankheader_t *oh)
|
||||||
result = fread(oh, sizeof(rankheader_t), 1, rankfile);
|
result = fread(oh, sizeof(rankheader_t), 1, rankfile);
|
||||||
|
|
||||||
if (result != sizeof(rankheader_t))
|
if (result != sizeof(rankheader_t))
|
||||||
Con_Printf("READ_PLAYERHEADER() fread: expected %i, result was %i (%i)\n",sizeof(rankheader_t),result,errno);
|
Con_Printf("READ_PLAYERHEADER() fread: expected %lu, result was %u (%s)\n",(long unsigned int)sizeof(rankheader_t),(unsigned int)result,strerror(errno));
|
||||||
|
|
||||||
oh->prev = swaplong(oh->prev); //score is held for convineance.
|
oh->prev = swaplong(oh->prev); //score is held for convineance.
|
||||||
oh->next = swaplong(oh->next);
|
oh->next = swaplong(oh->next);
|
||||||
|
@ -164,7 +164,7 @@ qboolean Rank_OpenRankings(void)
|
||||||
result = fread(&rankfileheader, sizeof(rankfileheader_t), 1, rankfile);
|
result = fread(&rankfileheader, sizeof(rankfileheader_t), 1, rankfile);
|
||||||
|
|
||||||
if (result != sizeof(rankfileheader_t))
|
if (result != sizeof(rankfileheader_t))
|
||||||
Con_Printf("Rank_OpenRankings() fread: expected %i, result was %i (%i)\n",sizeof(rankfileheader_t),result,errno);
|
Con_Printf("Rank_OpenRankings() fread: expected %lu, result was %u (%s)\n",(long unsigned int)sizeof(rankfileheader_t),(unsigned int)result,strerror(errno));
|
||||||
|
|
||||||
rankfileheader.version = swaplong(rankfileheader.version);
|
rankfileheader.version = swaplong(rankfileheader.version);
|
||||||
rankfileheader.usedslots = swaplong(rankfileheader.usedslots);
|
rankfileheader.usedslots = swaplong(rankfileheader.usedslots);
|
||||||
|
|
|
@ -119,7 +119,7 @@ int Sys_DebugLog(char *file, char *fmt, ...)
|
||||||
result = write(fd, data, strlen(data)); // do something with the result
|
result = write(fd, data, strlen(data)); // do something with the result
|
||||||
|
|
||||||
if (result != strlen(data))
|
if (result != strlen(data))
|
||||||
Con_Printf("Sys_DebugLog() write: Filename: %s, expected %i, result was %i (%i)\n",file,strlen(data),result,errno);
|
Con_Printf("Sys_DebugLog() write: Filename: %s, expected %lu, result was %lu (%s)\n",file,(unsigned long)strlen(data),(unsigned long)result,strerror(errno));
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue