On 11/10/2011 19:22, JonY wrote:
> On 11/10/2011 18:39, Erik de Castro Lopo wrote:
>>
>> I'm subscribed to the list (and I set my reply-to to the list).
>> Please do not CC me.
>>
>> JonY wrote:
>>
>>> Its probably on one of the sf tracker somewhere, I can't seem to find it
>>> anymore. It wasn't anything complicated, so I should be able to redo it
>>> quickly.
>>
>> I'm a Linux guy. I do not have easy access to a windows machine
>> and don't have the time or patience to maintain one.
>>
>> For windows stuff I'll be relying on others to provide and test
>> patches.
>>
>> Erik
> 
> 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.
> 
> Tested on MinGW.
> 
> Sven-Hendrik, or any other mingw guys around, do you mind testing the
> patch too? Patch based on git master from
> https://git.xiph.org/mirrors/flac.git.
> 

Ifdef changes now consolidated into a single file.
diff --git a/include/FLAC/compat.h b/include/FLAC/compat.h
new file mode 100755
index 0000000..83ccc9e
--- /dev/null
+++ b/include/FLAC/compat.h
@@ -0,0 +1,53 @@
+/* libFLAC - Free Lossless Audio Codec library
+ * Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009  Josh Coalson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the Xiph.org Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+#ifndef FLAC__COMPAT_H
+#define FLAC__COMPAT_H
+
+#if HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#define flactypei64 PRId64
+#define flactypeu64 PRIu64
+#else
+#ifdef _MSC_VER
+#define flactypei64 "I64d"
+#define flactypeu64 "I64u"
+#else
+#define flactypei64 "lld"
+#define flactypeu64 "llu"
+#endif
+#endif
+
+#endif
diff --git a/src/flac/analyze.c b/src/flac/analyze.c
index 1073758..6865f3b 100644
--- a/src/flac/analyze.c
+++ b/src/flac/analyze.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "FLAC/all.h"
+#include "FLAC/compat.h"
 #include "analyze.h"
 
 typedef struct {
@@ -66,11 +67,7 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned 
frame_number, FLAC__
        unsigned i, channel, partitions;
 
        /* do the human-readable part first */
-#ifdef _MSC_VER
-       fprintf(fout, 
"frame=%u\toffset=%I64u\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n",
 frame_number, frame_offset, frame_bytes*8, frame->header.blocksize, 
frame->header.sample_rate, channels, 
FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
-#else
-       fprintf(fout, 
"frame=%u\toffset=%llu\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n",
 frame_number, (unsigned long long)frame_offset, frame_bytes*8, 
frame->header.blocksize, frame->header.sample_rate, channels, 
FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
-#endif
+       fprintf(fout, 
"frame=%u\toffset=%"flactypei64"\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n",
 frame_number, (unsigned long long)frame_offset, frame_bytes*8, 
frame->header.blocksize, frame->header.sample_rate, channels, 
FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
        for(channel = 0; channel < channels; channel++) {
                const FLAC__Subframe *subframe = frame->subframes+channel;
                const FLAC__bool is_rice2 = 
subframe->data.fixed.entropy_coding_method.type == 
FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2;
diff --git a/src/metaflac/operations.c b/src/metaflac/operations.c
index 639a1da..787b44c 100644
--- a/src/metaflac/operations.c
+++ b/src/metaflac/operations.c
@@ -24,6 +24,7 @@
 #include "usage.h"
 #include "utils.h"
 #include "FLAC/assert.h"
+#include "FLAC/compat.h"
 #include "FLAC/metadata.h"
 #include "share/alloc.h"
 #include "share/grabbag.h"
@@ -565,11 +566,7 @@ void write_metadata(const char *filename, 
FLAC__StreamMetadata *block, unsigned
                        PPR; printf("  sample_rate: %u Hz\n", 
block->data.stream_info.sample_rate);
                        PPR; printf("  channels: %u\n", 
block->data.stream_info.channels);
                        PPR; printf("  bits-per-sample: %u\n", 
block->data.stream_info.bits_per_sample);
-#ifdef _MSC_VER
-                       PPR; printf("  total samples: %I64u\n", 
block->data.stream_info.total_samples);
-#else
-                       PPR; printf("  total samples: %llu\n", (unsigned long 
long)block->data.stream_info.total_samples);
-#endif
+                       PPR; printf("  total samples: %"flactypeu64"\n", 
(unsigned long long)block->data.stream_info.total_samples);
                        PPR; printf("  MD5 signature: ");
                        for(i = 0; i < 16; i++) {
                                printf("%02x", 
(unsigned)block->data.stream_info.md5sum[i]);
@@ -596,11 +593,7 @@ void write_metadata(const char *filename, 
FLAC__StreamMetadata *block, unsigned
                        PPR; printf("  seek points: %u\n", 
block->data.seek_table.num_points);
                        for(i = 0; i < block->data.seek_table.num_points; i++) {
                                
if(block->data.seek_table.points[i].sample_number != 
FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) {
-#ifdef _MSC_VER
-                                       PPR; printf("    point %u: 
sample_number=%I64u, stream_offset=%I64u, frame_samples=%u\n", i, 
block->data.seek_table.points[i].sample_number, 
block->data.seek_table.points[i].stream_offset, 
block->data.seek_table.points[i].frame_samples);
-#else
-                                       PPR; printf("    point %u: 
sample_number=%llu, stream_offset=%llu, frame_samples=%u\n", i, (unsigned long 
long)block->data.seek_table.points[i].sample_number, (unsigned long 
long)block->data.seek_table.points[i].stream_offset, 
block->data.seek_table.points[i].frame_samples);
-#endif
+                                       PPR; printf("    point %u: 
sample_number=%"flactypeu64", stream_offset=%"flactypeu64", 
frame_samples=%u\n", i, (unsigned long 
long)block->data.seek_table.points[i].sample_number, (unsigned long 
long)block->data.seek_table.points[i].stream_offset, 
block->data.seek_table.points[i].frame_samples);
                                }
                                else {
                                        PPR; printf("    point %u: 
PLACEHOLDER\n", i);
@@ -618,11 +611,7 @@ void write_metadata(const char *filename, 
FLAC__StreamMetadata *block, unsigned
                        break;
                case FLAC__METADATA_TYPE_CUESHEET:
                        PPR; printf("  media catalog number: %s\n", 
block->data.cue_sheet.media_catalog_number);
-#ifdef _MSC_VER
-                       PPR; printf("  lead-in: %I64u\n", 
block->data.cue_sheet.lead_in);
-#else
-                       PPR; printf("  lead-in: %llu\n", (unsigned long 
long)block->data.cue_sheet.lead_in);
-#endif
+                       PPR; printf("  lead-in: %"flactypeu64"\n", (unsigned 
long long)block->data.cue_sheet.lead_in);
                        PPR; printf("  is CD: %s\n", 
block->data.cue_sheet.is_cd? "true":"false");
                        PPR; printf("  number of tracks: %u\n", 
block->data.cue_sheet.num_tracks);
                        for(i = 0; i < block->data.cue_sheet.num_tracks; i++) {
@@ -630,11 +619,7 @@ void write_metadata(const char *filename, 
FLAC__StreamMetadata *block, unsigned
                                const FLAC__bool is_last = (i == 
block->data.cue_sheet.num_tracks-1);
                                const FLAC__bool is_leadout = is_last && 
track->num_indices == 0;
                                PPR; printf("    track[%u]\n", i);
-#ifdef _MSC_VER
-                               PPR; printf("      offset: %I64u\n", 
track->offset);
-#else
-                               PPR; printf("      offset: %llu\n", (unsigned 
long long)track->offset);
-#endif
+                               PPR; printf("      offset: %"flactypeu64"\n", 
(unsigned long long)track->offset);
                                if(is_last) {
                                        PPR; printf("      number: %u (%s)\n", 
(unsigned)track->number, is_leadout? "LEAD-OUT" : "INVALID");
                                }
@@ -649,11 +634,7 @@ void write_metadata(const char *filename, 
FLAC__StreamMetadata *block, unsigned
                                        for(j = 0; j < track->num_indices; j++) 
{
                                                const 
FLAC__StreamMetadata_CueSheet_Index *index = track->indices+j;
                                                PPR; printf("        
index[%u]\n", j);
-#ifdef _MSC_VER
-                                               PPR; printf("          offset: 
%I64u\n", index->offset);
-#else
-                                               PPR; printf("          offset: 
%llu\n", (unsigned long long)index->offset);
-#endif
+                                               PPR; printf("          offset: 
%"flactypeu64"\n", (unsigned long long)index->offset);
                                                PPR; printf("          number: 
%u\n", (unsigned)index->number);
                                        }
                                }
diff --git a/src/share/grabbag/cuesheet.c b/src/share/grabbag/cuesheet.c
index 682ee3d..fa39f62 100644
--- a/src/share/grabbag/cuesheet.c
+++ b/src/share/grabbag/cuesheet.c
@@ -22,6 +22,7 @@
 
 #include "share/grabbag.h"
 #include "FLAC/assert.h"
+#include "FLAC/compat.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -649,19 +650,10 @@ void grabbag__cuesheet_emit(FILE *file, const 
FLAC__StreamMetadata *cuesheet, co
                                fprintf(file, "%02u:%02u:%02u\n", m, s, f);
                        }
                        else
-#ifdef _MSC_VER
-                               fprintf(file, "%I64u\n", track->offset + 
index->offset);
-#else
-                               fprintf(file, "%llu\n", (unsigned long 
long)(track->offset + index->offset));
-#endif
+                               fprintf(file, "%"flactypeu64"\n", (unsigned 
long long)(track->offset + index->offset));
                }
        }
 
-#ifdef _MSC_VER
-       fprintf(file, "REM FLAC__lead-in %I64u\n", cs->lead_in);
-       fprintf(file, "REM FLAC__lead-out %u %I64u\n", 
(unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset);
-#else
-       fprintf(file, "REM FLAC__lead-in %llu\n", (unsigned long 
long)cs->lead_in);
-       fprintf(file, "REM FLAC__lead-out %u %llu\n", 
(unsigned)cs->tracks[track_num].number, (unsigned long 
long)cs->tracks[track_num].offset);
-#endif
+       fprintf(file, "REM FLAC__lead-in %"flactypeu64"\n", (unsigned long 
long)cs->lead_in);
+       fprintf(file, "REM FLAC__lead-out %u %"flactypeu64"\n", 
(unsigned)cs->tracks[track_num].number, (unsigned long 
long)cs->tracks[track_num].offset);
 }
diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c
index 1f40c62..b403bd6 100644
--- a/src/test_libFLAC/encoders.c
+++ b/src/test_libFLAC/encoders.c
@@ -26,6 +26,7 @@
 #include <string.h>
 #include "encoders.h"
 #include "FLAC/assert.h"
+#include "FLAC/compat.h"
 #include "FLAC/stream_encoder.h"
 #include "share/grabbag.h"
 #include "test_libs_common/file_utils_flac.h"
@@ -449,11 +450,7 @@ static FLAC__bool test_stream_encoder(Layer layer, 
FLAC__bool is_ogg)
 
        printf("testing FLAC__stream_encoder_get_total_samples_estimate()... ");
        if(FLAC__stream_encoder_get_total_samples_estimate(encoder) != 
streaminfo_.data.stream_info.total_samples) {
-#ifdef _MSC_VER
-               printf("FAILED, expected %I64u, got %I64u\n", 
streaminfo_.data.stream_info.total_samples, 
FLAC__stream_encoder_get_total_samples_estimate(encoder));
-#else
-               printf("FAILED, expected %llu, got %llu\n", (unsigned long 
long)streaminfo_.data.stream_info.total_samples, (unsigned long 
long)FLAC__stream_encoder_get_total_samples_estimate(encoder));
-#endif
+               printf("FAILED, expected %"flactypeu64", got %"flactypeu64"\n", 
(unsigned long long)streaminfo_.data.stream_info.total_samples, (unsigned long 
long)FLAC__stream_encoder_get_total_samples_estimate(encoder));
                return false;
        }
        printf("OK\n");
diff --git a/src/test_libFLAC/metadata_object.c 
b/src/test_libFLAC/metadata_object.c
index c9a8479..d6bda25 100644
--- a/src/test_libFLAC/metadata_object.c
+++ b/src/test_libFLAC/metadata_object.c
@@ -21,6 +21,7 @@
 #endif
 
 #include "FLAC/assert.h"
+#include "FLAC/compat.h"
 #include "FLAC/metadata.h"
 #include "test_libs_common/metadata_utils.h"
 #include "metadata.h"
@@ -47,11 +48,7 @@ static FLAC__bool compare_track_(const 
FLAC__StreamMetadata_CueSheet_Track *from
        unsigned i;
 
        if(from->offset != to->offset) {
-#ifdef _MSC_VER
-               printf("FAILED, track offset mismatch, expected %I64u, got 
%I64u\n", to->offset, from->offset);
-#else
-               printf("FAILED, track offset mismatch, expected %llu, got 
%llu\n", (unsigned long long)to->offset, (unsigned long long)from->offset);
-#endif
+               printf("FAILED, track offset mismatch, expected %"flactypeu64", 
got %"flactypeu64"\n", (unsigned long long)to->offset, (unsigned long 
long)from->offset);
                return false;
        }
        if(from->number != to->number) {
@@ -83,11 +80,7 @@ static FLAC__bool compare_track_(const 
FLAC__StreamMetadata_CueSheet_Track *from
        else {
                for(i = 0; i < to->num_indices; i++) {
                        if(from->indices[i].offset != to->indices[i].offset) {
-#ifdef _MSC_VER
-                               printf("FAILED, track indices[%u].offset 
mismatch, expected %I64u, got %I64u\n", i, to->indices[i].offset, 
from->indices[i].offset);
-#else
-                               printf("FAILED, track indices[%u].offset 
mismatch, expected %llu, got %llu\n", i, (unsigned long 
long)to->indices[i].offset, (unsigned long long)from->indices[i].offset);
-#endif
+                               printf("FAILED, track indices[%u].offset 
mismatch, expected %"flactypeu64", got %"flactypeu64"\n", i, (unsigned long 
long)to->indices[i].offset, (unsigned long long)from->indices[i].offset);
                                return false;
                        }
                        if(from->indices[i].number != to->indices[i].number) {
@@ -109,19 +102,11 @@ static FLAC__bool compare_seekpoint_array_(const 
FLAC__StreamMetadata_SeekPoint
 
        for(i = 0; i < n; i++) {
                if(from[i].sample_number != to[i].sample_number) {
-#ifdef _MSC_VER
-                       printf("FAILED, point[%u].sample_number mismatch, 
expected %I64u, got %I64u\n", i, to[i].sample_number, from[i].sample_number);
-#else
-                       printf("FAILED, point[%u].sample_number mismatch, 
expected %llu, got %llu\n", i, (unsigned long long)to[i].sample_number, 
(unsigned long long)from[i].sample_number);
-#endif
+                       printf("FAILED, point[%u].sample_number mismatch, 
expected %"flactypeu64", got %"flactypeu64"\n", i, (unsigned long 
long)to[i].sample_number, (unsigned long long)from[i].sample_number);
                        return false;
                }
                if(from[i].stream_offset != to[i].stream_offset) {
-#ifdef _MSC_VER
-                       printf("FAILED, point[%u].stream_offset mismatch, 
expected %I64u, got %I64u\n", i, to[i].stream_offset, from[i].stream_offset);
-#else
-                       printf("FAILED, point[%u].stream_offset mismatch, 
expected %llu, got %llu\n", i, (unsigned long long)to[i].stream_offset, 
(unsigned long long)from[i].stream_offset);
-#endif
+                       printf("FAILED, point[%u].stream_offset mismatch, 
expected %"flactypeu64", got %"flactypeu64"\n", i, (unsigned long 
long)to[i].stream_offset, (unsigned long long)from[i].stream_offset);
                        return false;
                }
                if(from[i].frame_samples != to[i].frame_samples) {
diff --git a/src/test_libs_common/metadata_utils.c 
b/src/test_libs_common/metadata_utils.c
index d940180..91797af 100644
--- a/src/test_libs_common/metadata_utils.c
+++ b/src/test_libs_common/metadata_utils.c
@@ -24,6 +24,7 @@
 #  include <config.h>
 #endif
 
+#include "FLAC/compat.h"
 #include "FLAC/metadata.h"
 #include "test_libs_common/metadata_utils.h"
 #include <stdio.h>
@@ -61,11 +62,8 @@ FLAC__bool mutils__compare_block_data_streaminfo(const 
FLAC__StreamMetadata_Stre
                return false;
        }
        if(blockcopy->total_samples != block->total_samples) {
-#ifdef _MSC_VER
-               printf("FAILED, total_samples mismatch, expected %I64u, got 
%I64u\n", block->total_samples, blockcopy->total_samples);
-#else
-               printf("FAILED, total_samples mismatch, expected %llu, got 
%llu\n", (unsigned long long)block->total_samples, (unsigned long 
long)blockcopy->total_samples);
-#endif
+
+               printf("FAILED, total_samples mismatch, expected 
%"flactypeu64", got %"flactypeu64"\n", (unsigned long 
long)block->total_samples, (unsigned long long)blockcopy->total_samples);
                return false;
        }
        if(0 != memcmp(blockcopy->md5sum, block->md5sum, 
sizeof(block->md5sum))) {
@@ -166,19 +164,11 @@ FLAC__bool mutils__compare_block_data_seektable(const 
FLAC__StreamMetadata_SeekT
        }
        for(i = 0; i < block->num_points; i++) {
                if(blockcopy->points[i].sample_number != 
block->points[i].sample_number) {
-#ifdef _MSC_VER
-                       printf("FAILED, points[%u].sample_number mismatch, 
expected %I64u, got %I64u\n", i, block->points[i].sample_number, 
blockcopy->points[i].sample_number);
-#else
-                       printf("FAILED, points[%u].sample_number mismatch, 
expected %llu, got %llu\n", i, (unsigned long 
long)block->points[i].sample_number, (unsigned long 
long)blockcopy->points[i].sample_number);
-#endif
+                       printf("FAILED, points[%u].sample_number mismatch, 
expected %"flactypeu64", got %"flactypeu64"\n", i, (unsigned long 
long)block->points[i].sample_number, (unsigned long 
long)blockcopy->points[i].sample_number);
                        return false;
                }
                if(blockcopy->points[i].stream_offset != 
block->points[i].stream_offset) {
-#ifdef _MSC_VER
-                       printf("FAILED, points[%u].stream_offset mismatch, 
expected %I64u, got %I64u\n", i, block->points[i].stream_offset, 
blockcopy->points[i].stream_offset);
-#else
-                       printf("FAILED, points[%u].stream_offset mismatch, 
expected %llu, got %llu\n", i, (unsigned long 
long)block->points[i].stream_offset, (unsigned long 
long)blockcopy->points[i].stream_offset);
-#endif
+                       printf("FAILED, points[%u].stream_offset mismatch, 
expected %"flactypeu64", got %"flactypeu64"\n", i, (unsigned long 
long)block->points[i].stream_offset, (unsigned long 
long)blockcopy->points[i].stream_offset);
                        return false;
                }
                if(blockcopy->points[i].frame_samples != 
block->points[i].frame_samples) {
@@ -240,11 +230,7 @@ FLAC__bool mutils__compare_block_data_cuesheet(const 
FLAC__StreamMetadata_CueShe
                return false;
        }
        if(blockcopy->lead_in != block->lead_in) {
-#ifdef _MSC_VER
-               printf("FAILED, lead_in mismatch, expected %I64u, got %I64u\n", 
block->lead_in, blockcopy->lead_in);
-#else
-               printf("FAILED, lead_in mismatch, expected %llu, got %llu\n", 
(unsigned long long)block->lead_in, (unsigned long long)blockcopy->lead_in);
-#endif
+               printf("FAILED, lead_in mismatch, expected %"flactypeu64", got 
%"flactypeu64"\n", (unsigned long long)block->lead_in, (unsigned long 
long)blockcopy->lead_in);
                return false;
        }
        if(blockcopy->is_cd != block->is_cd) {
@@ -257,11 +243,7 @@ FLAC__bool mutils__compare_block_data_cuesheet(const 
FLAC__StreamMetadata_CueShe
        }
        for(i = 0; i < block->num_tracks; i++) {
                if(blockcopy->tracks[i].offset != block->tracks[i].offset) {
-#ifdef _MSC_VER
-                       printf("FAILED, tracks[%u].offset mismatch, expected 
%I64u, got %I64u\n", i, block->tracks[i].offset, blockcopy->tracks[i].offset);
-#else
-                       printf("FAILED, tracks[%u].offset mismatch, expected 
%llu, got %llu\n", i, (unsigned long long)block->tracks[i].offset, (unsigned 
long long)blockcopy->tracks[i].offset);
-#endif
+                       printf("FAILED, tracks[%u].offset mismatch, expected 
%"flactypeu64", got %"flactypeu64"\n", i, (unsigned long 
long)block->tracks[i].offset, (unsigned long long)blockcopy->tracks[i].offset);
                        return false;
                }
                if(blockcopy->tracks[i].number != block->tracks[i].number) {
@@ -295,11 +277,7 @@ FLAC__bool mutils__compare_block_data_cuesheet(const 
FLAC__StreamMetadata_CueShe
                        else {
                                for(j = 0; j < block->tracks[i].num_indices; 
j++) {
                                        
if(blockcopy->tracks[i].indices[j].offset != 
block->tracks[i].indices[j].offset) {
-#ifdef _MSC_VER
-                                               printf("FAILED, 
tracks[%u].indices[%u].offset mismatch, expected %I64u, got %I64u\n", i, j, 
block->tracks[i].indices[j].offset, blockcopy->tracks[i].indices[j].offset);
-#else
-                                               printf("FAILED, 
tracks[%u].indices[%u].offset mismatch, expected %llu, got %llu\n", i, j, 
(unsigned long long)block->tracks[i].indices[j].offset, (unsigned long 
long)blockcopy->tracks[i].indices[j].offset);
-#endif
+                                               printf("FAILED, 
tracks[%u].indices[%u].offset mismatch, expected %"flactypeu64", got 
%"flactypeu64"\n", i, j, (unsigned long 
long)block->tracks[i].indices[j].offset, (unsigned long 
long)blockcopy->tracks[i].indices[j].offset);
                                                return false;
                                        }
                                        
if(blockcopy->tracks[i].indices[j].number != 
block->tracks[i].indices[j].number) {
diff --git a/src/test_seeking/main.c b/src/test_seeking/main.c
index 00dce64..79803d6 100644
--- a/src/test_seeking/main.c
+++ b/src/test_seeking/main.c
@@ -31,9 +31,24 @@
 #endif
 #include <sys/stat.h> /* for stat() */
 #include "FLAC/assert.h"
+#include "FLAC/compat.h"
 #include "FLAC/metadata.h"
 #include "FLAC/stream_decoder.h"
 
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#define flactypei64 PRId64
+#define flactypeu64 PRIu64
+#else
+#ifdef _MSC_VER
+#define flactypei64 "I64d"
+#define flactypeu64 "I64u"
+#else
+#define flactypei64 "lld"
+#define flactypeu64 "llu"
+#endif
+#endif
+
 typedef struct {
        FLAC__int32 **pcm;
        FLAC__bool got_data;
@@ -200,11 +215,7 @@ static FLAC__StreamDecoderWriteStatus 
write_callback_(const FLAC__StreamDecoder
 
        FLAC__ASSERT(frame->header.number_type == 
FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); /* decoder guarantees this */
        if (!dcd->quiet)
-#ifdef _MSC_VER
-               printf("frame@%I64u(%u)... ", 
frame->header.number.sample_number, frame->header.blocksize);
-#else
-               printf("frame@%llu(%u)... ", (unsigned long 
long)frame->header.number.sample_number, frame->header.blocksize);
-#endif
+               printf("frame@%"flactypeu64"(%u)... ", (unsigned long 
long)frame->header.number.sample_number, frame->header.blocksize);
        fflush(stdout);
 
        /* check against PCM data if we have it */
@@ -309,11 +320,7 @@ static FLAC__bool seek_barrage(FLAC__bool is_ogg, const 
char *filename, off_t fi
                        return die_s_("expected 
FLAC__STREAM_DECODER_END_OF_STREAM", decoder);
        }
 
-#ifdef _MSC_VER
-       printf("file's total_samples is %I64u\n", 
decoder_client_data.total_samples);
-#else
-       printf("file's total_samples is %llu\n", (unsigned long 
long)decoder_client_data.total_samples);
-#endif
+       printf("file's total_samples is %"flactypeu64"\n", (unsigned long 
long)decoder_client_data.total_samples);
        n = (long int)decoder_client_data.total_samples;
 
        if(n == 0 && total_samples >= 0)
@@ -347,11 +354,7 @@ static FLAC__bool seek_barrage(FLAC__bool is_ogg, const 
char *filename, off_t fi
                        pos = (FLAC__uint64)(local_rand_() % n);
                }
 
-#ifdef _MSC_VER
-               printf("#%u:seek(%I64u)... ", i, pos);
-#else
-               printf("#%u:seek(%llu)... ", i, (unsigned long long)pos);
-#endif
+               printf("#%u:seek(%"flactypeu64")... ", i, (unsigned long 
long)pos);
                fflush(stdout);
                if(!FLAC__stream_decoder_seek_absolute(decoder, pos)) {
                        if(pos >= (FLAC__uint64)n)

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Flac-dev mailing list
Flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to