ref: d0647a4f8650f92057274f2412bb8aa79f71a242
parent: 88a3f5e83cec6878e3f2dc289218c41db915d15b
author: Doug Cook <idigdoug@users.sourceforge.net>
date: Thu Dec 22 17:46:15 EST 2011
Fix GCC 4.6 warnings/errors
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,6 @@
case $target in
*cygwin* | *mingw*)
AC_LIBTOOL_WIN32_DLL
- LDFLAGS="$LDFLAGS -no-undefined"
;;
esac
AC_PROG_LIBTOOL
@@ -419,11 +418,6 @@
# support for OGG and if OGG libraries are found on this
# system then its highly likely to be compiled into FLAC
# and will require these at link time.
-case $target in
- *mingw*)
- FLAC_LIBS="-lwsock32"
- ;;
-esac
AC_OPTIONAL_FORMAT(flac, FLAC, [AC_CHECK_HEADER(FLAC/all.h, [AC_CHECK_LIB(FLAC, FLAC__stream_encoder_new, FLAC_LIBS="-lFLAC $FLAC_LIBS $OGG_VORBIS_LIBS",using_flac=no, $FLAC_LIBS $OGG_VORBIS_LIBS)], using_flac=no)])
--- a/lpc10/dyptrk.c
+++ b/lpc10/dyptrk.c
@@ -115,7 +115,7 @@
/* Local variables */
integer pbar;
real sbar;
- integer path[2], iptr, i__, j;
+ integer iptr, i__, j;
real alpha, minsc, maxsc;
/* Arguments */
@@ -327,7 +327,6 @@
for (i__ = 1; i__ <= 2; ++i__) {
j = j % 2 + 1;
*pitch = p[*pitch + j * 60 - 61];
- path[i__ - 1] = *pitch;
}
/* The following statement subtracts one from IPOINT, mod DEPTH. I
--- a/src/adpcm.c
+++ b/src/adpcm.c
@@ -175,7 +175,7 @@
const SAMPL *ip, *itop;
unsigned char *op;
int ox = 0; /* */
- int i, d, v0, v1, step;
+ int d, v0, v1, step;
double d2; /* long long is okay also, speed abt the same */
ip = ibuff + ch; /* point ip to 1st input sample for this channel */
@@ -201,7 +201,7 @@
op = obuff+7*chans; /* point to base of output nibbles */
ox = 4*ch;
}
- for (i = 0; ip < itop; ip+=chans) {
+ for (; ip < itop; ip+=chans) {
int vlin,d3,dp,c;
/* make linear prediction for next sample */
@@ -255,7 +255,7 @@
{
SAMPL v[2];
int n0,s0,s1,ss,smin;
- int d,dmin,k,kmin;
+ int dmin,k,kmin;
n0 = n/2; if (n0>32) n0=32;
if (*st<16) *st = 16;
@@ -290,7 +290,7 @@
}
*st = smin;
lsx_debug_more("kmin %d, smin %5d, ",kmin,smin);
- d=AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[kmin], ip, n, st, obuff);
+ AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[kmin], ip, n, st, obuff);
obuff[ch] = kmin;
}
--- a/src/flac.c
+++ b/src/flac.c
@@ -67,6 +67,14 @@
} priv_t;
+#if defined(__MINGW32__)
+/* Provide a local definition of ntohl so we don't need to load wsock32.dll. */
+unsigned long __stdcall ntohl(unsigned long val)
+{
+ return lsx_swapdw(val);
+}
+#endif
+
static void FLAC__decoder_metadata_callback(FLAC__StreamDecoder const * const flac, FLAC__StreamMetadata const * const metadata, void * const client_data)
{
--- a/src/formats.c
+++ b/src/formats.c
@@ -306,7 +306,7 @@
if (ft->encoding.reverse_bytes == (sox_option_t)
(!(ft->handler.flags & SOX_FILE_ENDBIG) != MACHINE_IS_BIGENDIAN))
lsx_report("`%s': overriding file-type byte-order", ft->filename);
- } else if (ft->encoding.reverse_bytes == sox_true)
+ } else if (ft->encoding.reverse_bytes == SOX_OPTION_YES)
lsx_report("`%s': overriding machine byte-order", ft->filename);
if (ft->encoding.reverse_bits == SOX_OPTION_DEFAULT)
--- a/src/g72x.c
+++ b/src/g72x.c
@@ -425,7 +425,7 @@
state_ptr->dq[cnt] = state_ptr->dq[cnt-1];
/* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */
if (mag == 0) {
- state_ptr->dq[0] = (dq >= 0) ? 0x20 : (short)0xFC20;
+ state_ptr->dq[0] = (dq >= 0) ? 0x20 : (short)(unsigned short)0xFC20;
} else {
exp = log2plus1(mag);
state_ptr->dq[0] = (dq >= 0) ?
@@ -445,7 +445,7 @@
exp = log2plus1(mag);
state_ptr->sr[0] = (exp << 6) + ((mag << 6) >> exp) - 0x400;
} else
- state_ptr->sr[0] = (short)(0xFC20);
+ state_ptr->sr[0] = (short)(unsigned short)0xFC20;
/* DELAY A */
state_ptr->pk[1] = state_ptr->pk[0];
--- a/src/mcompand.c
+++ b/src/mcompand.c
@@ -163,7 +163,7 @@
static int getopts(sox_effect_t * effp, int argc, char **argv)
{
char *subargv[6], *cp;
- size_t subargc, i, len;
+ size_t subargc, i;
priv_t * c = (priv_t *) effp->priv;
--argc, ++argv;
@@ -182,7 +182,6 @@
c->bands = lsx_calloc(c->nBands, sizeof(comp_band_t));
for (i=0;i<c->nBands;++i) {
- len = strlen(argv[i<<1]);
if (parse_subarg(argv[i<<1],subargv,&subargc) != SOX_SUCCESS)
return SOX_EOF;
if (sox_mcompand_getopts_1(&c->bands[i], subargc, &subargv[0]) != SOX_SUCCESS)
--- a/src/mp3-util.h
+++ b/src/mp3-util.h
@@ -101,7 +101,7 @@
struct id3_file * id3struct;
struct id3_tag * tag;
id3_utf8_t * utf8;
- int i, fd = dup(fileno(ft->fp));
+ int i, fd = dup(fileno((FILE*)ft->fp));
if ((id3struct = id3_file_fdopen(fd, ID3_FILE_MODE_READONLY))) {
if ((tag = id3_file_tag(id3struct)) && tag->frames)
--- a/src/reverb.c
+++ b/src/reverb.c
@@ -67,9 +67,17 @@
double r = rate * (1 / 44100.); /* Compensate for actual sample-rate */
for (i = 0; i < array_length(comb_lengths); ++i, offset = -offset)
- filter_create(&p->comb[i], scale * r * (comb_lengths[i] + stereo_adjust * offset) + .5);
+ {
+ filter_t * pcomb = &p->comb[i];
+ double n = scale * r * (comb_lengths[i] + stereo_adjust * offset) + .5;
+ filter_create(pcomb, n);
+ }
for (i = 0; i < array_length(allpass_lengths); ++i, offset = -offset)
- filter_create(&p->allpass[i], r * (allpass_lengths[i] + stereo_adjust * offset) + .5);
+ {
+ filter_t * pallpass = &p->allpass[i];
+ double n = r * (allpass_lengths[i] + stereo_adjust * offset) + .5;
+ filter_create(pallpass, n);
+ }
}
static void filter_array_process(filter_array_t * p,
--- a/src/sox.h
+++ b/src/sox.h
@@ -894,7 +894,7 @@
/* Close effects library and unload format handler plugins. */
int /* Returns SOX_SUCCESS if successful */
-sox_quit(void);
+SOX_API sox_quit(void);
/* callback to retrieve information about a format handler */
typedef const sox_format_handler_t *(SOX_API *sox_format_fn_t)(void);
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -54,10 +54,10 @@
assert_static(sizeof(off_t) == _FILE_OFFSET_BITS >> 3, OFF_T_BUILD_PROBLEM);
#endif
-#if defined __GNUC__
-#define FMT_size_t "zu"
-#elif defined _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
#define FMT_size_t "Iu"
+#elif defined __GNUC__
+#define FMT_size_t "zu"
#else
#define FMT_size_t "lu"
#endif
--- a/src/voc.c
+++ b/src/voc.c
@@ -212,7 +212,6 @@
*-----------------------------------------------------------------*/
static int startread(sox_format_t * ft)
{
- int rtn = SOX_SUCCESS;
char header[20];
priv_t * v = (priv_t *) ft->priv;
unsigned short sbseek;
@@ -292,7 +291,6 @@
break;
default:
lsx_fail("Unknown VOC format %d", v->format);
- rtn = SOX_EOF;
break;
}
ft->encoding.bits_per_sample = v->size;