Bläddra i källkod

No deprecated-writable-strings warnings any more!

Thomas Buck 11 år sedan
förälder
incheckning
3011e964e8
10 ändrade filer med 50 tillägg och 50 borttagningar
  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 Visa fil

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
 	va_list args;
177
 	va_list args;
178
 	gl_string_t *str;
178
 	gl_string_t *str;

+ 1
- 1
src/GLString.h Visa fil

118
 
118
 
119
 	void setActive(unsigned int string, bool active);
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
     * Pre  : String is valid gl_string id
123
     * Pre  : String is valid gl_string id
124
 	 *        Args form the string to fill String buffer
124
 	 *        Args form the string to fill String buffer

+ 5
- 5
src/OpenRaider.cpp Visa fil

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
 	printf("%s> WARNING %s %s:%i\n", func_name, warning, filename, line);
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
 	printf("%s> ERROR %s %s:%i\n", func_name, error, filename, line);
247
 	printf("%s> ERROR %s %s:%i\n", func_name, error, filename, line);
248
 }
248
 }
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
 	static char buffer[128];
805
 	static char buffer[128];
806
 	va_list args;
806
 	va_list args;

+ 1
- 1
src/OpenRaider.h Visa fil

226
 	 * Mongoose - Created
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
 	 * Pre  : Use like printf
231
 	 * Pre  : Use like printf
232
 	 *
232
 	 *

+ 2
- 2
src/Render.cpp Visa fil

199
 {
199
 {
200
 	char filename[128];
200
 	char filename[128];
201
 	bool fastCard = mFlags & Render::fFastCard;
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
 	int font_id;
203
 	int font_id;
204
 	int snow1_id;
204
 	int snow1_id;
205
 	int snow2_id;
205
 	int snow2_id;
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
 								 unsigned int snowTex1, unsigned int snowTex2)
387
 								 unsigned int snowTex1, unsigned int snowTex2)
388
 {
388
 {
389
 #ifdef USING_EMITTER
389
 #ifdef USING_EMITTER

+ 1
- 1
src/Render.h Visa fil

242
 	 * Mongoose - Created, factored out of UnRaider class
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
 						  unsigned int snowTex1, unsigned int snowTex2);
246
 						  unsigned int snowTex1, unsigned int snowTex2);
247
 	/*------------------------------------------------------
247
 	/*------------------------------------------------------
248
 	 * Pre  : Textures are init and these args are valid
248
 	 * Pre  : Textures are init and these args are valid

+ 1
- 1
src/SDLSystem.cpp Visa fil

158
 ////////////////////////////////////////////////////////////
158
 ////////////////////////////////////////////////////////////
159
 
159
 
160
 #ifdef FIXME
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
 	if (key > 255)
163
 	if (key > 255)
164
 	{
164
 	{

+ 30
- 30
src/SDLSystem.h Visa fil

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

+ 4
- 4
src/System.cpp Visa fil

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

+ 4
- 4
src/System.h Visa fil

102
 	// Public Accessors
102
 	// Public Accessors
103
 	////////////////////////////////////////////////////////////
103
 	////////////////////////////////////////////////////////////
104
 
104
 
105
-   static char *bufferString(char *string, ...);
105
+   static char *bufferString(const char *string, ...);
106
    /*------------------------------------------------------
106
    /*------------------------------------------------------
107
     * Pre  : <String> is a valid string with valid args
107
     * Pre  : <String> is a valid string with valid args
108
 	 *
108
 	 *
118
     * Mongoose - Created, was GLString::glPrintf
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
 	 * Pre  :
123
 	 * Pre  :
124
 	 * Post : Returns allocated string of path, with
124
 	 * Post : Returns allocated string of path, with
210
 	 * Mongoose - Created
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
 	 * Pre  : <Cmd> is a valid command string
215
 	 * Pre  : <Cmd> is a valid command string
216
 	 *        <Key> is a valid keyboard code
216
 	 *        <Key> is a valid keyboard code
354
 	 * Mongoose - Created
354
 	 * Mongoose - Created
355
 	 ------------------------------------------------------*/
355
 	 ------------------------------------------------------*/
356
 
356
 
357
-	virtual int loadResourceFile(char *filename);
357
+	virtual int loadResourceFile(const char *filename);
358
 	/*------------------------------------------------------
358
 	/*------------------------------------------------------
359
 	 * Pre  :
359
 	 * Pre  :
360
 	 * Post : Init the resource vars
360
 	 * Post : Init the resource vars

Laddar…
Avbryt
Spara