fix MSVC warning with explicit casts
authorJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 15 Nov 2002 19:32:57 +0000 (19:32 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 15 Nov 2002 19:32:57 +0000 (19:32 +0000)
src/libFLAC/stream_decoder.c
src/plugin_common/replaygain_synthesis.c
src/share/grabbag/seektable.c

index b13f007..3651a2d 100644 (file)
@@ -1144,7 +1144,7 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
 
                        if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN, read_callback_, decoder))
                                return false; /* the read_callback_ sets the state for us */
-                       track->number = x;
+                       track->number = (FLAC__byte)x;
 
                        FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0);
                        if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN/8, read_callback_, decoder))
@@ -1163,7 +1163,7 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
 
                        if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN, read_callback_, decoder))
                                return false; /* the read_callback_ sets the state for us */
-                       track->num_indices = x;
+                       track->num_indices = (FLAC__byte)x;
 
                        if(track->num_indices > 0) {
                                if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) {
@@ -1177,7 +1177,7 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
 
                                        if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN, read_callback_, decoder))
                                                return false; /* the read_callback_ sets the state for us */
-                                       index->number = x;
+                                       index->number = (FLAC__byte)x;
 
                                        if(!FLAC__bitbuffer_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN, read_callback_, decoder))
                                                return false; /* the read_callback_ sets the state for us */
index 5675a6a..fc34377 100644 (file)
@@ -356,7 +356,7 @@ PLUGIN_COMMON_API int FLAC__plugin_common__apply_gain(FLAC__byte *data_out, FLAC
                -268435456, /* 29 bits-per-sample */
                -536870912, /* 30 bits-per-sample */
                -1073741824, /* 31 bits-per-sample */
-               -2147483648ll /* 32 bits-per-sample */
+               (FLAC__int64)(-1073741824) * 2 /* 32 bits-per-sample */
        };
        const FLAC__int32 conv_factor = conv_factors_[source_bps];
        const FLAC__int64 hard_clip_factor = hard_clip_factors_[source_bps];
index 993bc32..e6aaade 100644 (file)
@@ -60,7 +60,12 @@ GRABBAG_API FLAC__bool grabbag__seektable_convert_specification_to_template(cons
                                        if(!only_explicit_placeholders) {
                                                double sec = atof(pt);
                                                if(sec > 0.0) {
+#if defined _MSC_VER || defined __MINGW32__
+                                                       /* with VC++ you have to spoon feed it the casting */
+                                                       unsigned n = (unsigned)((double)(FLAC__int64)total_samples_to_encode / (sec * (double)sample_rate));
+#else
                                                        unsigned n = (unsigned)((double)total_samples_to_encode / (sec * (double)sample_rate));
+#endif
                                                        if(!FLAC__metadata_object_seektable_template_append_spaced_points(seektable_template, n, total_samples_to_encode))
                                                                return false;
                                                }