Dmitri Pal wrote:
Jakub Hrozek wrote:
> On 04/13/2010 04:39 PM, Dmitri Pal wrote:
>
>> Jakub Hrozek wrote:
>>
>>> On 04/12/2010 05:13 PM, Dmitri Pal wrote:
>>>
>>>> Hello
>>>> The attached patch adds 4 conversion functions capable
>>>> of handling the following types of the values:
>>>> int32_t, int64_t, uint32_t and uint64_t
>>>>
>>> Ack to the code, but there is one thing to fix in the unit test:
>>> the %lld format specifier for int64_t is correct on 32bit architectures
>>> only, on 64bit the correct specifier is %ld - so the code emits a
>>> compiler warning on 64bit.
>>>
>>> Martin suggested that the values should be always casted up to long
>>>
> long
>
>>> - it will have some performance penalty, but since this is tracing code
>>> only, it doesn't matter. If we ever need to print exact-sized values in
>>> production code, we can use the C99 set of PRId64/PRId32 macros.
>>>
>> Can you post the warning?
>> I do not understand what line generates it.
>> All macros have explicit type cast.
>> There should not be a warning.
>> May be I am using signed when it should be unsigned? Then it should be a
>> bug...
>>
> The warnings are as follows:
>
> -----
> ini_config_ut.c: In function get_test:
> ini_config_ut.c:1169: warning: format %lld expects type long long
> int, but argument 2 has type int64_t
> ini_config_ut.c:1203: warning: format %llu expects type long long
> unsigned int, but argument 2 has type uint64_t
> -----
>
> You will not see them on your 32bit system as the formatting string is
> correct for a 32bit system, it is not for a 64bit one, where a '%ld'
> would be correct.
>
> Either casting the value "long long" or "unsigned long long" or
using
> the C99 PRI macros would solve the issue.
>
Ah thanks!
Now I see it:
COLOUT(printf("Value: %lld\n", val_int64));
Should be:
COLOUT(printf("Value: %lld\n", (long long)val_int64));
I will send an updated patch shortly
The updated patch attached.
__
_____________________________________________
sssd-devel mailing list
sssd-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel
--
Thank you,
Dmitri Pal
Engineering Manager IPA project,
Red Hat Inc.
-------------------------------
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/