From 2ee52e8aac60f13cdbfb53adcacac57985f4e24f Mon Sep 17 00:00:00 2001 From: Reece Dunn Date: Wed, 12 May 2010 22:40:52 +0100 Subject: [PATCH] Use const char * for string arguments to avoid deprecated conversion warnings. --- Source/Game.h | 8 ++++---- Source/GameInitDispose.cpp | 8 ++++---- Source/MacInput.cpp | 6 +++--- Source/MacInput.h | 6 +++--- Source/Skybox.cpp | 2 +- Source/Skybox.h | 2 +- Source/Terrain.cpp | 2 +- Source/Terrain.h | 2 +- Source/Text.cpp | 2 +- Source/Text.h | 2 +- Source/WinInput.cpp | 6 +++--- Source/WinInput.h | 6 +++--- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Source/Game.h b/Source/Game.h index b915f81..45d9eb8 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -241,10 +241,10 @@ public: bool oldattackkey; long long MD5_string (char *string); - static void LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha); - static void LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize); - void LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize); - bool AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize); + static void LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha); + static void LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize); + void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize); + bool AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize); void InitGame(); void LoadStuff(); void LoadingScreen(); diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index 5b3113d..0378282 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -421,7 +421,7 @@ void Game::LoadSounds() } -void Game::LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalpha) +void Game::LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool hasalpha) { GLuint type; @@ -474,7 +474,7 @@ void Game::LoadTexture(char *fileName, GLuint *textureid,int mipmap, bool hasalp // } } -void Game::LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize) +void Game::LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize) { GLuint type; int i; @@ -538,7 +538,7 @@ void Game::LoadTextureSave(char *fileName, GLuint *textureid,int mipmap,GLubyte // } } -void Game::LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize) +void Game::LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize) { int i; int bytesPerPixel; @@ -573,7 +573,7 @@ void Game::LoadSave(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array } } -bool Game::AddClothes(char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize) +bool Game::AddClothes(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize) { int i; int bytesPerPixel; diff --git a/Source/MacInput.cpp b/Source/MacInput.cpp index c36a466..f695273 100644 --- a/Source/MacInput.cpp +++ b/Source/MacInput.cpp @@ -48,7 +48,7 @@ Boolean IsKeyDown( unsigned char *keyMap, unsigned short theKey ) } -unsigned short CharToKey(char* which) +unsigned short CharToKey(const char* which) { if(!strcmp(which,"a")){ return MAC_A_KEY; @@ -187,7 +187,7 @@ unsigned short CharToKey(char* which) } } -char* KeyToChar(unsigned short which) +const char* KeyToChar(unsigned short which) { static int i; @@ -814,7 +814,7 @@ char Shift(char which) return which; } -bool Compare(char *thestring, char *tocompare, int start, int end) +bool Compare(const char *thestring, const char *tocompare, int start, int end) { static int i; for(i=start;i<=end;i++){ diff --git a/Source/MacInput.h b/Source/MacInput.h index aa85de7..60e65f9 100644 --- a/Source/MacInput.h +++ b/Source/MacInput.h @@ -135,10 +135,10 @@ void InitMouse(); void MoveMouse(int xcoord, int ycoord, Point *mouseloc); void RefreshMouse(Point *mouseloc); void DisposeMouse(); -unsigned short CharToKey(char* which); -char* KeyToChar(unsigned short which); +unsigned short CharToKey(const char* which); +const char* KeyToChar(unsigned short which); char KeyToSingleChar(unsigned short which); char Shift(char which); -bool Compare(char *thestring, char *tocompare, int start, int end); +bool Compare(const char *thestring, const char *tocompare, int start, int end); #endif diff --git a/Source/Skybox.cpp b/Source/Skybox.cpp index f80b80d..811029a 100644 --- a/Source/Skybox.cpp +++ b/Source/Skybox.cpp @@ -34,7 +34,7 @@ extern float skyboxg; extern float skyboxb; extern int tutoriallevel; -bool SkyBox::load( char *ffront,char *fleft,char *fback,char *fright,char *fup,char *fdown,char *fcloud,char *freflect) +bool SkyBox::load( const char *ffront,const char *fleft,const char *fback,const char *fright,const char *fup,const char *fdown,const char *fcloud,const char *freflect) { /* static GLuint type; unsigned char fileNamep[256]; diff --git a/Source/Skybox.h b/Source/Skybox.h index d40c44d..aa9e1f7 100644 --- a/Source/Skybox.h +++ b/Source/Skybox.h @@ -32,7 +32,7 @@ public: GLuint front,left,back,right,up,down,cloud,reflect; float cloudmove; - bool load(char *ffront,char *fleft,char *fback,char *fright,char *fup,char *fdown,char *fcloud,char *freflect); + bool load(const char *ffront,const char *fleft,const char *fback,const char *fright,const char *fup,const char *fdown,const char *fcloud,const char *freflect); void draw(); SkyBox(); diff --git a/Source/Terrain.cpp b/Source/Terrain.cpp index e56f681..6ee96a5 100644 --- a/Source/Terrain.cpp +++ b/Source/Terrain.cpp @@ -371,7 +371,7 @@ void Terrain::UpdateVertexArray(int whichx, int whichy){ } -bool Terrain::load(char *fileName) +bool Terrain::load(const char *fileName) { static long i,j; static long x,y; diff --git a/Source/Terrain.h b/Source/Terrain.h index 71223bd..4a3746d 100644 --- a/Source/Terrain.h +++ b/Source/Terrain.h @@ -117,7 +117,7 @@ public: void UpdateTransparency(int whichx, int whichy); void UpdateTransparencyother(int whichx, int whichy); void UpdateTransparencyotherother(int whichx, int whichy); - bool load(char *fileName); + bool load(const char *fileName); void CalculateNormals(); void drawdecals(); void draw(int layer); diff --git a/Source/Text.cpp b/Source/Text.cpp index aeb7412..1298b38 100644 --- a/Source/Text.cpp +++ b/Source/Text.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Game.h" extern TGAImageRec texture; -void Text::LoadFontTexture(char *fileName) +void Text::LoadFontTexture(const char *fileName) { GLuint type; diff --git a/Source/Text.h b/Source/Text.h index 09499c5..8627479 100644 --- a/Source/Text.h +++ b/Source/Text.h @@ -35,7 +35,7 @@ public: GLuint FontTexture; GLuint base; - void LoadFontTexture(char *fileName); + void LoadFontTexture(const char *fileName); void BuildFont(); void glPrint(float x, float y, char *string, int set, float size, float width, float height); void glPrintOutline(float x, float y, char *string, int set, float size, float width, float height); diff --git a/Source/WinInput.cpp b/Source/WinInput.cpp index 513924d..59b1277 100644 --- a/Source/WinInput.cpp +++ b/Source/WinInput.cpp @@ -61,7 +61,7 @@ Boolean IsKeyDown( unsigned char *keyMap, unsigned short theKey ) return 0; } -unsigned short CharToKey(char* which) +unsigned short CharToKey(const char* which) { // alphabetic keys if(!strcasecmp(which,"a")){ @@ -360,7 +360,7 @@ unsigned short CharToKey(char* which) return UNKNOWN_KEY; } -char* KeyToChar(unsigned short which) +const char* KeyToChar(unsigned short which) { static int i; @@ -1007,7 +1007,7 @@ char Shift(char which) return which; } -bool Compare(char *thestring, char *tocompare, int start, int end) +bool Compare(const char *thestring, const char *tocompare, int start, int end) { static int i; for(i=start;i<=end;i++){ diff --git a/Source/WinInput.h b/Source/WinInput.h index 8170ba1..b84b0e0 100644 --- a/Source/WinInput.h +++ b/Source/WinInput.h @@ -141,11 +141,11 @@ void InitMouse(); void MoveMouse(int xcoord, int ycoord, Point *mouseloc); void RefreshMouse(Point *mouseloc); void DisposeMouse(); -unsigned short CharToKey(char* which); -char* KeyToChar(unsigned short which); +unsigned short CharToKey(const char* which); +const char* KeyToChar(unsigned short which); char KeyToSingleChar(unsigned short which); char Shift(char which); -bool Compare(char *thestring, char *tocompare, int start, int end); +bool Compare(const char *thestring, const char *tocompare, int start, int end); typedef unsigned char KeyMap[16]; -- 2.39.5