[vdr] VDR developer version 1.5.15 - compilation warnings

Michael Mauch michael.mauch at gmx.de
Tue Feb 19 21:23:28 CET 2008


Dave P wrote:
> On Tuesday 19 Feb 2008, Klaus Schmidinger wrote:
> 
>> > remote.c:124: warning: format "%016LX" expects type "long long
>> > unsigned int", but argument 4 has type "uint64_t"
>>
>> Apparently there are macros for this, like PRId64 and such.
>> But i don't like having to write something like
>>
>>   int64_t n = ...;
>>   printf("Some number %" PRId64 "\n", n);
> 
> It seems to be the POSIX way...
> 
>> Don't know if the gettext mechanisms would be able to handle
>>
>>        tr("Some number %" PRId64 "\n")
> 
> It would probably be necessary to have multiple translations for the string 
> after macro expansion (negating the whole reason for having the macro in 
> the first place). 

<http://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html>
seems to promise that it works without multiple translations:

  Assume you have code like

     printf ("The amount is %0" PRId64 "\n", number);

  The gettext tools and library have special support for these
  <inttypes.h> macros. You can therefore simply write 

     printf (gettext ("The amount is %0" PRId64 "\n"), number);

  The PO file will contain the string "The amount is %0<PRId64>\n". The
  translators will provide a translation containing "%0<PRId64>" as
  well, and at runtime the gettext function's result will contain the 
  appropriate constant string, "d" or "ld" or "lld". 


gettext-0.14 (4 years old) already has this text, so it's probably safe
to use by now. (Apparently I have been living under a rock for the last
couple of years, I didn't even know about that PRId64 thing - thanks for
pointing it out.)

Regards...
                Michael




More information about the vdr mailing list