Commit 9bedd782 authored by Josh Coalson's avatar Josh Coalson
Browse files

fix compiler warnings

parent c8c9c991
......@@ -292,7 +292,7 @@ int main(int argc, char *argv[])
_wildcard(&argc, &argv);
#endif
srand(time(0));
srand((unsigned)time(0));
setlocale(LC_ALL, "");
if(!init_options()) {
flac__utils_printf(stderr, 1, "ERROR: allocating memory\n");
......
......@@ -339,7 +339,7 @@ namespace FLAC {
void StreamInfo::set_total_samples(FLAC__uint64 value)
{
FLAC__ASSERT(is_valid());
FLAC__ASSERT(value < (1u << FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN));
FLAC__ASSERT(value < (((FLAC__uint64)1) << FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN));
object_->data.stream_info.total_samples = value;
}
......@@ -738,7 +738,7 @@ namespace FLAC {
if(0 == p)
p = (const char *)entry_.entry + entry_.length;
field_name_length_ = p - (const char *)entry_.entry;
field_name_length_ = (unsigned)(p - (const char *)entry_.entry);
if(0 == (field_name_ = (char *)malloc(field_name_length_ + 1))) { // +1 for the trailing \0
is_valid_ = false;
return;
......
......@@ -1238,7 +1238,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St
{
int i;
unsigned field_name_length;
size_t field_name_length;
const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length);
FLAC__ASSERT(0 != eq);
......
......@@ -1834,39 +1834,40 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_Picture *obj)
{
FLAC__uint32 len;
FLAC__uint32 x;
FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input));
/* read type */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->type, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN))
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN))
return false; /* read_callback_ sets the state for us */
obj->type = x;
/* read MIME type */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
return false; /* read_callback_ sets the state for us */
if(0 == (obj->mime_type = (char*)malloc(len+1))) {
if(0 == (obj->mime_type = (char*)malloc(x+1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
if(len > 0) {
if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->mime_type, len))
if(x > 0) {
if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->mime_type, x))
return false; /* read_callback_ sets the state for us */
}
obj->mime_type[len] = '\0';
obj->mime_type[x] = '\0';
/* read description */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
return false; /* read_callback_ sets the state for us */
if(0 == (obj->description = (FLAC__byte*)malloc(len+1))) {
if(0 == (obj->description = (FLAC__byte*)malloc(x+1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
if(len > 0) {
if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->description, len))
if(x > 0) {
if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->description, x))
return false; /* read_callback_ sets the state for us */
}
obj->description[len] = '\0';
obj->description[x] = '\0';
/* read width */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->width, FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN))
......
......@@ -469,7 +469,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi
}
else if(0 == strcmp(opt, "set-total-samples")) {
op = append_shorthand_operation(options, OP__SET_TOTAL_SAMPLES);
if(!parse_uint64(option_argument, &(op->argument.streaminfo_uint64.value)) || op->argument.streaminfo_uint64.value >= (1u<<FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) {
if(!parse_uint64(option_argument, &(op->argument.streaminfo_uint64.value)) || op->argument.streaminfo_uint64.value >= (((FLAC__uint64)1)<<FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) {
fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN);
ok = false;
}
......
......@@ -367,7 +367,7 @@ int main(int argc, char *argv[])
srandom(tv.tv_usec);
}
#else
srand(time(0));
srand((unsigned)time(0));
#endif
filesize = get_filesize_(filename);
......
......@@ -815,7 +815,7 @@ int main(int argc, char *argv[])
srandom(tv.tv_usec);
}
#else
srand(time(0));
srand((unsigned)time(0));
#endif
if(!generate_01()) return 1;
......
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