summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2014-07-04 08:31:57 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2014-07-04 08:32:01 +1000
commit5e8854fa8477296850940427d32c03604a900699 (patch)
treed83e93919a395af749479a2ede3a22218ff3dec7
parenteda98c49a84f7c414eea154a312bd146c3959986 (diff)
downloadflac-5e8854fa8477296850940427d32c03604a900699.tar.gz
src/ : Remove un-needed MSVC6 workaround.
MSVC6 was not able to cast from a uint64_t to a double and this commit removes some #ifdef hackery designed to work around this problem. Patch-from: lvqcl <lvqcl.mail@gmail.com>
-rw-r--r--src/flac/decode.c5
-rw-r--r--src/flac/encode.c6
-rw-r--r--src/libFLAC/fixed.c9
-rw-r--r--src/libFLAC/stream_decoder.c10
-rw-r--r--src/utils/flactimer/main.cpp5
5 files changed, 1 insertions, 34 deletions
diff --git a/src/flac/decode.c b/src/flac/decode.c
index e98c07a8..5e5e17ad 100644
--- a/src/flac/decode.c
+++ b/src/flac/decode.c
@@ -1429,12 +1429,7 @@ void print_error_with_state(const DecoderSession *d, const char *message)
void print_stats(const DecoderSession *decoder_session)
{
if(flac__utils_verbosity_ >= 2) {
-#if defined _MSC_VER || defined __MINGW32__
- /* with MSVC you have to spoon feed it the casting */
- const double progress = (double)(FLAC__int64)decoder_session->samples_processed / (double)(FLAC__int64)decoder_session->total_samples * 100.0;
-#else
const double progress = (double)decoder_session->samples_processed / (double)decoder_session->total_samples * 100.0;
-#endif
if(decoder_session->total_samples > 0) {
if ((unsigned)floor(progress + 0.5) == 100)
diff --git a/src/flac/encode.c b/src/flac/encode.c
index 67fbc745..0079a504 100644
--- a/src/flac/encode.c
+++ b/src/flac/encode.c
@@ -2450,14 +2450,8 @@ void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64
const FLAC__uint64 uesize = e->unencoded_size;
-#if defined _MSC_VER || defined __MINGW32__
- /* with MSVC you have to spoon feed it the casting */
- e->progress = e->total_samples_to_encode ? (double)(FLAC__int64)samples_written / (double)(FLAC__int64)e->total_samples_to_encode : 0;
- e->compression_ratio = (e->progress && uesize) ? (double)(FLAC__int64)e->bytes_written / ((double)(FLAC__int64)uesize * min(1.0, e->progress)) : 0;
-#else
e->progress = e->total_samples_to_encode ? (double)samples_written / (double)e->total_samples_to_encode : 0;
e->compression_ratio = (e->progress && uesize) ? (double)e->bytes_written / ((double)uesize * min(1.0, e->progress)) : 0;
-#endif
(void)encoder, (void)total_frames_estimate;
diff --git a/src/libFLAC/fixed.c b/src/libFLAC/fixed.c
index 7ee5ef8a..fe4e5734 100644
--- a/src/libFLAC/fixed.c
+++ b/src/libFLAC/fixed.c
@@ -317,20 +317,11 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig
FLAC__ASSERT(data_len > 0 || total_error_3 == 0);
FLAC__ASSERT(data_len > 0 || total_error_4 == 0);
#ifndef FLAC__INTEGER_ONLY_LIBRARY
-#if defined _MSC_VER || defined __MINGW32__
- /* with MSVC you have to spoon feed it the casting */
- residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
-#else
residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0);
residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0);
residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0);
residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0);
-#endif
#else
residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_wide_integerized(total_error_0, data_len) : 0;
residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_wide_integerized(total_error_1, data_len) : 0;
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c
index b31dcc4a..4ebb3353 100644
--- a/src/libFLAC/stream_decoder.c
+++ b/src/libFLAC/stream_decoder.c
@@ -3089,12 +3089,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s
return false;
}
#ifndef FLAC__INTEGER_ONLY_LIBRARY
-#if defined _MSC_VER || defined __MINGW32__
- /* with VC++ you have to spoon feed it the casting */
- pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(FLAC__int64)(target_sample - lower_bound_sample) / (FLAC__double)(FLAC__int64)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(FLAC__int64)(upper_bound - lower_bound)) - approx_bytes_per_frame;
-#else
pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(target_sample - lower_bound_sample) / (FLAC__double)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(upper_bound - lower_bound)) - approx_bytes_per_frame;
-#endif
#else
/* a little less accurate: */
if(upper_bound - lower_bound < 0xffffffff)
@@ -3218,12 +3213,7 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint
}
else {
#ifndef FLAC__INTEGER_ONLY_LIBRARY
-#if defined _MSC_VER || defined __MINGW32__
- /* with MSVC you have to spoon feed it the casting */
- pos = (FLAC__uint64)((FLAC__double)(FLAC__int64)(target_sample - left_sample) / (FLAC__double)(FLAC__int64)(right_sample - left_sample) * (FLAC__double)(FLAC__int64)(right_pos - left_pos));
-#else
pos = (FLAC__uint64)((FLAC__double)(target_sample - left_sample) / (FLAC__double)(right_sample - left_sample) * (FLAC__double)(right_pos - left_pos));
-#endif
#else
/* a little less accurate: */
if ((target_sample-left_sample <= 0xffffffff) && (right_pos-left_pos <= 0xffffffff))
diff --git a/src/utils/flactimer/main.cpp b/src/utils/flactimer/main.cpp
index a37fd3c6..fa3167be 100644
--- a/src/utils/flactimer/main.cpp
+++ b/src/utils/flactimer/main.cpp
@@ -27,9 +27,6 @@
#include "share/compat.h"
#include "share/safe_str.h"
-#define int64_t __int64
-#define uint64_t unsigned int64_t
-
static inline uint64_t time2nsec(const FILETIME &t)
{
uint64_t n = t.dwHighDateTime;
@@ -40,7 +37,7 @@ static inline uint64_t time2nsec(const FILETIME &t)
static void printtime(FILE *fout, uint64_t nsec, uint64_t total)
{
- unsigned pct = (unsigned)(100.0 * ((double)(int64_t)nsec / (double)(int64_t)total));
+ unsigned pct = (unsigned)(100.0 * ((double)nsec / (double)total));
uint64_t msec = nsec / 1000000; nsec -= msec * 1000000;
uint64_t sec = msec / 1000; msec -= sec * 1000;
uint64_t min = sec / 60; sec -= min * 60;