Release candidate for Libgcrypt 1.4.2

Simon Josefsson simon at josefsson.org
Mon Sep 1 21:56:43 CEST 2008


Werner Koch <wk at gnupg.org> writes:

> On Mon,  1 Sep 2008 18:36, simon at josefsson.org said:
>
>> -  snprintf (buf, sizeof buf, "%5lums", (unsigned long)t );
>> +  snprintf (buf, sizeof buf, "%5.0fms", (double)t );
>
> Do you understand why this occurs only with Wine?  I have not tested it
> on Wine but it works fine on a standard XP box.  Is there a problem with
> my code or is Wine's snprintf broken?

I actually don't know where the problem is.  I can't reproduce it in a
small snippet.  FWIW, this also works fine under mingw+wine:

  snprintf (buf, sizeof buf, "%5llums", t );

That is arguably more correct, but requires that all Windows supports
%ll.

Something seems to go wrong when the 64-bit value is cast to a 32-bit
value and then passed as an argument.  The values are interesting, see:

MD5          27574050817572874ms 5083798169452554ms 5083798169452604ms

That isn't even close to 64-bit or 32-bit boundaries.

/Simon



More information about the Gcrypt-devel mailing list