tests/ : Fix warnings from clang 3.5.

This commit is contained in:
Erik de Castro Lopo 2014-07-30 20:55:55 +10:00
parent c161588249
commit 40736c98b4
4 changed files with 17 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -172,7 +172,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
*/
if ((sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_MS_ADPCM)
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
if (abs (data [k] / scale) > decay_response (k))
if (ABS (data [k] / scale) > decay_response (k))
{ printf ("Line %d : Incorrect sample B (#%d : abs (%d) should be < %d).\n", __LINE__, k, data [k], decay_response (k)) ;
exit (1) ;
} ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -838,7 +838,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
*/
if ((sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_MS_ADPCM)
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
if (abs (data [channels * k] / scale) > decay_response (channels * k))
if (ABS (data [channels * k] / scale) > decay_response (channels * k))
{ printf ("\n\nLine %d : Incorrect sample B (#%d : abs (%d) should be < %d).\n", __LINE__, channels * k, data [channels * k], decay_response (channels * k)) ;
exit (1) ;
} ;
@ -1032,7 +1032,7 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
*/
if ((sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_MS_ADPCM)
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
if (abs (data [channels * k]) > decay_response (channels * k))
if (ABS (data [channels * k]) > decay_response (channels * k))
{ printf ("\n\nLine %d : Incorrect sample B (#%d : abs (%f) should be < %d).\n", __LINE__, channels * k, data [channels * k], decay_response (channels * k)) ;
exit (1) ;
} ;
@ -1207,7 +1207,7 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
oct_save_double (orig, data, datalen) ;
exit (1) ;
} ;
half_max_abs = LCT_MAX (half_max_abs, abs (0.5 * data [k])) ;
half_max_abs = LCT_MAX (half_max_abs, ABS (0.5 * data [k])) ;
} ;
if (half_max_abs < 1.0)
@ -1226,7 +1226,7 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
*/
if ((sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_MS_ADPCM)
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
if (abs (data [channels * k]) > decay_response (channels * k))
if (ABS (data [channels * k]) > decay_response (channels * k))
{ printf ("\n\nLine %d : Incorrect sample B (#%d : abs (%f) should be < %d).\n", __LINE__, channels * k, data [channels * k], decay_response (channels * k)) ;
exit (1) ;
} ;
@ -1421,7 +1421,7 @@ channels = 1 ;
oct_save_short (orig, smooth, datalen) ;
exit (1) ;
} ;
half_max_abs = LCT_MAX (half_max_abs, abs (0.5 * data [k])) ;
half_max_abs = LCT_MAX (half_max_abs, ABS (0.5 * data [k])) ;
} ;
if (half_max_abs < 1)
@ -1437,7 +1437,7 @@ channels = 1 ;
if ((sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_MS_ADPCM &&
(sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_GSM610)
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
if (abs (data [k]) > decay_response (k))
if (ABS (data [k]) > decay_response (k))
{ printf ("\n\nLine %d: Incorrect sample (#%" PRId64 " : abs (%d) should be < %d).\n", __LINE__, datalen + k, data [k], decay_response (k)) ;
exit (1) ;
} ;
@ -1824,7 +1824,7 @@ printf ("** fix this ** ") ;
oct_save_float (orig, smooth, datalen) ;
exit (1) ;
} ;
half_max_abs = LCT_MAX (half_max_abs, abs (0.5 * data [k])) ;
half_max_abs = LCT_MAX (half_max_abs, ABS (0.5 * data [k])) ;
} ;
if (half_max_abs <= 0.0)
@ -1841,7 +1841,7 @@ printf ("** fix this ** ") ;
if ((sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_MS_ADPCM &&
(sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_GSM610)
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
if (abs (data [k]) > decay_response (k))
if (ABS (data [k]) > decay_response (k))
{ printf ("\n\nLine %d: Incorrect sample (#%" PRId64 " : abs (%d) should be < %d).\n", __LINE__, datalen + k, (int) data [k], (int) decay_response (k)) ;
exit (1) ;
} ;
@ -2033,7 +2033,7 @@ channels = 1 ;
if ((sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_MS_ADPCM &&
(sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_GSM610)
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
if (abs (data [k]) > decay_response (k))
if (ABS (data [k]) > decay_response (k))
{ printf ("\n\nLine %d: Incorrect sample (#%" PRId64 " : abs (%d) should be < %d).\n", __LINE__, datalen + k, (int) data [k], (int) decay_response (k)) ;
exit (1) ;
} ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2002-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -84,7 +84,7 @@ raw_offset_test (const char *filename, int typeminor)
sndfile = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
check_log_buffer_or_die (sndfile, __LINE__) ;
if (abs (BUFFER_LEN - sfinfo.frames) > 1)
if (ABS (BUFFER_LEN - sfinfo.frames) > 1)
{ printf ("\n\nLine %d : Incorrect sample count (%" PRId64 " should be %d)\n", __LINE__, sfinfo.frames, BUFFER_LEN) ;
dump_log_buffer (sndfile) ;
exit (1) ;

View File

@ -1,6 +1,6 @@
[+ AutoGen5 template h c +]
/*
** Copyright (C) 2002-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2002-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -37,6 +37,7 @@ extern "C" {
#define ARRAY_LEN(x) ((int) (sizeof (x)) / (sizeof ((x) [0])))
#define SIGNED_SIZEOF(x) ((int64_t) (sizeof (x)))
#define NOT(x) (! (x))
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define PIPE_INDEX(x) ((x) + 500)
#define PIPE_TEST_LEN 12345
@ -60,7 +61,7 @@ void write_mono_file (const char * filename, int format, int srate, float * outp
#ifdef __GNUC__
static inline void
exit_if_true (int test, const char *format, ...)
#ifdef __USE_MINGW_ANSI_STDIO
#if (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO)
__attribute__ ((format (gnu_printf, 2, 3))) ;
#else
__attribute__ ((format (printf, 2, 3))) ;