diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2012-02-01 20:34:04 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2012-02-01 20:34:04 +1100 |
commit | ce8a75134cace056f6c436d54b57bad1a1d93797 (patch) | |
tree | ad3225304d65339597d053f930328a9cf437a5fb | |
parent | 8bbbf56403808ff75126cd0840a936aedbc4113b (diff) | |
download | flac-ce8a75134cace056f6c436d54b57bad1a1d93797.tar.gz |
Fix a bunch of printf format warnings.
-rw-r--r-- | examples/c/decode/file/main.c | 6 | ||||
-rw-r--r-- | examples/c/encode/file/main.c | 8 | ||||
-rw-r--r-- | src/flac/analyze.c | 7 | ||||
-rw-r--r-- | src/flac/iffscan.c | 12 | ||||
-rw-r--r-- | src/metaflac/operations.c | 30 | ||||
-rw-r--r-- | src/metaflac/operations_shorthand_cuesheet.c | 6 | ||||
-rw-r--r-- | src/metaflac/operations_shorthand_streaminfo.c | 6 | ||||
-rw-r--r-- | src/plugin_xmms/fileinfo.c | 10 | ||||
-rw-r--r-- | src/plugin_xmms/http.c | 50 | ||||
-rw-r--r-- | src/share/grabbag/cuesheet.c | 15 | ||||
-rw-r--r-- | src/test_libFLAC/encoders.c | 6 | ||||
-rw-r--r-- | src/test_libFLAC/metadata_object.c | 24 | ||||
-rw-r--r-- | src/test_seeking/main.c | 18 |
13 files changed, 54 insertions, 144 deletions
diff --git a/examples/c/decode/file/main.c b/examples/c/decode/file/main.c index 32b55594..e5138b4f 100644 --- a/examples/c/decode/file/main.c +++ b/examples/c/decode/file/main.c @@ -174,11 +174,7 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet fprintf(stderr, "sample rate : %u Hz\n", sample_rate); fprintf(stderr, "channels : %u\n", channels); fprintf(stderr, "bits per sample: %u\n", bps); -#ifdef _MSC_VER - fprintf(stderr, "total samples : %I64u\n", total_samples); -#else - fprintf(stderr, "total samples : %llu\n", total_samples); -#endif + fprintf(stderr, "total samples : %" PRIu64 "\n", total_samples); } } diff --git a/examples/c/encode/file/main.c b/examples/c/encode/file/main.c index 0f7f4c0b..1baad1d3 100644 --- a/examples/c/encode/file/main.c +++ b/examples/c/encode/file/main.c @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) channels = 2; bps = 16; total_samples = (((((((unsigned)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4; - + /* allocate the encoder */ if((encoder = FLAC__stream_encoder_new()) == NULL) { fprintf(stderr, "ERROR: allocating encoder\n"); @@ -165,9 +165,5 @@ void progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_wr { (void)encoder, (void)client_data; -#ifdef _MSC_VER - fprintf(stderr, "wrote %I64u bytes, %I64u/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate); -#else - fprintf(stderr, "wrote %llu bytes, %llu/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate); -#endif + fprintf(stderr, "wrote %" PRIu64 " bytes, %" PRIu64 "/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate); } diff --git a/src/flac/analyze.c b/src/flac/analyze.c index 10737581..98128e54 100644 --- a/src/flac/analyze.c +++ b/src/flac/analyze.c @@ -25,6 +25,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <inttypes.h> #include "FLAC/all.h" #include "analyze.h" @@ -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=%" PRIu64 "\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, (uint64_t)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/flac/iffscan.c b/src/flac/iffscan.c index b94a865a..da74a5f5 100644 --- a/src/flac/iffscan.c +++ b/src/flac/iffscan.c @@ -114,15 +114,9 @@ int main(int argc, char *argv[]) fprintf(stderr, "ERROR reading %s\n", fn); return 1; } -#ifdef _MSC_VER - printf(" RIFF size=%016I64x=(%I64u)", unpack64le_(buf+8), unpack64le_(buf+8)); - printf(" data size=%016I64x=(%I64u)", unpack64le_(buf+16), unpack64le_(buf+16)); - printf(" sample count=%016I64x=(%I64u)", unpack64le_(buf+24), unpack64le_(buf+24)); -#else - printf(" RIFF size=%016llx=(%llu)", unpack64le_(buf+8), unpack64le_(buf+8)); - printf(" data size=%016llx=(%llu)", unpack64le_(buf+16), unpack64le_(buf+16)); - printf(" sample count=%016llx=(%llu)", unpack64le_(buf+24), unpack64le_(buf+24)); -#endif + printf(" RIFF size=%016" PRIx64 "=(" PRIu64 ")", unpack64le_(buf+8), unpack64le_(buf+8)); + printf(" data size=%016" PRIx64 "=(" PRIu64 ")", unpack64le_(buf+16), unpack64le_(buf+16)); + printf(" sample count=%016" PRIx64 "=(" PRIu64 ")", unpack64le_(buf+24), unpack64le_(buf+24)); printf(" table size=%08x=(%u)", unpack32le_(buf+32), unpack32le_(buf+32)); } printf("\n"); diff --git a/src/metaflac/operations.c b/src/metaflac/operations.c index 639a1da7..7ec3b3b2 100644 --- a/src/metaflac/operations.c +++ b/src/metaflac/operations.c @@ -565,11 +565,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: %" PRIu64 "\n", (uint64_t)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 +592,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=%" PRIu64 ", stream_offset=%" PRIu64 ", frame_samples=%u\n", i, (uint64_t)block->data.seek_table.points[i].sample_number, (uint64_t)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 +610,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: %" PRIu64 "\n", (uint64_t)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 +618,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: %" PRIu64 "\n", (uint64_t)track->offset); if(is_last) { PPR; printf(" number: %u (%s)\n", (unsigned)track->number, is_leadout? "LEAD-OUT" : "INVALID"); } @@ -649,11 +633,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: %" PRIu64 "\n", (uint64_t)index->offset); PPR; printf(" number: %u\n", (unsigned)index->number); } } diff --git a/src/metaflac/operations_shorthand_cuesheet.c b/src/metaflac/operations_shorthand_cuesheet.c index 084339c8..aa7a34d8 100644 --- a/src/metaflac/operations_shorthand_cuesheet.c +++ b/src/metaflac/operations_shorthand_cuesheet.c @@ -162,11 +162,7 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, for(track = 0; track < cs->num_tracks; track++) { const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+track; for(index = 0; index < tr->num_indices; index++) { -#ifdef _MSC_VER - sprintf(spec, "%I64u;", tr->offset + tr->indices[index].offset); -#else - sprintf(spec, "%llu;", (unsigned long long)(tr->offset + tr->indices[index].offset)); -#endif + sprintf(spec, "%" PRIu64 "u;", (uint64_t)(tr->offset + tr->indices[index].offset)); local_strcat(seekpoint_specification, spec); } } diff --git a/src/metaflac/operations_shorthand_streaminfo.c b/src/metaflac/operations_shorthand_streaminfo.c index 134f24cb..0e9ab851 100644 --- a/src/metaflac/operations_shorthand_streaminfo.c +++ b/src/metaflac/operations_shorthand_streaminfo.c @@ -75,11 +75,7 @@ FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool p printf("%u\n", block->data.stream_info.bits_per_sample); break; case OP__SHOW_TOTAL_SAMPLES: -#ifdef _MSC_VER - printf("%I64u\n", block->data.stream_info.total_samples); -#else - printf("%llu\n", (unsigned long long)block->data.stream_info.total_samples); -#endif + printf("%" PRIu64 "\n", (uint64_t)block->data.stream_info.total_samples); break; case OP__SET_MD5SUM: memcpy(block->data.stream_info.md5sum, operation->argument.streaminfo_md5.value, 16); diff --git a/src/plugin_xmms/fileinfo.c b/src/plugin_xmms/fileinfo.c index 096d2210..c3ea8af2 100644 --- a/src/plugin_xmms/fileinfo.c +++ b/src/plugin_xmms/fileinfo.c @@ -182,7 +182,7 @@ static void remove_tag(GtkWidget * w, gpointer data) { (void)w; (void)data; - + FLAC_plugin__tags_delete_tag(tags_, "TITLE"); FLAC_plugin__tags_delete_tag(tags_, "ARTIST"); FLAC_plugin__tags_delete_tag(tags_, "ALBUM"); @@ -221,17 +221,13 @@ static void show_file_info(void) label_set_text(flac_blocksize, _("Blocksize: variable\n min/max: %d/%d"), streaminfo.data.stream_info.min_blocksize, streaminfo.data.stream_info.max_blocksize); if (streaminfo.data.stream_info.total_samples) - label_set_text(flac_samples, _("Samples: %llu\nLength: %d:%.2d"), + label_set_text(flac_samples, _("Samples: %" PRIu64 "\nLength: %d:%.2d"), streaminfo.data.stream_info.total_samples, (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate / 60), (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate % 60)); if(!stat(current_filename, &_stat) && S_ISREG(_stat.st_mode)) { -#if _FILE_OFFSET_BITS == 64 - label_set_text(flac_filesize, _("Filesize: %lld B"), _stat.st_size); -#else - label_set_text(flac_filesize, _("Filesize: %ld B"), _stat.st_size); -#endif + label_set_text(flac_filesize, _("Filesize: %zd B"), _stat.st_size); if (streaminfo.data.stream_info.total_samples) label_set_text(flac_bitrate, _("Avg. bitrate: %.1f kb/s\nCompression ratio: %.1f%%"), 8.0 * (float)(_stat.st_size) / (1000.0 * (float)streaminfo.data.stream_info.total_samples / (float)streaminfo.data.stream_info.sample_rate), diff --git a/src/plugin_xmms/http.c b/src/plugin_xmms/http.c index af3235fb..d8959f27 100644 --- a/src/plugin_xmms/http.c +++ b/src/plugin_xmms/http.c @@ -131,7 +131,7 @@ static gchar *basic_authentication_encode (const gchar *user, const gchar *passw res = g_strdup_printf("%s: Basic %s\r\n", header, t2); g_free(t2); g_free(t1); - + return res; } @@ -181,7 +181,7 @@ static void parse_url(const gchar * url, gchar ** user, gchar ** pass, gchar ** *port = 80; } *host = g_strdup(h); - + if (f) *filename = g_strdup(f + 1); else @@ -369,7 +369,7 @@ static int http_connect (gchar *url_, gboolean head, guint64 offset) do { redirect=FALSE; - + g_strstrip(url); parse_url(url, &user, &pass, &host, &port, &filename); @@ -441,7 +441,7 @@ static int http_connect (gchar *url_, gboolean head, guint64 offset) flac_ip.set_info_text(NULL); eof = TRUE; - + } break; } @@ -455,12 +455,12 @@ static int http_connect (gchar *url_, gboolean head, guint64 offset) if (flac_cfg.stream.use_udp_channel) { udp_port = udp_establish_listener (&udp_sock); - if (udp_port > 0) + if (udp_port > 0) sprintf (udpspace, "x-audiocast-udpport: %d\r\n", udp_port); else udp_sock = 0; } - + if(user && pass) auth = basic_authentication_encode(user, pass, "Authorization"); @@ -481,17 +481,17 @@ static int http_connect (gchar *url_, gboolean head, guint64 offset) "Host: %s\r\n" "User-Agent: %s/%s\r\n" "%s%s%s%s", - file, host, "Reference FLAC Player", FLAC__VERSION_STRING, + file, host, "Reference FLAC Player", FLAC__VERSION_STRING, proxy_auth ? proxy_auth : "", auth ? auth : "", flac_cfg.stream.cast_title_streaming ? "Icy-MetaData:1\r\n" : "", flac_cfg.stream.use_udp_channel ? udpspace : ""); if (offset && !head) { gchar *temp_dead = temp; - temp = g_strdup_printf ("%sRange: %llu-\r\n", temp, offset); + temp = g_strdup_printf ("%sRange: %" PRIu64 "-\r\n", temp, offset); fprintf (stderr, "%s", temp); g_free (temp_dead); } - + g_free(file); if(proxy_auth) g_free(proxy_auth); @@ -535,7 +535,7 @@ static int http_connect (gchar *url_, gboolean head, guint64 offset) break; } } - } + } redirect=TRUE; break; } @@ -576,7 +576,7 @@ static int http_connect (gchar *url_, gboolean head, guint64 offset) #endif /*udp_serverport = atoi (line + 20);*/ } - + } else { @@ -588,7 +588,7 @@ static int http_connect (gchar *url_, gboolean head, guint64 offset) } } } - + if(redirect) { if (output_file) @@ -617,7 +617,7 @@ static void *http_buffer_loop(void *arg) url = (gchar *) arg; sock = http_connect (url, false, offset); - + if (sock >= 0 && flac_cfg.stream.save_http_stream) { gchar *output_name; file = flac_http_get_title(url); @@ -705,7 +705,7 @@ static void *http_buffer_loop(void *arg) g_free(buffer); g_free(url); - + pthread_exit(NULL); return NULL; /* avoid compiler warning */ } @@ -749,11 +749,11 @@ static int udp_establish_listener(int *sock) { struct sockaddr_in sin; socklen_t sinlen = sizeof (struct sockaddr_in); - + #ifdef DEBUG_UDP fprintf (stderr,"Establishing udp listener\n"); #endif - + if ((*sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { g_log(NULL, G_LOG_LEVEL_CRITICAL, @@ -764,7 +764,7 @@ static int udp_establish_listener(int *sock) memset(&sin, 0, sinlen); sin.sin_family = AF_INET; sin.sin_addr.s_addr = g_htonl(INADDR_ANY); - + if (bind(*sock, (struct sockaddr *)&sin, sinlen) < 0) { g_log(NULL, G_LOG_LEVEL_CRITICAL, @@ -792,7 +792,7 @@ static int udp_establish_listener(int *sock) #ifdef DEBUG_UDP fprintf (stderr,"Listening on local %s:%d\n", inet_ntoa(sin.sin_addr), g_ntohs(sin.sin_port)); #endif - + return g_ntohs(sin.sin_port); } @@ -806,7 +806,7 @@ static int udp_check_for_data(int sock) socklen_t fromlen; fromlen = sizeof(struct sockaddr_in); - + if ((len = recvfrom(sock, buf, 1024, 0, (struct sockaddr *)&from, &fromlen)) < 0) { if (errno != EAGAIN) @@ -824,24 +824,24 @@ static int udp_check_for_data(int sock) lines = g_strsplit(buf, "\n", 0); if (!lines) return 0; - + for (i = 0; lines[i]; i++) { while ((lines[i][strlen(lines[i]) - 1] == '\n') || (lines[i][strlen(lines[i]) - 1] == '\r')) lines[i][strlen(lines[i]) - 1] = '\0'; - + valptr = strchr(lines[i], ':'); - + if (!valptr) continue; else valptr++; - + g_strstrip(valptr); if (!strlen(valptr)) continue; - + if (strstr(lines[i], "x-audiocast-streamtitle") != NULL) { title = g_strdup_printf ("%s (%s)", valptr, icy_name); @@ -857,7 +857,7 @@ static int udp_check_for_data(int sock) set_track_info(NULL, atoi(valptr)); } #endif - + else if (strstr(lines[i], "x-audiocast-streammsg") != NULL) { /* set_track_info(title, -1); */ diff --git a/src/share/grabbag/cuesheet.c b/src/share/grabbag/cuesheet.c index 682ee3dd..95b25743 100644 --- a/src/share/grabbag/cuesheet.c +++ b/src/share/grabbag/cuesheet.c @@ -649,19 +649,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, "%" PRIu64 "\n", (uint64_t)(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 %" PRIu64 "\n", (uint64_t)cs->lead_in); + fprintf(file, "REM FLAC__lead-out %u %" PRIu64 "\n", (unsigned)cs->tracks[track_num].number, (uint64_t)cs->tracks[track_num].offset); } diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c index 1f40c62c..9d0d0dd4 100644 --- a/src/test_libFLAC/encoders.c +++ b/src/test_libFLAC/encoders.c @@ -449,11 +449,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 %" PRIu64 ", got %" PRIu64 "\n", (uint64_t)streaminfo_.data.stream_info.total_samples, (uint64_t)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 c9a8479c..fd0f8c72 100644 --- a/src/test_libFLAC/metadata_object.c +++ b/src/test_libFLAC/metadata_object.c @@ -47,11 +47,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 %" PRIu64 ", got %" PRIu64 "\n", (uint64_t)to->offset, (uint64_t)from->offset); return false; } if(from->number != to->number) { @@ -83,11 +79,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 %" PRIu64 ", got %" PRIu64 "\n", i, (uint64_t)to->indices[i].offset, (uint64_t)from->indices[i].offset); return false; } if(from->indices[i].number != to->indices[i].number) { @@ -109,19 +101,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 %" PRIu64 ", got %" PRIu64 "\n", i, (uint64_t)to[i].sample_number, (uint64_t)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 %" PRIu64 ", got %" PRIu64 "\n", i, (uint64_t)to[i].stream_offset, (uint64_t)from[i].stream_offset); return false; } if(from[i].frame_samples != to[i].frame_samples) { diff --git a/src/test_seeking/main.c b/src/test_seeking/main.c index 00dce64a..5c93dd11 100644 --- a/src/test_seeking/main.c +++ b/src/test_seeking/main.c @@ -200,11 +200,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@%" PRIu64 "(%u)... ", (uint64_t)frame->header.number.sample_number, frame->header.blocksize); fflush(stdout); /* check against PCM data if we have it */ @@ -309,11 +305,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 %" PRIu64 "\n", (uint64_t)decoder_client_data.total_samples); n = (long int)decoder_client_data.total_samples; if(n == 0 && total_samples >= 0) @@ -347,11 +339,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(%" PRIu64 ")... ", i, (uint64_t)pos); fflush(stdout); if(!FLAC__stream_decoder_seek_absolute(decoder, pos)) { if(pos >= (FLAC__uint64)n) |