bug-parted
[Top][All Lists]
Advanced

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

Re: Parted 1.4.20 and PRIx64


From: Andrew Clausen
Subject: Re: Parted 1.4.20 and PRIx64
Date: Wed, 24 Oct 2001 15:14:28 +1000
User-agent: Mutt/1.2.5i

On Tue, Oct 23, 2001 at 11:30:10PM +0200, Martin v. Loewis wrote:
> Hi Andrew,
> 
> In the recent parted, you use
> 
>       _("GUID Partition Table Header Signature is wrong: "
>         "" PRIx64 " should be " PRIx64 ""),
>       (*gpt)->Signature, GPT_HEADER_SIGNATURE);
> 
> When translating it, I noticed that the string split is inconvenient;
> it would rather like to translate the second part as
> 
>           PRIx64 " sollte " PRIx64 "sein"
> 
> Since it won't work this way, I asked Bruno Haible for suggestions:
> 
> <quote>
> > Of course, this ends up as two strings into the catalog, which is
> > undesirable.
> 
> Oh, I would have expected that none of the two strings end up in the
> catalog. But anyway...:
> 
> The string is wrong, it should read
> 
>     _("GUID Partition Table Header Signature is wrong: %" PRIx64 " should be 
> %" PRIx64)
> 
> because PRIx64 doesn't include a percent sign by itself.
> 
> I'd recommend
> 
>     char* fmtstring = xasprintf (_("GUID Partition Table Header Signature is 
> wrong: %%%s should be %%%s", PRIx64, PRIx64));
>     printf (fmtstring, (*gpt)->Signature, GPT_HEADER_SIGNATURE);
>     free (fmtstring);
> 
> where xasprintf is a fail-safe asprintf variant.
> 
> This is portable and provides for the possibility that the translator
> might need to swap the two arguments; in which case she'll have to use
>     ... %%2$%2$s ... %%1$%1$s
> instead of
>     ... %%%s ... %%%s
> 
> Wow, these are weird format strings! :-)
> 
> Bruno
> </quote>
> 
> Could you please correct the code along these lines?

[excessive quoting for the benefit of the list]

Grrr, that's UGLY.  Why not use that %llx, (long long) trick instead?

i.e.

        printf (_("blah blah %llx"), (long long) some_num);

Andrew




reply via email to

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