Quellcode durchsuchen

No deprecated-writable-strings warnings any more!

Thomas Buck vor 11 Jahren
Ursprung
Commit
3011e964e8
10 geänderte Dateien mit 50 neuen und 50 gelöschten Zeilen
  1. 1
    1
      src/GLString.cpp
  2. 1
    1
      src/GLString.h
  3. 5
    5
      src/OpenRaider.cpp
  4. 1
    1
      src/OpenRaider.h
  5. 2
    2
      src/Render.cpp
  6. 1
    1
      src/Render.h
  7. 1
    1
      src/SDLSystem.cpp
  8. 30
    30
      src/SDLSystem.h
  9. 4
    4
      src/System.cpp
  10. 4
    4
      src/System.h

+ 1
- 1
src/GLString.cpp Datei anzeigen

@@ -172,7 +172,7 @@ void GLString::setActive(unsigned int string, bool active)
172 172
 }
173 173
 
174 174
 
175
-void GLString::SetString(unsigned int string, char *s, ...)
175
+void GLString::SetString(unsigned int string, const char *s, ...)
176 176
 {
177 177
 	va_list args;
178 178
 	gl_string_t *str;

+ 1
- 1
src/GLString.h Datei anzeigen

@@ -118,7 +118,7 @@ class GLString
118 118
 
119 119
 	void setActive(unsigned int string, bool active);
120 120
 
121
-	void SetString(unsigned int string, char *s, ...);
121
+	void SetString(unsigned int string, const char *s, ...);
122 122
    /*------------------------------------------------------
123 123
     * Pre  : String is valid gl_string id
124 124
 	 *        Args form the string to fill String buffer

+ 5
- 5
src/OpenRaider.cpp Datei anzeigen

@@ -235,14 +235,14 @@ void percent_callback(int p)
235 235
 }
236 236
 
237 237
 
238
-void openraider_warning(char *func_name, char *warning,
239
-								char *filename, int line)
238
+void openraider_warning(const char *func_name, const char *warning,
239
+								const char *filename, int line)
240 240
 {
241 241
 	printf("%s> WARNING %s %s:%i\n", func_name, warning, filename, line);
242 242
 }
243 243
 
244
-void openraider_error(char *func_name, char *error,
245
-							 char *filename, int line)
244
+void openraider_error(const char *func_name, const char *error,
245
+							 const char *filename, int line)
246 246
 {
247 247
 	printf("%s> ERROR %s %s:%i\n", func_name, error, filename, line);
248 248
 }
@@ -800,7 +800,7 @@ void OpenRaider::handleKeyPressEvent(unsigned int key, unsigned int mod)
800 800
 }
801 801
 
802 802
 
803
-void OpenRaider::print(bool dump_stdout, char *format, ...)
803
+void OpenRaider::print(bool dump_stdout, const char *format, ...)
804 804
 {
805 805
 	static char buffer[128];
806 806
 	va_list args;

+ 1
- 1
src/OpenRaider.h Datei anzeigen

@@ -226,7 +226,7 @@ class OpenRaider : public SDLSystem
226 226
 	 * Mongoose - Created
227 227
 	 ------------------------------------------------------*/
228 228
 
229
-	void print(bool dump_stdout, char *format, ...);
229
+	void print(bool dump_stdout, const char *format, ...);
230 230
 	/*------------------------------------------------------
231 231
 	 * Pre  : Use like printf
232 232
 	 *

+ 2
- 2
src/Render.cpp Datei anzeigen

@@ -199,7 +199,7 @@ void Render::initTextures(char *textureDir, unsigned int *numLoaded,
199 199
 {
200 200
 	char filename[128];
201 201
 	bool fastCard = mFlags & Render::fFastCard;
202
-	char *console = "Toggle the Console with [`] key, Menu with <esc>";
202
+	const char *console = "Toggle the Console with [`] key, Menu with <esc>";
203 203
 	int font_id;
204 204
 	int snow1_id;
205 205
 	int snow2_id;
@@ -383,7 +383,7 @@ void Render::loadMd3(char *model, char *skin)
383 383
 }
384 384
 
385 385
 
386
-void Render::initEmitter(char *name, unsigned int size,
386
+void Render::initEmitter(const char *name, unsigned int size,
387 387
 								 unsigned int snowTex1, unsigned int snowTex2)
388 388
 {
389 389
 #ifdef USING_EMITTER

+ 1
- 1
src/Render.h Datei anzeigen

@@ -242,7 +242,7 @@ class Render
242 242
 	 * Mongoose - Created, factored out of UnRaider class
243 243
 	 ------------------------------------------------------*/
244 244
 
245
-	void initEmitter(char *name, unsigned int size,
245
+	void initEmitter(const char *name, unsigned int size,
246 246
 						  unsigned int snowTex1, unsigned int snowTex2);
247 247
 	/*------------------------------------------------------
248 248
 	 * Pre  : Textures are init and these args are valid

+ 1
- 1
src/SDLSystem.cpp Datei anzeigen

@@ -158,7 +158,7 @@ unsigned int SDLSystem::getTicks()
158 158
 ////////////////////////////////////////////////////////////
159 159
 
160 160
 #ifdef FIXME
161
-void SDLSystem::bindKeyCommand(char *cmd, int key, int event)
161
+void SDLSystem::bindKeyCommand(const char *cmd, int key, int event)
162 162
 {
163 163
 	if (key > 255)
164 164
 	{

+ 30
- 30
src/SDLSystem.h Datei anzeigen

@@ -1,19 +1,19 @@
1 1
 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2 2
 /*================================================================
3
- * 
3
+ *
4 4
  * Project : OpenRaider
5 5
  * Author  : Terry 'Mongoose' Hendrix II
6 6
  * Website : http://www.westga.edu/~stu7440/
7 7
  * Email   : stu7440@westga.edu
8 8
  * Object  : SDLSystem
9 9
  * License : No use w/o permission (C) 2002 Mongoose
10
- * Comments: 
10
+ * Comments:
11 11
  *
12 12
  *
13
- *           This file was generated using Mongoose's C++ 
13
+ *           This file was generated using Mongoose's C++
14 14
  *           template generator script.  <stu7440@westga.edu>
15
- * 
16
- *-- History ------------------------------------------------ 
15
+ *
16
+ *-- History ------------------------------------------------
17 17
  *
18 18
  * 2002.06.06:
19 19
  * Mongoose - Created
@@ -41,12 +41,12 @@ class SDLSystem : public System
41 41
 
42 42
 	SDLSystem();
43 43
 	/*------------------------------------------------------
44
-	 * Pre  : 
44
+	 * Pre  :
45 45
 	 * Post : Constructs an object of SDLSystem
46 46
 	 *
47 47
 	 *-- History ------------------------------------------
48 48
 	 *
49
-	 * 2002.06.06: 
49
+	 * 2002.06.06:
50 50
 	 * Mongoose - Created
51 51
 	 ------------------------------------------------------*/
52 52
 
@@ -57,7 +57,7 @@ class SDLSystem : public System
57 57
 	 *
58 58
 	 *-- History ------------------------------------------
59 59
 	 *
60
-	 * 2002.06.06: 
60
+	 * 2002.06.06:
61 61
 	 * Mongoose - Created
62 62
 	 ------------------------------------------------------*/
63 63
 
@@ -68,13 +68,13 @@ class SDLSystem : public System
68 68
 
69 69
 	virtual unsigned int getTicks();
70 70
 	/*------------------------------------------------------
71
-	 * Pre  : 
71
+	 * Pre  :
72 72
 	 * Post : Returns number of milliseconds since start of
73 73
 	 *        program
74 74
 	 *
75 75
 	 *-- History ------------------------------------------
76 76
 	 *
77
-	 * 2002.06.06: 
77
+	 * 2002.06.06:
78 78
 	 * Mongoose - Created
79 79
 	 ------------------------------------------------------*/
80 80
 
@@ -83,13 +83,13 @@ class SDLSystem : public System
83 83
 	// Public Mutators
84 84
 	////////////////////////////////////////////////////////////
85 85
 
86
-	//FIXME: void bindKeyCommand(char *cmd, int key, int event);
86
+	//FIXME: void bindKeyCommand(const char *cmd, int key, int event);
87 87
 	/*------------------------------------------------------
88 88
 	 * Pre  : <Cmd> is a valid command string
89 89
 	 *        <Key> is a valid keyboard code
90 90
 	 *        <Event> is a valid game event Id
91 91
 	 *
92
-	 * Post : Sets <Event> binding <Cmd> to <Key> press 
92
+	 * Post : Sets <Event> binding <Cmd> to <Key> press
93 93
 	 *
94 94
 	 *-- History ------------------------------------------
95 95
 	 *
@@ -101,7 +101,7 @@ class SDLSystem : public System
101 101
    /*------------------------------------------------------
102 102
     * Pre  : <X>, and <Y> are valid world coordinates
103 103
 	 *        <String> is a valid string
104
-	 *     
104
+	 *
105 105
 	 *        Requires glEnterMode2d() call before entry
106 106
 	 *
107 107
 	 *        System::bufferString(..) can cache printf()
@@ -117,7 +117,7 @@ class SDLSystem : public System
117 117
 	 * 2003.06.03:
118 118
 	 * Mongoose - Ported to SDL_TTF
119 119
 	 *
120
-    * 2001.12.31: 
120
+    * 2001.12.31:
121 121
     * Mongoose - Created
122 122
     ------------------------------------------------------*/
123 123
 
@@ -136,11 +136,11 @@ class SDLSystem : public System
136 136
 	 * 2003.06.03:
137 137
 	 * Mongoose - Ported to SDL_TTF
138 138
 	 *
139
-    * 2001.12.31: 
139
+    * 2001.12.31:
140 140
     * Mongoose - Created
141 141
     ------------------------------------------------------*/
142 142
 
143
-	void initVideo(unsigned int width, unsigned int height, 
143
+	void initVideo(unsigned int width, unsigned int height,
144 144
 						bool fullscreen);
145 145
 	/*------------------------------------------------------
146 146
 	 * Pre  : Video mode request <Width> x <Height>
@@ -150,36 +150,36 @@ class SDLSystem : public System
150 150
 	 *
151 151
 	 *-- History ------------------------------------------
152 152
 	 *
153
-	 * 2002.06.06: 
153
+	 * 2002.06.06:
154 154
 	 * Mongoose - Created
155 155
 	 ------------------------------------------------------*/
156 156
 
157 157
 	void resize(unsigned int width, unsigned int height);
158 158
 	/*------------------------------------------------------
159
-	 * Pre  : 
159
+	 * Pre  :
160 160
 	 * Post : Resizes game window
161 161
 	 *
162 162
 	 *-- History ------------------------------------------
163 163
 	 *
164
-	 * 2002.06.06: 
164
+	 * 2002.06.06:
165 165
 	 * Mongoose - Created, from old SDLUnitTest code
166 166
 	 ------------------------------------------------------*/
167 167
 
168 168
 	void runGame();
169 169
 	/*------------------------------------------------------
170
-	 * Pre  : 
170
+	 * Pre  :
171 171
 	 * Post : Start game loop
172 172
 	 *
173 173
 	 *-- History ------------------------------------------
174 174
 	 *
175
-	 * 2002.06.06: 
175
+	 * 2002.06.06:
176 176
 	 * Mongoose - Created
177 177
 	 ------------------------------------------------------*/
178 178
 
179 179
 	void setGrabMouse(bool on);
180 180
 	/*------------------------------------------------------
181
-	 * Pre  : 
182
-	 * Post : 
181
+	 * Pre  :
182
+	 * Post :
183 183
 	 *
184 184
 	 *-- History ------------------------------------------
185 185
 	 *
@@ -189,34 +189,34 @@ class SDLSystem : public System
189 189
 
190 190
 	void shutdown(int i);
191 191
 	/*------------------------------------------------------
192
-	 * Pre  : 
192
+	 * Pre  :
193 193
 	 * Post : Shutsdown the game subsystems, exits game loop
194 194
 	 *
195 195
 	 *-- History ------------------------------------------
196 196
 	 *
197
-	 * 2002.06.06: 
197
+	 * 2002.06.06:
198 198
 	 * Mongoose - Created
199 199
 	 ------------------------------------------------------*/
200 200
 
201 201
 	void swapBuffersGL();
202 202
 	/*------------------------------------------------------
203
-	 * Pre  : 
203
+	 * Pre  :
204 204
 	 * Post : Swaps OpenGL buufers ( call at end of frame )
205 205
 	 *
206 206
 	 *-- History ------------------------------------------
207 207
 	 *
208
-	 * 2002.06.06: 
208
+	 * 2002.06.06:
209 209
 	 * Mongoose - Created
210 210
 	 ------------------------------------------------------*/
211 211
 
212 212
 	void toggleFullscreen();
213 213
 	/*------------------------------------------------------
214
-	 * Pre  : 
214
+	 * Pre  :
215 215
 	 * Post : Toggle fullscreen windowing mode
216 216
 	 *
217 217
 	 *-- History ------------------------------------------
218 218
 	 *
219
-	 * 2002.06.06: 
219
+	 * 2002.06.06:
220 220
 	 * Mongoose - Created
221 221
 	 ------------------------------------------------------*/
222 222
 
@@ -231,7 +231,7 @@ class SDLSystem : public System
231 231
 	////////////////////////////////////////////////////////////
232 232
 	// Private Mutators
233 233
 	////////////////////////////////////////////////////////////
234
-	
234
+
235 235
 	SDL_Surface *mWindow;	/* This is the pointer to the SDL surface */
236 236
 };
237 237
 #endif

+ 4
- 4
src/System.cpp Datei anzeigen

@@ -101,7 +101,7 @@ System::~System()
101 101
 // Public Accessors
102 102
 ////////////////////////////////////////////////////////////
103 103
 
104
-char *System::bufferString(char *string, ...)
104
+char *System::bufferString(const char *string, ...)
105 105
 {
106 106
 	int sz = 60;
107 107
 	int n;
@@ -155,7 +155,7 @@ char *System::bufferString(char *string, ...)
155 155
 }
156 156
 
157 157
 
158
-char *System::fullPath(char *path, char end)
158
+char *System::fullPath(const char *path, char end)
159 159
 {
160 160
 	unsigned int i, lenPath, lenEnv, len;
161 161
 	char *env, *dir;
@@ -346,7 +346,7 @@ unsigned int System::addCommandMode(const char *command)
346 346
 }
347 347
 
348 348
 // FIXME: Modifer support later
349
-void System::bindKeyCommand(char *cmd, unsigned int key, int event)
349
+void System::bindKeyCommand(const char *cmd, unsigned int key, int event)
350 350
 {
351 351
 	printf("Bound command '%s' -> event %i (0x%x key)\n", cmd, event, key);
352 352
 	mKeyEvents.Add(key, event);
@@ -388,7 +388,7 @@ void System::command(const char *cmd)
388 388
 }
389 389
 
390 390
 
391
-int System::loadResourceFile(char *filename)
391
+int System::loadResourceFile(const char *filename)
392 392
 {
393 393
 	char buffer[256];
394 394
 	bool line_comment = false;

+ 4
- 4
src/System.h Datei anzeigen

@@ -102,7 +102,7 @@ public:
102 102
 	// Public Accessors
103 103
 	////////////////////////////////////////////////////////////
104 104
 
105
-   static char *bufferString(char *string, ...);
105
+   static char *bufferString(const char *string, ...);
106 106
    /*------------------------------------------------------
107 107
     * Pre  : <String> is a valid string with valid args
108 108
 	 *
@@ -118,7 +118,7 @@ public:
118 118
     * Mongoose - Created, was GLString::glPrintf
119 119
     ------------------------------------------------------*/
120 120
 
121
-	static char *fullPath(char *path, char end);
121
+	static char *fullPath(const char *path, char end);
122 122
 	/*------------------------------------------------------
123 123
 	 * Pre  :
124 124
 	 * Post : Returns allocated string of path, with
@@ -210,7 +210,7 @@ public:
210 210
 	 * Mongoose - Created
211 211
 	 ------------------------------------------------------*/
212 212
 
213
-	virtual void bindKeyCommand(char *cmd, unsigned int key, int event);
213
+	virtual void bindKeyCommand(const char *cmd, unsigned int key, int event);
214 214
 	/*------------------------------------------------------
215 215
 	 * Pre  : <Cmd> is a valid command string
216 216
 	 *        <Key> is a valid keyboard code
@@ -354,7 +354,7 @@ public:
354 354
 	 * Mongoose - Created
355 355
 	 ------------------------------------------------------*/
356 356
 
357
-	virtual int loadResourceFile(char *filename);
357
+	virtual int loadResourceFile(const char *filename);
358 358
 	/*------------------------------------------------------
359 359
 	 * Pre  :
360 360
 	 * Post : Init the resource vars

Laden…
Abbrechen
Speichern