From e58aabdb75426038449174748d966835b74f9445 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Tue, 14 Nov 2006 05:40:34 +0000 Subject: [PATCH] fixes from MSVC6 --- src/libFLAC/stream_decoder.c | 4 ++-- src/test_libFLAC++/encoders.cpp | 4 ++++ src/test_libFLAC/encoders.c | 4 ++++ src/test_libFLAC/metadata_object.c | 16 ++++++++++++++++ src/test_libs_common/metadata_utils.c | 24 ++++++++++++++++++++++++ src/test_seeking/main.c | 12 ++++++++++++ 6 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index e7bbd4c..e27b821 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -3085,7 +3085,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; return false; } - approx_bytes_per_frame = 2 * (upper_bound - pos) / 3 + 16; + approx_bytes_per_frame = (unsigned)(2 * (upper_bound - pos) / 3 + 16); } else { /* target_sample >= this_frame_sample + this frame's blocksize */ @@ -3095,7 +3095,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; return false; } - approx_bytes_per_frame = 2 * (lower_bound - pos) / 3 + 16; + approx_bytes_per_frame = (unsigned)(2 * (lower_bound - pos) / 3 + 16); } } diff --git a/src/test_libFLAC++/encoders.cpp b/src/test_libFLAC++/encoders.cpp index 3c88721..297bf8a 100644 --- a/src/test_libFLAC++/encoders.cpp +++ b/src/test_libFLAC++/encoders.cpp @@ -453,7 +453,11 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("testing get_total_samples_estimate()... "); if(encoder->get_total_samples_estimate() != streaminfo_.data.stream_info.total_samples) { +#ifdef _MSC_VER + printf("FAILED, expected %I64u, got %I64u\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate()); +#else printf("FAILED, expected %llu, got %llu\n", (unsigned long long)streaminfo_.data.stream_info.total_samples, (unsigned long long)encoder->get_total_samples_estimate()); +#endif return false; } printf("OK\n"); diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c index d7c555e..8e2ed81 100644 --- a/src/test_libFLAC/encoders.c +++ b/src/test_libFLAC/encoders.c @@ -423,7 +423,11 @@ 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 return false; } printf("OK\n"); diff --git a/src/test_libFLAC/metadata_object.c b/src/test_libFLAC/metadata_object.c index c1607e6..109d5d5 100644 --- a/src/test_libFLAC/metadata_object.c +++ b/src/test_libFLAC/metadata_object.c @@ -46,7 +46,11 @@ 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 return false; } if(from->number != to->number) { @@ -78,7 +82,11 @@ 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 return false; } if(from->indices[i].number != to->indices[i].number) { @@ -100,11 +108,19 @@ 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 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 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 7728dba..836d5f0 100644 --- a/src/test_libs_common/metadata_utils.c +++ b/src/test_libs_common/metadata_utils.c @@ -61,7 +61,11 @@ 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 return false; } if(0 != memcmp(blockcopy->md5sum, block->md5sum, sizeof(block->md5sum))) { @@ -162,11 +166,19 @@ 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 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 return false; } if(blockcopy->points[i].frame_samples != block->points[i].frame_samples) { @@ -228,7 +240,11 @@ 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 return false; } if(blockcopy->is_cd != block->is_cd) { @@ -241,7 +257,11 @@ 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 return false; } if(blockcopy->tracks[i].number != block->tracks[i].number) { @@ -275,7 +295,11 @@ 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 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 3ce2458..4fbcb4d 100644 --- a/src/test_seeking/main.c +++ b/src/test_seeking/main.c @@ -103,7 +103,11 @@ static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder } else if (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER) { 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 } else { FLAC__ASSERT(0); @@ -202,7 +206,11 @@ 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 #if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ if (decoder_client_data.total_samples > (FLAC__uint64)RAND_MAX) { printf("ERROR: must be total_samples < %u\n", (unsigned)RAND_MAX); @@ -248,7 +256,11 @@ static FLAC__bool seek_barrage(FLAC__bool is_ogg, const char *filename, off_t fi #endif } +#ifdef _MSC_VER + printf("seek(%I64u)... ", pos); +#else printf("seek(%llu)... ", (unsigned long long)pos); +#endif fflush(stdout); if(!FLAC__stream_decoder_seek_absolute(decoder, pos)) { if(pos < (FLAC__uint64)n && decoder_client_data.total_samples != 0) -- 2.7.4