tests : Fix gcc-4.3 compiler warnings.

This commit is contained in:
Erik de Castro Lopo 2008-10-19 16:06:42 +11:00
parent 797f33196c
commit 10ca1fd3d1
8 changed files with 27 additions and 17 deletions

View File

@ -26,6 +26,11 @@ Cfg/depcomp
Cfg/install-sh
Cfg/ltmain.sh
Cfg/missing
M4/libtool.m4
M4/ltoptions.m4
M4/ltsugar.m4
M4/ltversion.m4
M4/lt~obsolete.m4
Makefile
Makefile.in
aclocal.m4

View File

@ -7,6 +7,10 @@
* tests/command_test.c
Fix a valgrind warning.
* tests/error_test.c tests/multi_file_test.c tests/peak_chunk_test.c
tests/pipe_test.tpl tests/stdio_test.c tests/win32_test.c
Fix gcc-4.3 compiler warnings.
2008-10-17 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/broadcast.c

View File

@ -152,7 +152,7 @@ bad_wav_test (const char * filename)
exit (1) ;
} ;
fwrite (data, sizeof (data), 1, file) ;
exit_if_true (fwrite (data, sizeof (data), 1, file) != 1, "\n\nLine %d : fwrite failed.\n", __LINE__) ;
fclose (file) ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;

View File

@ -144,7 +144,7 @@ multi_file_test (const char *filename, int *formats, int format_count)
exit (1) ;
} ;
write (fd, "1234", 4) ;
k = write (fd, "1234", 4) ;
for (k = 0 ; k < format_count ; k++)
write_file_at_end (fd, formats [k], 2, k) ;

View File

@ -274,12 +274,12 @@ check_logged_peaks (char *buffer)
} ;
if (position == 0)
{ printf ("\n\nLine %d: peak position for channel %d should not be at offset 0.\n", __LINE__, chan) ;
printf (buffer) ;
printf ("%s", buffer) ;
exit (1) ;
} ;
if (chan != k || fabs ((position) * 0.01 - value) > 1e-6)
{ printf ("\n\nLine %d: Error : peak value incorrect!\n", __LINE__) ;
printf (buffer) ;
printf ("%s", buffer) ;
printf ("\n\nLine %d: %d %f %f\n", __LINE__, chan, position * 0.01, value) ;
exit (1) ;
} ;

View File

@ -42,6 +42,7 @@ main (void)
#include <unistd.h>
#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
@ -95,7 +96,7 @@ main (void)
{ int k ;
if (file_exists ("libsndfile.spec.in"))
chdir ("tests") ;
exit_if_true (chdir ("tests") != 0, "\n Error : chdir ('tests') failed.\n") ;
for (k = 0 ; read_only_types [k].format ; k++)
pipe_read_test (read_only_types [k].format, read_only_types [k].ext) ;
@ -193,7 +194,7 @@ useek_pipe_rw_[+ (get "type_name") +] (const char * ext, SF_INFO * psfinfo_write
/*
** Create the pipe.
*/
pipe (pipefd) ;
exit_if_true (pipe (pipefd) != 0, "\n\n%s %d : pipe failed : %s\n", __func__, __LINE__, strerror (errno)) ;
/*
** Attach the write end of the pipe to be written to.

View File

@ -74,7 +74,7 @@ main (void)
{ int k ;
if (file_exists ("libsndfile.spec.in"))
chdir ("tests") ;
exit_if_true (chdir ("tests") != 0, "\n Error : chdir ('tests') failed.\n") ;
for (k = 0 ; filetypes [k] ; k++)
stdio_test (filetypes [k]) ;

View File

@ -100,7 +100,7 @@ show_fstat_error (void)
static char data [256] ;
STATBUF statbuf ;
int fd, mode, flags ;
int fd, mode, flags, ignored ;
if (sizeof (statbuf.st_size) != sizeof (INT64))
{ printf ("\n\nLine %d: Error, sizeof (statbuf.st_size) != 8.\n\n", __LINE__) ;
@ -116,7 +116,7 @@ show_fstat_error (void)
{ printf ("\n\nLine %d: open() failed : %s\n\n", __LINE__, strerror (errno)) ;
return ;
} ;
write (fd, data, sizeof (data)) ;
ignored = write (fd, data, sizeof (data)) ;
close (fd) ;
printf ("1) Re-open file in read/write mode and write another %d bytes at the end.\n", SIGNED_SIZEOF (data)) ;
@ -127,11 +127,11 @@ show_fstat_error (void)
return ;
} ;
LSEEK (fd, 0, SEEK_END) ;
write (fd, data, sizeof (data)) ;
ignored = write (fd, data, sizeof (data)) ;
printf ("2) Now use system (\"%s %s\") to show the file length.\n\n", dir_cmd, filename) ;
sprintf (data, "%s %s", dir_cmd, filename) ;
system (data) ;
ignored = system (data) ;
puts ("") ;
printf ("3) Now use fstat() to get the file length.\n") ;
@ -159,7 +159,7 @@ show_lseek_error (void)
static char data [256] ;
INT64 retval ;
int fd, mode, flags ;
int fd, mode, flags, ignored ;
puts ("\n64 bit lseek() test.\n--------------------") ;
@ -170,7 +170,7 @@ show_lseek_error (void)
{ printf ("\n\nLine %d: open() failed : %s\n\n", __LINE__, strerror (errno)) ;
return ;
} ;
write (fd, data, sizeof (data)) ;
ignored = write (fd, data, sizeof (data)) ;
close (fd) ;
printf ("1) Re-open file in read/write mode and write another %d bytes at the end.\n", SIGNED_SIZEOF (data)) ;
@ -182,11 +182,11 @@ show_lseek_error (void)
} ;
LSEEK (fd, 0, SEEK_END) ;
write (fd, data, sizeof (data)) ;
ignored = write (fd, data, sizeof (data)) ;
printf ("2) Now use system (\"%s %s\") to show the file length.\n\n", dir_cmd, filename) ;
sprintf (data, "%s %s", dir_cmd, filename) ;
system (data) ;
ignored = system (data) ;
puts ("") ;
printf ("3) Now use lseek() to go to the end of the file.\n") ;
@ -211,7 +211,7 @@ show_stat_fstat_error (void)
static char data [256] ;
int fd, mode, flags ;
int stat_size, fstat_size ;
int stat_size, fstat_size, ignored ;
struct stat buf ;
/* Known to fail on WinXP. */
@ -226,7 +226,7 @@ show_stat_fstat_error (void)
return ;
} ;
write (fd, data, sizeof (data)) ;
ignored = write (fd, data, sizeof (data)) ;
printf ("1) Now call stat and fstat on the file and retreive the file lengths.\n") ;