r11775 - in packages/trunk/tecnoballz/debian: . patches

Peter Pentchev roam-guest at alioth.debian.org
Thu Feb 17 16:02:18 UTC 2011


Author: roam-guest
Date: 2011-02-17 16:01:42 +0000 (Thu, 17 Feb 2011)
New Revision: 11775

Added:
   packages/trunk/tecnoballz/debian/patches/032_warnings.patch
Modified:
   packages/trunk/tecnoballz/debian/changelog
   packages/trunk/tecnoballz/debian/patches/series
   packages/trunk/tecnoballz/debian/rules
Log:
Fix a slew of compiler warnings and build with -Werror by default.


Modified: packages/trunk/tecnoballz/debian/changelog
===================================================================
--- packages/trunk/tecnoballz/debian/changelog	2011-02-17 15:24:12 UTC (rev 11774)
+++ packages/trunk/tecnoballz/debian/changelog	2011-02-17 16:01:42 UTC (rev 11775)
@@ -11,6 +11,9 @@
   * Add the 031_honor_cxxflags patch.
   * Use dpkg-buildflags to obtain the default values for CPPFLAGS,
     CXXFLAGS and LDFLAGS.
+  * Add -Werror to the compiler flags unless the non-standard "nowerror"
+    build option is specified.
+  * Add the 032_warnings patch to fix a slew of compiler warnings.
 
  -- Peter Pentchev <roam at ringlet.net>  Thu, 17 Feb 2011 10:35:58 +0200
 

Added: packages/trunk/tecnoballz/debian/patches/032_warnings.patch
===================================================================
--- packages/trunk/tecnoballz/debian/patches/032_warnings.patch	                        (rev 0)
+++ packages/trunk/tecnoballz/debian/patches/032_warnings.patch	2011-02-17 16:01:42 UTC (rev 11775)
@@ -0,0 +1,195 @@
+Description: Fix some compiler warnings.
+ - constify a couple of char pointers to static strings
+ - remove some unneeded declarations with mismatched types
+ - add some parentheses to disambiguate operations' priority
+ - initialize a loop index to avoid an array[-1] access
+ - add some parentheses to fix a comparison's logic
+Forwarded: no
+Author: Peter Pentchev <roam at ringlet.net>
+Last-Update: 2011-02-17
+
+--- a/src/handler_audio.cc
++++ b/src/handler_audio.cc
+@@ -234,7 +234,7 @@
+       "Mix_QuerySpec return " << Mix_GetError () << std::endl;
+       return;
+     }
+-  char *format = "Unknown";
++  const char *format = "Unknown";
+   switch (format_id)
+     {
+     case AUDIO_U8:
+--- a/src/handler_popup_menu.cc
++++ b/src/handler_popup_menu.cc
+@@ -424,7 +424,7 @@
+           for (j = 0; j < num_of_columns; j++)
+             {
+               unsigned char pixel = cycling_table[color];
+-              char a = *(p++) - 32;
++              a = *(p++) - 32;
+               if (a != 0)
+                 {
+                   b = c[a];
+@@ -509,7 +509,7 @@
+           for (j = 0; j < num_of_columns; j++)
+             {
+               unsigned char pixel = cycling_table[color];
+-              char a = *(p++) - 32;
++              a = *(p++) - 32;
+               if (a != 0)
+                 {
+                   b = c[a];
+--- a/src/handler_resources.cc
++++ b/src/handler_resources.cc
+@@ -45,7 +45,7 @@
+ #endif
+ #endif
+ 
+-char * handler_resources::fnamescore = SCOREFILE;
++const char * handler_resources::fnamescore = SCOREFILE;
+ const char *
+   handler_resources::folder_640 = "hires/";
+ const char *
+@@ -621,7 +621,7 @@
+  * @param fname filename specified by path
+  */
+ char *
+-handler_resources::load_file (char *fname)
++handler_resources::load_file (const char *fname)
+ {
+   return load_file (fname, &last_filesize_loaded);
+ }
+@@ -633,7 +633,7 @@
+  * return a pointer to the file data 
+ */
+ char *
+-handler_resources::load_file (char *fname, Uint32 * fsize)
++handler_resources::load_file (const char *fname, Uint32 * fsize)
+ {
+   /* locate a file under one of the data directories */
+   char *pname = locate_data_file (fname);
+--- a/include/handler_resources.h
++++ b/include/handler_resources.h
+@@ -42,7 +42,7 @@
+     static const char *folderdata;
+     static const char *folder_320;
+     static const char *folder_640;
+-    static char *fnamescore;
++    static const char *fnamescore;
+     static char tmp_filename[512];
+     static char pathstring[512];
+     static const Uint32 TEXTS_OFFSET = 2048;
+@@ -118,8 +118,8 @@
+ 
+   private:
+     char *loadfile_with_lang (const char *const filename, Uint32 * const fsize);
+-    char *load_file (char *fname);
+-    char *load_file (char *fname, Uint32 * fsize);
++    char *load_file (const char *fname);
++    char *load_file (const char *fname, Uint32 * fsize);
+   };
+ 
+ #endif
+--- a/src/lispreader.cc
++++ b/src/lispreader.cc
+@@ -121,7 +121,7 @@
+ static int
+ _scan (lisp_stream_t *stream)
+ {
+-  static char *delims = "\"();";
++  static const char *delims = "\"();";
+ 
+   int c;
+ 
+@@ -549,7 +549,7 @@
+       {
+         struct
+           {
+-            char *name;
++            const char *name;
+             int type;
+           }
+         types[] =
+--- a/src/sprite_display_menu.cc
++++ b/src/sprite_display_menu.cc
+@@ -234,7 +234,7 @@
+               for (j = 0; j < NUM_OF_COLUMNS; j++)
+                 {
+                   unsigned char pixel = color_cycling[color];
+-                  char a = *(p++) - 32;
++                  a = *(p++) - 32;
+                   if (a != 0)
+                     {
+                       b = c[a];
+@@ -335,7 +335,7 @@
+               for (j = 0; j < NUM_OF_COLUMNS; j++)
+                 {
+                   unsigned char pixel = color_cycling[color];
+-                  char a = *(p++) - 32;
++                  a = *(p++) - 32;
+                   if (a != 0)
+                     {
+                       b = c[a];
+--- a/src/sprite_gem.cc
++++ b/src/sprite_gem.cc
+@@ -99,7 +99,7 @@
+   paddle = pad;
+   towards = paddle->get_paddle_number ();
+   speed_of_moving = resolution;
+-  Uint32 h = (random_counter >> 4 + rand_count++) & 7;
++  Uint32 h = (random_counter >> (4 + rand_count++)) & 7;
+   random_counter += xcoord;
+   h = gem_random[h];
+   gem_id = h;
+--- a/src/supervisor_map_editor.cc
++++ b/src/supervisor_map_editor.cc
+@@ -832,7 +832,7 @@
+ #else
+   umask (0002);
+ #endif
+-  char *
++  const char *
+   filename = "edmap.data";
+   Sint32
+   handle = open (filename, O_WRONLY | O_CREAT, 00666);
+--- a/include/supervisor_shop.h
++++ b/include/supervisor_shop.h
+@@ -164,7 +164,7 @@
+     /** Prices of all the available options in the shop */
+     static Uint32 options_prices[];
+     /** Indexes of the texts used for sales confirmation messages */
+-    static char led_index_to_text_index[];
++    static unsigned char led_index_to_text_index[];
+ 
+   public:
+     supervisor_shop ();
+--- a/src/supervisor_shop.cc
++++ b/src/supervisor_shop.cc
+@@ -866,6 +866,7 @@
+         }
+       else
+         {
++	  i = 0;
+           while (available_options_id[i] != sprite_capsule::LEAVE_SHOP)
+             {
+               if (available_options_id[i] == drop_id)
+@@ -1081,7 +1082,7 @@
+ /**
+  * Indexes of the texts used for sales confirmation messages
+  */
+-char
++unsigned char
+ supervisor_shop::led_index_to_text_index[] =
+ {
+   /* S+/F1/F2/RW/B2/B3 */
+--- a/src/tinyxmlparser.cc
++++ b/src/tinyxmlparser.cc
+@@ -354,7 +354,7 @@
+ 	}
+ 	else
+ 	{
+-		while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
++		while ( *p && (IsWhiteSpace( *p ) || *p == '\n' || *p =='\r') )
+ 			++p;
+ 	}
+ 

Modified: packages/trunk/tecnoballz/debian/patches/series
===================================================================
--- packages/trunk/tecnoballz/debian/patches/series	2011-02-17 15:24:12 UTC (rev 11774)
+++ packages/trunk/tecnoballz/debian/patches/series	2011-02-17 16:01:42 UTC (rev 11775)
@@ -3,3 +3,4 @@
 020_level_data.diff
 030_texts_dir.diff
 031_honor_cxxflags.diff
+032_warnings.patch

Modified: packages/trunk/tecnoballz/debian/rules
===================================================================
--- packages/trunk/tecnoballz/debian/rules	2011-02-17 15:24:12 UTC (rev 11774)
+++ packages/trunk/tecnoballz/debian/rules	2011-02-17 16:01:42 UTC (rev 11775)
@@ -10,6 +10,10 @@
 # Warnings
 CXXFLAGS += -Wall -fno-strict-aliasing
 
+ifeq (,$(filter nowerror,$(DEB_BUILD_OPTIONS)))
+	CXXFLAGS+=	-Werror
+endif
+
 export CPPFLAGS CXXFLAGS LDFLAGS
 
 override_dh_auto_configure:




More information about the Pkg-games-commits mailing list