From 7581d121c18c07ff98e5b0d7787c3d4e13d808ab Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Mon, 20 Nov 2006 07:19:15 +0000 Subject: [PATCH] patch: support for borland c++ compile (SF#1599018: http://sourceforge.net/tracker/index.php?func=detail&aid=1599018&group_id=13478&atid=313478) --- include/FLAC/ordinals.h | 4 ++-- src/libFLAC/format.c | 2 +- src/libFLAC/lpc.c | 12 ++++++------ src/libFLAC/metadata_iterators.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/FLAC/ordinals.h b/include/FLAC/ordinals.h index 42ac9779..4ca23a81 100644 --- a/include/FLAC/ordinals.h +++ b/include/FLAC/ordinals.h @@ -32,14 +32,14 @@ #ifndef FLAC__ORDINALS_H #define FLAC__ORDINALS_H -#if !(defined(_MSC_VER) || defined(__EMX__)) +#if !(defined(_MSC_VER) || defined(__BORLANDC__) || defined(__EMX__)) #include #endif typedef signed char FLAC__int8; typedef unsigned char FLAC__uint8; -#if defined _MSC_VER +#if defined(_MSC_VER) || defined(__BORLANDC__) typedef __int16 FLAC__int16; typedef __int32 FLAC__int32; typedef __int64 FLAC__int64; diff --git a/src/libFLAC/format.c b/src/libFLAC/format.c index 9d45620b..af384ea4 100644 --- a/src/libFLAC/format.c +++ b/src/libFLAC/format.c @@ -54,7 +54,7 @@ /* VERSION should come from configure */ FLAC_API const char *FLAC__VERSION_STRING = VERSION; -#if defined _MSC_VER || defined __MINW32__ +#if defined _MSC_VER || defined __BORLANDC__ || defined __MINW32__ /* yet one more hack because of MSVC6: */ FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 1.1.3 20061120"; #else diff --git a/src/libFLAC/lpc.c b/src/libFLAC/lpc.c index 174c3e0a..aa9b1c3b 100644 --- a/src/libFLAC/lpc.c +++ b/src/libFLAC/lpc.c @@ -316,7 +316,7 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c #endif unsigned i, j; FLAC__int32 sum; - const FLAC__int32 *history; + const FLAC__int32 *r = residual, *history; #ifdef FLAC__OVERFLOW_DETECT_VERBOSE fprintf(stderr,"FLAC__lpc_restore_signal: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization); @@ -345,7 +345,7 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c #endif #endif } - *(data++) = *(residual++) + (sum >> lp_quantization); + *(data++) = *(r++) + (sum >> lp_quantization); } /* Here's a slower but clearer version: @@ -362,7 +362,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l { unsigned i, j; FLAC__int64 sum; - const FLAC__int32 *history; + const FLAC__int32 *r = residual, *history; #ifdef FLAC__OVERFLOW_DETECT_VERBOSE fprintf(stderr,"FLAC__lpc_restore_signal_wide: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization); @@ -382,12 +382,12 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization)); break; } - if(FLAC__bitmath_silog2_wide((FLAC__int64)(*residual) + (sum >> lp_quantization)) > 32) { - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%lld, data=%lld\n", i, *residual, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*residual) + (sum >> lp_quantization))); + if(FLAC__bitmath_silog2_wide((FLAC__int64)(*r) + (sum >> lp_quantization)) > 32) { + fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%lld, data=%lld\n", i, *r, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*r) + (sum >> lp_quantization))); break; } #endif - *(data++) = *(residual++) + (FLAC__int32)(sum >> lp_quantization); + *(data++) = *(r++) + (FLAC__int32)(sum >> lp_quantization); } } diff --git a/src/libFLAC/metadata_iterators.c b/src/libFLAC/metadata_iterators.c index d5c4490a..38f75bbf 100644 --- a/src/libFLAC/metadata_iterators.c +++ b/src/libFLAC/metadata_iterators.c @@ -3195,7 +3195,7 @@ FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tem (void)fclose(*tempfile); *tempfile = 0; -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ +#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ || defined __EMX__ /* on some flavors of windows, rename() will fail if the destination already exists */ if(unlink(filename) < 0) { cleanup_tempfile_(tempfile, tempfilename); @@ -3248,7 +3248,7 @@ void set_file_stats_(const char *filename, struct stat *stats) srctime.modtime = stats->st_mtime; (void)chmod(filename, stats->st_mode); (void)utime(filename, &srctime); -#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ +#if !defined _MSC_VER && !defined __BORLANDC__ && !defined __MINGW32__ && !defined __EMX__ (void)chown(filename, stats->st_uid, -1); (void)chown(filename, -1, stats->st_gid); #endif