mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
tests/ : Fix all printf format warnings.
This commit is contained in:
parent
f4da909c5d
commit
518e3be6ef
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 2003-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2003-2012 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
|
||||
@ -17,15 +17,17 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
static unsigned char aifc_data [] =
|
||||
@ -152,8 +154,8 @@ rw_test (const char *filename)
|
||||
} ;
|
||||
|
||||
if (sfinfo_rd.frames != sfinfo_rw.frames)
|
||||
{ printf ("\n\nLine %d : frame count mismatch (rd %ld != rw %ld).\n\n", __LINE__,
|
||||
SF_COUNT_TO_LONG (sfinfo_rd.frames), SF_COUNT_TO_LONG (sfinfo_rw.frames)) ;
|
||||
{ printf ("\n\nLine %d : frame count mismatch (rd %" PRId64 " != rw %" PRId64 ").\n\n", __LINE__,
|
||||
sfinfo_rd.frames, sfinfo_rw.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -157,7 +157,7 @@ chunk_test (const char *filename, int typemajor)
|
||||
|
||||
exit_if_true (
|
||||
memcmp (testdata, chunk_info.data, length_before),
|
||||
"\n\nLine %d : Data compare failed.\n %s\n %s\n\n", __LINE__, testdata, chunk_info.data
|
||||
"\n\nLine %d : Data compare failed.\n %s\n %s\n\n", __LINE__, testdata, (char*) chunk_info.data
|
||||
) ;
|
||||
|
||||
free (chunk_info.data) ;
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
@ -241,7 +243,7 @@ float_norm_test (const char *filename)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %ld)\n", __LINE__, BUFFER_LEN, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %" PRId64 ")\n", __LINE__, BUFFER_LEN, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -357,7 +359,7 @@ double_norm_test (const char *filename)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %ld)\n", __LINE__, BUFFER_LEN, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %" PRId64 ")\n", __LINE__, BUFFER_LEN, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -546,7 +548,7 @@ calc_peak_test (int filetype, const char *filename)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %ld)\n", __LINE__, BUFFER_LEN, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %" PRId64 ")\n", __LINE__, BUFFER_LEN, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -593,7 +595,7 @@ calc_peak_test (int filetype, const char *filename)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %ld)\n", __LINE__, BUFFER_LEN, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %" PRId64 ")\n", __LINE__, BUFFER_LEN, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -824,8 +826,8 @@ current_sf_info_test (const char *filename)
|
||||
sf_command (outfile, SFC_GET_CURRENT_SF_INFO, &outinfo, sizeof (outinfo)) ;
|
||||
|
||||
exit_if_true (outinfo.frames != BUFFER_LEN,
|
||||
"\n\nLine %d : Initial sfinfo.frames (%ld) should be %d.\n\n", __LINE__,
|
||||
SF_COUNT_TO_LONG (outinfo.frames), BUFFER_LEN
|
||||
"\n\nLine %d : Initial sfinfo.frames (%" PRId64 ") should be %d.\n\n", __LINE__,
|
||||
outinfo.frames, BUFFER_LEN
|
||||
) ;
|
||||
|
||||
/* Read file making sure no channel map exists. */
|
||||
@ -837,8 +839,8 @@ current_sf_info_test (const char *filename)
|
||||
sf_command (infile, SFC_GET_CURRENT_SF_INFO, &ininfo, sizeof (ininfo)) ;
|
||||
|
||||
exit_if_true (ininfo.frames != BUFFER_LEN,
|
||||
"\n\nLine %d : Initial sfinfo.frames (%ld) should be %d.\n\n", __LINE__,
|
||||
SF_COUNT_TO_LONG (ininfo.frames), BUFFER_LEN
|
||||
"\n\nLine %d : Initial sfinfo.frames (%" PRId64 ") should be %d.\n\n", __LINE__,
|
||||
ininfo.frames, BUFFER_LEN
|
||||
) ;
|
||||
|
||||
sf_close (outfile) ;
|
||||
@ -967,7 +969,7 @@ broadcast_rdwr_test (const char *filename, int filetype)
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
sf_close (file) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %" PRId64 " should be %" PRId64 ".\n", __LINE__, sfinfo.frames, frames) ;
|
||||
|
||||
unlink (filename) ;
|
||||
puts ("ok") ;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 2006-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2006-2012 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
|
||||
@ -159,7 +159,7 @@ read_file (const char * filename, int format)
|
||||
|
||||
if (file.frames () != ARRAY_LEN (sbuffer) * 4)
|
||||
{ printf ("\n\n%s %d : Error : frames %ld should be %lu.\n\n", __func__, __LINE__,
|
||||
SF_COUNT_TO_LONG (file.frames ()), (long unsigned int) ARRAY_LEN (sbuffer) * 4 / 2) ;
|
||||
(long) file.frames (), (long) ARRAY_LEN (sbuffer) * 4 / 2) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -187,14 +187,14 @@ read_file (const char * filename, int format)
|
||||
count = file.seek (file.frames () - 10, SEEK_SET) ;
|
||||
if (count != file.frames () - 10)
|
||||
{ printf ("\n\n%s %d : Error : offset (%ld) should be %ld\n\n", __func__, __LINE__,
|
||||
SF_COUNT_TO_LONG (count), SF_COUNT_TO_LONG (file.frames () - 10)) ;
|
||||
(long) count, (long) (file.frames () - 10)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
count = file.read (sbuffer, ARRAY_LEN (sbuffer)) ;
|
||||
if (count != 10 * file.channels ())
|
||||
{ printf ("\n\n%s %d : Error : count (%ld) should be %ld\n\n", __func__, __LINE__,
|
||||
SF_COUNT_TO_LONG (count), SF_COUNT_TO_LONG (10 * file.channels ())) ;
|
||||
(long) count, (long) (10 * file.channels ())) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -16,15 +16,16 @@
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define BUFFER_SIZE (1 << 14)
|
||||
#define SAMPLE_RATE (11025)
|
||||
@ -70,7 +71,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, *orig, *data, sum_abs ;
|
||||
long datalen, seekpos ;
|
||||
sf_count_t datalen, seekpos ;
|
||||
double scale ;
|
||||
|
||||
printf ("\nThis is program is not part of the libsndfile test suite.\n\n") ;
|
||||
@ -102,7 +103,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
} ;
|
||||
|
||||
if ((k = sf_writef_int (file, orig, datalen)) != datalen)
|
||||
{ printf ("sf_writef_int failed with short write (%ld => %d).\n", datalen, k) ;
|
||||
{ printf ("sf_writef_int failed with short write (%" PRId64 " => %d).\n", datalen, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
sf_close (file) ;
|
||||
@ -124,12 +125,12 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + datalen / 2))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -141,7 +142,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
check_log_buffer_or_die (file, __LINE__) ;
|
||||
|
||||
if ((k = sf_readf_int (file, data, datalen)) != datalen)
|
||||
{ printf ("Line %d: short read (%d should be %ld).\n", __LINE__, k, datalen) ;
|
||||
{ printf ("Line %d: short read (%d should be %" PRId64 ").\n", __LINE__, k, datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -161,7 +162,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("Line %d: Incorrect read length (%ld should be %d).\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames - datalen), k) ;
|
||||
{ printf ("Line %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__, sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -209,7 +210,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %ld failed (%d).\n", seekpos, k) ;
|
||||
{ printf ("Seek to start of file + %" PRId64 " failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -224,7 +225,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("Line %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %ld)\n", __LINE__, k, seekpos + 1) ;
|
||||
{ printf ("Line %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %" PRId64 ")\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -232,7 +233,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
sf_readf_int (file, data, 1) ;
|
||||
if (error_function ((double) data [0], (double) orig [seekpos], margin) || k != seekpos)
|
||||
{ printf ("Line %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %ld).\n", __LINE__, data [0], orig [seekpos], k, seekpos + 1) ;
|
||||
{ printf ("Line %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %" PRId64 ").\n", __LINE__, data [0], orig [seekpos], k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -241,7 +242,7 @@ lcomp_test_int (const char *str, const char *filename, int filetype, double marg
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
sf_readf_int (file, data, 1) ;
|
||||
if (error_function ((double) data [0], (double) orig [seekpos], margin) || k != seekpos)
|
||||
{ printf ("sf_seek (backwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %ld).\n", data [0], orig [seekpos], k, seekpos) ;
|
||||
{ printf ("sf_seek (backwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %" PRId64 ").\n", data [0], orig [seekpos], k, seekpos) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[+ AutoGen5 template c +]
|
||||
/*
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2012 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
|
||||
@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -210,7 +211,7 @@ float_scaled_test (const char *filename, int allow_exit, int replace_float, int
|
||||
sf_command (file, SFC_TEST_IEEE_FLOAT_REPLACE, NULL, replace_float) ;
|
||||
|
||||
exit_if_true (sfinfo.format != filetype, "\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n", __LINE__, filetype, sfinfo.format) ;
|
||||
exit_if_true (sfinfo.frames < DFT_DATA_LENGTH, "\n\nLine %d: Incorrect number of frames in file (too short). (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), DFT_DATA_LENGTH) ;
|
||||
exit_if_true (sfinfo.frames < DFT_DATA_LENGTH, "\n\nLine %d: Incorrect number of frames in file (too short). (%" PRId64 " should be %d)\n", __LINE__, sfinfo.frames, DFT_DATA_LENGTH) ;
|
||||
exit_if_true (sfinfo.channels != 1, "\n\nLine %d: Incorrect number of channels in file.\n", __LINE__) ;
|
||||
|
||||
check_log_buffer_or_die (file, __LINE__) ;
|
||||
@ -258,7 +259,7 @@ double_scaled_test (const char *filename, int allow_exit, int replace_float, int
|
||||
sf_command (file, SFC_TEST_IEEE_FLOAT_REPLACE, NULL, replace_float) ;
|
||||
|
||||
exit_if_true (sfinfo.format != filetype, "\n\nLine %d: Returned format incorrect (0x%08X => 0x%08X).\n", __LINE__, filetype, sfinfo.format) ;
|
||||
exit_if_true (sfinfo.frames < DFT_DATA_LENGTH, "\n\nLine %d: Incorrect number of frames in file (too short). (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), DFT_DATA_LENGTH) ;
|
||||
exit_if_true (sfinfo.frames < DFT_DATA_LENGTH, "\n\nLine %d: Incorrect number of frames in file (too short). (%" PRId64 " should be %d)\n", __LINE__, sfinfo.frames, DFT_DATA_LENGTH) ;
|
||||
exit_if_true (sfinfo.channels != 1, "\n\nLine %d: Incorrect number of channels in file.\n", __LINE__) ;
|
||||
|
||||
check_log_buffer_or_die (file, __LINE__) ;
|
||||
@ -305,7 +306,7 @@ static void
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
|
||||
if (sfinfo.frames != ARRAY_LEN ([+ (get "float_name") +]_data))
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file (too short). (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), DFT_DATA_LENGTH) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file (too short). (%" PRId64 " should be %d)\n", __LINE__, sfinfo.frames, DFT_DATA_LENGTH) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -273,7 +273,7 @@ update_header_sub (const char *filename, int typemajor, int write_mode)
|
||||
check_log_buffer_or_die (infile, __LINE__) ;
|
||||
|
||||
if (sfinfo.frames < BUFFER_LEN || sfinfo.frames > BUFFER_LEN + 50)
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), BUFFER_LEN) ;
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %d)\n", __LINE__, sfinfo.frames, BUFFER_LEN) ;
|
||||
dump_log_buffer (infile) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -298,7 +298,7 @@ update_header_sub (const char *filename, int typemajor, int write_mode)
|
||||
check_log_buffer_or_die (infile, __LINE__) ;
|
||||
|
||||
if (sfinfo.frames < 2 * BUFFER_LEN || sfinfo.frames > 2 * BUFFER_LEN + 50)
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * BUFFER_LEN) ;
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %d)\n", __LINE__, sfinfo.frames, 2 * BUFFER_LEN) ;
|
||||
dump_log_buffer (infile) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -375,7 +375,7 @@ update_seek_[+ (get "name") +]_test (const char *filename, int filetype)
|
||||
sf_close (infile) ;
|
||||
|
||||
if (sfinfo.frames != k * frames)
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %ld)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), SF_COUNT_TO_LONG (k + frames)) ;
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %ld)\n", __LINE__, sfinfo.frames, k + frames) ;
|
||||
dump_log_buffer (infile) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -520,7 +520,7 @@ extra_header_test (const char *filename, int filetype)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != k * frames)
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %ld)\n", [+ (tpl-file-line "%2$d") +], SF_COUNT_TO_LONG (sfinfo.frames), SF_COUNT_TO_LONG (k + frames)) ;
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %ld)\n", [+ (tpl-file-line "%2$d") +], sfinfo.frames, k + frames) ;
|
||||
dump_log_buffer (infile) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2012 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
|
||||
@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -93,7 +94,7 @@ headerless_test (const char * filename, int format, int expected)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < BUFFER_SIZE)
|
||||
{ printf ("Line %d: Incorrect number of.frames in file. (%d => %ld)\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Line %d: Incorrect number of.frames in file. (%d => %" PRId64 ")\n", __LINE__, BUFFER_SIZE, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -154,7 +155,7 @@ old_test (void)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < BUFFER_SIZE)
|
||||
{ printf ("Line %d: Incorrect number of.frames in file. (%d => %ld)\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Line %d: Incorrect number of.frames in file. (%d => %" PRId64 ")\n", __LINE__, BUFFER_SIZE, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -556,7 +558,7 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, seekpos, half_max_abs ;
|
||||
long datalen ;
|
||||
sf_count_t datalen ;
|
||||
short *orig, *data ;
|
||||
|
||||
print_test_name ("lcomp_test_short", filename) ;
|
||||
@ -593,12 +595,12 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few frames in file. (%ld should be a little more than %ld)\n", SF_COUNT_TO_LONG (sfinfo.frames), datalen) ;
|
||||
{ printf ("Too few frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + datalen / 20))
|
||||
{ printf ("Too many frames in file. (%ld should be a little more than %ld)\n", SF_COUNT_TO_LONG (sfinfo.frames), datalen) ;
|
||||
{ printf ("Too many frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -629,8 +631,8 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_short (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%ld should be %d).\n", __LINE__,
|
||||
SF_COUNT_TO_LONG (channels * sfinfo.frames - datalen), k) ;
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__,
|
||||
channels * sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -742,7 +744,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, half_max_abs ;
|
||||
long datalen, seekpos ;
|
||||
sf_count_t datalen, seekpos ;
|
||||
double scale, max_val ;
|
||||
int *orig, *data ;
|
||||
|
||||
@ -790,12 +792,12 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + datalen / 20))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -826,8 +828,8 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%ld should be %d).\n", __LINE__,
|
||||
SF_COUNT_TO_LONG (channels * sfinfo.frames - datalen), k) ;
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__,
|
||||
channels * sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -872,7 +874,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %ld failed (%d).\n", seekpos, k) ;
|
||||
{ printf ("Seek to start of file + %" PRId64 " failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -884,7 +886,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %ld)\n", __LINE__, k, seekpos + 1) ;
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %" PRId64 ")\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -892,7 +894,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
|
||||
if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %ld).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
|
||||
{ printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %" PRId64 ").\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -901,7 +903,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
test_readf_int_or_die (file, 0, data, 1, __LINE__) ;
|
||||
if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %ld).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
|
||||
{ printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_int failed (%d, %d) (%d, %" PRId64 ").\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -939,7 +941,7 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, seekpos ;
|
||||
long datalen ;
|
||||
sf_count_t datalen ;
|
||||
float *orig, *data ;
|
||||
double half_max_abs ;
|
||||
|
||||
@ -978,12 +980,12 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + datalen / 20))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1020,8 +1022,8 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_float (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%ld should be %d).\n", __LINE__,
|
||||
SF_COUNT_TO_LONG (channels * sfinfo.frames - datalen), k) ;
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__,
|
||||
channels * sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1133,7 +1135,7 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, seekpos ;
|
||||
long datalen ;
|
||||
sf_count_t datalen ;
|
||||
double *orig, *data ;
|
||||
double half_max_abs ;
|
||||
|
||||
@ -1172,12 +1174,12 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + datalen / 20))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1214,8 +1216,8 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_double (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%ld should be %d).\n", __LINE__,
|
||||
SF_COUNT_TO_LONG (channels * sfinfo.frames - datalen), k) ;
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__,
|
||||
channels * sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1328,7 +1330,7 @@ sdlcomp_test_short (const char *filename, int filetype, int channels, double mar
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, seekpos, half_max_abs ;
|
||||
long datalen ;
|
||||
sf_count_t datalen ;
|
||||
short *orig, *data, *smooth ;
|
||||
|
||||
channels = 1 ;
|
||||
@ -1386,12 +1388,12 @@ channels = 1 ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + 400))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", SF_COUNT_TO_LONG (sfinfo.frames), datalen) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1428,7 +1430,7 @@ channels = 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_read_short (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %ld).\n", __LINE__, k, SF_COUNT_TO_LONG (sfinfo.frames - datalen)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %" PRId64 ").\n", __LINE__, k, sfinfo.frames - datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1436,7 +1438,7 @@ channels = 1 ;
|
||||
(sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_GSM610)
|
||||
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
|
||||
if (abs (data [k]) > decay_response (k))
|
||||
{ printf ("\n\nLine %d: Incorrect sample (#%ld : abs (%d) should be < %d).\n", __LINE__, datalen + k, 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) ;
|
||||
} ;
|
||||
|
||||
@ -1456,7 +1458,7 @@ channels = 1 ;
|
||||
|
||||
for (k = 0 ; k < datalen / 7 ; k++)
|
||||
if (error_function (1.0 * data [k], 1.0 * smooth [k], margin))
|
||||
{ printf ("\nLine %d: Incorrect sample C (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), smooth [k], data [k]) ;
|
||||
{ printf ("\nLine %d: Incorrect sample C (#%d (%" PRId64 ") : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), smooth [k], data [k]) ;
|
||||
for (m = 0 ; m < 10 ; m++)
|
||||
printf ("%d ", data [k]) ;
|
||||
printf ("\n") ;
|
||||
@ -1533,7 +1535,7 @@ sdlcomp_test_int (const char *filename, int filetype, int channels, double margi
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, seekpos, half_max_abs ;
|
||||
long datalen ;
|
||||
sf_count_t datalen ;
|
||||
int *orig, *data, *smooth ;
|
||||
double scale ;
|
||||
|
||||
@ -1594,12 +1596,12 @@ channels = 1 ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + 400))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", SF_COUNT_TO_LONG (sfinfo.frames), datalen) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1632,7 +1634,7 @@ channels = 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %ld).\n", __LINE__, k, SF_COUNT_TO_LONG (sfinfo.frames - datalen)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %" PRId64 ").\n", __LINE__, k, sfinfo.frames - datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1643,7 +1645,7 @@ channels = 1 ;
|
||||
(sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_G723_24)
|
||||
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
|
||||
if (abs (data [k]) > decay_response (k))
|
||||
{ printf ("\n\nLine %d: Incorrect sample (#%ld : abs (%d) should be < %d).\n", __LINE__, datalen + k, 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) ;
|
||||
} ;
|
||||
|
||||
@ -1663,7 +1665,7 @@ channels = 1 ;
|
||||
|
||||
for (k = 0 ; k < datalen / 7 ; k++)
|
||||
if (error_function (data [k] / scale, smooth [k] / scale, margin))
|
||||
{ printf ("\nLine %d: Incorrect sample (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), smooth [k], data [k]) ;
|
||||
{ printf ("\nLine %d: Incorrect sample (#%d (%" PRId64 ") : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), smooth [k], data [k]) ;
|
||||
for (m = 0 ; m < 10 ; m++)
|
||||
printf ("%d ", data [k]) ;
|
||||
printf ("\n") ;
|
||||
@ -1740,7 +1742,7 @@ sdlcomp_test_float (const char *filename, int filetype, int channels, double mar
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, seekpos ;
|
||||
long datalen ;
|
||||
sf_count_t datalen ;
|
||||
float *orig, *data, *smooth ;
|
||||
double half_max_abs ;
|
||||
|
||||
@ -1789,12 +1791,12 @@ printf ("** fix this ** ") ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + 400))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", SF_COUNT_TO_LONG (sfinfo.frames), datalen) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1832,7 +1834,7 @@ printf ("** fix this ** ") ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_read_float (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %ld).\n", __LINE__, k, SF_COUNT_TO_LONG (sfinfo.frames - datalen)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %" PRId64 ").\n", __LINE__, k, sfinfo.frames - datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -1840,7 +1842,7 @@ printf ("** fix this ** ") ;
|
||||
(sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_GSM610)
|
||||
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
|
||||
if (abs (data [k]) > decay_response (k))
|
||||
{ printf ("\n\nLine %d: Incorrect sample (#%ld : abs (%d) should be < %d).\n", __LINE__, datalen + k, (int) data [k], (int) 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) ;
|
||||
} ;
|
||||
|
||||
@ -1860,7 +1862,7 @@ printf ("** fix this ** ") ;
|
||||
|
||||
for (k = 0 ; k < datalen / 7 ; k++)
|
||||
if (error_function (data [k], smooth [k], margin))
|
||||
{ printf ("\nLine %d: Incorrect sample C (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), (int) smooth [k], (int) data [k]) ;
|
||||
{ printf ("\nLine %d: Incorrect sample C (#%d (%" PRId64 ") : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), (int) smooth [k], (int) data [k]) ;
|
||||
for (m = 0 ; m < 10 ; m++)
|
||||
printf ("%d ", (int) data [k]) ;
|
||||
printf ("\n") ;
|
||||
@ -1937,7 +1939,7 @@ sdlcomp_test_double (const char *filename, int filetype, int channels, double ma
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, m, seekpos ;
|
||||
long datalen ;
|
||||
sf_count_t datalen ;
|
||||
double *orig, *data, *smooth, half_max_abs ;
|
||||
|
||||
channels = 1 ;
|
||||
@ -1980,12 +1982,12 @@ channels = 1 ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + 400))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", SF_COUNT_TO_LONG (sfinfo.frames), datalen) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -2024,7 +2026,7 @@ channels = 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_read_double (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %ld).\n", __LINE__, k, SF_COUNT_TO_LONG (sfinfo.frames - datalen)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %" PRId64 ").\n", __LINE__, k, sfinfo.frames - datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -2032,7 +2034,7 @@ channels = 1 ;
|
||||
(sfinfo.format & SF_FORMAT_SUBMASK) != SF_FORMAT_GSM610)
|
||||
for (k = 0 ; k < sfinfo.frames - datalen ; k++)
|
||||
if (abs (data [k]) > decay_response (k))
|
||||
{ printf ("\n\nLine %d: Incorrect sample (#%ld : abs (%d) should be < %d).\n", __LINE__, datalen + k, (int) data [k], (int) 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) ;
|
||||
} ;
|
||||
|
||||
@ -2052,7 +2054,7 @@ channels = 1 ;
|
||||
|
||||
for (k = 0 ; k < datalen / 7 ; k++)
|
||||
if (error_function (data [k], smooth [k], margin))
|
||||
{ printf ("\nLine %d: Incorrect sample C (#%d (%ld) : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), (int) smooth [k], (int) data [k]) ;
|
||||
{ printf ("\nLine %d: Incorrect sample C (#%d (%" PRId64 ") : %d => %d).\n", __LINE__, k, k + m * (datalen / 7), (int) smooth [k], (int) data [k]) ;
|
||||
for (m = 0 ; m < 10 ; m++)
|
||||
printf ("%d ", (int) data [k]) ;
|
||||
printf ("\n") ;
|
||||
@ -2128,8 +2130,7 @@ static void
|
||||
read_raw_test (const char *filename, int filetype, int channels)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
sf_count_t count ;
|
||||
long datalen ;
|
||||
sf_count_t count, datalen ;
|
||||
short *orig, *data ;
|
||||
int k ;
|
||||
|
||||
@ -2167,12 +2168,12 @@ read_raw_test (const char *filename, int filetype, int channels)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < datalen / channels)
|
||||
{ printf ("Too few.frames in file. (%ld should be a little more than %ld)\n", datalen, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("Too few.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", datalen, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > (datalen + 400))
|
||||
{ printf ("Too many.frames in file. (%ld should be a little more than %ld)\n", SF_COUNT_TO_LONG (sfinfo.frames), datalen) ;
|
||||
{ printf ("Too many.frames in file. (%" PRId64 " should be a little more than %" PRId64 ")\n", sfinfo.frames, datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -2185,7 +2186,7 @@ read_raw_test (const char *filename, int filetype, int channels)
|
||||
|
||||
count = sf_read_raw (file, orig_buffer.c, datalen + 5 * channels) ;
|
||||
if (count != sfinfo.channels * sfinfo.frames)
|
||||
{ printf ("\nLine %d : sf_read_raw returned %ld should be %ld\n", __LINE__, SF_COUNT_TO_LONG (count), sfinfo.channels * SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\nLine %d : sf_read_raw returned %" PRId64 " should be %" PRId64 "\n", __LINE__, count, sfinfo.channels * sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2012 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
|
||||
@ -20,6 +20,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -30,8 +33,6 @@
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -157,7 +158,7 @@ multi_file_test (const char *filename, int *formats, int format_count)
|
||||
{
|
||||
if (verbose)
|
||||
{ puts ("\n------------------------------------") ;
|
||||
printf ("This offset : %ld\n", SF_COUNT_TO_LONG (embed_info.offset + embed_info.length)) ;
|
||||
printf ("This offset : %" PRId64 "\n", embed_info.offset + embed_info.length) ;
|
||||
} ;
|
||||
|
||||
if (lseek (fd, embed_info.offset + embed_info.length, SEEK_SET) < 0)
|
||||
@ -168,7 +169,7 @@ multi_file_test (const char *filename, int *formats, int format_count)
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
if ((sndfile = sf_open_fd (fd, SFM_READ, &sfinfo, SF_FALSE)) == NULL)
|
||||
{ printf ("\n\nLine %d: sf_open_fd failed\n", __LINE__) ;
|
||||
printf ("Embedded file number : %d offset : %ld\n", file_count, SF_COUNT_TO_LONG (embed_info.offset)) ;
|
||||
printf ("Embedded file number : %d offset : %" PRId64 "\n", file_count, embed_info.offset) ;
|
||||
puts (sf_strerror (sndfile)) ;
|
||||
dump_log_buffer (sndfile) ;
|
||||
exit (1) ;
|
||||
@ -179,7 +180,7 @@ multi_file_test (const char *filename, int *formats, int format_count)
|
||||
sf_close (sndfile) ;
|
||||
|
||||
if (verbose)
|
||||
printf ("\nNext offset : %ld\nNext length : %ld\n", SF_COUNT_TO_LONG (embed_info.offset), SF_COUNT_TO_LONG (embed_info.length)) ;
|
||||
printf ("\nNext offset : %" PRId64 "\nNext length : %" PRId64 "\n", embed_info.offset, embed_info.length) ;
|
||||
} ;
|
||||
|
||||
file_count -- ;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -174,7 +175,7 @@ pcm_test_[+ (get "name") +] (const char *filename, int filetype, uint64_t hash)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != items)
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %ld)\n", __LINE__, items, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %" PRId64 ")\n", __LINE__, items, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -236,7 +237,7 @@ pcm_test_[+ (get "name") +] (const char *filename, int filetype, uint64_t hash)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != items)
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %ld)\n", __LINE__, items, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %" PRId64 ")\n", __LINE__, items, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -298,7 +299,7 @@ pcm_test_[+ (get "name") +] (const char *filename, int filetype, uint64_t hash)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != items)
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %ld)\n", __LINE__, items, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %" PRId64 ")\n", __LINE__, items, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -361,7 +362,7 @@ pcm_test_[+ (get "name") +] (const char *filename, int filetype, uint64_t hash)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != items)
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %ld)\n", __LINE__, items, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %" PRId64 ")\n", __LINE__, items, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -451,7 +452,7 @@ pcm_test_float (const char *filename, int filetype, uint64_t hash, int replace_f
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != items)
|
||||
{ printf ("\n\nError (%s:%d) Mono : Incorrect number of frames in file. (%d => %ld)\n", __FILE__, __LINE__, items, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nError (%s:%d) Mono : Incorrect number of frames in file. (%d => %" PRId64 ")\n", __FILE__, __LINE__, items, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -575,7 +576,7 @@ pcm_test_float (const char *filename, int filetype, uint64_t hash, int replace_f
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != frames)
|
||||
{ printf ("\n\nError (%s:%d) Stereo : Incorrect number of frames in file. (%d => %ld)\n", __FILE__, __LINE__, frames, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nError (%s:%d) Stereo : Incorrect number of frames in file. (%d => %" PRId64 ")\n", __FILE__, __LINE__, frames, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -714,7 +715,7 @@ pcm_test_double (const char *filename, int filetype, uint64_t hash, int replace_
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != items)
|
||||
{ printf ("\n\nError (%s:%d) Mono : Incorrect number of frames in file. (%d => %ld)\n", __FILE__, __LINE__, items, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nError (%s:%d) Mono : Incorrect number of frames in file. (%d => %" PRId64 ")\n", __FILE__, __LINE__, items, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -848,7 +849,7 @@ pcm_test_double (const char *filename, int filetype, uint64_t hash, int replace_
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != frames)
|
||||
{ printf ("\n\nError (%s:%d) Stereo : Incorrect number of frames in file. (%d => %ld)\n", __FILE__, __LINE__, frames, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nError (%s:%d) Stereo : Incorrect number of frames in file. (%d => %" PRId64 ")\n", __FILE__, __LINE__, frames, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -347,7 +348,7 @@ read_write_peak_test (const char *filename, int filetype)
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
|
||||
|
||||
exit_if_true (sfinfo.channels * sfinfo.frames != 2 * ARRAY_LEN (small_data),
|
||||
"Line %d : frame count is %ld, should be %d\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * ARRAY_LEN (small_data)) ;
|
||||
"Line %d : frame count is %" PRId64 ", should be %zd\n", __LINE__, sfinfo.frames, 2 * ARRAY_LEN (small_data)) ;
|
||||
|
||||
sf_command (file, SFC_GET_SIGNAL_MAX, &max_peak, sizeof (double)) ;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -84,7 +85,7 @@ raw_offset_test (const char *filename, int typeminor)
|
||||
check_log_buffer_or_die (sndfile, __LINE__) ;
|
||||
|
||||
if (abs (BUFFER_LEN - sfinfo.frames) > 1)
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), BUFFER_LEN) ;
|
||||
{ printf ("\n\nLine %d : Incorrect sample count (%" PRId64 " should be %d)\n", __LINE__, sfinfo.frames, BUFFER_LEN) ;
|
||||
dump_log_buffer (sndfile) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[+ AutoGen5 template c +]
|
||||
/*
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2012 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
|
||||
@ -22,13 +22,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "utils.h"
|
||||
@ -167,7 +167,7 @@ main (void)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != BUFFER_SIZE)
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file (%d => %" PRId64 ").\n\n", __LINE__, BUFFER_SIZE, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -301,7 +301,7 @@ main (void)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != BUFFER_SIZE)
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file (%d => %" PRId64 ").\n\n", __LINE__, BUFFER_SIZE, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -380,7 +380,7 @@ main (void)
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames != 3 * BUFFER_SIZE)
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file (%d => %ld).\n\n", __LINE__, 3 * BUFFER_SIZE, SF_COUNT_TO_LONG (sfinfo.frames)) ;
|
||||
{ printf ("\n\nLine %d: Incorrect number of frames in file (%d => %" PRId64 ").\n\n", __LINE__, 3 * BUFFER_SIZE, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -526,7 +527,7 @@ string_rdwr_test (const char *filename, int typemajor)
|
||||
sf_close (file) ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %" PRId64 " should be %" PRId64 ".\n", __LINE__, sfinfo.frames, frames) ;
|
||||
str = sf_get_string (file, SF_STR_TITLE) ;
|
||||
exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
|
||||
exit_if_true (strcmp (str, title) != 0, "\n\nLine %d : SF_STR_TITLE doesn't match what was written.\n", __LINE__) ;
|
||||
@ -553,7 +554,7 @@ string_rdwr_test (const char *filename, int typemajor)
|
||||
exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
|
||||
exit_if_true (strcmp (str, title) != 0, "\n\nLine %d : SF_STR_TITLE doesn't match what was written.\n", __LINE__) ;
|
||||
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %" PRId64 " should be %" PRId64 ".\n", __LINE__, sfinfo.frames, frames) ;
|
||||
|
||||
sf_close (file) ;
|
||||
unlink (filename) ;
|
||||
@ -587,7 +588,7 @@ string_short_rdwr_test (const char *filename, int typemajor)
|
||||
|
||||
/* Open the file RDWR. */
|
||||
file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %" PRId64 " should be %" PRId64 ".\n", __LINE__, sfinfo.frames, frames) ;
|
||||
str = sf_get_string (file, SF_STR_TITLE) ;
|
||||
exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
|
||||
exit_if_true (strcmp (str, long_title) != 0, "\n\nLine %d : SF_STR_TITLE doesn't match what was written.\n", __LINE__) ;
|
||||
@ -661,7 +662,7 @@ software_string_test (const char *filename)
|
||||
exit_if_true (result == NULL, "\n\nLine %d : sf_get_string (file, SF_STR_SOFTWARE) returned NULL.\n\n", __LINE__) ;
|
||||
|
||||
exit_if_true (strstr (result, sfname) != result,
|
||||
"\n\nLine %d : String '%s''%s' -> '%s'\n\n", sfname, result) ;
|
||||
"\n\nLine %d : Can't fine string '%s' in '%s'\n\n", __LINE__, sfname, result) ;
|
||||
sf_close (file) ;
|
||||
} ;
|
||||
|
||||
@ -709,7 +710,7 @@ string_rdwr_grow_test (const char *filename, int typemajor)
|
||||
/* Now open file again. It should now contain two BUFFER_LEN's worth of frames and the strings. */
|
||||
frames = 2 * BUFFER_LEN / sfinfo.channels ;
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %" PRId64 " should be %" PRId64 ".\n", __LINE__, sfinfo.frames, frames) ;
|
||||
|
||||
/* Check the strings */
|
||||
str = sf_get_string (file, SF_STR_TITLE) ;
|
||||
@ -761,7 +762,7 @@ string_header_update (const char *filename, int typemajor)
|
||||
file1 = test_open_file_or_die (filename, SFM_READ, &sfinfo1, SF_TRUE, __LINE__) ;
|
||||
|
||||
frames = (BUFFER_LEN + GROW_BUFFER_AMOUNT) / sfinfo.channels ;
|
||||
exit_if_true (frames != sfinfo1.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo1.frames, frames) ;
|
||||
exit_if_true (frames != sfinfo1.frames, "\n\nLine %d : Frame count %" PRId64 " should be %" PRId64 ".\n", __LINE__, sfinfo1.frames, frames) ;
|
||||
|
||||
/* The strings are probably not readable by the second soundfile handle because write_tailer has not yet been called.
|
||||
It's a design decision whether SFC_UPDATE_HEADER_NOW should write the tailer. I think it's fine that it doesn't. */
|
||||
@ -780,7 +781,7 @@ string_header_update (const char *filename, int typemajor)
|
||||
/* Open file again and verify data and string. */
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
frames = (BUFFER_LEN + 2*GROW_BUFFER_AMOUNT) / sfinfo.channels ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %lld should be %lld.\n", __LINE__, sfinfo.frames, frames) ;
|
||||
exit_if_true (frames != sfinfo.frames, "\n\nLine %d : Frame count %" PRId64 " should be %" PRId64 ".\n", __LINE__, sfinfo.frames, frames) ;
|
||||
str = sf_get_string (file, SF_STR_TITLE) ;
|
||||
exit_if_true (str == NULL, "\n\nLine %d : SF_STR_TITLE string is NULL.\n", __LINE__) ;
|
||||
exit_if_true (strcmp (str, long_title) != 0, "\n\nLine %d : SF_STR_TITLE doesn't match what was written.\n", __LINE__) ;
|
||||
|
@ -34,7 +34,6 @@ extern "C" {
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define SF_COUNT_TO_LONG(x) ((long) (x))
|
||||
#define ARRAY_LEN(x) ((int) (sizeof (x)) / (sizeof ((x) [0])))
|
||||
#define SIGNED_SIZEOF(x) ((int64_t) (sizeof (x)))
|
||||
#define NOT(x) (! (x))
|
||||
@ -427,7 +426,7 @@ hexdump_file (const char * filename, sf_count_t offset, sf_count_t length)
|
||||
int k, m, ch, readcount ;
|
||||
|
||||
if (length > 1000000)
|
||||
{ printf ("\n\nError : length (%ld) too long.\n\n", SF_COUNT_TO_LONG (offset)) ;
|
||||
{ printf ("\n\nError : length (%" PRId64 ") too long.\n\n", offset) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -437,7 +436,7 @@ hexdump_file (const char * filename, sf_count_t offset, sf_count_t length)
|
||||
} ;
|
||||
|
||||
if (fseek (file, offset, SEEK_SET) != 0)
|
||||
{ printf ("\n\nError : fseek(file, %ld, SEEK_SET) failed : %s\n\n", SF_COUNT_TO_LONG (offset), strerror (errno)) ;
|
||||
{ printf ("\n\nError : fseek(file, %" PRId64 ", SEEK_SET) failed : %s\n\n", offset, strerror (errno)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -446,7 +445,7 @@ hexdump_file (const char * filename, sf_count_t offset, sf_count_t length)
|
||||
for (k = 0 ; k < length ; k+= sizeof (buffer))
|
||||
{ readcount = fread (buffer, 1, sizeof (buffer), file) ;
|
||||
|
||||
printf ("%08lx : ", SF_COUNT_TO_LONG (offset + k)) ;
|
||||
printf ("%08" PRIx64 " : ", offset + k) ;
|
||||
|
||||
for (m = 0 ; m < readcount ; m++)
|
||||
printf ("%02x ", buffer [m] & 0xFF) ;
|
||||
@ -575,7 +574,7 @@ test_read_write_position_or_die (SNDFILE *file, int line_num, int pass, sf_count
|
||||
{ printf ("\n\nLine %d ", line_num) ;
|
||||
if (pass > 0)
|
||||
printf ("(pass %d): ", pass) ;
|
||||
printf ("Read position (%ld) should be %ld.\n", SF_COUNT_TO_LONG (pos), SF_COUNT_TO_LONG (read_pos)) ;
|
||||
printf ("Read position (%" PRId64 ") should be %" PRId64 ".\n", pos, read_pos) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -584,8 +583,7 @@ test_read_write_position_or_die (SNDFILE *file, int line_num, int pass, sf_count
|
||||
{ printf ("\n\nLine %d", line_num) ;
|
||||
if (pass > 0)
|
||||
printf (" (pass %d)", pass) ;
|
||||
printf (" : Write position (%ld) should be %ld.\n",
|
||||
SF_COUNT_TO_LONG (pos), SF_COUNT_TO_LONG (write_pos)) ;
|
||||
printf (" : Write position (%" PRId64 ") should be %" PRId64 ".\n", pos, write_pos) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -638,9 +636,8 @@ test_seek_or_die (SNDFILE *file, sf_count_t offset, int whence, sf_count_t new_p
|
||||
channel_name = (channels == 1) ? "Mono" : "Stereo" ;
|
||||
|
||||
if ((position = sf_seek (file, offset, whence)) != new_pos)
|
||||
{ printf ("\n\nLine %d : %s : sf_seek (file, %ld, %s) returned %ld (should be %ld).\n\n",
|
||||
line_num, channel_name, SF_COUNT_TO_LONG (offset), whence_name,
|
||||
SF_COUNT_TO_LONG (position), SF_COUNT_TO_LONG (new_pos)) ;
|
||||
{ printf ("\n\nLine %d : %s : sf_seek (file, %" PRId64 ", %s) returned %" PRId64 " (should be %" PRId64 ").\n\n",
|
||||
line_num, channel_name, offset, whence_name, position, new_pos) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -656,8 +653,8 @@ test_[+ (get "op_element") +]_[+ (get "io_element") +]_or_die (SNDFILE *file, in
|
||||
{ printf ("\n\nLine %d", line_num) ;
|
||||
if (pass > 0)
|
||||
printf (" (pass %d)", pass) ;
|
||||
printf (" : sf_[+ (get "op_element") +]_[+ (get "io_element") +] failed with short [+ (get "op_element") +] (%ld => %ld).\n",
|
||||
SF_COUNT_TO_LONG ([+ (get "count_name") +]), SF_COUNT_TO_LONG (count)) ;
|
||||
printf (" : sf_[+ (get "op_element") +]_[+ (get "io_element") +] failed with short [+ (get "op_element") +] (%" PRId64 " => %" PRId64 ").\n",
|
||||
[+ (get "count_name") +], count) ;
|
||||
fflush (stdout) ;
|
||||
puts (sf_strerror (file)) ;
|
||||
exit (1) ;
|
||||
@ -675,8 +672,7 @@ test_read_raw_or_die (SNDFILE *file, int pass, void *test, sf_count_t items, int
|
||||
{ printf ("\n\nLine %d", line_num) ;
|
||||
if (pass > 0)
|
||||
printf (" (pass %d)", pass) ;
|
||||
printf (" : sf_read_raw failed with short read (%ld => %ld).\n",
|
||||
SF_COUNT_TO_LONG (items), SF_COUNT_TO_LONG (count)) ;
|
||||
printf (" : sf_read_raw failed with short read (%" PRId64 " => %" PRId64 ").\n", items, count) ;
|
||||
fflush (stdout) ;
|
||||
puts (sf_strerror (file)) ;
|
||||
exit (1) ;
|
||||
@ -695,8 +691,8 @@ test_[+ (get "op_element") +]_[+ (get "io_element") +]_or_die (SNDFILE *file, in
|
||||
{ printf ("\n\nLine %d", line_num) ;
|
||||
if (pass > 0)
|
||||
printf (" (pass %d)", pass) ;
|
||||
printf (" : sf_[+ (get "op_element") +]_[+ (get "io_element") +] failed with short [+ (get "op_element") +] (%ld => %ld).\n",
|
||||
SF_COUNT_TO_LONG ([+ (get "count_name") +]), SF_COUNT_TO_LONG (count)) ;
|
||||
printf (" : sf_[+ (get "op_element") +]_[+ (get "io_element") +] failed with short [+ (get "op_element") +] (%" PRId64 " => %" PRId64 ").\n",
|
||||
[+ (get "count_name") +], count) ;
|
||||
fflush (stdout) ;
|
||||
puts (sf_strerror (file)) ;
|
||||
exit (1) ;
|
||||
@ -714,8 +710,7 @@ test_write_raw_or_die (SNDFILE *file, int pass, const void *test, sf_count_t ite
|
||||
{ printf ("\n\nLine %d", line_num) ;
|
||||
if (pass > 0)
|
||||
printf (" (pass %d)", pass) ;
|
||||
printf (" : sf_write_raw failed with short write (%ld => %ld).\n",
|
||||
SF_COUNT_TO_LONG (items), SF_COUNT_TO_LONG (count)) ;
|
||||
printf (" : sf_write_raw failed with short write (%" PRId64 " => %" PRId64 ").\n", items, count) ;
|
||||
fflush (stdout) ;
|
||||
puts (sf_strerror (file)) ;
|
||||
exit (1) ;
|
||||
|
@ -22,17 +22,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "generate.h"
|
||||
#include "utils.h"
|
||||
#include "generate.h"
|
||||
|
||||
#define SAMPLE_RATE 11025
|
||||
#define DATA_LENGTH (1 << 12)
|
||||
@ -533,12 +534,12 @@ mono_[+ (get "type_name") +]_test (const char *filename, int format, int long_fi
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < 2 * items)
|
||||
{ printf ("\n\nLine %d : Mono : Incorrect number of frames in file (too short). (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), items) ;
|
||||
{ printf ("\n\nLine %d : Mono : Incorrect number of frames in file (too short). (%" PRId64 " should be %d)\n", __LINE__, sfinfo.frames, items) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (! long_file_ok && sfinfo.frames > 2 * items)
|
||||
{ printf ("\n\nLine %d : Mono : Incorrect number of frames in file (too long). (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), items) ;
|
||||
{ printf ("\n\nLine %d : Mono : Incorrect number of frames in file (too long). (%" PRId64 " should be %d)\n", __LINE__, sfinfo.frames, items) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -621,7 +622,7 @@ mono_[+ (get "type_name") +]_test (const char *filename, int format, int long_fi
|
||||
|
||||
/* Check that we haven't read beyond EOF. */
|
||||
if (count > sfinfo.frames)
|
||||
{ printf ("\n\nLines %d : read past end of file (%ld should be %ld)\n", __LINE__, (long) count, (long) sfinfo.frames) ;
|
||||
{ printf ("\n\nLines %d : read past end of file (%" PRId64 " should be %" PRId64 ")\n", __LINE__, count, sfinfo.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -681,14 +682,14 @@ stereo_[+ (get "type_name") +]_test (const char *filename, int format, int long_
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < frames)
|
||||
{ printf ("\n\nLine %d : Stereo : Incorrect number of frames in file (too short). (%ld should be %d)\n",
|
||||
__LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
|
||||
{ printf ("\n\nLine %d : Stereo : Incorrect number of frames in file (too short). (%" PRId64 " should be %d)\n",
|
||||
__LINE__, sfinfo.frames, frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (! long_file_ok && sfinfo.frames > frames)
|
||||
{ printf ("\n\nLine %d : Stereo : Incorrect number of frames in file (too long). (%ld should be %d)\n",
|
||||
__LINE__, SF_COUNT_TO_LONG (sfinfo.frames), frames) ;
|
||||
{ printf ("\n\nLine %d : Stereo : Incorrect number of frames in file (too long). (%" PRId64 " should be %d)\n",
|
||||
__LINE__, sfinfo.frames, frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -852,12 +853,12 @@ mono_rdwr_[+ (get "type_name") +]_test (const char *filename, int format, int lo
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames < 3 * DATA_LENGTH)
|
||||
{ printf ("\n\nLine %d : Not enough frames in file. (%ld < %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 3 * DATA_LENGTH ) ;
|
||||
{ printf ("\n\nLine %d : Not enough frames in file. (%" PRId64 " < %d)\n", __LINE__, sfinfo.frames, 3 * DATA_LENGTH ) ;
|
||||
exit (1) ;
|
||||
}
|
||||
|
||||
if (! long_file_ok && sfinfo.frames != 3 * DATA_LENGTH)
|
||||
{ printf ("\n\nLine %d : Incorrect number of frames in file. (%ld should be %d)\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 3 * DATA_LENGTH ) ;
|
||||
{ printf ("\n\nLine %d : Incorrect number of frames in file. (%" PRId64 " should be %d)\n", __LINE__, sfinfo.frames, 3 * DATA_LENGTH ) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -919,7 +920,7 @@ new_rdwr_[+ (get "type_name") +]_test (const char *filename, int format, int all
|
||||
|
||||
rwfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, allow_fd, __LINE__) ;
|
||||
if (sfinfo.frames != 2 * frames)
|
||||
{ printf ("\n\nLine %d : incorrect number of frames in file (%ld should be %d)\n\n", __LINE__, SF_COUNT_TO_LONG (sfinfo.frames), 2 * frames) ;
|
||||
{ printf ("\n\nLine %d : incorrect number of frames in file (%" PRId64 " should be %d)\n\n", __LINE__, sfinfo.frames, 2 * frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -969,8 +970,8 @@ empty_file_test (const char *filename, int format)
|
||||
/* Open for read and check the length. */
|
||||
file = test_open_file_or_die (filename, SFM_READ, &info, allow_fd, __LINE__) ;
|
||||
|
||||
if (SF_COUNT_TO_LONG (info.frames) != 0)
|
||||
{ printf ("\n\nError : frame count (%ld) should be zero.\n", SF_COUNT_TO_LONG (info.frames)) ;
|
||||
if (info.frames != 0)
|
||||
{ printf ("\n\nError : frame count (%" PRId64 ") should be zero.\n", info.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -979,8 +980,8 @@ empty_file_test (const char *filename, int format)
|
||||
/* Open for read/write and check the length. */
|
||||
file = test_open_file_or_die (filename, SFM_RDWR, &info, allow_fd, __LINE__) ;
|
||||
|
||||
if (SF_COUNT_TO_LONG (info.frames) != 0)
|
||||
{ printf ("\n\nError : frame count (%ld) should be zero.\n", SF_COUNT_TO_LONG (info.frames)) ;
|
||||
if (info.frames != 0)
|
||||
{ printf ("\n\nError : frame count (%" PRId64 ") should be zero.\n", info.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
@ -989,8 +990,8 @@ empty_file_test (const char *filename, int format)
|
||||
/* Open for read and check the length. */
|
||||
file = test_open_file_or_die (filename, SFM_READ, &info, allow_fd, __LINE__) ;
|
||||
|
||||
if (SF_COUNT_TO_LONG (info.frames) != 0)
|
||||
{ printf ("\n\nError : frame count (%ld) should be zero.\n", SF_COUNT_TO_LONG (info.frames)) ;
|
||||
if (info.frames != 0)
|
||||
{ printf ("\n\nError : frame count (%" PRId64 ") should be zero.\n", info.frames) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user