Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] Re: (PR#9689) Patch: quash warnings in client/text.c
Home

[Freeciv-Dev] Re: (PR#9689) Patch: quash warnings in client/text.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bh@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#9689) Patch: quash warnings in client/text.c
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Aug 2004 21:40:59 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9689 >

Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=9689 >
> 
> Another alternative is to cast the size_t values as integers.  This
> _may_ be more portable since I'm not sure if %lu is guaranteed to be the
> same as size_t on all platforms.  I looked at the printf manual once and
> it claimed a special character for size_t (like %lz or something), but
> when I looked deeper I found this is not portable at all.

Here's a patch that does that.  Would it be better this way?

jason

? stamp-h1.in
? stamp-h2.in
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.8
diff -u -r1.8 text.c
--- client/text.c       13 Aug 2004 00:51:17 -0000      1.8
+++ client/text.c       13 Aug 2004 04:39:34 -0000
@@ -76,7 +76,7 @@
   static char buf[GROW_TMP_SIZE];
 
   if (my_vsnprintf(buf, sizeof(buf), format, ap) == -1) {
-    die("Formatted string bigger than %lu", sizeof(buf));
+    die("Formatted string bigger than %lu", (unsigned long)sizeof(buf));
   }
 
   new_len = strlen(*buffer) + strlen(buf) + 1;
@@ -87,7 +87,7 @@
     size_t new_size = MAX(new_len, *buffer_size * 2);
 
     freelog(LOG_VERBOSE, "expand from %lu to %lu to add '%s'",
-           *buffer_size, new_size, buf);
+           (unsigned long)*buffer_size, (unsigned long)new_size, buf);
 
     *buffer_size = new_size;
     *buffer = fc_realloc(*buffer, *buffer_size);

[Prev in Thread] Current Thread [Next in Thread]