File: fixed_all_gcc_warnings.patch

package info (click to toggle)
blockout2 2.5%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 5,236 kB
  • sloc: cpp: 10,786; ansic: 148; makefile: 127
file content (329 lines) | stat: -rw-r--r-- 9,503 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
--- a/BlockOut/SoundManager.cpp
+++ b/BlockOut/SoundManager.cpp
@@ -21,6 +21,7 @@
 
 #define PLAY(x) if( enabled && x ) Mix_PlayChannel (-1, x, 0);
 
+extern const char * LID(const char * fileName);
 // ------------------------------------------------
 
 SoundManager::SoundManager() {
@@ -82,7 +83,7 @@
 
 // ------------------------------------------------
 
-int SoundManager::InitSound(char *fileName,Mix_Chunk **snd) {
+int SoundManager::InitSound(const char *fileName,Mix_Chunk **snd) {
 
   *snd = Mix_LoadWAV ( fileName );
   if( *snd == NULL ) {
--- a/BlockOut/Types.h
+++ b/BlockOut/Types.h
@@ -197,21 +197,21 @@
 // Util functions
 //-----------------------------------------------------------------------------
 
-extern VERTEX v(float x,float y,float z);
-extern void Normalize(VERTEX *v);
-extern int fround(float x);
-extern char *FormatTime(float seconds);
-extern char *FormatDate(uint32 time);
-extern char *FormatDateShort(uint32 time);
-extern int CreateTexture(int width,int height,char *imgName,GLuint *hmap);
-extern char GetChar(BYTE *keys);
+VERTEX v(float x,float y,float z);
+void Normalize(VERTEX *v);
+int fround(float x);
+char *FormatTime(float seconds);
+char *FormatDate(uint32 time);
+char *FormatDateShort(uint32 time);
+int CreateTexture(int width,int height,const char *imgName,GLuint *hmap);
+char GetChar(BYTE *keys);
 #ifndef WINDOWS
-extern void ZeroMemory(void *buff,int size);
+void ZeroMemory(void *buff,int size);
 #endif
-extern BOOL DirExists(char *dirname);
-extern BOOL CheckEnv();
-extern char *LID(char *fileName);
-extern char *LHD(char *fileName);
+BOOL DirExists(char *dirname);
+BOOL CheckEnv();
+const char *LID(const char *fileName);
+const char *LHD(const char *fileName);
 
 
 #endif /* TYPESH */
--- a/BlockOut/Utils.cpp
+++ b/BlockOut/Utils.cpp
@@ -236,7 +236,7 @@
 // Name: LID()
 // Desc: Locate file in the installation directory
 //-----------------------------------------------------------------------------
-char *LID(char *fileName) {
+const char *LID(const char *fileName) {
 
 #ifdef WINDOWS
   return fileName;
@@ -252,7 +252,7 @@
 // Name: LHD()
 // Desc: Locate file in the home directory
 //-----------------------------------------------------------------------------
-char *LHD(char *fileName) {
+const char *LHD(const char *fileName) {
 
   static char ret[512];
 
@@ -276,7 +276,7 @@
 // Name: CreateTexture()
 // Desc: Create a texture (no alpha)
 //-----------------------------------------------------------------------------
-int CreateTexture(int width,int height,char *imgName,GLuint *hmap) {
+int CreateTexture(int width,int height,const char *imgName,GLuint *hmap) {
 
   *hmap = 0;
   CImage img;
--- a/BlockOut/MenuGraphics.cpp
+++ b/BlockOut/MenuGraphics.cpp
@@ -438,7 +438,7 @@
 
 // ---------------------------------------------------------------------
 
-void Menu::RenderTitle(char *title) {
+void Menu::RenderTitle(const char *title) {
 
   int  lgth = (int)strlen(title);
   int  nwFont = fround((float)wFont*1.1f);
@@ -454,7 +454,7 @@
 
 // ---------------------------------------------------------------------
 
-void Menu::RenderText(int x,int y,BOOL selected,char *text) {
+void Menu::RenderText(int x,int y,BOOL selected,const char *text) {
 
   float startLine   = 0.515f;
   float startColumn = 0.15f;
--- a/BlockOut/Menu.h
+++ b/BlockOut/Menu.h
@@ -61,8 +61,8 @@
     // Menu page
     void ToPage(MenuPage *page);
     void ToPage(MenuPage *page,int iParam,void *wParam);
-    void RenderText(int x,int y,BOOL selected,char *text);
-    void RenderTitle(char *title);
+    void RenderText(int x,int y,BOOL selected,const char *text);
+    void RenderTitle(const char *title);
 
     PageMainMenu mainMenuPage;
     PageStartGame startGamePage;
--- a/BlockOut/SetupManager.h
+++ b/BlockOut/SetupManager.h
@@ -67,7 +67,7 @@
     float GetAnimationTime(); /* in seconds */
 
     // Names
-    char *GetName();
+    const char *GetName();
     const char *GetBlockSetName();
 
     // Sound
--- a/BlockOut/EditControl.cpp
+++ b/BlockOut/EditControl.cpp
@@ -30,7 +30,7 @@
 
 // ------------------------------------------------
 
-void EditControl::SetMode(char *text,BOOL edit,BYTE *keys) {
+void EditControl::SetMode(const char *text,BOOL edit,BYTE *keys) {
 
   if( strlen(text)>=255 ) {
     strncpy(editText,text,255);
--- a/BlockOut/EditControl.h
+++ b/BlockOut/EditControl.h
@@ -27,7 +27,7 @@
     void SetDisplayLength(int length);
 
     // Set edit control mode (keys can be NULL)
-    void SetMode(char *text,BOOL edit,BYTE *keys);
+    void SetMode(const char *text,BOOL edit,BYTE *keys);
 
     // Get the mode
     BOOL GetMode();
--- a/BlockOut/SoundManager.h
+++ b/BlockOut/SoundManager.h
@@ -55,7 +55,7 @@
     void SetEnable(BOOL enable);
 
   private:
-    int InitSound(char *fileName,Mix_Chunk **snd);
+    int InitSound(const char *fileName,Mix_Chunk **snd);
 
     char errMsg[1024];
     BOOL enabled;
--- a/BlockOut/SetupManager.cpp
+++ b/BlockOut/SetupManager.cpp
@@ -364,7 +364,7 @@
 
 // ------------------------------------------------
 
-char *SetupManager::GetName() {
+const char *SetupManager::GetName() {
 
   static char ret[32];
   strcpy(ret,"");
--- a/BlockOut/BlockOut.cpp
+++ b/BlockOut/BlockOut.cpp
@@ -65,11 +65,11 @@
 // Name: BlockOut()
 // Desc: Application constructor. Sets attributes for the app.
 //-----------------------------------------------------------------------------
-BlockOut::BlockOut()
+BlockOut::BlockOut() : GLApplication(STR(APP_VERSION))
 {
   inited = FALSE;
   mode = MENU_MODE;
-  m_strWindowTitle = STR(APP_VERSION);
+//   m_strWindowTitle = STR(APP_VERSION);
   ZeroMemory( m_bKey, sizeof(m_bKey) );
 }
 
--- a/BlockOut/GLApp/GLApp.h
+++ b/BlockOut/GLApp/GLApp.h
@@ -60,7 +60,7 @@
 
     // Internal variables for the state of the app
     BOOL      m_bWindowed;
-    char*     m_strWindowTitle;
+    const char* m_strWindowTitle;
     int       m_screenWidth;
     int       m_screenHeight;
     BOOL      m_bVSync;
@@ -95,7 +95,7 @@
     static void printGlError();
 
     // Internal constructor
-    GLApplication();
+    GLApplication(const char * strWindowTitle);
 
 private:
 
--- a/BlockOut/GLApp/GLApp.cpp
+++ b/BlockOut/GLApp/GLApp.cpp
@@ -14,11 +14,13 @@
 
 // -------------------------------------------
 
-GLApplication::GLApplication() {
+GLApplication::GLApplication(const char * strWindowTitle) : 
+    m_strWindowTitle(strWindowTitle)
+{
 
   m_bWindowed = true;
   m_bVSync = false;
-  m_strWindowTitle = (char *)"GL application";
+  //m_strWindowTitle = (char *)"GL application";
   strcpy((char *)m_strFrameStats,"");
   m_screenWidth = 640;
   m_screenHeight = 480;
@@ -286,7 +288,7 @@
 #ifdef WINDOWS
   MessageBox(NULL, message, "Error", MB_OK | MB_ICONERROR);
 #else
-  printf(message);
+  printf("%s", message);
 #endif
 
 }
--- a/BlockOut/GLApp/GLSprite.h
+++ b/BlockOut/GLApp/GLSprite.h
@@ -15,7 +15,7 @@
   
   // Initialise the sprite
   // return 1 when success, 0 otherwise
-  int RestoreDeviceObjects(char *diffName,char *alphaName,int srcWidth,int scrHeight);
+  int RestoreDeviceObjects(const char *diffName,const char *alphaName,int srcWidth,int scrHeight);
 
   // Update sprite mapping and coordinates
   void UpdateSprite(int x1,int y1,int x2,int y2);
--- a/BlockOut/GLApp/GLSprite.cpp
+++ b/BlockOut/GLApp/GLSprite.cpp
@@ -8,7 +8,7 @@
 #undef LoadImage
 #include <CImage.h>
 
-extern char *LID(char *fileName);
+extern const char *LID(const char *fileName);
 
 // -------------------------------------------
 
@@ -54,7 +54,7 @@
 
 // -------------------------------------------
 
-int Sprite2D::RestoreDeviceObjects(char *diffName,char *alphaName,int scrWidth,int scrHeight) {
+int Sprite2D::RestoreDeviceObjects(const char *diffName,const char *alphaName,int scrWidth,int scrHeight) {
 
   GLint  bpp;
   GLenum format;
--- a/BlockOut/GLApp/GLFont.cpp
+++ b/BlockOut/GLApp/GLFont.cpp
@@ -8,7 +8,7 @@
 #undef LoadImage
 #include <CImage.h>
 
-extern char *LID(char *fileName);
+extern const char *LID(const char *fileName);
 
 // -------------------------------------------
 
@@ -21,7 +21,7 @@
 
   // Load the image
   CImage img;
-  if( !img.LoadImage(LID((char *)"images/font.png")) ) {
+  if( !img.LoadImage(LID("images/font.png")) ) {
 #ifdef WINDOWS
     char message[256];
 	sprintf(message,"Failed to load %s\n",LID((char *)"images/font.png"));
--- a/ImageLib/include/CImage.h
+++ b/ImageLib/include/CImage.h
@@ -16,7 +16,7 @@
 	// Load an image
 	// Supports GIF , JPG or PNG format
 	// Return 1 when image has been succesfully load , 0 otherwise.
-  int LoadImage(char *FileName);
+  int LoadImage(const char *FileName);
 
 	// Get error message if LoadImage fails.
 	char *GetErrorMessage();
--- a/ImageLib/src/CImage.cpp
+++ b/ImageLib/src/CImage.cpp
@@ -27,7 +27,7 @@
 
 // ------ Load image -----
 
-int CImage::LoadImage(char *FileName) {
+int CImage::LoadImage(const char *FileName) {
 
   Release();
 
--- a/ImageLib/src/CImage.h
+++ b/ImageLib/src/CImage.h
@@ -18,7 +18,7 @@
 	// Load an image
 	// Supports GIF , JPG or PNG format
 	// Return 1 when image has been succesfully load , 0 otherwise.
-    int LoadImage(char *FileName);
+    int LoadImage(const char *FileName);
 
 	// Get error message if LoadImage fails.
 	char *GetErrorMessage();
--- a/ImageLib/src/png/hpng.c
+++ b/ImageLib/src/png/hpng.c
@@ -1,5 +1,6 @@
 #include <malloc.h>
 #include <math.h>
+#include <string.h>
 #include "png/png.h"
 #include "hpng.h"