gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: format specifier warning on wchar_t


From: Dan Oetting
Subject: Re: format specifier warning on wchar_t
Date: Fri, 13 Jan 2006 17:18:16 -0700


On Jan 13, 2006, at 2:39 PM, Pawel Kot wrote:

Hi,

On 1/12/06, Dan Oetting <address@hidden> wrote:
This line produces a warning because wc is type wchar_t and %lx is for
printing longs which may be a different size.
 sprintf(dest + (o_len << 2), "%04lx", wc);

What compiler do you use and what warning do you get? With:
gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
there is no warning for this particular thing.

I'm using Xcode on OS X 10.4.4 which in turn uses gcc version 4.0.0 20041026.
The warning parameters have been adjusted to get rid of the majority of mostly safe warnings (like -Wno-pointer-sign) and turned up looking for some potentially platform dependent bugs (like -Wformat)

Is this better for the diff?

Index: gsm-encoding.c
===================================================================
RCS file: /sources/gnokii/gnokii/common/gsm-encoding.c,v
retrieving revision 1.64
diff -d -p --unified=3 -r1.64 gsm-encoding.c
--- gsm-encoding.c 31 Jul 2005 21:42:31 -0000 1.64
+++ gsm-encoding.c 14 Jan 2006 00:05:04 -0000
@@ -425,7 +425,7 @@ void char_ucs2_encode(unsigned char* des
  i_len += length;
  break;
  }
- sprintf(dest + (o_len << 2), "%04lx", wc);
+ sprintf(dest + (o_len << 2), "%04x", (int)wc);
  }
  return;
 }


reply via email to

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