Drastically reduced compiler warnings on clang

This commit is contained in:
OM 2023-05-21 00:29:26 +02:00
parent 31ac3f7096
commit 76178064a0
33 changed files with 93 additions and 92 deletions

View file

@ -4801,7 +4801,7 @@ void ClientGameCommandManager::SpawnTempModel(int mcount, int timeAlive)
// Make sure to not spawn the world model as a tempmodel
// Of course it would become extremely confusing...
if (!(p->cgd.flags & T_DLIGHT) && p->ent.reType == ET_MODELANIM_SKEL && !p->ent.hModel)
if (!(p->cgd.flags & T_DLIGHT) && p->ent.reType == RT_MODEL && !p->ent.hModel)
{
Com_Printf("^~^~^ not spawning tempmodel because it is using the world as a brush model\n");
FreeTempModel(p);

View file

@ -273,7 +273,7 @@ enum class vsstypes_t : unsigned char {
NUM_VSS_TYPES
};
class cvssource_t : public Class
class cvssource_t
{
public:
cvssource_t* next;
@ -309,7 +309,7 @@ public:
qboolean lastValid;
};
class cvssourcestate_t : public Class
class cvssourcestate_t
{
public:
Vector origin;

View file

@ -934,7 +934,7 @@ void CL_WritePacket( void ) {
clc.lastPacketSentTime = cls.realtime;
if ( cl_showSend->integer ) {
Com_Printf( "%i ", buf.cursize );
Com_Printf( "%zu ", buf.cursize );
}
CL_Netchan_Transmit (&clc.netchan, &buf);

View file

@ -51,8 +51,8 @@ qboolean alt_down;
qboolean ctrl_down;
typedef struct {
char *name;
int keynum;
const char *name;
int keynum;
} keyname_t;
@ -466,7 +466,7 @@ void Key_SetCtrlBinding( int keynum, const char *binding ) {
Key_GetBinding
===================
*/
char *Key_GetBinding( int keynum ) {
const char *Key_GetBinding( int keynum ) {
if ( keynum < 0 || keynum >= K_LASTKEY ) {
return "";
}

View file

@ -3299,7 +3299,7 @@ CL_ServerInfoPacket
void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
int i, type;
char info[MAX_INFO_STRING];
char* str;
const char* str;
char *infoString;
int prot;
@ -3495,7 +3495,7 @@ CL_ServerStatusResponse
===================
*/
void CL_ServerStatusResponse( netadr_t from, msg_t *msg ) {
char *s;
const char *s;
char info[MAX_INFO_STRING];
int i, l, score, ping;
int len;
@ -3588,7 +3588,7 @@ CL_LocalServers_f
==================
*/
void CL_LocalServers_f( void ) {
char *message;
const char *message;
int i, j;
netadr_t to;

View file

@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "client.h"
#include "cl_ui.h"
char *svc_strings[256] = {
const char *svc_strings[256] = {
"svc_bad",
"svc_nop",
@ -41,7 +41,7 @@ char *svc_strings[256] = {
msg_t *cl_currentMSG;
void SHOWNET( msg_t *msg, char *s) {
void SHOWNET( msg_t *msg, const char *s) {
if ( cl_shownet->integer >= 2) {
Com_Printf ("%3i:%s\n", msg->readcount-1, s);
}
@ -793,7 +793,7 @@ void CL_ParseServerMessage( msg_t *msg ) {
int cmd;
//Com_Printf( "ParseServerMessage: %i\n", msg->cursize );
if ( cl_shownet->integer == 1 ) {
Com_Printf ("%i ",msg->cursize);
Com_Printf ("%zu ",msg->cursize);
} else if ( cl_shownet->integer >= 2 ) {
Com_Printf ("------------------\n");
}

View file

@ -877,7 +877,7 @@ Key_GetBindingBuf
====================
*/
static void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
char *value;
const char *value;
value = Key_GetBinding( keynum );
if ( value ) {
@ -3638,8 +3638,8 @@ void UI_WantsKeyboard() {
}
struct widgettrans_s {
char *src;
char *dst;
const char *src;
const char *dst;
};
static widgettrans_s s_widgettrans[ 2 ] =
@ -4885,7 +4885,7 @@ static void SaveConsoleRectangle( void ) {
if( !fakk_console->IsMinimized() ) {
r = fakk_console->getFrame();
Cvar_Set( "ui_consoleposition", va( "%d %d %d %d", r.pos.x, r.pos.y, r.size.width, r.size.height ) );
Cvar_Set( "ui_consoleposition", va( "%d %d %d %d", (int)r.pos.x, (int)r.pos.y, (int)r.size.width, (int)r.size.height ) );
if( wasMinimized ) {
fakk_console->ProcessEvent( UIFloatingWindow::W_MinimizePressed );
@ -5492,7 +5492,7 @@ qboolean UI_IsResourceLoaded( const char *name ) {
case 104:
return TIKI_FindTikiAnim( name + 1 ) != NULL;
case 103:
return SkeletorCacheFindFilename( name + 1, NULL ) != NULL;
return SkeletorCacheFindFilename( name + 1, NULL );
case 107:
return S_IsSoundRegistered( name + 1 );
case 110:

View file

@ -29,8 +29,8 @@ public:
SoundPickerClass();
void FileSelected( str &currentDirectory, str &partialName, str &fullname );
void FileChosen( str &currentDirectory, str &partialName, str &fullname );
void FileSelected( str &currentDirectory, str &partialName, str &fullname ) override;
void FileChosen( str &currentDirectory, str &partialName, str &fullname ) override;
};
#endif /* __CL_UISOUNDPICKER_H__ */

View file

@ -519,7 +519,8 @@ void UIFakkLabel::DrawStatbar( float frac )
}
break;
}
default:
break;
}
}
else
@ -574,6 +575,8 @@ void UIFakkLabel::DrawStatbar( float frac )
}
break;
}
default:
break;
}
}
}
@ -603,6 +606,8 @@ void UIFakkLabel::DrawStatbar( float frac )
1.0
);
break;
default:
break;
}
}
}

View file

@ -59,7 +59,7 @@ public:
void UpdateLocationPrint( int x, int y, const char *s, float alpha );
qboolean LetterboxActive( void );
void InitSubtitle( void );
void FrameInitialized( void );
void FrameInitialized( void ) override;
virtual void Pressed( Event *ev );
};

View file

@ -42,7 +42,7 @@ extern int chat_playerNum;
int Key_StringToKeynum( const char *str );
void Key_WriteBindings( fileHandle_t f );
void Key_SetBinding( int keynum, const char *binding );
char *Key_GetBinding( int keynum );
const char *Key_GetBinding( int keynum );
qboolean Key_IsDown( int keynum );
qboolean Key_GetOverstrikeMode( void );
void Key_SetOverstrikeMode( qboolean state );

View file

@ -422,7 +422,7 @@ void State::ParseAndProcessCommand
{
int argc;
const char *argv[ MAX_COMMANDS ];
char args[ MAX_COMMANDS ][ MAXTOKEN ];
char args[ MAX_COMMANDS ][ SCRIPT_MAXTOKEN ];
Script script;
Event *event;

View file

@ -241,7 +241,7 @@ typedef struct gameImport_s
void ( *AddCommand )( const char *cmdName, xcommand_t cmdFunction );
int ( *FS_ReadFile )( const char *qpath, void **buffer, qboolean quiet );
void ( *FS_FreeFile )( void *buffer );
size_t( *FS_WriteFile )( const char *qpath, const void *buffer, size_t size );
int ( *FS_WriteFile )( const char *qpath, const void *buffer, int size );
fileHandle_t ( *FS_FOpenFileWrite )( const char *fileName );
fileHandle_t ( *FS_FOpenFileAppend )( const char *fileName );
const char *( *FS_PrepFileWrite )( const char *fileName );

View file

@ -582,7 +582,7 @@ const char* Script::GrabNextToken(qboolean crossline)
*token_p++ = *script_p++;
}
if (token_p == &token[MAXTOKEN]) {
if (token_p == &token[SCRIPT_MAXTOKEN]) {
FILE_Error(ERR_DROP, "Token too large on line %i in file %s\n",
line, filename.c_str());
}
@ -824,7 +824,7 @@ const char* Script::GetLine(qboolean crossline)
start = script_p;
SkipToEOL();
size = script_p - start;
if (size < (MAXTOKEN - 1)) {
if (size < (SCRIPT_MAXTOKEN - 1)) {
memcpy(token, start, size);
token[size] = '\0';
} else {
@ -859,7 +859,7 @@ const char* Script::GetRaw(void)
start = script_p;
SkipToEOL();
size = script_p - start;
if (size < (MAXTOKEN - 1)) {
if (size < (SCRIPT_MAXTOKEN - 1)) {
memset(token, 0, sizeof(token));
memcpy(token, start, size);
} else {
@ -946,7 +946,7 @@ const char* Script::GetString(qboolean crossline)
startline, filename.c_str());
}
if (token_p == &token[MAXTOKEN]) {
if (token_p == &token[SCRIPT_MAXTOKEN]) {
FILE_Error(ERR_DROP, "String too large on line %i in file %s\n",
line, filename.c_str());
}
@ -1075,7 +1075,7 @@ int Script::LinesInFile(void)
qboolean temp_tokenready;
const char* temp_script_p;
int temp_line;
char temp_token[MAXTOKEN];
char temp_token[SCRIPT_MAXTOKEN];
int numentries;
temp_tokenready = tokenready;

View file

@ -40,13 +40,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define TOKENSPACE (' ')
#define TOKENSPECIAL ('$')
#define MAXTOKEN 512
#define SCRIPT_MAXTOKEN 512
typedef struct {
qboolean tokenready;
int offset;
int line;
char token[MAXTOKEN];
char token[SCRIPT_MAXTOKEN];
} scriptmarker_t;
typedef struct {
@ -67,7 +67,7 @@ protected:
Container<macro*> macrolist;
int line;
char token[MAXTOKEN];
char token[SCRIPT_MAXTOKEN];
qboolean releaseBuffer;
qboolean hasError;

View file

@ -388,7 +388,7 @@ void TikiScript::AddMacro( const char *name, const char *expansion )
return;
}
if( nummacros >= MAXMACROS )
if( nummacros >= TIKI_MAXMACROS )
{
TIKI_DPrintf( "Too many %cdefine in file %s\n", TOKENSPECIAL, Filename() );
}
@ -420,7 +420,7 @@ qboolean TikiScript::ProcessCommand( qboolean crossline )
char argument1[ 256 ];
char argument2[ 256 ];
sscanf( script_p, "%c%s %s %s\n", &dummy, &command, &argument1, &argument2 );
sscanf( script_p, "%c%s %s %s\n", &dummy, command, argument1, argument2 );
if( !stricmp( command, "define" ) )
{
@ -760,7 +760,7 @@ const char *TikiScript::GetToken( qboolean crossline )
*token_p++ = *i->script_p++;
}
if( token_p == &i->token[ MAXTOKEN ] )
if( token_p == &i->token[ TIKI_MAXTOKEN ] )
{
TIKI_DPrintf( "Token too large on line %i in file %s\n", i->line, i->Filename() );
break;
@ -869,7 +869,7 @@ const char *TikiScript::GetLine( qboolean crossline )
start = i->script_p;
SkipToEOL();
size = i->script_p - start;
if( size < ( MAXTOKEN - 1 ) )
if( size < ( TIKI_MAXTOKEN - 1 ) )
{
memcpy( i->token, start, size );
i->token[ size ] = '\0';
@ -928,7 +928,7 @@ const char *TikiScript::GetAndIgnoreLine( qboolean crossline )
start = script_p;
SkipToEOL();
size = script_p - start;
if( size < ( MAXTOKEN - 1 ) )
if( size < ( TIKI_MAXTOKEN - 1 ) )
{
memcpy( token, start, size );
token[ size ] = '\0';
@ -981,7 +981,7 @@ const char *TikiScript::GetRaw( void )
start = script_p;
SkipToEOL();
size = script_p - start;
if( size < ( MAXTOKEN - 1 ) )
if( size < ( TIKI_MAXTOKEN - 1 ) )
{
memset( token, 0, sizeof( token ) );
memcpy( token, start, size );
@ -1086,7 +1086,7 @@ const char *TikiScript::GetString( qboolean crossline )
"line %d in file %s\n", startline, i->filename );
}
if( token_p == &i->token[ MAXTOKEN ] )
if( token_p == &i->token[ TIKI_MAXTOKEN ] )
{
TIKI_DPrintf( "String too large on line %i in file %s\n", i->line, i->filename );
}
@ -1192,7 +1192,7 @@ int TikiScript::LinesInFile( void )
qboolean temp_tokenready;
const char *temp_script_p;
int temp_line;
char temp_token[ MAXTOKEN ];
char temp_token[ TIKI_MAXTOKEN ];
int numentries;
temp_tokenready = tokenready;
@ -1232,7 +1232,7 @@ void TikiScript::Parse( char *data, int length, const char *name )
Reset();
this->length = length;
end_p = script_p + length;
strncpy( filename, name, MAXTOKEN );
strncpy( filename, name, TIKI_MAXTOKEN );
}
/*

View file

@ -32,21 +32,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define TOKENSPACE (' ')
#define TOKENSPECIAL ('$')
#ifndef MAXTOKEN
#define MAXTOKEN 256
#endif
#define TIKI_MAXTOKEN 256
#define MAXMACROS 48
#define TIKI_MAXMACROS 48
typedef struct {
char name[ MAXTOKEN ];
char macro[ MAXTOKEN ];
char name[TIKI_MAXTOKEN];
char macro[TIKI_MAXTOKEN];
} tiki_macro_t;
typedef struct {
const char *mark_script_p;
qboolean mark_tokenready;
char mark_token[ MAXTOKEN ];
char mark_token[TIKI_MAXTOKEN];
} tiki_mark_t;
#ifdef __cplusplus
@ -57,13 +55,13 @@ protected:
qboolean tokenready;
class TikiScript *include;
class TikiScript *parent;
char filename[ MAXTOKEN ];
char filename[TIKI_MAXTOKEN];
const char *script_p;
const char *end_p;
tiki_macro_t macros[ MAXMACROS ];
tiki_macro_t macros[TIKI_MAXMACROS];
int nummacros;
int line;
char token[ MAXTOKEN ];
char token[TIKI_MAXTOKEN];
qboolean releaseBuffer;
tiki_mark_t mark[ 64 ];
int mark_pos;

View file

@ -98,7 +98,7 @@ typedef struct uiimport_s {
const char *( *Client_TranslateWidgetName )( const char *widget );
void( *Connect )( const char *server );
const char *( *Key_GetKeynameForCommand )( const char *command );
char *( *Key_GetCommandForKey )( int keynum );
const char *( *Key_GetCommandForKey )( int keynum );
void ( *Key_SetBinding )( int keynum, const char *binding );
void ( *Key_GetKeysForCommand )( const char *command, int *key1, int *key2 );
const char *( *Key_KeynumToString )( int keynum );

View file

@ -44,8 +44,8 @@ public:
void Pressed( void );
void SetCommand( Event *ev );
void SetCommand( str s );
void DrawUnpressed( void );
void DrawPressed( void );
void DrawUnpressed( void ) override;
void DrawPressed( void ) override;
void Clear( void );
qboolean KeyEvent( int key, unsigned int time ) override;
void SetAlternate( qboolean a );

View file

@ -77,8 +77,6 @@ int UIConsole::getNextItem
return -1;
}
m_numitems = m_numitems;
m_firstitem = m_firstitem;
prev = prev + 1;
if (m_numitems < MAX_CONSOLE_ITEMS)

View file

@ -30,7 +30,7 @@ public:
public:
UIChildSpaceWidget();
qboolean KeyEvent( int key, unsigned int time );
qboolean KeyEvent( int key, unsigned int time ) override;
};
class UIFloatingWindow : public UIWidget {

View file

@ -30,7 +30,7 @@ public:
CLASS_PROTOTYPE( UIGlobalGameList );
public:
virtual void UpdateServers();
virtual void UpdateServers() override;
};
#endif

View file

@ -69,7 +69,7 @@ public:
void EventConnect( Event *ev );
void PlayEnterSound( void );
qboolean SetActiveRow( UIWidget *w );
void Realign( void );
void Realign( void ) override;
};
class UILanGameListLabel : public UILabel {

View file

@ -48,28 +48,28 @@ public:
protected:
void Draw( void ) override;
qboolean KeyEvent( int key, unsigned int time );
void CharEvent( int ch );
qboolean KeyEvent( int key, unsigned int time ) override;
void CharEvent( int ch ) override;
void Pressed( Event *ev );
void Released( Event *ev );
void ScrollNext( void );
void ScrollPrev( void );
void FrameInitialized( void );
void FrameInitialized( void ) override;
void LayoutAddListItem( Event *ev );
void AddItem( str item, str alias );
public:
UIList();
~UIList();
void UpdateUIElement( void );
void UpdateData( void );
void UpdateUIElement( void ) override;
void UpdateData( void ) override;
};
class UIListIndex : public UIList {
public:
CLASS_PROTOTYPE( UIListIndex );
qboolean KeyEvent( int key, unsigned int time );
qboolean KeyEvent( int key, unsigned int time ) override;
};
#endif /* __UILIST_H__ */

View file

@ -35,12 +35,12 @@ public:
protected:
virtual void TrySelectItem( int which );
qboolean KeyEvent( int key, unsigned int time );
qboolean KeyEvent( int key, unsigned int time ) override;
public:
UIListBase();
void FrameInitialized( void );
void FrameInitialized( void ) override;
int getCurrentItem( void );
virtual int getNumItems( void );
virtual void DeleteAllItems( void );
@ -78,20 +78,20 @@ protected:
void MouseReleased( Event *ev );
void DeleteAllItems( Event *ev );
void SetListFont( Event *ev );
void TrySelectItem( int which );
void TrySelectItem( int which ) override;
public:
UIListBox();
void AddItem( const char *item, const char *command );
void AddItem( int index, const char *command );
void FrameInitialized( void );
void FrameInitialized( void ) override;
void LayoutAddListItem( Event *ev );
void LayoutAddConfigstringListItem( Event *ev );
str getItemText( int which );
int getNumItems( void );
void DeleteAllItems( void );
void DeleteItem( int which );
int getNumItems( void ) override;
void DeleteAllItems( void ) override;
void DeleteItem( int which ) override;
};
#endif /* __UILISTBOX_H__ */

View file

@ -89,7 +89,7 @@ public:
UIListCtrl();
~UIListCtrl();
void FrameInitialized( void );
void FrameInitialized( void ) override;
void SetDrawHeader( qboolean bDrawHeader );
void AddItem( UIListCtrlItem *item );
void InsertItem( UIListCtrlItem *item, int where );
@ -97,9 +97,9 @@ public:
UIListCtrlItem *GetItem( int item );
void AddColumn( str title, int name, int width, bool numeric, bool reverse_sort );
void RemoveAllColumns( void );
int getNumItems( void );
void DeleteAllItems( void );
void DeleteItem( int which );
int getNumItems( void ) override;
void DeleteAllItems( void ) override;
void DeleteItem( int which ) override;
virtual void SortByColumn( int column );
void SortByLastSortColumn( void );
void setCompareFunction( int( *func ) ( const UIListCtrlItem *i1, const UIListCtrlItem *i2, int columnname ) );

View file

@ -53,7 +53,7 @@ public:
CLASS_PROTOTYPE( UIMultiLineEdit );
protected:
void FrameInitialized( void );
void FrameInitialized( void ) override;
void PointToSelectionPoint( UIPoint2D& p, selectionpoint_t& sel );
str& LineFromLineNumber( int num, bool resetpos );
void EnsureSelectionPointVisible( selectionpoint_t& point );
@ -67,8 +67,8 @@ public:
UIMultiLineEdit();
void Draw( void ) override;
qboolean KeyEvent( int key, unsigned int time );
void CharEvent( int ch );
qboolean KeyEvent( int key, unsigned int time ) override;
void CharEvent( int ch ) override;
UIPoint2D getEndSelPoint( void );
void MouseDown( Event *ev );
void MouseUp( Event *ev );

View file

@ -35,7 +35,7 @@ public:
public:
UINotepadEdit();
void CharEvent( int ch );
void CharEvent( int ch ) override;
void setNotepad( UINotepad *notepad );
bool GotoLine( int line );
bool FindText( const char *text, int offsetFromSel );

View file

@ -98,7 +98,7 @@ public:
void setPopupBGColor( str menu, UColor c );
void setPulldownShader( const char *title, UIReggedMaterial *mat );
void setSelectedPulldownShader( const char *title, UIReggedMaterial *mat );
void Realign( void );
void Realign( void ) override;
void Draw( void ) override;
};

View file

@ -35,10 +35,10 @@ public:
UIPulldownMenuContainer();
protected:
void FrameInitialized( void );
void setBackgroundAlpha( float f );
void setBackgroundColor( const UColor& color, bool setbordercolor );
void setForegroundColor( const UColor& color );
void FrameInitialized( void ) override;
void setBackgroundAlpha( float f ) override;
void setBackgroundColor( const UColor& color, bool setbordercolor ) override;
void setForegroundColor( const UColor& color ) override;
void SetPopupHighlightFGColor( Event *ev );
void SetPopupHighlightBGColor( Event *ev );
void SetPopupFGColor( Event *ev );
@ -47,7 +47,7 @@ protected:
void SetHighlightBGColor( Event *ev );
void SetMenuShader( Event *ev );
void SetSelectedMenuShader( Event *ev );
void Realign( void );
void Realign( void ) override;
void PulldownVirtualRes( Event *ev );
public:

View file

@ -149,7 +149,7 @@ CLASS_DECLARATION( UIWidget, UIStatusBar, NULL )
UIStatusBar::UIStatusBar()
{
m_sizeenabled = false;
m_sizeenabled = NULL;
m_created = false;
m_sizer = NULL;
m_align.alignment = WND_ALIGN_NONE;

View file

@ -2969,7 +2969,7 @@ bool UIWidget::PassEventToWidget
if( m_enabledCvar.length() )
{
if( !UI_GetCvarInt( m_cvarname, NULL ) )
if( !UI_GetCvarInt( m_cvarname, 0 ) )
return false;
}

View file

@ -69,8 +69,8 @@ public:
UIWidget *FindPrevControl( UIWidget *control );
void setCursor( const char *string );
void showCursor( bool show );
virtual void CharEvent( int ch );
virtual qboolean KeyEvent( int key, unsigned int time );
virtual void CharEvent( int ch ) override;
virtual qboolean KeyEvent( int key, unsigned int time ) override;
void CreateMenus( void );
UIReggedMaterial *RegisterShader( const str& name );
UIReggedMaterial *RefreshShader( const str& name );
@ -83,7 +83,7 @@ public:
void BindKeyToCommand( str command, int key, int index, qboolean alternate );
UIWidget *BindActive( void );
void SetBindActive( UIWidget *w );
virtual void Shutdown( void );
virtual void Shutdown( void ) override;
void DeactiveFloatingWindows( void );
bool DialogExists( void );
void RemoveAllDialogBoxes( void );