Commit acd4a434 authored by Josh Coalson's avatar Josh Coalson
Browse files

fix compiler warnings

parent b413ea41
......@@ -632,7 +632,7 @@ FLAC__bool FLAC__bitbuffer_write_zeroes(FLAC__BitBuffer *bb, unsigned bits)
return true;
}
FLaC__INLINE FLAC__bool FLAC__bitbuffer_write_raw_uint32(FLAC__BitBuffer *bb, FLAC__uint32 val, unsigned bits)
FLAC__bool FLAC__bitbuffer_write_raw_uint32(FLAC__BitBuffer *bb, FLAC__uint32 val, unsigned bits)
{
unsigned n, k;
......
......@@ -58,5 +58,5 @@ void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect);
typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__uint64 total_samples_estimate, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data);
FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data);
#endif
......@@ -57,7 +57,6 @@ static FLAC__bool is_big_endian_host_;
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
FLaC__INLINE
void
FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16])
{
......
......@@ -2925,8 +2925,9 @@ FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC
FLAC__byte buffer[8192];
size_t n;
FLAC__ASSERT(bytes >= 0);
while(bytes > 0) {
n = min(sizeof(buffer), bytes);
n = min(sizeof(buffer), (size_t)bytes);
if(fread(buffer, 1, n, file) != n) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
return false;
......@@ -2946,8 +2947,9 @@ FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Re
FLAC__byte buffer[8192];
size_t n;
FLAC__ASSERT(bytes >= 0);
while(bytes > 0) {
n = min(sizeof(buffer), bytes);
n = min(sizeof(buffer), (size_t)bytes);
if(read_cb(buffer, 1, n, handle) != n) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR;
return false;
......
......@@ -108,7 +108,7 @@ void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect)
* separate write callback for the fLaC magic, and then separate write
* callbacks for each metadata block and audio frame.
*/
FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__uint64 total_samples_estimate, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data)
FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data)
{
/* WATCHOUT:
* This depends on the behavior of FLAC__StreamEncoder that 'samples'
......
......@@ -2707,7 +2707,6 @@ FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const
if(encoder->private_->is_ogg) {
status = FLAC__ogg_encoder_aspect_write_callback_wrapper(
&encoder->protected_->ogg_encoder_aspect,
FLAC__stream_encoder_get_total_samples_estimate(encoder),
buffer,
bytes,
samples,
......
......@@ -251,6 +251,8 @@ FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitBuff
blocksize_hint = u = 6;
else if(header->blocksize <= 0x10000)
blocksize_hint = u = 7;
else
u = 0;
break;
}
if(!FLAC__bitbuffer_write_raw_uint32(bb, u, FLAC__FRAME_HEADER_BLOCK_SIZE_LEN))
......
......@@ -562,7 +562,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
#ifdef _MSC_VER
PPR; printf(" total samples: %I64u\n", block->data.stream_info.total_samples);
#else
PPR; printf(" total samples: %llu\n", block->data.stream_info.total_samples);
PPR; printf(" total samples: %llu\n", (unsigned long long)block->data.stream_info.total_samples);
#endif
PPR; printf(" MD5 signature: ");
for(i = 0; i < 16; i++) {
......@@ -593,7 +593,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
#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, block->data.seek_table.points[i].sample_number, block->data.seek_table.points[i].stream_offset, block->data.seek_table.points[i].frame_samples);
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
}
else {
......@@ -615,7 +615,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
#ifdef _MSC_VER
PPR; printf(" lead-in: %I64u\n", block->data.cue_sheet.lead_in);
#else
PPR; printf(" lead-in: %llu\n", block->data.cue_sheet.lead_in);
PPR; printf(" lead-in: %llu\n", (unsigned long long)block->data.cue_sheet.lead_in);
#endif
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);
......@@ -627,7 +627,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
#ifdef _MSC_VER
PPR; printf(" offset: %I64u\n", track->offset);
#else
PPR; printf(" offset: %llu\n", track->offset);
PPR; printf(" offset: %llu\n", (unsigned long long)track->offset);
#endif
if(is_last) {
PPR; printf(" number: %u (%s)\n", (unsigned)track->number, is_leadout? "LEAD-OUT" : "INVALID");
......@@ -646,7 +646,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned
#ifdef _MSC_VER
PPR; printf(" offset: %I64u\n", index->offset);
#else
PPR; printf(" offset: %llu\n", index->offset);
PPR; printf(" offset: %llu\n", (unsigned long long)index->offset);
#endif
PPR; printf(" number: %u\n", (unsigned)index->number);
}
......
......@@ -162,7 +162,7 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet,
#ifdef _MSC_VER
sprintf(spec, "%I64u;", tr->offset + tr->indices[index].offset);
#else
sprintf(spec, "%llu;", tr->offset + tr->indices[index].offset);
sprintf(spec, "%llu;", (unsigned long long)(tr->offset + tr->indices[index].offset));
#endif
local_strcat(seekpoint_specification, spec);
}
......
......@@ -77,7 +77,7 @@ FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool p
#ifdef _MSC_VER
printf("%I64u\n", block->data.stream_info.total_samples);
#else
printf("%llu\n", block->data.stream_info.total_samples);
printf("%llu\n", (unsigned long long)block->data.stream_info.total_samples);
#endif
break;
case OP__SET_MD5SUM:
......
......@@ -584,7 +584,7 @@ void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, co
#ifdef _MSC_VER
fprintf(file, "%I64u\n", track->offset + index->offset);
#else
fprintf(file, "%llu\n", track->offset + index->offset);
fprintf(file, "%llu\n", (unsigned long long)(track->offset + index->offset));
#endif
}
}
......@@ -593,7 +593,7 @@ void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, co
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", cs->lead_in);
fprintf(file, "REM FLAC__lead-out %u %llu\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset);
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
}
......@@ -453,7 +453,7 @@ 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) {
printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate());
printf("FAILED, expected %llu, got %llu\n", (unsigned long long)streaminfo_.data.stream_info.total_samples, (unsigned long long)encoder->get_total_samples_estimate());
return false;
}
printf("OK\n");
......
......@@ -423,7 +423,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) {
printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, FLAC__stream_encoder_get_total_samples_estimate(encoder));
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));
return false;
}
printf("OK\n");
......
......@@ -46,7 +46,7 @@ static FLAC__bool compare_track_(const FLAC__StreamMetadata_CueSheet_Track *from
unsigned i;
if(from->offset != to->offset) {
printf("FAILED, track offset mismatch, expected %llu, got %llu\n", to->offset, from->offset);
printf("FAILED, track offset mismatch, expected %llu, got %llu\n", (unsigned long long)to->offset, (unsigned long long)from->offset);
return false;
}
if(from->number != to->number) {
......@@ -78,7 +78,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) {
printf("FAILED, track indices[%u].offset mismatch, expected %llu, got %llu\n", i, to->indices[i].offset, from->indices[i].offset);
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);
return false;
}
if(from->indices[i].number != to->indices[i].number) {
......@@ -100,11 +100,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) {
printf("FAILED, point[%u].sample_number mismatch, expected %llu, got %llu\n", i, to[i].sample_number, from[i].sample_number);
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);
return false;
}
if(from[i].stream_offset != to[i].stream_offset) {
printf("FAILED, point[%u].stream_offset mismatch, expected %llu, got %llu\n", i, to[i].stream_offset, from[i].stream_offset);
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);
return false;
}
if(from[i].frame_samples != to[i].frame_samples) {
......
......@@ -61,7 +61,7 @@ FLAC__bool mutils__compare_block_data_streaminfo(const FLAC__StreamMetadata_Stre
return false;
}
if(blockcopy->total_samples != block->total_samples) {
printf("FAILED, total_samples mismatch, expected %llu, got %llu\n", block->total_samples, blockcopy->total_samples);
printf("FAILED, total_samples mismatch, expected %llu, got %llu\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))) {
......@@ -162,11 +162,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) {
printf("FAILED, points[%u].sample_number mismatch, expected %llu, got %llu\n", i, block->points[i].sample_number, blockcopy->points[i].sample_number);
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);
return false;
}
if(blockcopy->points[i].stream_offset != block->points[i].stream_offset) {
printf("FAILED, points[%u].stream_offset mismatch, expected %llu, got %llu\n", i, block->points[i].stream_offset, blockcopy->points[i].stream_offset);
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);
return false;
}
if(blockcopy->points[i].frame_samples != block->points[i].frame_samples) {
......@@ -228,7 +228,7 @@ FLAC__bool mutils__compare_block_data_cuesheet(const FLAC__StreamMetadata_CueShe
return false;
}
if(blockcopy->lead_in != block->lead_in) {
printf("FAILED, lead_in mismatch, expected %llu, got %llu\n", block->lead_in, blockcopy->lead_in);
printf("FAILED, lead_in mismatch, expected %llu, got %llu\n", (unsigned long long)block->lead_in, (unsigned long long)blockcopy->lead_in);
return false;
}
if(blockcopy->is_cd != block->is_cd) {
......@@ -241,7 +241,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) {
printf("FAILED, tracks[%u].offset mismatch, expected %llu, got %llu\n", i, block->tracks[i].offset, blockcopy->tracks[i].offset);
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);
return false;
}
if(blockcopy->tracks[i].number != block->tracks[i].number) {
......@@ -275,7 +275,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) {
printf("FAILED, tracks[%u].indices[%u].offset mismatch, expected %llu, got %llu\n", i, j, block->tracks[i].indices[j].offset, blockcopy->tracks[i].indices[j].offset);
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);
return false;
}
if(blockcopy->tracks[i].indices[j].number != block->tracks[i].indices[j].number) {
......
......@@ -103,7 +103,7 @@ static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder
}
else if (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER) {
if (!dcd->quiet)
printf("frame@%llu(%u)... ", frame->header.number.sample_number, frame->header.blocksize);
printf("frame@%llu(%u)... ", (unsigned long long)frame->header.number.sample_number, frame->header.blocksize);
}
else {
FLAC__ASSERT(0);
......@@ -202,7 +202,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);
}
printf("file's total_samples is %llu\n", decoder_client_data.total_samples);
printf("file's total_samples is %llu\n", (unsigned long long)decoder_client_data.total_samples);
#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 +248,7 @@ static FLAC__bool seek_barrage(FLAC__bool is_ogg, const char *filename, off_t fi
#endif
}
printf("seek(%llu)... ", pos);
printf("seek(%llu)... ", (unsigned long long)pos);
fflush(stdout);
if(!FLAC__stream_decoder_seek_absolute(decoder, pos)) {
if(pos < (FLAC__uint64)n && decoder_client_data.total_samples != 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment