]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix a number of char types that should be int, to make them immune to
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 19 Jan 2009 21:14:27 +0000 (21:14 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 19 Jan 2009 21:14:27 +0000 (21:14 +0000)
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

14 files changed:
cd_bsd.c
cd_linux.c
cd_null.c
cd_sdl.c
cd_shared.c
cd_win.c
cdaudio.h
conproc.c
console.c
gl_draw.c
keys.c
keys.h
menu.c
menu.h

index e74a567a5a82f181b152f4d576d64bd36cf32702..7b3a855af4db44d1077a2847c16eea379eb99aa9 100644 (file)
--- 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;
index c8cdd6c38465303aab9c655e0cead2f532bf32f5..4544a5d122cda6f117a423db0a210b58efd5ab0c 100644 (file)
@@ -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;
index d639614f4ba4e33d49150620b2e8e94574ad6a1c..18987ada4b78383725534ee4822945784a6c8f6c 100644 (file)
--- 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;
 }
index b9a7a7539423ea6eaecb02ebeccd18c6230996ff..c508fc02eeabb021028ac479c545c200d7b76516 100644 (file)
--- 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;
index 36bae1272e17fd35cc3c27e1c29eaa747d045494..9ab0210a531fdd4ffa692a32e0fadc4e677edc02 100644 (file)
@@ -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);
index 2cc716133e12c7c4a77df297d06df6f6cf9b9235..913aec31e4681488c5193632486d3f6692618d9f 100644 (file)
--- 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;
index 993c4008d2627895a78da5b0f7c0923ca974ce95..2b9729e3f0c26d77ad571f99dcd8cf00d176dadf 100644 (file)
--- 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);
index dd21407d79ba65e603b6edf656563ab608db8ca2..ccbb849c9c2a44c0183521a988af2dc80b86bc2e 100644 (file)
--- 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;
                
index 4d9b71b8cca0a79804ab1e25440afd0a6cb86571..e545b70286df355bdb80370ef0810b12188a5ccf 100644 (file)
--- 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] == '\"')
index d1d52a665f880af3f9659f269cce2c3da21cc743..fad253b9f8ab5fbe8ceca78a27ce6e9a9763e204 100644 (file)
--- 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 839652ea2f443db7162f1972f7d862b0833ee003..fce61a985fcffcb512d82d9af5ca54ef5f084488 100644 (file)
--- 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 c498a621155b798794fc8997cf5c0e06861cb7dc..5b42933a1d464f338ee76bdf0942e6e590b50226 100644 (file)
--- 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 804e42c1818c01d1ea3a6bc1ef67f7d41141570f..144de64aeeda29a977e2c6f55e967e8b3425694d 100644 (file)
--- 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 0e52ef4aba06b7c34a0fc1bbbd3f3c777d1feb0e..4cb3e85764b9d8ca8b52c26c4ca4e9f98e89b798 100644 (file)
--- 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);