gnokii-users
[Top][All Lists]
Advanced

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

format specifier warning on wchar_t


From: Dan Oetting
Subject: format specifier warning on wchar_t
Date: Thu, 12 Jan 2006 10:53:25 -0700

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);

Removing the "l" or casting wc to a long will remove the warning and insure the code works properly on nearly all systems. Perhaps removing the "l" and casting wc to an int is the best approach to maximize compatibility.

-- Dan Oetting


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


reply via email to

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