From f9efec5d9bd92a5b614aab549f8b0a009051fbbc Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 19 Jan 2009 21:14:27 +0000 Subject: [PATCH] fix a number of char types that should be int, to make them immune to unsigned char vs signed char disputes on different operating systems git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8658 d7cf8633-e32d-0410-b094-e92efae38249 --- cd_bsd.c | 2 +- cd_linux.c | 2 +- cd_null.c | 2 +- cd_sdl.c | 2 +- cd_shared.c | 4 +-- cd_win.c | 2 +- cdaudio.h | 2 +- conproc.c | 4 +-- console.c | 6 ++-- gl_draw.c | 2 +- keys.c | 6 ++-- keys.h | 2 +- menu.c | 98 ++++++++++++++++++++++++++--------------------------- menu.h | 2 +- 14 files changed, 68 insertions(+), 68 deletions(-) diff --git a/cd_bsd.c b/cd_bsd.c index e74a567a..7b3a855a 100644 --- a/cd_bsd.c +++ b/cd_bsd.c @@ -122,7 +122,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (unsigned char track) +int CDAudio_SysPlay (int track) { struct ioc_read_toc_entry rte; struct cd_toc_entry entry; diff --git a/cd_linux.c b/cd_linux.c index c8cdd6c3..4544a5d1 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -112,7 +112,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (unsigned char track) +int CDAudio_SysPlay (int track) { struct cdrom_tocentry entry; struct cdrom_ti ti; diff --git a/cd_null.c b/cd_null.c index d639614f..18987ada 100644 --- a/cd_null.c +++ b/cd_null.c @@ -48,7 +48,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (unsigned char track) +int CDAudio_SysPlay (int track) { return -1; } diff --git a/cd_sdl.c b/cd_sdl.c index b9a7a753..c508fc02 100644 --- a/cd_sdl.c +++ b/cd_sdl.c @@ -80,7 +80,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (unsigned char track) +int CDAudio_SysPlay (int track) { SDL_CDStop( cd ); endtime = realtime + (float) cd->track[ track - 1 ].length / CD_FPS; diff --git a/cd_shared.c b/cd_shared.c index 36bae127..9ab0210a 100644 --- a/cd_shared.c +++ b/cd_shared.c @@ -32,7 +32,7 @@ extern void CDAudio_SysCloseDoor (void); extern int CDAudio_SysGetAudioDiskInfo (void); extern float CDAudio_SysGetVolume (void); extern void CDAudio_SysSetVolume (float volume); -extern int CDAudio_SysPlay (unsigned char track); +extern int CDAudio_SysPlay (int track); extern int CDAudio_SysStop (void); extern int CDAudio_SysPause (void); extern int CDAudio_SysResume (void); @@ -273,7 +273,7 @@ success: CDAudio_Pause (); } -void CDAudio_Play (unsigned char track, qboolean looping) +void CDAudio_Play (int track, qboolean looping) { char buf[20]; dpsnprintf(buf, sizeof(buf), "%d", (int) track); diff --git a/cd_win.c b/cd_win.c index 2cc71613..913aec31 100644 --- a/cd_win.c +++ b/cd_win.c @@ -99,7 +99,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (unsigned char track) +int CDAudio_SysPlay (int track) { DWORD dwReturn; MCI_PLAY_PARMS mciPlayParms; diff --git a/cdaudio.h b/cdaudio.h index 993c4008..2b9729e3 100644 --- a/cdaudio.h +++ b/cdaudio.h @@ -39,7 +39,7 @@ extern cvar_t cdaudioinitialized; int CDAudio_Init(void); void CDAudio_Open(void); void CDAudio_Close(void); -void CDAudio_Play(unsigned char track, qboolean looping); +void CDAudio_Play(int track, qboolean looping); void CDAudio_Play_byName (const char *trackname, qboolean looping); void CDAudio_Stop(void); void CDAudio_Pause(void); diff --git a/conproc.c b/conproc.c index dd21407d..ccbb849c 100644 --- a/conproc.c +++ b/conproc.c @@ -39,7 +39,7 @@ BOOL GetScreenBufferLines (int *piLines); BOOL SetScreenBufferLines (int iLines); BOOL ReadText (LPTSTR pszText, int iBeginLine, int iEndLine); BOOL WriteText (LPCTSTR szText); -int CharToCode (char c); +int CharToCode (int c); BOOL SetConsoleCXCY(HANDLE hStdout, int cx, int cy); @@ -262,7 +262,7 @@ BOOL WriteText (LPCTSTR szText) } -int CharToCode (char c) +int CharToCode (int c) { char upper; diff --git a/console.c b/console.c index 4d9b71b8..e545b702 100644 --- a/console.c +++ b/console.c @@ -844,7 +844,7 @@ Con_Rcon_AddChar Adds a character to the rcon buffer ================ */ -void Con_Rcon_AddChar(char c) +void Con_Rcon_AddChar(int c) { if(log_dest_buffer_appending) return; @@ -1030,7 +1030,7 @@ void Con_Print(const char *msg) int lastcolor = 0; const char *in; char *out; - char color; + int color; for(in = line, out = printline; *in; ++in) { switch(*in) @@ -2322,7 +2322,7 @@ int Nicks_AddLastColor(char *buffer, int pos) { qboolean quote_added = false; int match; - char color = STRING_COLOR_DEFAULT + '0'; + int color = STRING_COLOR_DEFAULT + '0'; char r = 0, g = 0, b = 0; if(con_nickcompletion_flags.integer & NICKS_ADD_QUOTE && buffer[Nicks_matchpos-1] == '\"') diff --git a/gl_draw.c b/gl_draw.c index d1d52a66..fad253b9 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -1059,7 +1059,7 @@ float DrawQ_String_Font(float startx, float starty, const char *text, size_t max float vertex3f[QUADELEMENTS_MAXQUADS*4*3]; float texcoord2f[QUADELEMENTS_MAXQUADS*4*2]; float color4f[QUADELEMENTS_MAXQUADS*4*4]; - char ch; + int ch; int current_alpha, tempcolorindex; int tw, th; diff --git a/keys.c b/keys.c index 839652ea..fce61a98 100644 --- a/keys.c +++ b/keys.c @@ -233,7 +233,7 @@ Interactive line editing and console scrollback ==================== */ static void -Key_Console (int key, char ascii) +Key_Console (int key, int ascii) { // LordHavoc: copied most of this from Q2 to improve keyboard handling switch (key) @@ -530,7 +530,7 @@ unsigned int chat_bufferlen = 0; extern int Nicks_CompleteChatLine(char *buffer, size_t size, unsigned int pos); static void -Key_Message (int key, char ascii) +Key_Message (int key, int ascii) { if (key == K_ENTER || ascii == 10 || ascii == 13) @@ -905,7 +905,7 @@ static char tbl_keyascii[MAX_KEYS]; static keydest_t tbl_keydest[MAX_KEYS]; void -Key_Event (int key, char ascii, qboolean down) +Key_Event (int key, int ascii, qboolean down) { const char *bind; qboolean q; diff --git a/keys.h b/keys.h index c498a621..5b42933a 100644 --- a/keys.h +++ b/keys.h @@ -215,7 +215,7 @@ extern unsigned int chat_bufferlen; void Key_WriteBindings(qfile_t *f); void Key_Init(void); void Key_Init_Cvars(void); -void Key_Event(int key, char ascii, qboolean down); +void Key_Event(int key, int ascii, qboolean down); void Key_ClearStates (void); void Key_SetBinding (int keynum, int bindmap, const char *binding); diff --git a/menu.c b/menu.c index 804e42c1..144de64a 100644 --- a/menu.c +++ b/menu.c @@ -82,28 +82,28 @@ static void M_ServerList_Draw (void); static void M_ModList_Draw (void); -static void M_Main_Key (int key, char ascii); - static void M_SinglePlayer_Key (int key, char ascii); - static void M_Transfusion_Episode_Key (int key, char ascii); - static void M_Transfusion_Skill_Key (int key, char ascii); - static void M_Load_Key (int key, char ascii); - static void M_Save_Key (int key, char ascii); - static void M_MultiPlayer_Key (int key, char ascii); - static void M_Setup_Key (int key, char ascii); - static void M_Options_Key (int key, char ascii); - static void M_Options_Effects_Key (int key, char ascii); - static void M_Options_Graphics_Key (int key, char ascii); - static void M_Options_ColorControl_Key (int key, char ascii); - static void M_Keys_Key (int key, char ascii); - static void M_Reset_Key (int key, char ascii); - static void M_Video_Key (int key, char ascii); - static void M_Help_Key (int key, char ascii); - static void M_Credits_Key (int key, char ascii); - static void M_Quit_Key (int key, char ascii); -static void M_LanConfig_Key (int key, char ascii); -static void M_GameOptions_Key (int key, char ascii); -static void M_ServerList_Key (int key, char ascii); -static void M_ModList_Key (int key, char ascii); +static void M_Main_Key (int key, int ascii); + static void M_SinglePlayer_Key (int key, int ascii); + static void M_Transfusion_Episode_Key (int key, int ascii); + static void M_Transfusion_Skill_Key (int key, int ascii); + static void M_Load_Key (int key, int ascii); + static void M_Save_Key (int key, int ascii); + static void M_MultiPlayer_Key (int key, int ascii); + static void M_Setup_Key (int key, int ascii); + static void M_Options_Key (int key, int ascii); + static void M_Options_Effects_Key (int key, int ascii); + static void M_Options_Graphics_Key (int key, int ascii); + static void M_Options_ColorControl_Key (int key, int ascii); + static void M_Keys_Key (int key, int ascii); + static void M_Reset_Key (int key, int ascii); + static void M_Video_Key (int key, int ascii); + static void M_Help_Key (int key, int ascii); + static void M_Credits_Key (int key, int ascii); + static void M_Quit_Key (int key, int ascii); +static void M_LanConfig_Key (int key, int ascii); +static void M_GameOptions_Key (int key, int ascii); +static void M_ServerList_Key (int key, int ascii); +static void M_ModList_Key (int key, int ascii); static qboolean m_entersound; // play after drawing a frame, so caching won't disrupt the sound @@ -316,7 +316,7 @@ void M_Menu_Demos_f (void) } -static void M_Demo_Key (int k, char ascii) +static void M_Demo_Key (int k, int ascii) { switch (k) { @@ -467,7 +467,7 @@ static void M_Main_Draw (void) } -static void M_Main_Key (int key, char ascii) +static void M_Main_Key (int key, int ascii) { switch (key) { @@ -748,7 +748,7 @@ static void M_SinglePlayer_Draw (void) } -static void M_SinglePlayer_Key (int key, char ascii) +static void M_SinglePlayer_Key (int key, int ascii) { if (gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH) { @@ -913,7 +913,7 @@ static void M_Save_Draw (void) } -static void M_Load_Key (int k, char ascii) +static void M_Load_Key (int k, int ascii) { switch (k) { @@ -954,7 +954,7 @@ static void M_Load_Key (int k, char ascii) } -static void M_Save_Key (int k, char ascii) +static void M_Save_Key (int k, int ascii) { switch (k) { @@ -1017,7 +1017,7 @@ static void M_Transfusion_Episode_Draw (void) M_DrawPic (0, 120 + (m_episode_cursor + 1) * 40, va("gfx/menu/episode%iselected", m_episode_cursor + 1)); } -static void M_Transfusion_Episode_Key (int key, char ascii) +static void M_Transfusion_Episode_Key (int key, int ascii) { switch (key) { @@ -1075,7 +1075,7 @@ static void M_Transfusion_Skill_Draw (void) M_DrawPic (0, 140 + (m_skill_cursor + 1) *40, va("gfx/menu/difficulty%iselected", m_skill_cursor + 1)); } -static void M_Transfusion_Skill_Key (int key, char ascii) +static void M_Transfusion_Skill_Key (int key, int ascii) { switch (key) { @@ -1189,7 +1189,7 @@ static void M_MultiPlayer_Draw (void) } -static void M_MultiPlayer_Key (int key, char ascii) +static void M_MultiPlayer_Key (int key, int ascii) { switch (key) { @@ -1382,7 +1382,7 @@ static void M_Setup_Draw (void) } -static void M_Setup_Key (int k, char ascii) +static void M_Setup_Key (int k, int ascii) { int l; @@ -1668,7 +1668,7 @@ static void M_Options_Draw (void) } -static void M_Options_Key (int k, char ascii) +static void M_Options_Key (int k, int ascii) { switch (k) { @@ -1883,7 +1883,7 @@ static void M_Options_Effects_Draw (void) } -static void M_Options_Effects_Key (int k, char ascii) +static void M_Options_Effects_Key (int k, int ascii) { switch (k) { @@ -2019,7 +2019,7 @@ static void M_Options_Graphics_Draw (void) } -static void M_Options_Graphics_Key (int k, char ascii) +static void M_Options_Graphics_Key (int k, int ascii) { switch (k) { @@ -2246,7 +2246,7 @@ static void M_Options_ColorControl_Draw (void) } -static void M_Options_ColorControl_Key (int k, char ascii) +static void M_Options_ColorControl_Key (int k, int ascii) { switch (k) { @@ -2620,7 +2620,7 @@ static void M_Keys_Draw (void) } -static void M_Keys_Key (int k, char ascii) +static void M_Keys_Key (int k, int ascii) { char cmd[80]; int keys[NUMKEYS]; @@ -2696,7 +2696,7 @@ void M_Menu_Reset_f (void) } -static void M_Reset_Key (int key, char ascii) +static void M_Reset_Key (int key, int ascii) { switch (key) { @@ -2959,7 +2959,7 @@ static void M_Menu_Video_AdjustSliders (int dir) } -static void M_Video_Key (int key, char ascii) +static void M_Video_Key (int key, int ascii) { switch (key) { @@ -3042,7 +3042,7 @@ static void M_Help_Draw (void) } -static void M_Help_Key (int key, char ascii) +static void M_Help_Key (int key, int ascii) { switch (key) { @@ -3089,7 +3089,7 @@ static void M_Credits_Draw (void) } -static void M_Credits_Key (int key, char ascii) +static void M_Credits_Key (int key, int ascii) { M_Menu_Main_f (); } @@ -3196,7 +3196,7 @@ void M_Menu_Quit_f (void) } -static void M_Quit_Key (int key, char ascii) +static void M_Quit_Key (int key, int ascii) { switch (key) { @@ -3331,7 +3331,7 @@ static void M_LanConfig_Draw (void) } -static void M_LanConfig_Key (int key, char ascii) +static void M_LanConfig_Key (int key, int ascii) { int l; @@ -4239,7 +4239,7 @@ static void M_NetStart_Change (int dir) } } -static void M_GameOptions_Key (int key, char ascii) +static void M_GameOptions_Key (int key, int ascii) { gamelevels_t *g; int l; @@ -4395,7 +4395,7 @@ static void M_ServerList_Draw (void) } -static void M_ServerList_Key(int k, char ascii) +static void M_ServerList_Key(int k, int ascii) { switch (k) { @@ -4615,7 +4615,7 @@ static void M_ModList_Draw (void) } } -static void M_ModList_Key(int k, char ascii) +static void M_ModList_Key(int k, int ascii) { switch (k) { @@ -4665,7 +4665,7 @@ static void M_ModList_Key(int k, char ascii) //============================================================================= /* Menu Subsystem */ -static void M_KeyEvent(int key, char ascii, qboolean downevent); +static void M_KeyEvent(int key, int ascii, qboolean downevent); static void M_Draw(void); void M_ToggleMenu_f(void); static void M_Shutdown(void); @@ -4902,7 +4902,7 @@ void M_Draw (void) } -void M_KeyEvent (int key, char ascii, qboolean downevent) +void M_KeyEvent (int key, int ascii, qboolean downevent) { if (!downevent) return; @@ -5067,7 +5067,7 @@ void MP_Error(const char *format, ...) Host_AbortCurrentFrame(); } -void MP_KeyEvent (int key, char ascii, qboolean downevent) +void MP_KeyEvent (int key, int ascii, qboolean downevent) { PRVM_Begin; PRVM_SetProg(PRVM_MENUPROG); @@ -5182,7 +5182,7 @@ void MP_Restart(void) //============================================================================ // Menu router -void (*MR_KeyEvent) (int key, char ascii, qboolean downevent); +void (*MR_KeyEvent) (int key, int ascii, qboolean downevent); void (*MR_Draw) (void); void (*MR_ToggleMenu_f) (void); void (*MR_Shutdown) (void); diff --git a/menu.h b/menu.h index 0e52ef4a..4cb3e857 100644 --- a/menu.h +++ b/menu.h @@ -80,7 +80,7 @@ void MP_Shutdown (void);*/ void MR_Init_Commands (void); void MR_Init (void); void MR_Restart (void); -extern void (*MR_KeyEvent) (int key, char ascii, qboolean downevent); +extern void (*MR_KeyEvent) (int key, int ascii, qboolean downevent); extern void (*MR_Draw) (void); extern void (*MR_ToggleMenu_f) (void); extern void (*MR_Shutdown) (void); -- 2.39.2