[flac-dev] [Flac-dev] Git branch with compiling fixes for win32
JonY
jon_y at users.sourceforge.net
Thu Feb 2 02:57:37 PST 2012
On 2/1/2012 22:36, JonY wrote:
> On 2/1/2012 18:52, Erik de Castro Lopo wrote:
>> JonY wrote:
>>
>>> Alright, here's a quick fix, although it is more ugly than I remembered.
>>>
>>> Basically, it removes those _MSC_VER ifdefs, and relies on inttypes.h
>>> where available, and falls back to I64 on MSVC and then ll for others,
>>> all format warnings suppressed.
>>
>> JonY,
>>
>> Sorry for the delay on actually getting on to this.
>>
>> I tried your patch, but it wasn't quite right. The problem is that %ll
>> is the correct format specifier for uint64_t on 32bit Linux but not
>> on 64 bit Linux.
>>
>
> Something is very very wrong about the above statements. I thought I
> used PRI?64 when inttypes.h is found (Linux should have it, old code
> uses %ll? anyway for non-msvc, so shouldn't have any new issues).
>
> inttypes.h and stdint.h is supposed to be abstractions to remove these
> issues.
>
>> In C99, the correct way to print a uint64_t value is:
>>
>> printf ("THe value is : " PRIu64 "\n", value) ;
>>
>> I have gone ahead and fixed this through the code and fixed this, but I
>> may have broken some either MSVC or MinGW on the way. I'd appreciate it
>> if you test whats in git now.
>>
>> For those files where any compiler baulks at the PRIu64/PRIx64/PRId64,
>> you should add a #ifdef block that might look something like:
>>
>> #ifdef HAVE_INTTYPES_H
>> #include <inttypes.h>
>> #else
>> #if defined (_MSC_VER) && ! defined (PRId64)
>> #define PRId64 "I64d"
>> #endif
>> #if defined (_MSC_VER) && ! defined (PRIu64)
>> #define PRIu64 "I64u"
>> #endif
>> #endif
>>
>> We'll worry about compilers that don't have the PRI_64 values as we find
>> them.
>>
>
> OK, I'll do a quick test build tomorrow. More thorough testing will come
> during the weekends.
>
Attached patch builds without any warnings for MinGW.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: format_fix.txt
Url: http://lists.xiph.org/pipermail/flac-dev/attachments/20120202/b3722d1b/attachment-0001.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: OpenPGP digital signature
Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20120202/b3722d1b/attachment-0001.pgp
More information about the flac-dev
mailing list