Browse Source

engine: fix fs_offset_t/size_t conversion, const qualifiers

pull/2/head
Alibek Omarov 6 years ago
parent
commit
fe14a360b4
  1. 4
      engine/client/cl_game.c
  2. 2
      engine/client/cl_parse.c
  3. 2
      engine/client/cl_scrn.c
  4. 8
      engine/client/console.c
  5. 4
      engine/client/s_mix.c
  6. 6
      engine/client/s_mouth.c
  7. 2
      engine/common/base_cmd.c
  8. 2
      engine/common/cmd.c
  9. 2
      engine/common/common.c
  10. 12
      engine/common/con_utils.c
  11. 2
      engine/common/custom.c
  12. 2
      engine/common/host.c
  13. 20
      engine/common/imagelib/imagelib.h
  14. 4
      engine/common/imagelib/img_bmp.c
  15. 4
      engine/common/imagelib/img_dds.c
  16. 2
      engine/common/imagelib/img_main.c
  17. 4
      engine/common/imagelib/img_tga.c
  18. 14
      engine/common/imagelib/img_wad.c
  19. 19
      engine/common/mod_bmodel.c
  20. 4
      engine/common/mod_studio.c
  21. 2
      engine/common/model.c
  22. 2
      engine/common/net_chan.c
  23. 2
      engine/common/soundlib/snd_main.c
  24. 2
      engine/common/soundlib/snd_mp3.c
  25. 2
      engine/common/soundlib/snd_wav.c
  26. 6
      engine/common/soundlib/soundlib.h
  27. 2
      engine/platform/posix/sys_posix.c
  28. 2
      engine/server/sv_game.c
  29. 2
      engine/server/sv_log.c
  30. 6
      ref_gl/gl_rmain.c
  31. 6
      ref_gl/gl_rsurf.c
  32. 20
      ref_gl/gl_sprite.c
  33. 8
      ref_gl/gl_studio.c

4
engine/client/cl_game.c

@ -647,7 +647,7 @@ and hold them into permament memory pool
*/ */
static void CL_InitTitles( const char *filename ) static void CL_InitTitles( const char *filename )
{ {
size_t fileSize; fs_offset_t fileSize;
byte *pMemFile; byte *pMemFile;
int i; int i;
@ -1194,7 +1194,7 @@ upload sprite frames
static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite, uint type, uint texFlags ) static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite, uint type, uint texFlags )
{ {
byte *buf; byte *buf;
size_t size; fs_offset_t size;
qboolean loaded; qboolean loaded;
Assert( m_pSprite != NULL ); Assert( m_pSprite != NULL );

2
engine/client/cl_parse.c

@ -1702,7 +1702,7 @@ CL_ParseResLocation
*/ */
void CL_ParseResLocation( sizebuf_t *msg ) void CL_ParseResLocation( sizebuf_t *msg )
{ {
const char *data = MSG_ReadString( msg ); char *data = MSG_ReadString( msg );
char token[256]; char token[256];
if( Q_strlen( data ) > 256 ) if( Q_strlen( data ) > 256 )

2
engine/client/cl_scrn.c

@ -550,7 +550,7 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname )
{ {
int i, fontWidth; int i, fontWidth;
byte *buffer; byte *buffer;
size_t length; fs_offset_t length;
qfont_t *src; qfont_t *src;
if( cls.creditsFont.valid ) if( cls.creditsFont.valid )

8
engine/client/console.c

@ -558,7 +558,7 @@ static qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font
{ {
int i, fontWidth; int i, fontWidth;
byte *buffer; byte *buffer;
size_t length; fs_offset_t length;
qfont_t *src; qfont_t *src;
if( font->valid ) 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 ) static void Con_DrawCharToConback( int num, const byte *conchars, byte *dest )
{ {
int row, col; int row, col;
byte *source; const byte *source;
int drawline; int drawline;
int x; int x;
@ -2349,8 +2349,8 @@ void Con_VidInit( void )
if( !con.background ) // last chance - quake conback image if( !con.background ) // last chance - quake conback image
{ {
qboolean draw_to_console = false; qboolean draw_to_console = false;
int length = 0; fs_offset_t length = 0;
byte *buf; const byte *buf;
// NOTE: only these games want to draw build number into console background // NOTE: only these games want to draw build number into console background
if( !Q_stricmp( FS_Gamedir(), "id1" )) if( !Q_stricmp( FS_Gamedir(), "id1" ))

4
engine/client/s_mix.c

@ -450,7 +450,7 @@ int S_MixDataToDevice( channel_t *pChannel, int sampleCount, int outRate, int ou
int availableSamples, outSampleCount; int availableSamples, outSampleCount;
wavdata_t *pSource = pChannel->sfx->cache; wavdata_t *pSource = pChannel->sfx->cache;
qboolean use_loop = pChannel->use_loop; qboolean use_loop = pChannel->use_loop;
char *pData = NULL; void *pData = NULL;
double sampleFrac; double sampleFrac;
int i, j; int i, j;
@ -1059,4 +1059,4 @@ void MIX_PaintChannels( int endtime )
S_TransferPaintBuffer( end ); S_TransferPaintBuffer( end );
paintedtime = end; paintedtime = end;
} }
} }

6
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; 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; if( pdata == NULL ) return;
i = 0; i = 0;
@ -123,7 +123,7 @@ void SND_MoveMouth16( channel_t *ch, wavdata_t *pSource, int count )
} }
else pos = ch->pMixer.sample; 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; if( pdata == NULL ) return;
i = 0; i = 0;
@ -149,4 +149,4 @@ void SND_MoveMouth16( channel_t *ch, wavdata_t *pSource, int count )
pMouth->sndavg = 0; pMouth->sndavg = 0;
pMouth->sndcount = 0; pMouth->sndcount = 0;
} }
} }

2
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 ) if( !invalid )
{ {

2
engine/common/cmd.c

@ -765,7 +765,7 @@ void Cmd_RemoveCommand( const char *cmd_name )
Cmd_LookupCmds 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; cmd_t *cmd;
cmdalias_t *alias; cmdalias_t *alias;

2
engine/common/common.c

@ -847,7 +847,7 @@ byte* COM_LoadFileForMe( const char *filename, int *pLength )
{ {
string name; string name;
byte *file, *pfile; byte *file, *pfile;
size_t iLength; fs_offset_t iLength;
if( !COM_CheckString( filename )) if( !COM_CheckString( filename ))
{ {

12
engine/common/con_utils.c

@ -914,9 +914,9 @@ static void Con_AddCommandToList( const char *s, const char *unused1, const char
Con_SortCmds 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; con.shortestMatch[0] = 0;
// find matching commands and variables // find matching commands and variables
Cmd_LookupCmds( NULL, NULL, Con_AddCommandToList ); Cmd_LookupCmds( NULL, NULL, (setpair_t)Con_AddCommandToList );
Cvar_LookupVars( 0, NULL, NULL, Con_AddCommandToList ); Cvar_LookupVars( 0, NULL, NULL, (setpair_t)Con_AddCommandToList );
if( !con.matchCount ) return; // no matches if( !con.matchCount ) return; // no matches
@ -1100,8 +1100,8 @@ void Con_CompleteCommand( field_t *field )
Con_Printf( "]%s\n", con.completionField->buffer ); Con_Printf( "]%s\n", con.completionField->buffer );
// run through again, printing matches // run through again, printing matches
Cmd_LookupCmds( NULL, NULL, Con_PrintCmdMatches ); Cmd_LookupCmds( NULL, NULL, (setpair_t)Con_PrintCmdMatches );
Cvar_LookupVars( 0, NULL, NULL, Con_PrintCvarMatches ); Cvar_LookupVars( 0, NULL, NULL, (setpair_t)Con_PrintCvarMatches );
} }
} }

2
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 COM_CreateCustomization( customization_t *pListHead, resource_t *pResource, int playernumber, int flags, customization_t **pOut, int *nLumps )
{ {
qboolean bError = false; qboolean bError = false;
size_t checksize = 0; fs_offset_t checksize = 0;
customization_t *pCust; customization_t *pCust;
if( pOut ) *pOut = NULL; if( pOut ) *pOut = NULL;

2
engine/common/host.c

@ -255,7 +255,7 @@ void Host_Exec_f( void )
{ {
string cfgpath; string cfgpath;
char *f, *txt; char *f, *txt;
size_t len; fs_offset_t len;
if( Cmd_Argc() != 2 ) if( Cmd_Argc() != 2 )
{ {

20
engine/common/imagelib/imagelib.h

@ -47,7 +47,7 @@ typedef struct loadformat_s
{ {
const char *formatstring; const char *formatstring;
const char *ext; 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; image_hint_t hint;
} loadpixformat_t; } loadpixformat_t;
@ -296,15 +296,15 @@ void Image_GetPaletteHL( void );
// //
// formats load // formats load
// //
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
// //
// formats save // formats save

4
engine/common/imagelib/img_bmp.c

@ -33,7 +33,7 @@ typedef struct tagRGBQUAD {
Image_LoadBMP 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 *buf_p, *pixbuf;
byte palette[256][4]; byte palette[256][4];
@ -83,7 +83,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, size_t filesize )
if( bhdr.fileSize != filesize ) if( bhdr.fileSize != filesize )
{ {
// Sweet Half-Life issues. splash.bmp have bogus 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. // bogus compression? Only non-compressed supported.

4
engine/common/imagelib/img_dds.c

@ -239,7 +239,7 @@ void Image_DXTAdjustVolume( dds_t *hdr )
Image_LoadDDS 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; dds_t header;
byte *fin; byte *fin;
@ -329,4 +329,4 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
SetBits( image.flags, IMAGE_DDS_FORMAT ); SetBits( image.flags, IMAGE_DDS_FORMAT );
return true; return true;
} }

2
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; string path, loadname, sidename;
qboolean anyformat = true; qboolean anyformat = true;
int i; int i;
size_t filesize = 0; fs_offset_t filesize = 0;
const loadpixformat_t *format; const loadpixformat_t *format;
const cubepack_t *cmap; const cubepack_t *cmap;
byte *f; byte *f;

4
engine/common/imagelib/img_tga.c

@ -21,7 +21,7 @@ GNU General Public License for more details.
Image_LoadTGA 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; int i, columns, rows, row_inc, row, col;
byte *buf_p, *pixbuf, *targa_rgba; byte *buf_p, *pixbuf, *targa_rgba;
@ -302,4 +302,4 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
Mem_Free( buffer ); Mem_Free( buffer );
return true; return true;
} }

14
engine/common/imagelib/img_wad.c

@ -25,13 +25,13 @@ GNU General Public License for more details.
Image_LoadPAL 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; int rendermode = LUMP_NORMAL;
if( filesize != 768 ) 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; return false;
} }
@ -74,7 +74,7 @@ qboolean Image_LoadPAL( const char *name, const byte *buffer, size_t filesize )
Image_LoadFNT 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; qfont_t font;
const byte *pal, *fin; const byte *pal, *fin;
@ -147,7 +147,7 @@ void Image_SetMDLPointer( byte *p )
Image_LoadMDL 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; byte *fin;
size_t pixels; size_t pixels;
@ -197,7 +197,7 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
Image_LoadSPR 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 dspriteframe_t *pin; // identical for q1\hl sprites
qboolean truecolor = false; qboolean truecolor = false;
@ -261,7 +261,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, size_t filesize )
Image_LoadLMP 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; lmp_t lmp;
byte *fin, *pal; byte *fin, *pal;
@ -346,7 +346,7 @@ qboolean Image_LoadLMP( const char *name, const byte *buffer, size_t filesize )
Image_LoadMIP 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; mip_t mip;
qboolean hl_texture; qboolean hl_texture;

19
engine/common/mod_bmodel.c

@ -1251,7 +1251,7 @@ static qboolean Mod_LoadColoredLighting( dbspmodel_t *bmod )
char modelname[64]; char modelname[64];
char path[64]; char path[64];
int iCompare; int iCompare;
size_t litdatasize; fs_offset_t litdatasize;
byte *in; byte *in;
COM_FileBase( loadmodel->name, modelname ); COM_FileBase( loadmodel->name, modelname );
@ -1279,7 +1279,7 @@ static qboolean Mod_LoadColoredLighting( dbspmodel_t *bmod )
if( litdatasize != ( bmod->lightdatasize * 3 )) 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 ); Mem_Free( in );
return false; return false;
} }
@ -1301,7 +1301,7 @@ Mod_LoadDeluxemap
static void Mod_LoadDeluxemap( dbspmodel_t *bmod ) static void Mod_LoadDeluxemap( dbspmodel_t *bmod )
{ {
char modelname[64]; char modelname[64];
size_t deluxdatasize; fs_offset_t deluxdatasize;
char path[64]; char path[64];
int iCompare; int iCompare;
byte *in; byte *in;
@ -1334,7 +1334,7 @@ static void Mod_LoadDeluxemap( dbspmodel_t *bmod )
if( deluxdatasize != bmod->lightdatasize ) 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 ); Mem_Free( in );
return; return;
} }
@ -1527,7 +1527,7 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
if( bmod->isworld ) if( bmod->isworld )
{ {
char entfilename[MAX_QPATH]; char entfilename[MAX_QPATH];
int entpatchsize; fs_offset_t entpatchsize;
size_t ft1, ft2; size_t ft1, ft2;
// world is check for entfile too // world is check for entfile too
@ -1947,7 +1947,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
} }
else else
{ {
size_t srcSize = 0; fs_offset_t srcSize = 0;
byte *src = NULL; byte *src = NULL;
// NOTE: we can't loading it from wad as normal because _luma texture doesn't exist // 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 ) static void Mod_LoadTexInfo( dbspmodel_t *bmod )
{ {
mfaceinfo_t *fout, *faceinfo; mfaceinfo_t *fout, *faceinfo;
int i, j, miptex; int i, j, k, miptex;
dfaceinfo_t *fin; dfaceinfo_t *fin;
mtexinfo_t *out; mtexinfo_t *out;
dtexinfo_t *in; dtexinfo_t *in;
@ -2109,8 +2109,9 @@ static void Mod_LoadTexInfo( dbspmodel_t *bmod )
for( i = 0; i < bmod->numtexinfo; i++, in++, out++ ) for( i = 0; i < bmod->numtexinfo; i++, in++, out++ )
{ {
for( j = 0; j < 8; j++ ) for( j = 0; j < 2; j++ )
out->vecs[0][j] = in->vecs[0][j]; for( k = 0; k < 4; k++ )
out->vecs[j][k] = in->vecs[j][k];
miptex = in->miptex; miptex = in->miptex;
if( miptex < 0 || miptex > loadmodel->numtextures ) if( miptex < 0 || miptex > loadmodel->numtextures )

4
engine/common/mod_studio.c

@ -598,8 +598,8 @@ void *R_StudioGetAnim( studiohdr_t *m_pStudioHeader, model_t *m_pSubModel, mstud
{ {
mstudioseqgroup_t *pseqgroup; mstudioseqgroup_t *pseqgroup;
cache_user_t *paSequences; cache_user_t *paSequences;
size_t filesize; fs_offset_t filesize;
byte *buf; byte *buf;
pseqgroup = (mstudioseqgroup_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqgroupindex) + pseqdesc->seqgroup; pseqgroup = (mstudioseqgroup_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqgroupindex) + pseqdesc->seqgroup;
if( pseqdesc->seqgroup == 0 ) if( pseqdesc->seqgroup == 0 )

2
engine/common/model.c

@ -507,7 +507,7 @@ Mod_LoadCacheFile
void Mod_LoadCacheFile( const char *filename, cache_user_t *cu ) void Mod_LoadCacheFile( const char *filename, cache_user_t *cu )
{ {
char modname[MAX_QPATH]; char modname[MAX_QPATH];
size_t size; fs_offset_t size;
byte *buf; byte *buf;
Assert( cu != NULL ); Assert( cu != NULL );

2
engine/common/net_chan.c

@ -953,7 +953,7 @@ int Netchan_CreateFileFragments( netchan_t *chan, const char *filename )
int send, pos; int send, pos;
int remaining; int remaining;
int bufferid = 1; int bufferid = 1;
int filesize = 0; fs_offset_t filesize = 0;
char compressedfilename[MAX_OSPATH]; char compressedfilename[MAX_OSPATH];
int compressedFileTime; int compressedFileTime;
int fileTime; int fileTime;

2
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 ); const char *ext = COM_FileExtension( filename );
string path, loadname; string path, loadname;
qboolean anyformat = true; qboolean anyformat = true;
size_t filesize = 0; fs_offset_t filesize = 0;
const loadwavfmt_t *format; const loadwavfmt_t *format;
byte *f; byte *f;

2
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; void *mpeg;
size_t pos = 0; size_t pos = 0;

2
engine/common/soundlib/snd_wav.c

@ -139,7 +139,7 @@ qboolean StreamFindNextChunk( file_t *file, const char *name, int *last_chunk )
Sound_LoadWAV 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; int samples, fmt;
qboolean mpeg_stream = false; qboolean mpeg_stream = false;

6
engine/common/soundlib/soundlib.h

@ -25,7 +25,7 @@ typedef struct loadwavfmt_s
{ {
const char *formatstring; const char *formatstring;
const char *ext; 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; } loadwavfmt_t;
typedef struct streamfmt_s typedef struct streamfmt_s
@ -117,8 +117,8 @@ extern sndlib_t sound;
// //
// formats load // formats load
// //
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 );
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 );
// //
// stream operate // stream operate

2
engine/platform/posix/sys_posix.c

@ -98,6 +98,6 @@ void Platform_MessageBox( const char *title, const char *message, qboolean paren
fprintf( stderr, fprintf( stderr,
"======================================\n" "======================================\n"
"%s: %s\n" "%s: %s\n"
"======================================\n, title, message ); "======================================\n", title, message );
} }
#endif #endif

2
engine/server/sv_game.c

@ -2172,7 +2172,7 @@ SV_StartMusic
void SV_StartMusic( const char *curtrack, const char *looptrack, int position ) void SV_StartMusic( const char *curtrack, const char *looptrack, int position )
{ {
MSG_BeginServerCmd( &sv.multicast, svc_stufftext ); 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 ); SV_Multicast( MSG_ALL, NULL, NULL, false, false );
} }

2
engine/server/sv_log.c

@ -149,7 +149,7 @@ void Log_PrintServerVars( void )
return; return;
Log_Printf( "Server cvars start\n" ); 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" ); Log_Printf( "Server cvars end\n" );
} }

6
ref_gl/gl_rmain.c

@ -78,7 +78,7 @@ R_TransEntityCompare
Sorting translucent entities by rendermode then by distance 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; cl_entity_t *ent1, *ent2;
vec3_t vecLen, org; 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 rendermode1;
int rendermode2; int rendermode2;
ent1 = (cl_entity_t *)*a; ent1 = *(cl_entity_t **)a;
ent2 = (cl_entity_t *)*b; ent2 = *(cl_entity_t **)b;
rendermode1 = R_GetEntityRenderMode( ent1 ); rendermode1 = R_GetEntityRenderMode( ent1 );
rendermode2 = R_GetEntityRenderMode( ent2 ); rendermode2 = R_GetEntityRenderMode( ent2 );

6
ref_gl/gl_rsurf.c

@ -1435,14 +1435,14 @@ R_SurfaceCompare
compare translucent surfaces 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; msurface_t *surf1, *surf2;
vec3_t org1, org2; vec3_t org1, org2;
float len1, len2; float len1, len2;
surf1 = (msurface_t *)a->surf; surf1 = (msurface_t *)((sortedface_t *)a)->surf;
surf2 = (msurface_t *)b->surf; surf2 = (msurface_t *)((sortedface_t *)b)->surf;
VectorAdd( RI.currententity->origin, surf1->info->origin, org1 ); VectorAdd( RI.currententity->origin, surf1->info->origin, org1 );
VectorAdd( RI.currententity->origin, surf2->info->origin, org2 ); VectorAdd( RI.currententity->origin, surf2->info->origin, org2 );

20
ref_gl/gl_sprite.c

@ -51,9 +51,9 @@ R_SpriteLoadFrame
upload a single frame 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; mspriteframe_t *pspriteframe;
int gl_texturenum = 0; int gl_texturenum = 0;
char texname[128]; char texname[128];
@ -96,16 +96,16 @@ R_SpriteLoadGroup
upload a group frames 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; mspritegroup_t *pspritegroup;
dspriteinterval_t *pin_intervals; const dspriteinterval_t *pin_intervals;
float *poutintervals; float *poutintervals;
int i, groupsize, numframes; int i, groupsize, numframes;
void *ptemp; const void *ptemp;
pingroup = (dspritegroup_t *)pin; pingroup = (const dspritegroup_t *)pin;
numframes = pingroup->numframes; numframes = pingroup->numframes;
groupsize = sizeof( mspritegroup_t ) + (numframes - 1) * sizeof( pspritegroup->frames[0] ); 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; pspritegroup->numframes = numframes;
*ppframe = (mspriteframe_t *)pspritegroup; *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 )); poutintervals = Mem_Calloc( mod->mempool, numframes * sizeof( float ));
pspritegroup->intervals = poutintervals; pspritegroup->intervals = poutintervals;
@ -126,13 +126,13 @@ static dframetype_t *R_SpriteLoadGroup( model_t *mod, void *pin, mspriteframe_t
pin_intervals++; pin_intervals++;
} }
ptemp = (void *)pin_intervals; ptemp = (const void *)pin_intervals;
for( i = 0; i < numframes; i++ ) for( i = 0; i < numframes; i++ )
{ {
ptemp = R_SpriteLoadFrame( mod, ptemp, &pspritegroup->frames[i], framenum * 10 + i ); ptemp = R_SpriteLoadFrame( mod, ptemp, &pspritegroup->frames[i], framenum * 10 + i );
} }
return (dframetype_t *)ptemp; return (const dframetype_t *)ptemp;
} }
/* /*

8
ref_gl/gl_studio.c

@ -1939,12 +1939,12 @@ R_StudioMeshCompare
Sorting opaque entities by model type 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; return 1;
if( FBitSet( a->flags, STUDIO_NF_MASKED )) if( FBitSet( ((const sortedmesh_t*)a)->flags, STUDIO_NF_MASKED ))
return -1; return -1;
return 0; return 0;
@ -3118,7 +3118,7 @@ void R_StudioRenderFinal( void )
{ {
for( i = 0; i < m_pStudioHeader->numbodyparts; i++ ) 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 ); GL_StudioSetRenderMode( rendermode );
R_StudioDrawPoints(); R_StudioDrawPoints();

Loading…
Cancel
Save