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.
diff --git a/src/flac/analyze.c b/src/flac/analyze.c
index 1073758..d4a4441 100644
--- a/src/flac/analyze.c
+++ b/src/flac/analyze.c
@@ -28,6 +28,20 @@
#include "FLAC/all.h"
#include "analyze.h"
+#ifdef HAVE_INTTYPES_H
+#include
+#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 residual;
unsigned count;
@@ -66,11 +80,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..e43e073 100644
--- a/src/metaflac/operations.c
+++ b/src/metaflac/operations.c
@@ -32,6 +32,20 @@
#include
#include "operations_shorthand.h"
+#ifdef HAVE_INTTYPES_H
+#include
+#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
+
static void show_version(void);
static FLAC__bool do_major_operation(const CommandLineOptions *options);
static FLAC__bool do_major_operation_on_file(const char *filename, const
CommandLineOptions *options);
@@ -565,11 +579,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 +606,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_METADAT