Re: win32 and internationalisation



On Fri, Jun 09, 2006 at 11:55:26PM +0100, Michael Ott wrote:
> I try to compile an application under winxp. Under Linux i work with
> some gnome lib (for printing) and this i cannot do under win32.
> 
> But i got an error before:
> I use only libglade-2.0 and gtk+-2.0 under win32.
> 
> When i try to compile i get on the following line:
> 
> sprintf(c_str, _("%02d.%02d.%d"), i_tmp_5, i_tmp_4, i_tmp_3);

Do not use sprintf(), use g_snprintf() or g_strdup_printf()
(and see below).

> i got the following error:
> 
> 796 H:\programming\projects\ampavi\src\ampavi_main_window.c [Warning] passing arg 2 of `sprintf' makes pointer from integer without a cast

The error probably comes from implicitly declared _().
When a C function is not declared, the compiler invents an
implicit declaration with int return value -- and you
definitely want to tell it to make a lot noise instead, for
gcc it's

  -Werror-implicit-function-declaration

and for MSVC it's

  #pragma warning(error:4013)

_() is a common convenience macro defined

  #define _(x) gettext(x)

but it's up to you to define it.

Why you mark "%02d.%02d.%d" as translatable anyway?  Either
the format is fixed and then it must not be translated, or
you want it translatable for some reason, but then you never
know how c_str needs to be long, so use g_strdup_printf().

Yeti


--
Anonyms eat their boogers.



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