From fe14a360b4019d8d7b53e305f142a21b5389fae0 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 2 May 2019 19:12:23 +0300 Subject: [PATCH] engine: fix fs_offset_t/size_t conversion, const qualifiers --- engine/client/cl_game.c | 4 ++-- engine/client/cl_parse.c | 2 +- engine/client/cl_scrn.c | 2 +- engine/client/console.c | 8 ++++---- engine/client/s_mix.c | 4 ++-- engine/client/s_mouth.c | 6 +++--- engine/common/base_cmd.c | 2 +- engine/common/cmd.c | 2 +- engine/common/common.c | 2 +- engine/common/con_utils.c | 12 ++++++------ engine/common/custom.c | 2 +- engine/common/host.c | 2 +- engine/common/imagelib/imagelib.h | 20 ++++++++++---------- engine/common/imagelib/img_bmp.c | 4 ++-- engine/common/imagelib/img_dds.c | 4 ++-- engine/common/imagelib/img_main.c | 2 +- engine/common/imagelib/img_tga.c | 4 ++-- engine/common/imagelib/img_wad.c | 14 +++++++------- engine/common/mod_bmodel.c | 19 ++++++++++--------- engine/common/mod_studio.c | 4 ++-- engine/common/model.c | 2 +- engine/common/net_chan.c | 2 +- engine/common/soundlib/snd_main.c | 2 +- engine/common/soundlib/snd_mp3.c | 2 +- engine/common/soundlib/snd_wav.c | 2 +- engine/common/soundlib/soundlib.h | 6 +++--- engine/platform/posix/sys_posix.c | 2 +- engine/server/sv_game.c | 2 +- engine/server/sv_log.c | 2 +- ref_gl/gl_rmain.c | 6 +++--- ref_gl/gl_rsurf.c | 6 +++--- ref_gl/gl_sprite.c | 20 ++++++++++---------- ref_gl/gl_studio.c | 8 ++++---- 33 files changed, 91 insertions(+), 90 deletions(-) diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 8869b605..0a2628e7 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -647,7 +647,7 @@ and hold them into permament memory pool */ static void CL_InitTitles( const char *filename ) { - size_t fileSize; + fs_offset_t fileSize; byte *pMemFile; int i; @@ -1194,7 +1194,7 @@ upload sprite frames static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite, uint type, uint texFlags ) { byte *buf; - size_t size; + fs_offset_t size; qboolean loaded; Assert( m_pSprite != NULL ); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 0750b174..84d57bc8 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1702,7 +1702,7 @@ CL_ParseResLocation */ void CL_ParseResLocation( sizebuf_t *msg ) { - const char *data = MSG_ReadString( msg ); + char *data = MSG_ReadString( msg ); char token[256]; if( Q_strlen( data ) > 256 ) diff --git a/engine/client/cl_scrn.c b/engine/client/cl_scrn.c index 405bbdf2..1bfd0799 100644 --- a/engine/client/cl_scrn.c +++ b/engine/client/cl_scrn.c @@ -550,7 +550,7 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname ) { int i, fontWidth; byte *buffer; - size_t length; + fs_offset_t length; qfont_t *src; if( cls.creditsFont.valid ) diff --git a/engine/client/console.c b/engine/client/console.c index 700dc1fd..61bf111c 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -558,7 +558,7 @@ static qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font { int i, fontWidth; byte *buffer; - size_t length; + fs_offset_t length; qfont_t *src; if( font->valid ) @@ -807,7 +807,7 @@ int Con_UtfMoveRight( char *str, int pos, int length ) static void Con_DrawCharToConback( int num, const byte *conchars, byte *dest ) { int row, col; - byte *source; + const byte *source; int drawline; int x; @@ -2349,8 +2349,8 @@ void Con_VidInit( void ) if( !con.background ) // last chance - quake conback image { qboolean draw_to_console = false; - int length = 0; - byte *buf; + fs_offset_t length = 0; + const byte *buf; // NOTE: only these games want to draw build number into console background if( !Q_stricmp( FS_Gamedir(), "id1" )) diff --git a/engine/client/s_mix.c b/engine/client/s_mix.c index d1368cb2..dd115753 100644 --- a/engine/client/s_mix.c +++ b/engine/client/s_mix.c @@ -450,7 +450,7 @@ int S_MixDataToDevice( channel_t *pChannel, int sampleCount, int outRate, int ou int availableSamples, outSampleCount; wavdata_t *pSource = pChannel->sfx->cache; qboolean use_loop = pChannel->use_loop; - char *pData = NULL; + void *pData = NULL; double sampleFrac; int i, j; @@ -1059,4 +1059,4 @@ void MIX_PaintChannels( int endtime ) S_TransferPaintBuffer( end ); paintedtime = end; } -} \ No newline at end of file +} diff --git a/engine/client/s_mouth.c b/engine/client/s_mouth.c index c242f8be..46dbbc7e 100644 --- a/engine/client/s_mouth.c +++ b/engine/client/s_mouth.c @@ -75,7 +75,7 @@ void SND_MoveMouth8( channel_t *ch, wavdata_t *pSource, int count ) } else pos = ch->pMixer.sample; - count = S_GetOutputData( pSource, &pdata, pos, count, ch->use_loop ); + count = S_GetOutputData( pSource, (void**)&pdata, pos, count, ch->use_loop ); if( pdata == NULL ) return; i = 0; @@ -123,7 +123,7 @@ void SND_MoveMouth16( channel_t *ch, wavdata_t *pSource, int count ) } else pos = ch->pMixer.sample; - count = S_GetOutputData( pSource, &pdata, pos, count, ch->use_loop ); + count = S_GetOutputData( pSource, (void**)&pdata, pos, count, ch->use_loop ); if( pdata == NULL ) return; i = 0; @@ -149,4 +149,4 @@ void SND_MoveMouth16( channel_t *ch, wavdata_t *pSource, int count ) pMouth->sndavg = 0; pMouth->sndcount = 0; } -} \ No newline at end of file +} diff --git a/engine/common/base_cmd.c b/engine/common/base_cmd.c index 7516d312..b1685626 100644 --- a/engine/common/base_cmd.c +++ b/engine/common/base_cmd.c @@ -278,7 +278,7 @@ void BaseCmd_Test_f( void ) } } - Cvar_LookupVars( 0, NULL, &invalid, BaseCmd_CheckCvars ); + Cvar_LookupVars( 0, NULL, &invalid, (setpair_t)BaseCmd_CheckCvars ); if( !invalid ) { diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 15e54092..e97d60ec 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -765,7 +765,7 @@ void Cmd_RemoveCommand( const char *cmd_name ) Cmd_LookupCmds ============ */ -void Cmd_LookupCmds( char *buffer, void *ptr, setpair_t callback ) +void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback ) { cmd_t *cmd; cmdalias_t *alias; diff --git a/engine/common/common.c b/engine/common/common.c index 603335cf..1590b1fb 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -847,7 +847,7 @@ byte* COM_LoadFileForMe( const char *filename, int *pLength ) { string name; byte *file, *pfile; - size_t iLength; + fs_offset_t iLength; if( !COM_CheckString( filename )) { diff --git a/engine/common/con_utils.c b/engine/common/con_utils.c index c670c61f..ef164271 100644 --- a/engine/common/con_utils.c +++ b/engine/common/con_utils.c @@ -914,9 +914,9 @@ static void Con_AddCommandToList( const char *s, const char *unused1, const char Con_SortCmds ================= */ -static int Con_SortCmds( const char **arg1, const char **arg2 ) +static int Con_SortCmds( const void *arg1, const void *arg2 ) { - return Q_stricmp( *arg1, *arg2 ); + return Q_stricmp( *(const char **)arg1, *(const char **)arg2 ); } /* @@ -1035,8 +1035,8 @@ void Con_CompleteCommand( field_t *field ) con.shortestMatch[0] = 0; // find matching commands and variables - Cmd_LookupCmds( NULL, NULL, Con_AddCommandToList ); - Cvar_LookupVars( 0, NULL, NULL, Con_AddCommandToList ); + Cmd_LookupCmds( NULL, NULL, (setpair_t)Con_AddCommandToList ); + Cvar_LookupVars( 0, NULL, NULL, (setpair_t)Con_AddCommandToList ); if( !con.matchCount ) return; // no matches @@ -1100,8 +1100,8 @@ void Con_CompleteCommand( field_t *field ) Con_Printf( "]%s\n", con.completionField->buffer ); // run through again, printing matches - Cmd_LookupCmds( NULL, NULL, Con_PrintCmdMatches ); - Cvar_LookupVars( 0, NULL, NULL, Con_PrintCvarMatches ); + Cmd_LookupCmds( NULL, NULL, (setpair_t)Con_PrintCmdMatches ); + Cvar_LookupVars( 0, NULL, NULL, (setpair_t)Con_PrintCvarMatches ); } } diff --git a/engine/common/custom.c b/engine/common/custom.c index 7b8c2736..982c57d3 100644 --- a/engine/common/custom.c +++ b/engine/common/custom.c @@ -64,7 +64,7 @@ void COM_ClearCustomizationList( customization_t *pHead, qboolean bCleanDecals ) qboolean COM_CreateCustomization( customization_t *pListHead, resource_t *pResource, int playernumber, int flags, customization_t **pOut, int *nLumps ) { qboolean bError = false; - size_t checksize = 0; + fs_offset_t checksize = 0; customization_t *pCust; if( pOut ) *pOut = NULL; diff --git a/engine/common/host.c b/engine/common/host.c index 40f49847..ade560b4 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -255,7 +255,7 @@ void Host_Exec_f( void ) { string cfgpath; char *f, *txt; - size_t len; + fs_offset_t len; if( Cmd_Argc() != 2 ) { diff --git a/engine/common/imagelib/imagelib.h b/engine/common/imagelib/imagelib.h index fdbe32e6..79fe6e1d 100644 --- a/engine/common/imagelib/imagelib.h +++ b/engine/common/imagelib/imagelib.h @@ -47,7 +47,7 @@ typedef struct loadformat_s { const char *formatstring; const char *ext; - qboolean (*loadfunc)( const char *name, const byte *buffer, size_t filesize ); + qboolean (*loadfunc)( const char *name, const byte *buffer, fs_offset_t filesize ); image_hint_t hint; } loadpixformat_t; @@ -296,15 +296,15 @@ void Image_GetPaletteHL( void ); // // formats load // -qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize ); -qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize ); -qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize ); -qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize ); -qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize ); -qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize ); -qboolean Image_LoadFNT( const char *name, const byte *buffer, size_t filesize ); -qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize ); -qboolean Image_LoadPAL( const char *name, const byte *buffer, size_t filesize ); +qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Image_LoadMDL( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Image_LoadFNT( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Image_LoadLMP( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesize ); // // formats save diff --git a/engine/common/imagelib/img_bmp.c b/engine/common/imagelib/img_bmp.c index 12415cf5..483c6f1a 100644 --- a/engine/common/imagelib/img_bmp.c +++ b/engine/common/imagelib/img_bmp.c @@ -33,7 +33,7 @@ typedef struct tagRGBQUAD { Image_LoadBMP ============= */ -qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesize ) { byte *buf_p, *pixbuf; byte palette[256][4]; @@ -83,7 +83,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize ) if( bhdr.fileSize != filesize ) { // Sweet Half-Life issues. splash.bmp have bogus filesize - Con_Reportf( S_WARN "Image_LoadBMP: %s have incorrect file size %i should be %i\n", name, filesize, bhdr.fileSize ); + Con_Reportf( S_WARN "Image_LoadBMP: %s have incorrect file size %li should be %i\n", name, filesize, bhdr.fileSize ); } // bogus compression? Only non-compressed supported. diff --git a/engine/common/imagelib/img_dds.c b/engine/common/imagelib/img_dds.c index 9db234ec..03b31ee0 100644 --- a/engine/common/imagelib/img_dds.c +++ b/engine/common/imagelib/img_dds.c @@ -239,7 +239,7 @@ void Image_DXTAdjustVolume( dds_t *hdr ) Image_LoadDDS ============= */ -qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesize ) { dds_t header; byte *fin; @@ -329,4 +329,4 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize ) SetBits( image.flags, IMAGE_DDS_FORMAT ); return true; -} \ No newline at end of file +} diff --git a/engine/common/imagelib/img_main.c b/engine/common/imagelib/img_main.c index e9f3f6e9..5e44b466 100644 --- a/engine/common/imagelib/img_main.c +++ b/engine/common/imagelib/img_main.c @@ -214,7 +214,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size ) string path, loadname, sidename; qboolean anyformat = true; int i; - size_t filesize = 0; + fs_offset_t filesize = 0; const loadpixformat_t *format; const cubepack_t *cmap; byte *f; diff --git a/engine/common/imagelib/img_tga.c b/engine/common/imagelib/img_tga.c index 0d883b2c..ba65cd9b 100644 --- a/engine/common/imagelib/img_tga.c +++ b/engine/common/imagelib/img_tga.c @@ -21,7 +21,7 @@ GNU General Public License for more details. Image_LoadTGA ============= */ -qboolean Image_LoadTGA( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesize ) { int i, columns, rows, row_inc, row, col; byte *buf_p, *pixbuf, *targa_rgba; @@ -302,4 +302,4 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix ) Mem_Free( buffer ); return true; -} \ No newline at end of file +} diff --git a/engine/common/imagelib/img_wad.c b/engine/common/imagelib/img_wad.c index 147d69cb..9c8c9206 100644 --- a/engine/common/imagelib/img_wad.c +++ b/engine/common/imagelib/img_wad.c @@ -25,13 +25,13 @@ GNU General Public License for more details. Image_LoadPAL ============ */ -qboolean Image_LoadPAL( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesize ) { int rendermode = LUMP_NORMAL; if( filesize != 768 ) { - Con_DPrintf( S_ERROR "Image_LoadPAL: (%s) have invalid size (%d should be %d)\n", name, filesize, 768 ); + Con_DPrintf( S_ERROR "Image_LoadPAL: (%s) have invalid size (%ld should be %d)\n", name, filesize, 768 ); return false; } @@ -74,7 +74,7 @@ qboolean Image_LoadPAL( const char *name, const byte *buffer, size_t filesize ) Image_LoadFNT ============ */ -qboolean Image_LoadFNT( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadFNT( const char *name, const byte *buffer, fs_offset_t filesize ) { qfont_t font; const byte *pal, *fin; @@ -147,7 +147,7 @@ void Image_SetMDLPointer( byte *p ) Image_LoadMDL ============ */ -qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadMDL( const char *name, const byte *buffer, fs_offset_t filesize ) { byte *fin; size_t pixels; @@ -197,7 +197,7 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize ) Image_LoadSPR ============ */ -qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesize ) { dspriteframe_t *pin; // identical for q1\hl sprites qboolean truecolor = false; @@ -261,7 +261,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize ) Image_LoadLMP ============ */ -qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadLMP( const char *name, const byte *buffer, fs_offset_t filesize ) { lmp_t lmp; byte *fin, *pal; @@ -346,7 +346,7 @@ qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize ) Image_LoadMIP ============= */ -qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize ) +qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesize ) { mip_t mip; qboolean hl_texture; diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index 0994a8d4..37e22028 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -1251,7 +1251,7 @@ static qboolean Mod_LoadColoredLighting( dbspmodel_t *bmod ) char modelname[64]; char path[64]; int iCompare; - size_t litdatasize; + fs_offset_t litdatasize; byte *in; COM_FileBase( loadmodel->name, modelname ); @@ -1279,7 +1279,7 @@ static qboolean Mod_LoadColoredLighting( dbspmodel_t *bmod ) if( litdatasize != ( bmod->lightdatasize * 3 )) { - Con_Printf( S_ERROR "%s has mismatched size (%i should be %i)\n", path, litdatasize, bmod->lightdatasize * 3 ); + Con_Printf( S_ERROR "%s has mismatched size (%li should be %i)\n", path, litdatasize, bmod->lightdatasize * 3 ); Mem_Free( in ); return false; } @@ -1301,7 +1301,7 @@ Mod_LoadDeluxemap static void Mod_LoadDeluxemap( dbspmodel_t *bmod ) { char modelname[64]; - size_t deluxdatasize; + fs_offset_t deluxdatasize; char path[64]; int iCompare; byte *in; @@ -1334,7 +1334,7 @@ static void Mod_LoadDeluxemap( dbspmodel_t *bmod ) if( deluxdatasize != bmod->lightdatasize ) { - Con_Reportf( S_ERROR "%s has mismatched size (%i should be %i)\n", path, deluxdatasize, bmod->lightdatasize ); + Con_Reportf( S_ERROR "%s has mismatched size (%li should be %i)\n", path, deluxdatasize, bmod->lightdatasize ); Mem_Free( in ); return; } @@ -1527,7 +1527,7 @@ static void Mod_LoadEntities( dbspmodel_t *bmod ) if( bmod->isworld ) { char entfilename[MAX_QPATH]; - int entpatchsize; + fs_offset_t entpatchsize; size_t ft1, ft2; // world is check for entfile too @@ -1947,7 +1947,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod ) } else { - size_t srcSize = 0; + fs_offset_t srcSize = 0; byte *src = NULL; // NOTE: we can't loading it from wad as normal because _luma texture doesn't exist @@ -2086,7 +2086,7 @@ Mod_LoadTexInfo static void Mod_LoadTexInfo( dbspmodel_t *bmod ) { mfaceinfo_t *fout, *faceinfo; - int i, j, miptex; + int i, j, k, miptex; dfaceinfo_t *fin; mtexinfo_t *out; dtexinfo_t *in; @@ -2109,8 +2109,9 @@ static void Mod_LoadTexInfo( dbspmodel_t *bmod ) for( i = 0; i < bmod->numtexinfo; i++, in++, out++ ) { - for( j = 0; j < 8; j++ ) - out->vecs[0][j] = in->vecs[0][j]; + for( j = 0; j < 2; j++ ) + for( k = 0; k < 4; k++ ) + out->vecs[j][k] = in->vecs[j][k]; miptex = in->miptex; if( miptex < 0 || miptex > loadmodel->numtextures ) diff --git a/engine/common/mod_studio.c b/engine/common/mod_studio.c index 8f6fd9fd..383752ef 100644 --- a/engine/common/mod_studio.c +++ b/engine/common/mod_studio.c @@ -598,8 +598,8 @@ void *R_StudioGetAnim( studiohdr_t *m_pStudioHeader, model_t *m_pSubModel, mstud { mstudioseqgroup_t *pseqgroup; cache_user_t *paSequences; - size_t filesize; - byte *buf; + fs_offset_t filesize; + byte *buf; pseqgroup = (mstudioseqgroup_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqgroupindex) + pseqdesc->seqgroup; if( pseqdesc->seqgroup == 0 ) diff --git a/engine/common/model.c b/engine/common/model.c index b87cd09c..bb65ed53 100644 --- a/engine/common/model.c +++ b/engine/common/model.c @@ -507,7 +507,7 @@ Mod_LoadCacheFile void Mod_LoadCacheFile( const char *filename, cache_user_t *cu ) { char modname[MAX_QPATH]; - size_t size; + fs_offset_t size; byte *buf; Assert( cu != NULL ); diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 884180c4..3e16efbb 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -953,7 +953,7 @@ int Netchan_CreateFileFragments( netchan_t *chan, const char *filename ) int send, pos; int remaining; int bufferid = 1; - int filesize = 0; + fs_offset_t filesize = 0; char compressedfilename[MAX_OSPATH]; int compressedFileTime; int fileTime; diff --git a/engine/common/soundlib/snd_main.c b/engine/common/soundlib/snd_main.c index 66ba9568..c68c14a1 100644 --- a/engine/common/soundlib/snd_main.c +++ b/engine/common/soundlib/snd_main.c @@ -59,7 +59,7 @@ wavdata_t *FS_LoadSound( const char *filename, const byte *buffer, size_t size ) const char *ext = COM_FileExtension( filename ); string path, loadname; qboolean anyformat = true; - size_t filesize = 0; + fs_offset_t filesize = 0; const loadwavfmt_t *format; byte *f; diff --git a/engine/common/soundlib/snd_mp3.c b/engine/common/soundlib/snd_mp3.c index d04819db..a9eb5667 100644 --- a/engine/common/soundlib/snd_mp3.c +++ b/engine/common/soundlib/snd_mp3.c @@ -52,7 +52,7 @@ const char *get_error( void *mpeg ); ================================================================= */ -qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize ) +qboolean Sound_LoadMPG( const char *name, const byte *buffer, fs_offset_t filesize ) { void *mpeg; size_t pos = 0; diff --git a/engine/common/soundlib/snd_wav.c b/engine/common/soundlib/snd_wav.c index 68484393..bd1584d9 100644 --- a/engine/common/soundlib/snd_wav.c +++ b/engine/common/soundlib/snd_wav.c @@ -139,7 +139,7 @@ qboolean StreamFindNextChunk( file_t *file, const char *name, int *last_chunk ) Sound_LoadWAV ============= */ -qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize ) +qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesize ) { int samples, fmt; qboolean mpeg_stream = false; diff --git a/engine/common/soundlib/soundlib.h b/engine/common/soundlib/soundlib.h index f9577b66..bcb6c095 100644 --- a/engine/common/soundlib/soundlib.h +++ b/engine/common/soundlib/soundlib.h @@ -25,7 +25,7 @@ typedef struct loadwavfmt_s { const char *formatstring; const char *ext; - qboolean (*loadfunc)( const char *name, const byte *buffer, size_t filesize ); + qboolean (*loadfunc)( const char *name, const byte *buffer, fs_offset_t filesize ); } loadwavfmt_t; typedef struct streamfmt_s @@ -117,8 +117,8 @@ extern sndlib_t sound; // // formats load // -qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize ); -qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize ); +qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesize ); +qboolean Sound_LoadMPG( const char *name, const byte *buffer, fs_offset_t filesize ); // // stream operate diff --git a/engine/platform/posix/sys_posix.c b/engine/platform/posix/sys_posix.c index 4ea4f4f8..3b40fa00 100644 --- a/engine/platform/posix/sys_posix.c +++ b/engine/platform/posix/sys_posix.c @@ -98,6 +98,6 @@ void Platform_MessageBox( const char *title, const char *message, qboolean paren fprintf( stderr, "======================================\n" "%s: %s\n" - "======================================\n, title, message ); + "======================================\n", title, message ); } #endif diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index feca67ac..974c50e9 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -2172,7 +2172,7 @@ SV_StartMusic void SV_StartMusic( const char *curtrack, const char *looptrack, int position ) { MSG_BeginServerCmd( &sv.multicast, svc_stufftext ); - MSG_WriteString( &sv.multicast, va( "music \"%s\" \"%s\" %li\n", curtrack, looptrack, position )); + MSG_WriteString( &sv.multicast, va( "music \"%s\" \"%s\" %d\n", curtrack, looptrack, position )); SV_Multicast( MSG_ALL, NULL, NULL, false, false ); } diff --git a/engine/server/sv_log.c b/engine/server/sv_log.c index dac1610a..319c8472 100644 --- a/engine/server/sv_log.c +++ b/engine/server/sv_log.c @@ -149,7 +149,7 @@ void Log_PrintServerVars( void ) return; Log_Printf( "Server cvars start\n" ); - Cvar_LookupVars( FCVAR_SERVER, NULL, NULL, Log_PrintServerCvar ); + Cvar_LookupVars( FCVAR_SERVER, NULL, NULL, (setpair_t)Log_PrintServerCvar ); Log_Printf( "Server cvars end\n" ); } diff --git a/ref_gl/gl_rmain.c b/ref_gl/gl_rmain.c index d82ed116..23341582 100644 --- a/ref_gl/gl_rmain.c +++ b/ref_gl/gl_rmain.c @@ -78,7 +78,7 @@ R_TransEntityCompare Sorting translucent entities by rendermode then by distance =============== */ -static int R_TransEntityCompare( const cl_entity_t **a, const cl_entity_t **b ) +static int R_TransEntityCompare( const void *a, const void *b ) { cl_entity_t *ent1, *ent2; vec3_t vecLen, org; @@ -86,8 +86,8 @@ static int R_TransEntityCompare( const cl_entity_t **a, const cl_entity_t **b ) int rendermode1; int rendermode2; - ent1 = (cl_entity_t *)*a; - ent2 = (cl_entity_t *)*b; + ent1 = *(cl_entity_t **)a; + ent2 = *(cl_entity_t **)b; rendermode1 = R_GetEntityRenderMode( ent1 ); rendermode2 = R_GetEntityRenderMode( ent2 ); diff --git a/ref_gl/gl_rsurf.c b/ref_gl/gl_rsurf.c index 6e95b110..6397a690 100644 --- a/ref_gl/gl_rsurf.c +++ b/ref_gl/gl_rsurf.c @@ -1435,14 +1435,14 @@ R_SurfaceCompare compare translucent surfaces ================= */ -static int R_SurfaceCompare( const sortedface_t *a, const sortedface_t *b ) +static int R_SurfaceCompare( const void *a, const void *b ) { msurface_t *surf1, *surf2; vec3_t org1, org2; float len1, len2; - surf1 = (msurface_t *)a->surf; - surf2 = (msurface_t *)b->surf; + surf1 = (msurface_t *)((sortedface_t *)a)->surf; + surf2 = (msurface_t *)((sortedface_t *)b)->surf; VectorAdd( RI.currententity->origin, surf1->info->origin, org1 ); VectorAdd( RI.currententity->origin, surf2->info->origin, org2 ); diff --git a/ref_gl/gl_sprite.c b/ref_gl/gl_sprite.c index 496f4ac2..fa6674fa 100644 --- a/ref_gl/gl_sprite.c +++ b/ref_gl/gl_sprite.c @@ -51,9 +51,9 @@ R_SpriteLoadFrame upload a single frame ==================== */ -static dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t **ppframe, int num ) +static const dframetype_t *R_SpriteLoadFrame( model_t *mod, const void *pin, mspriteframe_t **ppframe, int num ) { - dspriteframe_t *pinframe; + const dspriteframe_t *pinframe; mspriteframe_t *pspriteframe; int gl_texturenum = 0; char texname[128]; @@ -96,16 +96,16 @@ R_SpriteLoadGroup upload a group frames ==================== */ -static dframetype_t *R_SpriteLoadGroup( model_t *mod, void *pin, mspriteframe_t **ppframe, int framenum ) +static const dframetype_t *R_SpriteLoadGroup( model_t *mod, const void *pin, mspriteframe_t **ppframe, int framenum ) { - dspritegroup_t *pingroup; + const dspritegroup_t *pingroup; mspritegroup_t *pspritegroup; - dspriteinterval_t *pin_intervals; + const dspriteinterval_t *pin_intervals; float *poutintervals; int i, groupsize, numframes; - void *ptemp; + const void *ptemp; - pingroup = (dspritegroup_t *)pin; + pingroup = (const dspritegroup_t *)pin; numframes = pingroup->numframes; groupsize = sizeof( mspritegroup_t ) + (numframes - 1) * sizeof( pspritegroup->frames[0] ); @@ -113,7 +113,7 @@ static dframetype_t *R_SpriteLoadGroup( model_t *mod, void *pin, mspriteframe_t pspritegroup->numframes = numframes; *ppframe = (mspriteframe_t *)pspritegroup; - pin_intervals = (dspriteinterval_t *)(pingroup + 1); + pin_intervals = (const dspriteinterval_t *)(pingroup + 1); poutintervals = Mem_Calloc( mod->mempool, numframes * sizeof( float )); pspritegroup->intervals = poutintervals; @@ -126,13 +126,13 @@ static dframetype_t *R_SpriteLoadGroup( model_t *mod, void *pin, mspriteframe_t pin_intervals++; } - ptemp = (void *)pin_intervals; + ptemp = (const void *)pin_intervals; for( i = 0; i < numframes; i++ ) { ptemp = R_SpriteLoadFrame( mod, ptemp, &pspritegroup->frames[i], framenum * 10 + i ); } - return (dframetype_t *)ptemp; + return (const dframetype_t *)ptemp; } /* diff --git a/ref_gl/gl_studio.c b/ref_gl/gl_studio.c index 5260890b..ca9be5b2 100644 --- a/ref_gl/gl_studio.c +++ b/ref_gl/gl_studio.c @@ -1939,12 +1939,12 @@ R_StudioMeshCompare Sorting opaque entities by model type =============== */ -static int R_StudioMeshCompare( const sortedmesh_t *a, const sortedmesh_t *b ) +static int R_StudioMeshCompare( const void *a, const void *b ) { - if( FBitSet( a->flags, STUDIO_NF_ADDITIVE )) + if( FBitSet( ((const sortedmesh_t*)a)->flags, STUDIO_NF_ADDITIVE )) return 1; - if( FBitSet( a->flags, STUDIO_NF_MASKED )) + if( FBitSet( ((const sortedmesh_t*)a)->flags, STUDIO_NF_MASKED )) return -1; return 0; @@ -3118,7 +3118,7 @@ void R_StudioRenderFinal( void ) { for( i = 0; i < m_pStudioHeader->numbodyparts; i++ ) { - R_StudioSetupModel( i, &m_pBodyPart, &m_pSubModel ); + R_StudioSetupModel( i, (void**)&m_pBodyPart, (void**)&m_pSubModel ); GL_StudioSetRenderMode( rendermode ); R_StudioDrawPoints();