Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] Re: (PR#12907) fix gcc4 warnings
Home

[Freeciv-Dev] Re: (PR#12907) fix gcc4 warnings

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#12907) fix gcc4 warnings
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Apr 2005 09:09:09 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12907 >

Jason Short wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12907 >
> 
> This patch fixes a few warnings under gcc4.

And this patch fixes also a set of dio warnings.  This lets freeciv
compile for me completely without warnings under gcc4.  However some
modules (alsa) still have warnings.

-jason

Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.220
diff -u -r1.220 civclient.c
--- client/civclient.c  26 Apr 2005 19:58:24 -0000      1.220
+++ client/civclient.c  27 Apr 2005 16:00:13 -0000
@@ -102,7 +102,7 @@
   Convert a text string from the internal to the data encoding, when it
   is written to the network.
 **************************************************************************/
-static unsigned char *put_conv(const char *src, size_t *length)
+static char *put_conv(const char *src, size_t *length)
 {
   char *out = internal_to_data_string_malloc(src);
 
@@ -121,7 +121,7 @@
   large enough or the source was bad.
 **************************************************************************/
 static bool get_conv(char *dst, size_t ndst,
-                    const unsigned char *src, size_t nsrc)
+                    const char *src, size_t nsrc)
 {
   char *out = data_to_internal_string_malloc(src);
   bool ret = TRUE;
Index: client/clinet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/clinet.c,v
retrieving revision 1.115
diff -u -r1.115 clinet.c
--- client/clinet.c     15 Apr 2005 20:24:43 -0000      1.115
+++ client/clinet.c     27 Apr 2005 16:00:13 -0000
@@ -812,7 +812,7 @@
 # if defined(__VMS) && !defined(_DECC_V4_SOURCE)
     size_t fromlen;
 # else
-    int fromlen;
+  unsigned int fromlen;
 # endif
   union my_sockaddr fromend;
   struct hostent *from;
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.296
diff -u -r1.296 tilespec.c
--- client/tilespec.c   25 Apr 2005 06:19:31 -0000      1.296
+++ client/tilespec.c   27 Apr 2005 16:00:14 -0000
@@ -3703,8 +3703,8 @@
                      const struct unit *punit, const struct city *pcity,
                      const struct city *citymode)
 {
-  Terrain_type_id ttype, ttype_near[8];
-  enum tile_special_type tspecial, tspecial_near[8];
+  Terrain_type_id ttype = T_UNKNOWN, ttype_near[8];
+  enum tile_special_type tspecial = S_NO_SPECIAL, tspecial_near[8];
   int tileno, dir;
   struct unit *pfocus = get_unit_in_focus();
   struct drawn_sprite *save_sprs = sprs;
Index: common/dataio.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/dataio.c,v
retrieving revision 1.16
diff -u -r1.16 dataio.c
--- common/dataio.c     28 Jan 2005 19:57:09 -0000      1.16
+++ common/dataio.c     27 Apr 2005 16:00:14 -0000
@@ -70,7 +70,7 @@
  Returns FALSE if the destination isn't large enough or the source was
  bad.
 **************************************************************************/
-static bool get_conv(char *dst, size_t ndst, const unsigned char *src,
+static bool get_conv(char *dst, size_t ndst, const char *src,
                     size_t nsrc)
 {
   size_t len = nsrc;           /* length to copy, not including null */
@@ -317,7 +317,7 @@
 {
   if (put_conv_callback) {
     size_t length;
-    unsigned char *buffer;
+    char *buffer;
 
     if ((buffer = (*put_conv_callback) (value, &length))) {
       dio_put_memory(dout, buffer, length + 1);
@@ -528,7 +528,7 @@
 **************************************************************************/
 void dio_get_string(struct data_in *din, char *dest, size_t max_dest_size)
 {
-  unsigned char *c;
+  char *c;
   size_t ps_len;               /* length in packet, not including null */
   size_t offset, remaining;
 
Index: common/dataio.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/dataio.h,v
retrieving revision 1.7
diff -u -r1.7 dataio.h
--- common/dataio.h     13 Sep 2004 15:54:51 -0000      1.7
+++ common/dataio.h     27 Apr 2005 16:00:14 -0000
@@ -33,11 +33,11 @@
 };
 
 /* network string conversion */
-typedef unsigned char *(*DIO_PUT_CONV_FUN) (const char *src, size_t *length);
+typedef char *(*DIO_PUT_CONV_FUN) (const char *src, size_t *length);
 void dio_set_put_conv_callback(DIO_PUT_CONV_FUN fun);
 
 typedef bool(*DIO_GET_CONV_FUN) (char *dst, size_t ndst,
-                                const unsigned char *src, size_t nsrc);
+                                const char *src, size_t nsrc);
 void dio_set_get_conv_callback(DIO_GET_CONV_FUN fun);
 
 /* General functions */
Index: common/packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.274
diff -u -r1.274 packets.c
--- common/packets.c    29 Mar 2005 17:46:48 -0000      1.274
+++ common/packets.c    27 Apr 2005 16:00:14 -0000
@@ -158,9 +158,9 @@
        PACKET_PROCESSING_FINISHED || packet_type == PACKET_THAW_HINT) {
       pc->compression.frozen_level--;
       if (pc->compression.frozen_level == 0) {
-       unsigned long int compressed_size = 12 + pc->compression.queue.size * 
1.001;
+       uLongf compressed_size = 12 + pc->compression.queue.size * 1.001;
        int error;
-       unsigned char compressed[compressed_size];
+       Bytef compressed[compressed_size];
 
        error =
            compress2(compressed, &compressed_size,
Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.62
diff -u -r1.62 cm.c
--- common/aicore/cm.c  7 Apr 2005 04:36:02 -0000       1.62
+++ common/aicore/cm.c  27 Apr 2005 16:00:15 -0000
@@ -465,7 +465,7 @@
   Note this isn't the same as the number of *tiles* that are better.  There
   may be more than one tile of each type (see tile_type_num_tiles).
 ****************************************************************************/
-static const int tile_type_num_prereqs(const struct cm_tile_type *ptype)
+static int tile_type_num_prereqs(const struct cm_tile_type *ptype)
 {
   return ptype->better_types.size;
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#12907) fix gcc4 warnings, Jason Short <=