Use C99 snprintf everywhere.

This commit is contained in:
Erik de Castro Lopo 2009-02-14 08:32:12 +11:00
parent 0733b9962c
commit 033cc5ca35
16 changed files with 55 additions and 73 deletions

View File

@ -1,3 +1,8 @@
2009-02-14 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/common.h src/*.c
Use C99 snprintf everywhere.
2009-02-11 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* tests/test_wrapper.sh.in

View File

@ -484,7 +484,7 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
psf->peak_info->peaks [dword].value = value ;
psf->peak_info->peaks [dword].position = position ;
LSF_SNPRINTF (cptr, sizeof (psf->u.scbuf), " %2d %-12ld %g\n",
snprintf (cptr, sizeof (psf->u.scbuf), " %2d %-12ld %g\n",
dword, (long) psf->peak_info->peaks [dword].position, psf->peak_info->peaks [dword].value) ;
cptr [sizeof (psf->u.scbuf) - 1] = 0 ;
psf_log_printf (psf, cptr) ;

View File

@ -193,7 +193,7 @@ gen_coding_history (char * added_history, int added_history_max, const SF_INFO *
break ;
default :
LSF_SNPRINTF (chnstr, sizeof (chnstr), "%uchn", psfinfo->channels) ;
snprintf (chnstr, sizeof (chnstr), "%uchn", psfinfo->channels) ;
break ;
} ;
@ -226,7 +226,7 @@ gen_coding_history (char * added_history, int added_history_max, const SF_INFO *
break ;
} ;
count = LSF_SNPRINTF (added_history, added_history_max,
count = snprintf (added_history, added_history_max,
"A=PCM,F=%u,W=%hu,M=%s,T=%s-%s\r\n",
psfinfo->samplerate, width, chnstr, PACKAGE, VERSION) ;

View File

@ -264,7 +264,7 @@ caf_read_header (SF_PRIVATE *psf)
psf_binheader_readf (psf, "mE8b", &marker, &chunk_size, psf->u.ucbuf, 8) ;
srate = double64_be_read (psf->u.ucbuf) ;
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%5.3f", srate) ;
snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%5.3f", srate) ;
psf_log_printf (psf, "%M : %D\n Sample rate : %s\n", marker, chunk_size, psf->u.cbuf) ;
if (marker != desc_MARKER)
return SFE_CAF_NO_DESC ;
@ -315,7 +315,7 @@ caf_read_header (SF_PRIVATE *psf)
psf->peak_info->peaks [k].value = value ;
psf->peak_info->peaks [k].position = position ;
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " %2d %-12ld %g\n", k, (long) position, value) ;
snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), " %2d %-12ld %g\n", k, (long) position, value) ;
psf_log_printf (psf, psf->u.cbuf) ;
} ;

View File

@ -336,7 +336,7 @@ psf_asciiheader_printf (SF_PRIVATE *psf, const char *format, ...)
maxlen = sizeof (psf->header) - maxlen ;
va_start (argptr, format) ;
LSF_VSNPRINTF (start, maxlen, format, argptr) ;
vsnprintf (start, maxlen, format, argptr) ;
va_end (argptr) ;
/* Make sure the string is properly terminated. */
@ -1231,11 +1231,11 @@ psf_get_date_str (char *str, int maxlen)
#endif
if (tmptr)
LSF_SNPRINTF (str, maxlen, "%4d-%02d-%02d %02d:%02d:%02d UTC",
snprintf (str, maxlen, "%4d-%02d-%02d %02d:%02d:%02d UTC",
1900 + timedata.tm_year, timedata.tm_mon, timedata.tm_mday,
timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
else
LSF_SNPRINTF (str, maxlen, "Unknown date") ;
snprintf (str, maxlen, "Unknown date") ;
return ;
} /* psf_get_date_str */

View File

@ -811,29 +811,6 @@ const char * str_of_minor_format (int format) ;
const char * str_of_open_mode (int mode) ;
const char * str_of_endianness (int end) ;
/*------------------------------------------------------------------------------------
** Here's how we fix systems which don't snprintf / vsnprintf.
** Systems without these functions should use the
*/
#if USE_WINDOWS_API
#define LSF_SNPRINTF _snprintf
#elif (HAVE_SNPRINTF && ! FORCE_MISSING_SNPRINTF)
#define LSF_SNPRINTF snprintf
#else
int missing_snprintf (char *str, size_t n, char const *fmt, ...) ;
#define LSF_SNPRINTF missing_snprintf
#endif
#if USE_WINDOWS_API
#define LSF_VSNPRINTF _vsnprintf
#elif (HAVE_VSNPRINTF && ! FORCE_MISSING_SNPRINTF)
#define LSF_VSNPRINTF vsnprintf
#else
int missing_vsnprintf (char *str, size_t n, const char *fmt, ...) ;
#define LSF_VSNPRINTF missing_vsnprintf
#endif
/*------------------------------------------------------------------------------------
** Extra commands for sf_command(). Not for public use yet.
*/

View File

@ -123,7 +123,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
return 0 ;
/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
psf->error = SFE_NO_ERROR ;
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
@ -142,7 +142,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
** Now try for a resource fork stored as a separate file in the same
** directory, but preceded with a dot underscore.
*/
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
psf->error = SFE_NO_ERROR ;
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
@ -153,7 +153,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
** Now try for a resource fork stored in a separate file in the
** .AppleDouble/ directory.
*/
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
psf->error = SFE_NO_ERROR ;
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
@ -568,7 +568,7 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
/* Only log an error if no error has been set yet. */
if (psf->error == 0)
{ psf->error = SFE_SYSTEM ;
LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
} ;
return ;
@ -637,7 +637,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
return 0 ;
/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
psf->error = SFE_NO_ERROR ;
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
@ -648,7 +648,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
** Now try for a resource fork stored as a separate file in the same
** directory, but preceded with a dot underscore.
*/
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
psf->error = SFE_NO_ERROR ;
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
@ -659,7 +659,7 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
** Now try for a resource fork stored in a separate file in the
** .AppleDouble/ directory.
*/
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
snprintf (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
psf->error = SFE_NO_ERROR ;
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
@ -806,7 +806,7 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
NULL
) ;
LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s", lpMsgBuf) ;
snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s", lpMsgBuf) ;
LocalFree (lpMsgBuf) ;
} ;
@ -1516,7 +1516,7 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
/* Only log an error if no error has been set yet. */
if (psf->error == 0)
{ psf->error = SFE_SYSTEM ;
LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s", strerror (error)) ;
snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s", strerror (error)) ;
} ;
return ;

View File

@ -244,7 +244,7 @@ mat4_read_header (SF_PRIVATE *psf)
psf_binheader_readf (psf, "d", &value) ;
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " Value : %f\n", value) ;
snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), " Value : %f\n", value) ;
psf_log_printf (psf, psf->u.cbuf) ;
if ((rows != 1) || (cols != 1))
@ -383,7 +383,7 @@ mat4_marker_to_str (int marker)
/* This is a little unsafe but is really only for debugging. */
str [sizeof (str) - 1] = 0 ;
LSF_SNPRINTF (str, sizeof (str) - 1, "%08X", marker) ;
snprintf (str, sizeof (str) - 1, "%08X", marker) ;
return str ;
} /* mat4_marker_to_str */

View File

@ -360,7 +360,7 @@ mat5_read_header (SF_PRIVATE *psf)
{ double samplerate ;
psf_binheader_readf (psf, "d", &samplerate) ;
LSF_SNPRINTF (name, sizeof (name), "%f\n", samplerate) ;
snprintf (name, sizeof (name), "%f\n", samplerate) ;
psf_log_printf (psf, " Val : %s\n", name) ;
psf->sf.samplerate = lrint (samplerate) ;

View File

@ -112,7 +112,7 @@ pvf_write_header (SF_PRIVATE *psf, int UNUSED (calc_length))
if (psf->is_pipe == SF_FALSE)
psf_fseek (psf, 0, SEEK_SET) ;
LSF_SNPRINTF ((char*) psf->header, sizeof (psf->header), "PVF1\n%d %d %d\n",
snprintf ((char*) psf->header, sizeof (psf->header), "PVF1\n%d %d %d\n",
psf->sf.channels, psf->sf.samplerate, psf->bytewidth * 8) ;
psf->headindex = strlen ((char*) psf->header) ;

View File

@ -249,9 +249,9 @@ sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length))
rsrc.rsrc_len = sizeof (psf->header) ;
memset (rsrc.rsrc_data, 0xea, rsrc.rsrc_len) ;
LSF_SNPRINTF (str_rsrc [0].value, sizeof (str_rsrc [0].value), "_%d", rsrc.sample_size) ;
LSF_SNPRINTF (str_rsrc [1].value, sizeof (str_rsrc [1].value), "_%d.000000", rsrc.sample_rate) ;
LSF_SNPRINTF (str_rsrc [2].value, sizeof (str_rsrc [2].value), "_%d", rsrc.channels) ;
snprintf (str_rsrc [0].value, sizeof (str_rsrc [0].value), "_%d", rsrc.sample_size) ;
snprintf (str_rsrc [1].value, sizeof (str_rsrc [1].value), "_%d.000000", rsrc.sample_rate) ;
snprintf (str_rsrc [2].value, sizeof (str_rsrc [2].value), "_%d", rsrc.channels) ;
for (k = 0 ; k < ARRAY_LEN (str_rsrc) ; k++)
{ if (str_rsrc [k].value_len == 0)

View File

@ -357,19 +357,19 @@ sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user
/* Make sure we have a valid set ot virtual pointers. */
if (sfvirtual->get_filelen == NULL || sfvirtual->seek == NULL || sfvirtual->tell == NULL)
{ sf_errno = SFE_BAD_VIRTUAL_IO ;
LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_get_filelen / vio_seek / vio_tell in SF_VIRTUAL_IO struct.\n") ;
snprintf (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_get_filelen / vio_seek / vio_tell in SF_VIRTUAL_IO struct.\n") ;
return NULL ;
} ;
if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
{ sf_errno = SFE_BAD_VIRTUAL_IO ;
LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_read in SF_VIRTUAL_IO struct.\n") ;
snprintf (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_read in SF_VIRTUAL_IO struct.\n") ;
return NULL ;
} ;
if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
{ sf_errno = SFE_BAD_VIRTUAL_IO ;
LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_write in SF_VIRTUAL_IO struct.\n") ;
snprintf (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_write in SF_VIRTUAL_IO struct.\n") ;
return NULL ;
} ;
@ -517,7 +517,7 @@ sf_error_str (SNDFILE *sndfile, char *str, size_t maxlen)
errnum = psf->error ;
} ;
LSF_SNPRINTF (str, maxlen, "%s", sf_error_number (errnum)) ;
snprintf (str, maxlen, "%s", sf_error_number (errnum)) ;
return SFE_NO_ERROR ;
} /* sf_error_str */
@ -825,9 +825,9 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
if (data == NULL)
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
if (ENABLE_EXPERIMENTAL_CODE)
LSF_SNPRINTF (data, datasize, "%s-%s-exp", PACKAGE_NAME, PACKAGE_VERSION) ;
snprintf (data, datasize, "%s-%s-exp", PACKAGE_NAME, PACKAGE_VERSION) ;
else
LSF_SNPRINTF (data, datasize, "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
snprintf (data, datasize, "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
return strlen (data) ;
case SFC_GET_SIMPLE_FORMAT_COUNT :
@ -872,7 +872,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
if (sndfile == NULL && command == SFC_GET_LOG_INFO)
{ if (data == NULL)
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
LSF_SNPRINTF (data, datasize, "%s", sf_logbuffer) ;
snprintf (data, datasize, "%s", sf_logbuffer) ;
return strlen (data) ;
} ;
@ -957,7 +957,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
case SFC_GET_LOG_INFO :
if (data == NULL)
return SFE_BAD_COMMAND_PARAM ;
LSF_SNPRINTF (data, datasize, "%s", psf->logbuffer) ;
snprintf (data, datasize, "%s", psf->logbuffer) ;
break ;
case SFC_CALC_SIGNAL_MAX :
@ -2367,7 +2367,7 @@ validate_psf (SF_PRIVATE *psf)
static void
save_header_info (SF_PRIVATE *psf)
{ LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
{ snprintf (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
} /* save_header_info */
static void
@ -2375,16 +2375,16 @@ copy_filename (SF_PRIVATE *psf, const char *path)
{ const char *ccptr ;
char *cptr ;
LSF_SNPRINTF (psf->filepath, sizeof (psf->filepath), "%s", path) ;
snprintf (psf->filepath, sizeof (psf->filepath), "%s", path) ;
if ((ccptr = strrchr (path, '/')) || (ccptr = strrchr (path, '\\')))
ccptr ++ ;
else
ccptr = path ;
LSF_SNPRINTF (psf->filename, sizeof (psf->filename), "%s", ccptr) ;
snprintf (psf->filename, sizeof (psf->filename), "%s", ccptr) ;
/* Now grab the directory. */
LSF_SNPRINTF (psf->directory, sizeof (psf->directory), "%s", path) ;
snprintf (psf->directory, sizeof (psf->directory), "%s", path) ;
if ((cptr = strrchr (psf->directory, '/')) || (cptr = strrchr (psf->directory, '\\')))
cptr [1] = 0 ;
else
@ -2774,8 +2774,8 @@ error_exit :
sf_errno = error ;
if (error == SFE_SYSTEM)
LSF_SNPRINTF (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
snprintf (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
switch (error)
{ case SF_ERR_SYSTEM :

View File

@ -30,35 +30,35 @@
#define CMP_0_ARGS(line,err,fmt) \
{ psf->logindex = 0 ; \
LSF_SNPRINTF (buffer, sizeof (buffer), (fmt)) ; \
snprintf (buffer, sizeof (buffer), (fmt)) ; \
psf_log_printf (psf, (fmt)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}
#define CMP_2_ARGS(line,err,fmt,a) \
{ psf->logindex = 0 ; \
LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a)) ; \
snprintf (buffer, sizeof (buffer), (fmt), (a), (a)) ; \
psf_log_printf (psf, (fmt), (a), (a)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}
#define CMP_4_ARGS(line,err,fmt,a) \
{ psf->logindex = 0 ; \
LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a)) ; \
snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a)) ; \
psf_log_printf (psf, (fmt), (a), (a), (a), (a)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}
#define CMP_5_ARGS(line,err,fmt,a) \
{ psf->logindex = 0 ; \
LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a)) ; \
snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a)) ; \
psf_log_printf (psf, (fmt), (a), (a), (a), (a), (a)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}
#define CMP_6_ARGS(line,err,fmt,a) \
{ psf->logindex = 0 ; \
LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a), (a)) ; \
snprintf (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a), (a)) ; \
psf_log_printf (psf, (fmt), (a), (a), (a), (a), (a), (a)) ; \
err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \
}

View File

@ -490,7 +490,7 @@ wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
psf->peak_info->peaks [dword].value = value ;
psf->peak_info->peaks [dword].position = position ;
LSF_SNPRINTF (cptr, sizeof (psf->u.cbuf), " %2d %-12ld %g\n",
snprintf (cptr, sizeof (psf->u.cbuf), " %2d %-12ld %g\n",
dword, (long) psf->peak_info->peaks [dword].position, psf->peak_info->peaks [dword].value) ;
cptr [sizeof (psf->u.cbuf) - 1] = 0 ;
psf_log_printf (psf, cptr) ;
@ -1444,7 +1444,7 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen)
bytesread += psf_binheader_readf (psf, "4", &dword) ;
if (dword != 0)
{ LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f",
{ snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%f",
(1.0 * 0x80000000) / ((unsigned int) dword)) ;
psf_log_printf (psf, " Pitch Fract. : %s\n", psf->u.cbuf) ;
}
@ -1455,7 +1455,7 @@ wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen)
psf_log_printf (psf, " SMPTE Format : %u\n", dword) ;
bytesread += psf_binheader_readf (psf, "4", &dword) ;
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%02d:%02d:%02d %02d",
snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%02d:%02d:%02d %02d",
(dword >> 24) & 0x7F, (dword >> 16) & 0x7F, (dword >> 8) & 0x7F, dword & 0x7F) ;
psf_log_printf (psf, " SMPTE Offset : %s\n", psf->u.cbuf) ;
@ -1593,7 +1593,7 @@ wav_read_acid_chunk (SF_PRIVATE *psf, unsigned int chunklen)
bytesread += psf_binheader_readf (psf, "422f", &flags, &rootnote, &q1, &q2) ;
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", q2) ;
snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", q2) ;
psf_log_printf (psf, " Flags : 0x%04x (%s,%s,%s,%s,%s)\n", flags,
(flags & 0x01) ? "OneShot" : "Loop",
@ -1606,7 +1606,7 @@ wav_read_acid_chunk (SF_PRIVATE *psf, unsigned int chunklen)
rootnote, q1, psf->u.cbuf) ;
bytesread += psf_binheader_readf (psf, "422f", &beats, &meter_denom, &meter_numer, &tempo) ;
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", tempo) ;
snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", tempo) ;
psf_log_printf (psf, " Beats : %d\n Meter : %d/%d\n Tempo : %s\n",
beats, meter_numer, meter_denom, psf->u.cbuf) ;

View File

@ -233,7 +233,7 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, int fmtsize)
for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
{ bytesread +=
psf_binheader_readf (psf, "22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " %2d %7d %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
snprintf (psf->u.cbuf, sizeof (psf->u.cbuf), " %2d %7d %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
psf_log_printf (psf, psf->u.cbuf) ;
} ;
break ;

View File

@ -95,7 +95,7 @@ xi_open (SF_PRIVATE *psf)
memcpy (pxi->software, PACKAGE "-" VERSION " ", sizeof (pxi->software)) ;
memset (pxi->sample_name, 0, sizeof (pxi->sample_name)) ;
LSF_SNPRINTF (pxi->sample_name, sizeof (pxi->sample_name), "%s", "Sample #1") ;
snprintf (pxi->sample_name, sizeof (pxi->sample_name), "%s", "Sample #1") ;
pxi->sample_flags = (subformat == SF_FORMAT_DPCM_16) ? 16 : 0 ;