mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-27 03:50:29 +00:00
msvc: Fix annoying conversion warnings #304
This commit is contained in:
parent
1578687eb3
commit
4ff3b84eff
@ -118,7 +118,7 @@ encode_file (const char *infilename, const char *outfilename, int filetype)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
while ((readcount = sf_read_float (infile, buffer, BUFFER_LEN)) > 0)
|
||||
while ((readcount = (int) sf_read_float (infile, buffer, BUFFER_LEN)) > 0)
|
||||
sf_write_float (outfile, buffer, readcount) ;
|
||||
|
||||
sf_close (infile) ;
|
||||
|
@ -74,12 +74,12 @@ main (void)
|
||||
|
||||
if (sfinfo.channels == 1)
|
||||
{ for (k = 0 ; k < SAMPLE_COUNT ; k++)
|
||||
buffer [k] = AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI) ;
|
||||
buffer [k] = (int) (AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI)) ;
|
||||
}
|
||||
else if (sfinfo.channels == 2)
|
||||
{ for (k = 0 ; k < SAMPLE_COUNT ; k++)
|
||||
{ buffer [2 * k] = AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI) ;
|
||||
buffer [2 * k + 1] = AMPLITUDE * sin (RIGHT_FREQ * 2 * k * M_PI) ;
|
||||
{ buffer [2 * k] = (int) (AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI)) ;
|
||||
buffer [2 * k + 1] = (int) (AMPLITUDE * sin (RIGHT_FREQ * 2 * k * M_PI)) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
|
@ -110,7 +110,7 @@ main (void)
|
||||
/* While there are.frames in the input file, read them, process
|
||||
** them and write them to the output file.
|
||||
*/
|
||||
while ((readcount = sf_read_double (infile, data, BUFFER_LEN)))
|
||||
while ((readcount = (int) sf_read_double (infile, data, BUFFER_LEN)))
|
||||
{ process_data (data, readcount, sfinfo.channels) ;
|
||||
sf_write_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
|
@ -143,7 +143,7 @@ sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
readcount = frames ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_int (infile, data, frames) ;
|
||||
{ readcount = (int) sf_readf_int (infile, data, frames) ;
|
||||
sf_writef_int (outfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
|
@ -68,7 +68,7 @@ convert_to_text (SNDFILE * infile, FILE * outfile, int channels, int full_precis
|
||||
|
||||
frames = BLOCK_SIZE / channels ;
|
||||
|
||||
while ((readcount = sf_readf_float (infile, buf, frames)) > 0)
|
||||
while ((readcount = (int) sf_readf_float (infile, buf, frames)) > 0)
|
||||
{ for (k = 0 ; k < readcount ; k++)
|
||||
{ for (m = 0 ; m < channels ; m++)
|
||||
if (full_precision)
|
||||
|
@ -91,7 +91,7 @@ sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
readcount = frames ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_int (infile, data, frames) ;
|
||||
{ readcount = (int) sf_readf_int (infile, data, frames) ;
|
||||
sf_writef_int (outfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
@ -157,7 +157,7 @@ merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const MET
|
||||
/* Special case loudness values */
|
||||
#define REPLACE_IF_NEW_INT(x) \
|
||||
if (info->x != NULL) \
|
||||
{ binfo.x = round (atof (info->x) * 100.0) ; \
|
||||
{ binfo.x = (int16_t) round (atof (info->x) * 100.0) ; \
|
||||
} ;
|
||||
|
||||
REPLACE_IF_NEW_INT (loudness_value) ;
|
||||
@ -177,7 +177,7 @@ merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const MET
|
||||
/* Special case for coding_history because we may want to append. */
|
||||
if (info->coding_history != NULL)
|
||||
{ if (info->coding_hist_append)
|
||||
{ int slen = strlen (binfo.coding_history) ;
|
||||
{ int slen = (int) strlen (binfo.coding_history) ;
|
||||
|
||||
while (slen > 1 && isspace (binfo.coding_history [slen - 1]))
|
||||
slen -- ;
|
||||
@ -189,7 +189,7 @@ merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const MET
|
||||
|
||||
memset (binfo.coding_history, 0, sizeof (binfo.coding_history)) ;
|
||||
memcpy (binfo.coding_history, info->coding_history, slen) ;
|
||||
binfo.coding_history_size = slen ;
|
||||
binfo.coding_history_size = (uint32_t) slen ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
|
@ -143,7 +143,7 @@ concat_data_fp (SNDFILE *wfile, SNDFILE *rofile, int channels)
|
||||
sf_seek (wfile, 0, SEEK_END) ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_double (rofile, data, frames) ;
|
||||
{ readcount = (int) sf_readf_double (rofile, data, frames) ;
|
||||
sf_writef_double (wfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
@ -161,7 +161,7 @@ concat_data_int (SNDFILE *wfile, SNDFILE *rofile, int channels)
|
||||
sf_seek (wfile, 0, SEEK_END) ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_int (rofile, data, frames) ;
|
||||
{ readcount = (int) sf_readf_int (rofile, data, frames) ;
|
||||
sf_writef_int (wfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
|
@ -388,7 +388,7 @@ copy_metadata (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
memset (&binfo, 0, sizeof (binfo)) ;
|
||||
|
||||
if (channels < ARRAY_LEN (chanmap))
|
||||
{ size_t size = channels * sizeof (chanmap [0]) ;
|
||||
{ int size = channels * sizeof (chanmap [0]) ;
|
||||
|
||||
if (sf_command (infile, SFC_GET_CHANNEL_MAP_INFO, chanmap, size) == SF_TRUE)
|
||||
sf_command (outfile, SFC_SET_CHANNEL_MAP_INFO, chanmap, size) ;
|
||||
|
@ -190,7 +190,7 @@ deinterleave_int (STATE * state)
|
||||
int ch, k ;
|
||||
|
||||
do
|
||||
{ read_len = sf_readf_int (state->infile, state->din.i, BUFFER_LEN) ;
|
||||
{ read_len = (int) sf_readf_int (state->infile, state->din.i, BUFFER_LEN) ;
|
||||
|
||||
for (ch = 0 ; ch < state->channels ; ch ++)
|
||||
{ for (k = 0 ; k < read_len ; k++)
|
||||
@ -208,7 +208,7 @@ deinterleave_double (STATE * state)
|
||||
int ch, k ;
|
||||
|
||||
do
|
||||
{ read_len = sf_readf_double (state->infile, state->din.d, BUFFER_LEN) ;
|
||||
{ read_len = (int) sf_readf_double (state->infile, state->din.d, BUFFER_LEN) ;
|
||||
|
||||
for (ch = 0 ; ch < state->channels ; ch ++)
|
||||
{ for (k = 0 ; k < read_len ; k++)
|
||||
|
@ -159,7 +159,7 @@ interleave_int (STATE * state)
|
||||
{ max_read_len = 0 ;
|
||||
|
||||
for (ch = 0 ; ch < state->channels ; ch ++)
|
||||
{ read_len = sf_read_int (state->infile [ch], state->din.i, BUFFER_LEN) ;
|
||||
{ read_len = (int) sf_read_int (state->infile [ch], state->din.i, BUFFER_LEN) ;
|
||||
if (read_len < BUFFER_LEN)
|
||||
memset (state->din.i + read_len, 0, sizeof (state->din.i [0]) * (BUFFER_LEN - read_len)) ;
|
||||
|
||||
@ -185,7 +185,7 @@ interleave_double (STATE * state)
|
||||
{ max_read_len = 0 ;
|
||||
|
||||
for (ch = 0 ; ch < state->channels ; ch ++)
|
||||
{ read_len = sf_read_double (state->infile [ch], state->din.d, BUFFER_LEN) ;
|
||||
{ read_len = (int) sf_read_double (state->infile [ch], state->din.d, BUFFER_LEN) ;
|
||||
if (read_len < BUFFER_LEN)
|
||||
memset (state->din.d + read_len, 0, sizeof (state->din.d [0]) * (BUFFER_LEN - read_len)) ;
|
||||
|
||||
|
@ -233,7 +233,7 @@ find_data_offset (int fd, int format)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
slen = strlen (target) ;
|
||||
slen = (int) strlen (target) ;
|
||||
|
||||
lseek_or_die (fd, 0, SEEK_SET) ;
|
||||
|
||||
|
@ -428,7 +428,7 @@ static void
|
||||
get_filename_pathname (REGTEST_DB * db, const char *filepath)
|
||||
{
|
||||
const char * basename = db_basename (filepath) ;
|
||||
int slen ;
|
||||
size_t slen ;
|
||||
|
||||
/* Test for a relative path
|
||||
*/
|
||||
|
16
src/alac.c
16
src/alac.c
@ -471,7 +471,7 @@ alac_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
break ;
|
||||
|
||||
readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
|
||||
readcount = readcount > len ? len : readcount ;
|
||||
readcount = readcount > len ? (int) len : readcount ;
|
||||
|
||||
iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
|
||||
|
||||
@ -501,7 +501,7 @@ alac_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
break ;
|
||||
|
||||
readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
|
||||
readcount = readcount > len ? len : readcount ;
|
||||
readcount = readcount > len ? (int) len : readcount ;
|
||||
|
||||
iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
|
||||
|
||||
@ -534,7 +534,7 @@ alac_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
break ;
|
||||
|
||||
readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
|
||||
readcount = readcount > len ? len : readcount ;
|
||||
readcount = readcount > len ? (int) len : readcount ;
|
||||
|
||||
iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
|
||||
|
||||
@ -567,7 +567,7 @@ alac_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
break ;
|
||||
|
||||
readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
|
||||
readcount = readcount > len ? len : readcount ;
|
||||
readcount = readcount > len ? (int) len : readcount ;
|
||||
|
||||
iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
|
||||
|
||||
@ -648,7 +648,7 @@ alac_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
|
||||
while (len > 0)
|
||||
{ writecount = (plac->frames_per_block - plac->partial_block_frames) * plac->channels ;
|
||||
writecount = (writecount == 0 || writecount > len) ? len : writecount ;
|
||||
writecount = (writecount == 0 || writecount > len) ? (int) len : writecount ;
|
||||
|
||||
iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
|
||||
|
||||
@ -679,7 +679,7 @@ alac_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
|
||||
while (len > 0)
|
||||
{ writecount = (plac->frames_per_block - plac->partial_block_frames) * plac->channels ;
|
||||
writecount = (writecount == 0 || writecount > len) ? len : writecount ;
|
||||
writecount = (writecount == 0 || writecount > len) ? (int) len : writecount ;
|
||||
|
||||
iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
|
||||
|
||||
@ -713,7 +713,7 @@ alac_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
|
||||
while (len > 0)
|
||||
{ writecount = (plac->frames_per_block - plac->partial_block_frames) * plac->channels ;
|
||||
writecount = (writecount == 0 || writecount > len) ? len : writecount ;
|
||||
writecount = (writecount == 0 || writecount > len) ? (int) len : writecount ;
|
||||
|
||||
iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
|
||||
|
||||
@ -746,7 +746,7 @@ alac_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
|
||||
while (len > 0)
|
||||
{ writecount = (plac->frames_per_block - plac->partial_block_frames) * plac->channels ;
|
||||
writecount = (writecount == 0 || writecount > len) ? len : writecount ;
|
||||
writecount = (writecount == 0 || writecount > len) ? (int) len : writecount ;
|
||||
|
||||
iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
|
||||
|
||||
|
16
src/alaw.c
16
src/alaw.c
@ -372,7 +372,7 @@ alaw_read_alaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2s_array (ubuf.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -394,7 +394,7 @@ alaw_read_alaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2i_array (ubuf.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -419,7 +419,7 @@ alaw_read_alaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -443,7 +443,7 @@ alaw_read_alaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
alaw2d_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -469,7 +469,7 @@ alaw_write_s2alaw (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2alaw_array (ptr + total, bufferlen, ubuf.ucbuf) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -491,7 +491,7 @@ alaw_write_i2alaw (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2alaw_array (ptr + total, bufferlen, ubuf.ucbuf) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -516,7 +516,7 @@ alaw_write_f2alaw (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2alaw_array (ptr + total, bufferlen, ubuf.ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -541,7 +541,7 @@ alaw_write_d2alaw (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2alaw_array (ptr + total, bufferlen, ubuf.ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
@ -84,7 +84,7 @@ broadcast_var_set (SF_PRIVATE *psf, const SF_BROADCAST_INFO * info, size_t datas
|
||||
/* Force coding_history_size to be even. */
|
||||
len = strlen (psf->broadcast_16k->coding_history) ;
|
||||
len += (len & 1) ? 1 : 0 ;
|
||||
psf->broadcast_16k->coding_history_size = len ;
|
||||
psf->broadcast_16k->coding_history_size = (uint32_t) len ;
|
||||
|
||||
/* Currently writing this version. */
|
||||
psf->broadcast_16k->version = 2 ;
|
||||
|
16
src/caf.c
16
src/caf.c
@ -407,7 +407,7 @@ caf_read_header (SF_PRIVATE *psf)
|
||||
{ case peak_MARKER :
|
||||
psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
|
||||
if (chunk_size != CAF_PEAK_CHUNK_SIZE (psf->sf.channels))
|
||||
{ psf_binheader_readf (psf, "j", make_size_t (chunk_size)) ;
|
||||
{ psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
|
||||
psf_log_printf (psf, "*** File PEAK chunk %D should be %d.\n", chunk_size, CAF_PEAK_CHUNK_SIZE (psf->sf.channels)) ;
|
||||
return SFE_CAF_BAD_PEAK ;
|
||||
} ;
|
||||
@ -443,7 +443,7 @@ caf_read_header (SF_PRIVATE *psf)
|
||||
case chan_MARKER :
|
||||
if (chunk_size < 12)
|
||||
{ psf_log_printf (psf, "%M : %D (should be >= 12)\n", marker, chunk_size) ;
|
||||
psf_binheader_readf (psf, "j", make_size_t (chunk_size)) ;
|
||||
psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ caf_read_header (SF_PRIVATE *psf)
|
||||
|
||||
case free_MARKER :
|
||||
psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
|
||||
psf_binheader_readf (psf, "j", make_size_t (chunk_size)) ;
|
||||
psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
|
||||
break ;
|
||||
|
||||
case data_MARKER :
|
||||
@ -480,14 +480,14 @@ caf_read_header (SF_PRIVATE *psf)
|
||||
if (psf->datalength + psf->dataoffset < psf->filelength)
|
||||
psf->dataend = psf->datalength + psf->dataoffset ;
|
||||
|
||||
psf_binheader_readf (psf, "j", make_size_t (psf->datalength)) ;
|
||||
psf_binheader_readf (psf, "j", (size_t) psf->datalength) ;
|
||||
have_data = 1 ;
|
||||
break ;
|
||||
|
||||
case kuki_MARKER :
|
||||
psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
|
||||
pcaf->alac.kuki_offset = psf_ftell (psf) - 12 ;
|
||||
psf_binheader_readf (psf, "j", make_size_t (chunk_size)) ;
|
||||
psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
|
||||
break ;
|
||||
|
||||
case pakt_MARKER :
|
||||
@ -519,7 +519,7 @@ caf_read_header (SF_PRIVATE *psf)
|
||||
psf_log_printf (psf, "*** 'pakt' chunk header is all zero.\n") ;
|
||||
|
||||
pcaf->alac.pakt_offset = psf_ftell (psf) - 12 ;
|
||||
psf_binheader_readf (psf, "j", make_size_t (chunk_size) - 24) ;
|
||||
psf_binheader_readf (psf, "j", (size_t) chunk_size - 24) ;
|
||||
break ;
|
||||
|
||||
case info_MARKER :
|
||||
@ -538,7 +538,7 @@ caf_read_header (SF_PRIVATE *psf)
|
||||
|
||||
default :
|
||||
psf_log_printf (psf, "%M : %D (skipped)\n", marker, chunk_size) ;
|
||||
psf_binheader_readf (psf, "j", make_size_t (chunk_size)) ;
|
||||
psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
@ -846,7 +846,7 @@ caf_read_strings (SF_PRIVATE * psf, sf_count_t chunk_size)
|
||||
if ((buf = malloc (chunk_size + 1)) == NULL)
|
||||
return (psf->error = SFE_MALLOC_FAILED) ;
|
||||
|
||||
psf_binheader_readf (psf, "E4b", &count, buf, make_size_t (chunk_size)) ;
|
||||
psf_binheader_readf (psf, "E4b", &count, buf, (size_t) chunk_size) ;
|
||||
psf_log_printf (psf, " count: %u\n", count) ;
|
||||
|
||||
/* Force terminate `buf` to make sure. */
|
||||
|
@ -79,7 +79,7 @@ cart_var_set (SF_PRIVATE *psf, const SF_CART_INFO * info, size_t datasize)
|
||||
len = strlen (psf->cart_16k->tag_text) ;
|
||||
len += (len & 1) ? 1 : 2 ;
|
||||
|
||||
psf->cart_16k->tag_text_size = len ;
|
||||
psf->cart_16k->tag_text_size = (uint32_t) len ;
|
||||
|
||||
return SF_TRUE ;
|
||||
} /* cart_var_set */
|
||||
|
@ -75,7 +75,7 @@ psf_get_chunk_iterator (SF_PRIVATE * psf, const char * marker_str)
|
||||
hash = marker_len > 4 ? hash_of_str (marker_str) : u.marker ;
|
||||
|
||||
memcpy (psf->iterator->id, marker_str, marker_len) ;
|
||||
psf->iterator->id_size = marker_len ;
|
||||
psf->iterator->id_size = (unsigned) marker_len ;
|
||||
psf->iterator->hash = hash ;
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ psf_store_read_chunk_str (READ_CHUNKS * pchk, const char * marker_str, sf_count_
|
||||
rchunk.offset = offset ;
|
||||
rchunk.len = len ;
|
||||
|
||||
rchunk.id_size = marker_len > 64 ? 64 : marker_len ;
|
||||
rchunk.id_size = marker_len > 64 ? 64 : (unsigned) marker_len ;
|
||||
memcpy (rchunk.id, marker_str, rchunk.id_size) ;
|
||||
|
||||
return psf_store_read_chunk (pchk, &rchunk) ;
|
||||
|
@ -309,7 +309,7 @@ psf_calc_signal_max (SF_PRIVATE *psf, int normalize)
|
||||
len = ARRAY_LEN (ubuf.dbuf) - (ARRAY_LEN (ubuf.dbuf) % psf->sf.channels) ;
|
||||
|
||||
for (readcount = 1, max_val = 0.0 ; readcount > 0 ; /* nothing */)
|
||||
{ readcount = sf_read_double ((SNDFILE*) psf, data, len) ;
|
||||
{ readcount = (int) sf_read_double ((SNDFILE*) psf, data, len) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
{ temp = fabs (data [k]) ;
|
||||
max_val = temp > max_val ? temp : max_val ;
|
||||
@ -354,7 +354,7 @@ psf_calc_max_all_channels (SF_PRIVATE *psf, double *peaks, int normalize)
|
||||
chan = 0 ;
|
||||
readcount = len ;
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_read_double ((SNDFILE*) psf, data, len) ;
|
||||
{ readcount = (int) sf_read_double ((SNDFILE*) psf, data, len) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
{ temp = fabs (data [k]) ;
|
||||
peaks [chan] = temp > peaks [chan] ? temp : peaks [chan] ;
|
||||
|
28
src/common.c
28
src/common.c
@ -525,24 +525,24 @@ header_put_le_int (SF_PRIVATE *psf, int x)
|
||||
static inline void
|
||||
header_put_be_8byte (SF_PRIVATE *psf, sf_count_t x)
|
||||
{ psf->header.ptr [psf->header.indx++] = (x >> 56) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 48) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 40) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 32) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 24) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 16) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 8) ;
|
||||
psf->header.ptr [psf->header.indx++] = x ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 48) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 40) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 32) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 24) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 16) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 8) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) x ;
|
||||
} /* header_put_be_8byte */
|
||||
|
||||
static inline void
|
||||
header_put_le_8byte (SF_PRIVATE *psf, sf_count_t x)
|
||||
{ psf->header.ptr [psf->header.indx++] = x ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 8) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 16) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 24) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 32) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 40) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 48) ;
|
||||
{ psf->header.ptr [psf->header.indx++] = (unsigned char) x ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 8) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 16) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 24) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 32) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 40) ;
|
||||
psf->header.ptr [psf->header.indx++] = (unsigned char) (x >> 48) ;
|
||||
psf->header.ptr [psf->header.indx++] = (x >> 56) ;
|
||||
} /* header_put_le_8byte */
|
||||
|
||||
|
@ -242,7 +242,7 @@ dither_write_short (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
|
||||
dither_short (ptr, (short*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ;
|
||||
|
||||
thiswrite = pdither->write_short (psf, (short*) pdither->buffer, writecount) ;
|
||||
thiswrite = (int) pdither->write_short (psf, (short*) pdither->buffer, writecount) ;
|
||||
total += thiswrite ;
|
||||
len -= thiswrite ;
|
||||
if (thiswrite < writecount)
|
||||
@ -288,7 +288,7 @@ dither_write_int (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
|
||||
dither_int (ptr, (int*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ;
|
||||
|
||||
thiswrite = pdither->write_int (psf, (int*) pdither->buffer, writecount) ;
|
||||
thiswrite = (int) pdither->write_int (psf, (int*) pdither->buffer, writecount) ;
|
||||
total += thiswrite ;
|
||||
len -= thiswrite ;
|
||||
if (thiswrite < writecount)
|
||||
@ -333,7 +333,7 @@ dither_write_float (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
|
||||
dither_float (ptr, (float*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ;
|
||||
|
||||
thiswrite = pdither->write_float (psf, (float*) pdither->buffer, writecount) ;
|
||||
thiswrite = (int) pdither->write_float (psf, (float*) pdither->buffer, writecount) ;
|
||||
total += thiswrite ;
|
||||
len -= thiswrite ;
|
||||
if (thiswrite < writecount)
|
||||
@ -379,7 +379,7 @@ dither_write_double (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
|
||||
dither_double (ptr, (double*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ;
|
||||
|
||||
thiswrite = pdither->write_double (psf, (double*) pdither->buffer, writecount) ;
|
||||
thiswrite = (int) pdither->write_double (psf, (double*) pdither->buffer, writecount) ;
|
||||
total += thiswrite ;
|
||||
len -= thiswrite ;
|
||||
if (thiswrite < writecount)
|
||||
|
@ -572,7 +572,7 @@ host_read_d2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, readcount) ;
|
||||
@ -602,7 +602,7 @@ host_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
@ -628,7 +628,7 @@ host_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, readcount) ;
|
||||
@ -695,7 +695,7 @@ host_write_s2d (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -726,7 +726,7 @@ host_write_i2d (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -755,7 +755,7 @@ host_write_f2d (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -785,7 +785,7 @@ host_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
|
||||
endswap_double_copy (ubuf.dbuf, ptr + total, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -811,7 +811,7 @@ replace_read_d2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
@ -841,7 +841,7 @@ replace_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
@ -869,7 +869,7 @@ replace_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
@ -899,7 +899,7 @@ replace_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, readcount) ;
|
||||
@ -940,7 +940,7 @@ replace_write_s2d (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -973,7 +973,7 @@ replace_write_i2d (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1001,7 +1001,7 @@ replace_write_f2d (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1034,7 +1034,7 @@ replace_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_double_array (ubuf.dbuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
14
src/dwvw.c
14
src/dwvw.c
@ -198,7 +198,7 @@ dwvw_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = iptr [k] >> 16 ;
|
||||
@ -255,7 +255,7 @@ dwvw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * (float) (iptr [k]) ;
|
||||
@ -287,7 +287,7 @@ dwvw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * (double) (iptr [k]) ;
|
||||
@ -377,7 +377,7 @@ dwvw_decode_load_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int bit_count)
|
||||
/* Load bits in bit reseviour. */
|
||||
while (pdwvw->bit_count < bit_count)
|
||||
{ if (pdwvw->b.index >= pdwvw->b.end)
|
||||
{ pdwvw->b.end = psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
|
||||
{ pdwvw->b.end = (int) psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
|
||||
pdwvw->b.index = 0 ;
|
||||
} ;
|
||||
|
||||
@ -569,7 +569,7 @@ dwvw_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = arith_shift_left (ptr [total + k], 16) ;
|
||||
count = dwvw_encode_data (psf, pdwvw, iptr, writecount) ;
|
||||
@ -626,7 +626,7 @@ dwvw_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = psf_lrintf (normfact * ptr [total + k]) ;
|
||||
count = dwvw_encode_data (psf, pdwvw, iptr, writecount) ;
|
||||
@ -658,7 +658,7 @@ dwvw_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = psf_lrint (normfact * ptr [total + k]) ;
|
||||
count = dwvw_encode_data (psf, pdwvw, iptr, writecount) ;
|
||||
|
@ -523,7 +523,7 @@ host_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
/* Fix me : Need lef2s_array */
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
@ -554,7 +554,7 @@ host_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
@ -583,7 +583,7 @@ host_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
endswap_int_copy ((int*) (ptr + total), ubuf.ibuf, readcount) ;
|
||||
|
||||
@ -607,7 +607,7 @@ host_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
@ -645,7 +645,7 @@ host_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -676,7 +676,7 @@ host_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.fbuf, sizeof (float) , bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.fbuf, sizeof (float) , bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -706,7 +706,7 @@ host_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
|
||||
endswap_int_copy (ubuf.ibuf, (const int*) (ptr + total), bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -736,7 +736,7 @@ host_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -762,7 +762,7 @@ replace_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
@ -792,7 +792,7 @@ replace_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
@ -822,7 +822,7 @@ replace_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
@ -851,7 +851,7 @@ replace_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
@ -891,7 +891,7 @@ replace_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -924,7 +924,7 @@ replace_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -957,7 +957,7 @@ replace_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.fbuf, sizeof (float) , bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.fbuf, sizeof (float) , bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -988,7 +988,7 @@ replace_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
if (psf->data_endswap == SF_TRUE)
|
||||
endswap_int_array (ubuf.ibuf, bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
12
src/g72x.c
12
src/g72x.c
@ -264,7 +264,7 @@ g72x_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = g72x_read_block (psf, pg72x, sptr, readcount) ;
|
||||
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
@ -297,7 +297,7 @@ g72x_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = g72x_read_block (psf, pg72x, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * sptr [k] ;
|
||||
@ -329,7 +329,7 @@ g72x_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = g72x_read_block (psf, pg72x, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * (double) (sptr [k]) ;
|
||||
@ -505,7 +505,7 @@ g72x_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = ptr [total + k] >> 16 ;
|
||||
count = g72x_write_block (psf, pg72x, sptr, writecount) ;
|
||||
@ -536,7 +536,7 @@ g72x_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = psf_lrintf (normfact * ptr [total + k]) ;
|
||||
count = g72x_write_block (psf, pg72x, sptr, writecount) ;
|
||||
@ -568,7 +568,7 @@ g72x_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = psf_lrint (normfact * ptr [total + k]) ;
|
||||
count = g72x_write_block (psf, pg72x, sptr, writecount) ;
|
||||
|
20
src/gsm610.c
20
src/gsm610.c
@ -198,7 +198,7 @@ gsm610_wav_decode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610)
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (pgsm610->block, 1, WAVLIKE_GSM610_BLOCKSIZE, psf)) != WAVLIKE_GSM610_BLOCKSIZE)
|
||||
if ((k = (int) psf_fread (pgsm610->block, 1, WAVLIKE_GSM610_BLOCKSIZE, psf)) != WAVLIKE_GSM610_BLOCKSIZE)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, WAVLIKE_GSM610_BLOCKSIZE) ;
|
||||
|
||||
if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
|
||||
@ -226,7 +226,7 @@ gsm610_decode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610)
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
|
||||
if ((k = (int) psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, GSM610_BLOCKSIZE) ;
|
||||
|
||||
if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
|
||||
@ -302,7 +302,7 @@ gsm610_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = gsm610_read_block (psf, pgsm610, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = arith_shift_left (sptr [k], 16) ;
|
||||
@ -331,7 +331,7 @@ gsm610_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = gsm610_read_block (psf, pgsm610, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * sptr [k] ;
|
||||
@ -360,7 +360,7 @@ gsm610_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = gsm610_read_block (psf, pgsm610, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * sptr [k] ;
|
||||
@ -437,7 +437,7 @@ gsm610_encode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610)
|
||||
gsm_encode (pgsm610->gsm_data, pgsm610->samples, pgsm610->block) ;
|
||||
|
||||
/* Write the block to disk. */
|
||||
if ((k = psf_fwrite (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
|
||||
if ((k = (int) psf_fwrite (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, GSM610_BLOCKSIZE) ;
|
||||
|
||||
pgsm610->samplecount = 0 ;
|
||||
@ -458,7 +458,7 @@ gsm610_wav_encode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610)
|
||||
gsm_encode (pgsm610->gsm_data, pgsm610->samples+WAVLIKE_GSM610_SAMPLES / 2, pgsm610->block+WAVLIKE_GSM610_BLOCKSIZE / 2) ;
|
||||
|
||||
/* Write the block to disk. */
|
||||
if ((k = psf_fwrite (pgsm610->block, 1, WAVLIKE_GSM610_BLOCKSIZE, psf)) != WAVLIKE_GSM610_BLOCKSIZE)
|
||||
if ((k = (int) psf_fwrite (pgsm610->block, 1, WAVLIKE_GSM610_BLOCKSIZE, psf)) != WAVLIKE_GSM610_BLOCKSIZE)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, WAVLIKE_GSM610_BLOCKSIZE) ;
|
||||
|
||||
pgsm610->samplecount = 0 ;
|
||||
@ -532,7 +532,7 @@ gsm610_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = ptr [total + k] >> 16 ;
|
||||
count = gsm610_write_block (psf, pgsm610, sptr, writecount) ;
|
||||
@ -561,7 +561,7 @@ gsm610_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = psf_lrintf (normfact * ptr [total + k]) ;
|
||||
count = gsm610_write_block (psf, pgsm610, sptr, writecount) ;
|
||||
@ -592,7 +592,7 @@ gsm610_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = psf_lrint (normfact * ptr [total + k]) ;
|
||||
count = gsm610_write_block (psf, pgsm610, sptr, writecount) ;
|
||||
|
@ -273,7 +273,7 @@ count ++ ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (pima->block, 1, pima->blocksize * pima->channels, psf)) != pima->blocksize * pima->channels)
|
||||
if ((k = (int) psf_fread (pima->block, 1, pima->blocksize * pima->channels, psf)) != pima->blocksize * pima->channels)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ;
|
||||
|
||||
/* Read and check the block header. */
|
||||
@ -378,7 +378,7 @@ aiff_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima)
|
||||
} ;
|
||||
|
||||
/* Write the block to disk. */
|
||||
if ((k = psf_fwrite (pima->block, 1, pima->channels * pima->blocksize, psf)) != pima->channels * pima->blocksize)
|
||||
if ((k = (int) psf_fwrite (pima->block, 1, pima->channels * pima->blocksize, psf)) != pima->channels * pima->blocksize)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pima->channels * pima->blocksize) ;
|
||||
|
||||
memset (pima->block, 0, pima->channels * pima->blocksize) ;
|
||||
@ -401,7 +401,7 @@ wavlike_ima_decode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima)
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (pima->block, 1, pima->blocksize, psf)) != pima->blocksize)
|
||||
if ((k = (int) psf_fread (pima->block, 1, pima->blocksize, psf)) != pima->blocksize)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ;
|
||||
|
||||
/* Read and check the block header. */
|
||||
@ -557,7 +557,7 @@ wavlike_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima)
|
||||
|
||||
/* Write the block to disk. */
|
||||
|
||||
if ((k = psf_fwrite (pima->block, 1, pima->blocksize, psf)) != pima->blocksize)
|
||||
if ((k = (int) psf_fwrite (pima->block, 1, pima->blocksize, psf)) != pima->blocksize)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pima->blocksize) ;
|
||||
|
||||
memset (pima->samples, 0, pima->samplesperblock * sizeof (short)) ;
|
||||
|
@ -230,7 +230,7 @@ msadpcm_decode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms)
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
|
||||
if ((k = (int) psf_fread (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
|
||||
{ psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pms->blocksize) ;
|
||||
if (k <= 0)
|
||||
return 1 ;
|
||||
@ -355,7 +355,7 @@ msadpcm_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
|
||||
|
||||
if ((count = msadpcm_read_block (psf, pms, ptr, readcount)) <= 0)
|
||||
if ((count = (int) msadpcm_read_block (psf, pms, ptr, readcount)) <= 0)
|
||||
return -1 ;
|
||||
|
||||
total += count ;
|
||||
@ -382,9 +382,9 @@ msadpcm_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
|
||||
if ((count = msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
|
||||
if ((count = (int) msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
|
||||
return -1 ;
|
||||
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
@ -414,9 +414,9 @@ msadpcm_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
|
||||
if ((count = msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
|
||||
if ((count = (int) msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
|
||||
return -1 ;
|
||||
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
@ -446,9 +446,9 @@ msadpcm_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
|
||||
if ((count = msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
|
||||
if ((count = (int) msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
|
||||
return -1 ;
|
||||
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
@ -633,7 +633,7 @@ msadpcm_encode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms)
|
||||
|
||||
/* Write the block to disk. */
|
||||
|
||||
if ((k = psf_fwrite (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
|
||||
if ((k = (int) psf_fwrite (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pms->blocksize) ;
|
||||
|
||||
memset (pms->samples, 0, pms->samplesperblock * sizeof (short)) ;
|
||||
@ -679,7 +679,7 @@ msadpcm_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ writecount = (len > 0x10000000) ? 0x10000000 : (int) len ;
|
||||
|
||||
count = msadpcm_write_block (psf, pms, ptr, writecount) ;
|
||||
count = (int) msadpcm_write_block (psf, pms, ptr, writecount) ;
|
||||
|
||||
total += count ;
|
||||
len -= count ;
|
||||
@ -705,10 +705,10 @@ msadpcm_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = ptr [total + k] >> 16 ;
|
||||
count = msadpcm_write_block (psf, pms, sptr, writecount) ;
|
||||
count = (int) msadpcm_write_block (psf, pms, sptr, writecount) ;
|
||||
total += count ;
|
||||
len -= writecount ;
|
||||
if (count != writecount)
|
||||
@ -735,10 +735,10 @@ msadpcm_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = psf_lrintf (normfact * ptr [total + k]) ;
|
||||
count = msadpcm_write_block (psf, pms, sptr, writecount) ;
|
||||
count = (int) msadpcm_write_block (psf, pms, sptr, writecount) ;
|
||||
total += count ;
|
||||
len -= writecount ;
|
||||
if (count != writecount)
|
||||
@ -765,10 +765,10 @@ msadpcm_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = psf_lrint (normfact * ptr [total + k]) ;
|
||||
count = msadpcm_write_block (psf, pms, sptr, writecount) ;
|
||||
count = (int) msadpcm_write_block (psf, pms, sptr, writecount) ;
|
||||
total += count ;
|
||||
len -= writecount ;
|
||||
if (count != writecount)
|
||||
|
@ -702,7 +702,7 @@ static int
|
||||
psf_nms_adpcm_decode_block (SF_PRIVATE *psf, NMS_ADPCM_PRIVATE *pnms)
|
||||
{ int k ;
|
||||
|
||||
if ((k = psf_fread (pnms->block, sizeof (short), pnms->shortsperblock, psf)) != pnms->shortsperblock)
|
||||
if ((k = (int) psf_fread (pnms->block, sizeof (short), pnms->shortsperblock, psf)) != pnms->shortsperblock)
|
||||
{ psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pnms->shortsperblock) ;
|
||||
memset (pnms->block + (k * sizeof (short)), 0, (pnms->shortsperblock - k) * sizeof (short)) ;
|
||||
} ;
|
||||
@ -785,7 +785,7 @@ nms_adpcm_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = nms_adpcm_read_block (psf, pnms, sptr, readcount) ;
|
||||
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
@ -818,7 +818,7 @@ nms_adpcm_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = nms_adpcm_read_block (psf, pnms, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * sptr [k] ;
|
||||
@ -850,7 +850,7 @@ nms_adpcm_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = nms_adpcm_read_block (psf, pnms, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * (double) (sptr [k]) ;
|
||||
@ -875,7 +875,7 @@ psf_nms_adpcm_encode_block (SF_PRIVATE *psf, NMS_ADPCM_PRIVATE *pnms)
|
||||
endswap_short_array ((signed short *) pnms->block, pnms->shortsperblock) ;
|
||||
|
||||
/* Write the block to disk. */
|
||||
if ((k = psf_fwrite (pnms->block, sizeof (short), pnms->shortsperblock, psf)) != pnms->shortsperblock)
|
||||
if ((k = (int) psf_fwrite (pnms->block, sizeof (short), pnms->shortsperblock, psf)) != pnms->shortsperblock)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pnms->shortsperblock) ;
|
||||
|
||||
pnms->sample_curr = 0 ;
|
||||
@ -945,7 +945,7 @@ nms_adpcm_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = ptr [total + k] >> 16 ;
|
||||
count = nms_adpcm_write_block (psf, pnms, sptr, writecount) ;
|
||||
@ -976,7 +976,7 @@ nms_adpcm_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = psf_lrintf (normfact * ptr [total + k]) ;
|
||||
count = nms_adpcm_write_block (psf, pnms, sptr, writecount) ;
|
||||
@ -1008,7 +1008,7 @@ nms_adpcm_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
sptr = ubuf.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = psf_lrint (normfact * ptr [total + k]) ;
|
||||
count = nms_adpcm_write_block (psf, pnms, sptr, writecount) ;
|
||||
|
16
src/paf.c
16
src/paf.c
@ -493,7 +493,7 @@ paf24_read_block (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24)
|
||||
} ;
|
||||
|
||||
/* Read the block. */
|
||||
if ((k = psf_fread (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
|
||||
if ((k = (int) psf_fread (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, ppaf24->blocksize) ;
|
||||
|
||||
/* Do endian swapping if necessary. */
|
||||
@ -549,7 +549,7 @@ paf24_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = paf24_read (psf, ppaf24, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = iptr [k] >> 16 ;
|
||||
@ -591,7 +591,7 @@ paf24_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = paf24_read (psf, ppaf24, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * iptr [k] ;
|
||||
@ -619,7 +619,7 @@ paf24_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = paf24_read (psf, ppaf24, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * iptr [k] ;
|
||||
@ -668,7 +668,7 @@ paf24_write_block (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24)
|
||||
} ;
|
||||
|
||||
/* Write block to disk. */
|
||||
if ((k = psf_fwrite (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
|
||||
if ((k = (int) psf_fwrite (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, ppaf24->blocksize) ;
|
||||
|
||||
if (ppaf24->sample_count < ppaf24->write_block * PAF24_SAMPLES_PER_BLOCK + ppaf24->write_count)
|
||||
@ -718,7 +718,7 @@ paf24_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = ptr [total + k] << 16 ;
|
||||
count = paf24_write (psf, ppaf24, iptr, writecount) ;
|
||||
@ -772,7 +772,7 @@ paf24_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = psf_lrintf (normfact * ptr [total + k]) ;
|
||||
count = paf24_write (psf, ppaf24, iptr, writecount) ;
|
||||
@ -803,7 +803,7 @@ paf24_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = psf_lrint (normfact * ptr [total+k]) ;
|
||||
count = paf24_write (psf, ppaf24, iptr, writecount) ;
|
||||
|
122
src/pcm.c
122
src/pcm.c
@ -672,7 +672,7 @@ pcm_read_sc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2s_array (ubuf.scbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -694,7 +694,7 @@ pcm_read_uc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2s_array (ubuf.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -709,7 +709,7 @@ static sf_count_t
|
||||
pcm_read_bes2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ int total ;
|
||||
|
||||
total = psf_fread (ptr, sizeof (short), len, psf) ;
|
||||
total = (int) psf_fread (ptr, sizeof (short), len, psf) ;
|
||||
if (CPU_IS_LITTLE_ENDIAN)
|
||||
endswap_short_array (ptr, len) ;
|
||||
|
||||
@ -738,7 +738,7 @@ pcm_read_bet2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2s_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -760,7 +760,7 @@ pcm_read_let2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2s_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -782,7 +782,7 @@ pcm_read_bei2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2s_array (ubuf.ibuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -804,7 +804,7 @@ pcm_read_lei2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2s_array (ubuf.ibuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -829,7 +829,7 @@ pcm_read_sc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2i_array (ubuf.scbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -851,7 +851,7 @@ pcm_read_uc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2i_array (ubuf.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -873,7 +873,7 @@ pcm_read_bes2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2i_array (ubuf.sbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -895,7 +895,7 @@ pcm_read_les2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2i_array (ubuf.sbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -917,7 +917,7 @@ pcm_read_bet2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2i_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -939,7 +939,7 @@ pcm_read_let2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2i_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -989,7 +989,7 @@ pcm_read_sc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2f_array (ubuf.scbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1014,7 +1014,7 @@ pcm_read_uc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1039,7 +1039,7 @@ pcm_read_bes2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1064,7 +1064,7 @@ pcm_read_les2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1090,7 +1090,7 @@ pcm_read_bet2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1116,7 +1116,7 @@ pcm_read_let2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1141,7 +1141,7 @@ pcm_read_bei2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1166,7 +1166,7 @@ pcm_read_lei2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1194,7 +1194,7 @@ pcm_read_sc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
sc2d_array (ubuf.scbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1219,7 +1219,7 @@ pcm_read_uc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
uc2d_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1244,7 +1244,7 @@ pcm_read_bes2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
bes2d_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1269,7 +1269,7 @@ pcm_read_les2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
les2d_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1294,7 +1294,7 @@ pcm_read_bet2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
bet2d_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1320,7 +1320,7 @@ pcm_read_let2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
let2d_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1345,7 +1345,7 @@ pcm_read_bei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
bei2d_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1370,7 +1370,7 @@ pcm_read_lei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
lei2d_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -1398,7 +1398,7 @@ pcm_write_s2sc (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2sc_array (ptr + total, ubuf.scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1420,7 +1420,7 @@ pcm_write_s2uc (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2uc_array (ptr + total, ubuf.ucbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1446,7 +1446,7 @@ pcm_write_s2bes (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
endswap_short_copy (ubuf.sbuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1471,7 +1471,7 @@ pcm_write_s2les (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
endswap_short_copy (ubuf.sbuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1493,7 +1493,7 @@ pcm_write_s2bet (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2bet_array (ptr + total, (tribyte*) (ubuf.ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1515,7 +1515,7 @@ pcm_write_s2let (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2let_array (ptr + total, (tribyte*) (ubuf.ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1537,7 +1537,7 @@ pcm_write_s2bei (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2bei_array (ptr + total, ubuf.ibuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1559,7 +1559,7 @@ pcm_write_s2lei (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2lei_array (ptr + total, ubuf.ibuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1584,7 +1584,7 @@ pcm_write_i2sc (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2sc_array (ptr + total, ubuf.scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1606,7 +1606,7 @@ pcm_write_i2uc (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2uc_array (ptr + total, ubuf.ucbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1628,7 +1628,7 @@ pcm_write_i2bes (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2bes_array (ptr + total, ubuf.sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1650,7 +1650,7 @@ pcm_write_i2les (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2les_array (ptr + total, ubuf.sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1672,7 +1672,7 @@ pcm_write_i2bet (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2bet_array (ptr + total, (tribyte*) (ubuf.ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1694,7 +1694,7 @@ pcm_write_i2let (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2let_array (ptr + total, (tribyte*) (ubuf.ucbuf), bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1719,7 +1719,7 @@ pcm_write_i2bei (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
endswap_int_copy (ubuf.ibuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1744,7 +1744,7 @@ pcm_write_i2lei (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
endswap_int_copy (ubuf.ibuf, ptr + total, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1809,7 +1809,7 @@ pcm_write_f2sc (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.scbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1872,7 +1872,7 @@ pcm_write_f2uc (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.ucbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1949,7 +1949,7 @@ pcm_write_f2bes (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.sbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2026,7 +2026,7 @@ pcm_write_f2les (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.sbuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2101,7 +2101,7 @@ pcm_write_f2let (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, (tribyte*) (ubuf.ucbuf), bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2176,7 +2176,7 @@ pcm_write_f2bet (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, (tribyte*) (ubuf.ucbuf), bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2260,7 +2260,7 @@ pcm_write_f2bei (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.ibuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2345,7 +2345,7 @@ pcm_write_f2lei (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.ibuf, bufferlen, psf->norm_float) ;
|
||||
writecount = psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2408,7 +2408,7 @@ pcm_write_d2sc (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.scbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2471,7 +2471,7 @@ pcm_write_d2uc (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.ucbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2548,7 +2548,7 @@ pcm_write_d2bes (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.sbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2625,7 +2625,7 @@ pcm_write_d2les (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.sbuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2700,7 +2700,7 @@ pcm_write_d2let (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, (tribyte*) (ubuf.ucbuf), bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2775,7 +2775,7 @@ pcm_write_d2bet (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, (tribyte*) (ubuf.ucbuf), bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2860,7 +2860,7 @@ pcm_write_d2bei (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.ibuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -2945,7 +2945,7 @@ pcm_write_d2lei (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
convert (ptr + total, ubuf.ibuf, bufferlen, psf->norm_double) ;
|
||||
writecount = psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
26
src/sds.c
26
src/sds.c
@ -281,7 +281,7 @@ sds_read_header (SF_PRIVATE *psf, SDS_PRIVATE *psds)
|
||||
|
||||
for (blockcount = 0 ; bytesread < psf->filelength ; blockcount++)
|
||||
{
|
||||
bytesread += psf_fread (&marker, 1, 2, psf) ;
|
||||
bytesread += (int) psf_fread (&marker, 1, 2, psf) ;
|
||||
|
||||
if (marker == 0)
|
||||
break ;
|
||||
@ -431,7 +431,7 @@ sds_2byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds)
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
|
||||
|
||||
if (psds->read_data [0] != 0xF0)
|
||||
@ -475,7 +475,7 @@ sds_3byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds)
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
|
||||
|
||||
if (psds->read_data [0] != 0xF0)
|
||||
@ -519,7 +519,7 @@ sds_4byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds)
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
|
||||
|
||||
if (psds->read_data [0] != 0xF0)
|
||||
@ -565,7 +565,7 @@ sds_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = sds_read (psf, psds, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = iptr [k] >> 16 ;
|
||||
@ -611,7 +611,7 @@ sds_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = sds_read (psf, psds, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * iptr [k] ;
|
||||
@ -643,7 +643,7 @@ sds_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
count = sds_read (psf, psds, iptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * iptr [k] ;
|
||||
@ -794,7 +794,7 @@ sds_2byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds)
|
||||
psds->write_data [SDS_BLOCK_SIZE - 2] = checksum ;
|
||||
psds->write_data [SDS_BLOCK_SIZE - 1] = 0xF7 ;
|
||||
|
||||
if ((k = psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
if ((k = (int) psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
psf_log_printf (psf, "*** Warning : psf_fwrite (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
|
||||
|
||||
psds->write_block ++ ;
|
||||
@ -836,7 +836,7 @@ sds_3byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds)
|
||||
psds->write_data [SDS_BLOCK_SIZE - 2] = checksum ;
|
||||
psds->write_data [SDS_BLOCK_SIZE - 1] = 0xF7 ;
|
||||
|
||||
if ((k = psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
if ((k = (int) psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
psf_log_printf (psf, "*** Warning : psf_fwrite (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
|
||||
|
||||
psds->write_block ++ ;
|
||||
@ -879,7 +879,7 @@ sds_4byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds)
|
||||
psds->write_data [SDS_BLOCK_SIZE - 2] = checksum ;
|
||||
psds->write_data [SDS_BLOCK_SIZE - 1] = 0xF7 ;
|
||||
|
||||
if ((k = psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
if ((k = (int) psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
|
||||
psf_log_printf (psf, "*** Warning : psf_fwrite (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
|
||||
|
||||
psds->write_block ++ ;
|
||||
@ -908,7 +908,7 @@ sds_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = arith_shift_left (ptr [total + k], 16) ;
|
||||
count = sds_write (psf, psds, iptr, writecount) ;
|
||||
@ -956,7 +956,7 @@ sds_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = normfact * ptr [total + k] ;
|
||||
count = sds_write (psf, psds, iptr, writecount) ;
|
||||
@ -989,7 +989,7 @@ sds_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
iptr = ubuf.ibuf ;
|
||||
bufferlen = ARRAY_LEN (ubuf.ibuf) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : (int) len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
iptr [k] = normfact * ptr [total + k] ;
|
||||
count = sds_write (psf, psds, iptr, writecount) ;
|
||||
|
16
src/ulaw.c
16
src/ulaw.c
@ -873,7 +873,7 @@ ulaw_read_ulaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2s_array (ubuf.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -895,7 +895,7 @@ ulaw_read_ulaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2i_array (ubuf.ucbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -920,7 +920,7 @@ ulaw_read_ulaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -944,7 +944,7 @@ ulaw_read_ulaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
ulaw2d_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -970,7 +970,7 @@ ulaw_write_s2ulaw (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2ulaw_array (ptr + total, bufferlen, ubuf.ucbuf) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -992,7 +992,7 @@ ulaw_write_i2ulaw (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2ulaw_array (ptr + total, bufferlen, ubuf.ucbuf) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1018,7 +1018,7 @@ ulaw_write_f2ulaw (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2ulaw_array (ptr + total, bufferlen, ubuf.ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -1044,7 +1044,7 @@ ulaw_write_d2ulaw (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2ulaw_array (ptr + total, bufferlen, ubuf.ucbuf, normfact) ;
|
||||
writecount = psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.ucbuf, 1, bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
@ -128,7 +128,7 @@ vox_read_block (SF_PRIVATE *psf, IMA_OKI_ADPCM *pvox, short *ptr, int len)
|
||||
while (indx < len)
|
||||
{ pvox->code_count = (len - indx > IMA_OKI_ADPCM_PCM_LEN) ? IMA_OKI_ADPCM_CODE_LEN : (len - indx + 1) / 2 ;
|
||||
|
||||
if ((k = psf_fread (pvox->codes, 1, pvox->code_count, psf)) != pvox->code_count)
|
||||
if ((k = (int) psf_fread (pvox->codes, 1, pvox->code_count, psf)) != pvox->code_count)
|
||||
{ if (psf_ftell (psf) != psf->filelength)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pvox->code_count) ;
|
||||
if (k == 0)
|
||||
@ -275,7 +275,7 @@ vox_write_block (SF_PRIVATE *psf, IMA_OKI_ADPCM *pvox, const short *ptr, int len
|
||||
|
||||
ima_oki_adpcm_encode_block (pvox) ;
|
||||
|
||||
if ((k = psf_fwrite (pvox->codes, 1, pvox->code_count, psf)) != pvox->code_count)
|
||||
if ((k = (int) psf_fwrite (pvox->codes, 1, pvox->code_count, psf)) != pvox->code_count)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pvox->code_count) ;
|
||||
|
||||
indx += pvox->pcm_count ;
|
||||
|
@ -241,7 +241,9 @@ w64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
||||
psf_binheader_readf (psf, "j", 8 - (psf->header.indx & 0x7)) ;
|
||||
|
||||
/* Generate hash of 16 byte marker. */
|
||||
marker = chunk_size = 0 ;
|
||||
marker = 0 ;
|
||||
chunk_size = 0 ;
|
||||
|
||||
bytesread = psf_binheader_readf (psf, "eh8", &marker, &chunk_size) ;
|
||||
if (bytesread == 0)
|
||||
break ;
|
||||
|
36
src/xi.c
36
src/xi.c
@ -252,7 +252,7 @@ dpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (total > 0)
|
||||
{ len = (total > bufferlen) ? bufferlen : total ;
|
||||
total -= dpcm_read_dles2s (psf, ubuf.sbuf, len) ;
|
||||
total -= (int) dpcm_read_dles2s (psf, ubuf.sbuf, len) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
@ -260,7 +260,7 @@ dpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
||||
bufferlen = ARRAY_LEN (ubuf.sbuf) ;
|
||||
while (total > 0)
|
||||
{ len = (total > bufferlen) ? bufferlen : total ;
|
||||
total -= dpcm_read_dsc2s (psf, ubuf.sbuf, len) ;
|
||||
total -= (int) dpcm_read_dsc2s (psf, ubuf.sbuf, len) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
@ -522,7 +522,7 @@ dpcm_read_dsc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2s_array (pxi, ubuf.scbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -548,7 +548,7 @@ dpcm_read_dsc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2i_array (pxi, ubuf.scbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -577,7 +577,7 @@ dpcm_read_dsc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2f_array (pxi, ubuf.scbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -606,7 +606,7 @@ dpcm_read_dsc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
dsc2d_array (pxi, ubuf.scbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -635,7 +635,7 @@ dpcm_read_dles2s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2s_array (pxi, ubuf.sbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -661,7 +661,7 @@ dpcm_read_dles2i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2i_array (pxi, ubuf.sbuf, readcount, ptr + total) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -690,7 +690,7 @@ dpcm_read_dles2f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2f_array (pxi, ubuf.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -719,7 +719,7 @@ dpcm_read_dles2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
while (len > 0)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
readcount = psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
dles2d_array (pxi, ubuf.sbuf, readcount, ptr + total, normfact) ;
|
||||
total += readcount ;
|
||||
if (readcount < bufferlen)
|
||||
@ -760,7 +760,7 @@ dpcm_write_s2dsc (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2dsc_array (pxi, ptr + total, ubuf.scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -786,7 +786,7 @@ dpcm_write_i2dsc (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2dsc_array (pxi, ptr + total, ubuf.scbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -815,7 +815,7 @@ dpcm_write_f2dsc (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2dsc_array (pxi, ptr + total, ubuf.scbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -844,7 +844,7 @@ dpcm_write_d2dsc (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2dsc_array (pxi, ptr + total, ubuf.scbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -871,7 +871,7 @@ dpcm_write_s2dles (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
s2dles_array (pxi, ptr + total, ubuf.sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -897,7 +897,7 @@ dpcm_write_i2dles (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
i2dles_array (pxi, ptr + total, ubuf.sbuf, bufferlen) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -926,7 +926,7 @@ dpcm_write_f2dles (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
f2dles_array (pxi, ptr + total, ubuf.sbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
@ -955,7 +955,7 @@ dpcm_write_d2dles (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
d2dles_array (pxi, ptr + total, ubuf.sbuf, bufferlen, normfact) ;
|
||||
writecount = psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
writecount = (int) psf_fwrite (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
if (writecount < bufferlen)
|
||||
break ;
|
||||
|
@ -38,8 +38,8 @@
|
||||
#define LOG_BUFFER_SIZE 1024
|
||||
|
||||
static void chunk_test (const char *filename, int format) ;
|
||||
static void wav_subchunk_test (size_t chunk_size) ;
|
||||
static void large_free_test (const char *filename, int format, size_t chunk_size) ;
|
||||
static void wav_subchunk_test (unsigned int chunk_size) ;
|
||||
static void large_free_test (const char *filename, int format, unsigned int chunk_size) ;
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
@ -133,7 +133,7 @@ chunk_test_helper (const char *filename, int format, const char * testdata)
|
||||
snprintf (chunk_info.id, sizeof (chunk_info.id), "Test") ;
|
||||
chunk_info.id_size = 4 ;
|
||||
chunk_info.data = strdup (testdata) ;
|
||||
chunk_info.datalen = strlen (chunk_info.data) ;
|
||||
chunk_info.datalen = (unsigned int) strlen (chunk_info.data) ;
|
||||
|
||||
length_before = chunk_info.datalen ;
|
||||
|
||||
@ -224,7 +224,7 @@ multichunk_test_helper (const char *filename, int format, const char * testdata
|
||||
chunk_info.id_size = 4 ;
|
||||
|
||||
chunk_info.data = strdup (testdata [i]) ;
|
||||
chunk_info.datalen = strlen (chunk_info.data) ;
|
||||
chunk_info.datalen = (unsigned int) strlen (chunk_info.data) ;
|
||||
|
||||
length_before [i] = chunk_info.datalen ;
|
||||
|
||||
@ -316,7 +316,7 @@ chunk_test (const char *filename, int format)
|
||||
|
||||
|
||||
static void
|
||||
wav_subchunk_test (size_t chunk_size)
|
||||
wav_subchunk_test (unsigned int chunk_size)
|
||||
{ SNDFILE * file ;
|
||||
SF_INFO sfinfo ;
|
||||
SF_CHUNK_INFO chunk_info ;
|
||||
@ -325,7 +325,7 @@ wav_subchunk_test (size_t chunk_size)
|
||||
short audio [16] ;
|
||||
int err, value ;
|
||||
|
||||
snprintf (filename, sizeof (filename), "subchunk_%04d.wav", (int) chunk_size) ;
|
||||
snprintf (filename, sizeof (filename), "subchunk_%04u.wav", chunk_size) ;
|
||||
print_test_name (__func__, filename) ;
|
||||
|
||||
exit_if_true (sizeof (chunk_data) < chunk_size, "\n\nLine %d : sizeof (data) < chunk_size\n\n", __LINE__) ;
|
||||
@ -353,7 +353,7 @@ wav_subchunk_test (size_t chunk_size)
|
||||
snprintf (chunk_info.id, sizeof (chunk_info.id), "LIST") ;
|
||||
chunk_info.id_size = 4 ;
|
||||
chunk_info.data = chunk_data ;
|
||||
chunk_info.datalen = chunk_size ;
|
||||
chunk_info.datalen = (unsigned int) chunk_size ;
|
||||
|
||||
err = sf_set_chunk (file, &chunk_info) ;
|
||||
exit_if_true (
|
||||
@ -386,7 +386,7 @@ wav_subchunk_test (size_t chunk_size)
|
||||
} /* wav_subchunk_test */
|
||||
|
||||
static void
|
||||
large_free_test (const char *filename, int format, size_t chunk_size)
|
||||
large_free_test (const char *filename, int format, unsigned int chunk_size)
|
||||
{ SNDFILE * file ;
|
||||
SF_INFO sfinfo ;
|
||||
SF_CHUNK_INFO chunk_info ;
|
||||
|
@ -239,9 +239,9 @@ float_norm_test (const char *filename)
|
||||
|
||||
/* Create float_data with all values being less than 1.0. */
|
||||
for (k = 0 ; k < BUFFER_LEN / 2 ; k++)
|
||||
float_data [k] = (k + 5) / (2.0 * BUFFER_LEN) ;
|
||||
float_data [k] = (k + 5) / (2.0f * BUFFER_LEN) ;
|
||||
for (k = BUFFER_LEN / 2 ; k < BUFFER_LEN ; k++)
|
||||
float_data [k] = (k + 5) ;
|
||||
float_data [k] = (float) (k + 5) ;
|
||||
|
||||
if (! (file = sf_open (filename, SFM_WRITE, &sfinfo)))
|
||||
{ printf ("Line %d: sf_open_write failed with error : ", __LINE__) ;
|
||||
@ -252,7 +252,7 @@ float_norm_test (const char *filename)
|
||||
|
||||
/* Normalisation is on by default so no need to do anything here. */
|
||||
|
||||
if ((k = sf_write_float (file, float_data, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
|
||||
if ((k = (unsigned int) sf_write_float (file, float_data, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
|
||||
{ printf ("Line %d: sf_write_float failed with short write (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -260,7 +260,7 @@ float_norm_test (const char *filename)
|
||||
/* Turn normalisation off. */
|
||||
sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
|
||||
|
||||
if ((k = sf_write_float (file, float_data + BUFFER_LEN / 2, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
|
||||
if ((k = (unsigned int) sf_write_float (file, float_data + BUFFER_LEN / 2, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
|
||||
{ printf ("Line %d: sf_write_float failed with short write (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -291,7 +291,7 @@ float_norm_test (const char *filename)
|
||||
} ;
|
||||
|
||||
/* Read float_data and check that it is normalised (ie default). */
|
||||
if ((k = sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
if ((k = (unsigned int) sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: sf_read_float failed with short read (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -306,7 +306,7 @@ float_norm_test (const char *filename)
|
||||
sf_seek (file, 0, SEEK_SET) ;
|
||||
sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
|
||||
|
||||
if ((k = sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
if ((k = (unsigned int) sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: sf_read_float failed with short read (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -321,7 +321,7 @@ float_norm_test (const char *filename)
|
||||
sf_seek (file, 0, SEEK_SET) ;
|
||||
sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_TRUE) ;
|
||||
|
||||
if ((k = sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
if ((k = (unsigned int) sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: sf_read_float failed with short read (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -369,7 +369,7 @@ double_norm_test (const char *filename)
|
||||
/* Normailsation is on by default so no need to do anything here. */
|
||||
/*-sf_command (file, "set-norm-double", "true", 0) ;-*/
|
||||
|
||||
if ((k = sf_write_double (file, double_data, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
|
||||
if ((k = (unsigned int) sf_write_double (file, double_data, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
|
||||
{ printf ("Line %d: sf_write_double failed with short write (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -377,7 +377,7 @@ double_norm_test (const char *filename)
|
||||
/* Turn normalisation off. */
|
||||
sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
|
||||
|
||||
if ((k = sf_write_double (file, double_data + BUFFER_LEN / 2, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
|
||||
if ((k = (unsigned int) sf_write_double (file, double_data + BUFFER_LEN / 2, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
|
||||
{ printf ("Line %d: sf_write_double failed with short write (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -407,7 +407,7 @@ double_norm_test (const char *filename)
|
||||
} ;
|
||||
|
||||
/* Read double_data and check that it is normalised (ie default). */
|
||||
if ((k = sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
if ((k = (unsigned int) sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: sf_read_double failed with short read (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -422,7 +422,7 @@ double_norm_test (const char *filename)
|
||||
sf_seek (file, 0, SEEK_SET) ;
|
||||
sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
|
||||
|
||||
if ((k = sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
if ((k = (unsigned int) sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: sf_read_double failed with short read (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -437,7 +437,7 @@ double_norm_test (const char *filename)
|
||||
sf_seek (file, 0, SEEK_SET) ;
|
||||
sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_TRUE) ;
|
||||
|
||||
if ((k = sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
if ((k = (unsigned int) sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
|
||||
{ printf ("\n\nLine %d: sf_read_double failed with short read (%d ->%d)\n", __LINE__, BUFFER_LEN, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1021,7 +1021,7 @@ cue_test_var (const char *filename, int filetype, int count)
|
||||
sfinfo.channels = 1 ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
if (sf_command (file, SFC_SET_CUE, write_cue, cues_size) == SF_FALSE)
|
||||
if (sf_command (file, SFC_SET_CUE, write_cue, (int) cues_size) == SF_FALSE)
|
||||
{ printf ("\n\nLine %d : sf_command (SFC_SET_CUE) failed with %d cues, datasize %zu --> error: %s\n\n", __LINE__, count, cues_size, sf_strerror (file)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1032,7 +1032,7 @@ cue_test_var (const char *filename, int filetype, int count)
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
|
||||
if (sf_command (file, SFC_GET_CUE, read_cue, cues_size) == SF_FALSE)
|
||||
if (sf_command (file, SFC_GET_CUE, read_cue, (int) cues_size) == SF_FALSE)
|
||||
{ printf ("\n\nLine %d : sf_command (SFC_GET_CUE) failed with %d cues, datasize %zu --> error: %s\n\n", __LINE__, count, cues_size, sf_strerror (file)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1351,7 +1351,7 @@ broadcast_coding_history_test (const char *filename)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
bc_write.coding_history_size = strlen (supplied_history) ;
|
||||
bc_write.coding_history_size = (uint32_t) strlen (supplied_history) ;
|
||||
bc_write.coding_history_size = snprintf (bc_write.coding_history, sizeof (bc_write.coding_history), "%s", supplied_history) ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
@ -1423,7 +1423,7 @@ broadcast_coding_history_size (const char *filename)
|
||||
for (k = 0 ; bc_write.coding_history_size < 512 ; k++)
|
||||
{ snprintf (bc_write.coding_history + bc_write.coding_history_size,
|
||||
sizeof (bc_write.coding_history) - bc_write.coding_history_size, "line %4d\n", k) ;
|
||||
bc_write.coding_history_size = strlen (bc_write.coding_history) ;
|
||||
bc_write.coding_history_size = (uint32_t) strlen (bc_write.coding_history) ;
|
||||
} ;
|
||||
|
||||
exit_if_true (bc_write.coding_history_size < 512,
|
||||
@ -1493,7 +1493,7 @@ cart_test (const char *filename, int filetype)
|
||||
ca_write.level_reference = 42 ;
|
||||
snprintf (ca_write.url, sizeof (ca_write.url), "http://www.test.com/test_url") ;
|
||||
snprintf (ca_write.tag_text, sizeof (ca_write.tag_text), "tag text test! \r\n") ; // must be terminated \r\n to be valid
|
||||
ca_write.tag_text_size = strlen (ca_write.tag_text) ;
|
||||
ca_write.tag_text_size = (uint32_t) strlen (ca_write.tag_text) ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
if (sf_command (file, SFC_SET_CART_INFO, &ca_write, sizeof (ca_write)) == SF_FALSE)
|
||||
@ -1652,7 +1652,7 @@ cart_rdwr_test (const char *filename, int filetype)
|
||||
cinfo.level_reference = 42 ;
|
||||
snprintf (cinfo.url, sizeof (cinfo.url), "http://www.test.com/test_url") ;
|
||||
snprintf (cinfo.tag_text, sizeof (cinfo.tag_text), "tag text test!\r\n") ;
|
||||
cinfo.tag_text_size = strlen (cinfo.tag_text) ;
|
||||
cinfo.tag_text_size = (uint32_t) strlen (cinfo.tag_text) ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
frames = sfinfo.frames ;
|
||||
|
@ -102,7 +102,7 @@ vorbis_test (void)
|
||||
sf_close (file) ;
|
||||
|
||||
for (k = 0 ; k < ARRAY_LEN (float_data) ; k ++)
|
||||
max_abs = max_float (max_abs, fabs (float_data [k])) ;
|
||||
max_abs = max_float (max_abs, fabsf (float_data [k])) ;
|
||||
|
||||
exit_if_true (max_abs > 1.023,
|
||||
"\n\nLine %d : max_abs %f should be < 1.023.\n\n", __LINE__, max_abs) ;
|
||||
@ -160,8 +160,8 @@ compression_size_test (int format, const char * filename)
|
||||
sf_close (q3_file) ;
|
||||
sf_close (q6_file) ;
|
||||
|
||||
q3_size = file_length (q3_fname) ;
|
||||
q6_size = file_length (q6_fname) ;
|
||||
q3_size = (int) file_length (q3_fname) ;
|
||||
q6_size = (int) file_length (q6_fname) ;
|
||||
|
||||
exit_if_true (q3_size >= q6_size,
|
||||
"\n\nLine %d : q3 size (%d) >= q6 size (%d)\n\n", __LINE__, q3_size, q6_size) ;
|
||||
|
@ -86,7 +86,7 @@ dwvw_test (const char *filename, int format, int bit_width)
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
|
||||
if ((k = sf_read_int (file, read_buf, BUFFER_SIZE)) != BUFFER_SIZE)
|
||||
if ((k = (int) sf_read_int (file, read_buf, BUFFER_SIZE)) != BUFFER_SIZE)
|
||||
{ printf ("Error (line %d) : Only read %d/%d.frames.\n", __LINE__, k, BUFFER_SIZE) ;
|
||||
exit (1) ;
|
||||
}
|
||||
|
@ -39,10 +39,10 @@ generate_file (const char * filename, int format, int len)
|
||||
|
||||
output = calloc (len, sizeof (float)) ;
|
||||
|
||||
maxabs = crappy_snare (output, len, 0, 0.95, maxabs) ;
|
||||
maxabs = crappy_snare (output, len, len / 4, 0.85, maxabs) ;
|
||||
maxabs = crappy_snare (output, len, 2 * len / 4, 0.85, maxabs) ;
|
||||
crappy_snare (output, len, 3 * len / 4, 0.85, maxabs) ;
|
||||
maxabs = crappy_snare (output, len, 0, 0.95f, maxabs) ;
|
||||
maxabs = crappy_snare (output, len, len / 4, 0.85f, maxabs) ;
|
||||
maxabs = crappy_snare (output, len, 2 * len / 4, 0.85f, maxabs) ;
|
||||
crappy_snare (output, len, 3 * len / 4, 0.85f, maxabs) ;
|
||||
|
||||
write_mono_file (filename, format, 44100, output, len) ;
|
||||
|
||||
@ -51,24 +51,24 @@ generate_file (const char * filename, int format, int len)
|
||||
|
||||
static inline float
|
||||
rand_float (void)
|
||||
{ return rand () / (0.5 * RAND_MAX) - 1.0 ;
|
||||
{ return rand () / (0.5f * RAND_MAX) - 1.0f ;
|
||||
} /* rand_float */
|
||||
|
||||
static float
|
||||
crappy_snare (float *output, int len, int offset, float gain, float maxabs)
|
||||
{ int k ;
|
||||
float env = 0.0 ;
|
||||
float env = 0.0f ;
|
||||
|
||||
for (k = offset ; k < len && env < gain ; k++)
|
||||
{ env += 0.03 ;
|
||||
{ env += 0.03f ;
|
||||
output [k] += env * rand_float () ;
|
||||
maxabs = SF_MAX (maxabs, fabs (output [k])) ;
|
||||
maxabs = SF_MAX (maxabs, fabsf (output [k])) ;
|
||||
} ;
|
||||
|
||||
for ( ; k < len && env > 1e-8 ; k++)
|
||||
{ env *= 0.995 ;
|
||||
{ env *= 0.995f ;
|
||||
output [k] += env * rand_float () ;
|
||||
maxabs = SF_MAX (maxabs, fabs (output [k])) ;
|
||||
maxabs = SF_MAX (maxabs, fabsf (output [k])) ;
|
||||
} ;
|
||||
|
||||
return maxabs ;
|
||||
|
@ -74,7 +74,7 @@ headerless_test (const char * filename, int format, int expected)
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
|
||||
if ((k = sf_write_short (file, buffer, BUFFER_SIZE)) != BUFFER_SIZE)
|
||||
if ((k = (int) sf_write_short (file, buffer, BUFFER_SIZE)) != BUFFER_SIZE)
|
||||
{ printf ("Line %d: sf_write_short failed with short write (%d => %d).\n", __LINE__, BUFFER_SIZE, k) ;
|
||||
fflush (stdout) ;
|
||||
puts (sf_strerror (file)) ;
|
||||
@ -135,7 +135,7 @@ old_test (void)
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
|
||||
if ((k = sf_write_short (file, buffer, BUFFER_SIZE)) != BUFFER_SIZE)
|
||||
if ((k = (int) sf_write_short (file, buffer, BUFFER_SIZE)) != BUFFER_SIZE)
|
||||
{ printf ("Line %d: sf_write_short failed with short write (%d => %d).\n", __LINE__, BUFFER_SIZE, k) ;
|
||||
fflush (stdout) ;
|
||||
puts (sf_strerror (file)) ;
|
||||
@ -168,7 +168,7 @@ old_test (void)
|
||||
|
||||
check_log_buffer_or_die (file, __LINE__) ;
|
||||
|
||||
if ((k = sf_read_short (file, buffer, BUFFER_SIZE)) != BUFFER_SIZE)
|
||||
if ((k = (int) sf_read_short (file, buffer, BUFFER_SIZE)) != BUFFER_SIZE)
|
||||
{ printf ("Line %d: short read (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
@ -66,7 +66,7 @@ main (int argc, char *argv [])
|
||||
{ int value = k / 32 ;
|
||||
int_data [k] = (value & 1 ? -1 : 1) * value ;
|
||||
short_data [k] = int_data [k] ;
|
||||
float_data [k] = int_data [k] / 32000.0 ;
|
||||
float_data [k] = int_data [k] / 32000.0f ;
|
||||
double_data [k] = int_data [k] / 32000.0 ;
|
||||
}
|
||||
|
||||
|
@ -661,7 +661,7 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
data = data_buffer.s ;
|
||||
orig = orig_buffer.s ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, (int) datalen) ;
|
||||
for (k = 0 ; k < channels * datalen ; k++)
|
||||
orig [k] = (short) (orig_buffer.d [k]) ;
|
||||
|
||||
@ -712,7 +712,7 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
{ if (error_function (data [k], orig [k], margin))
|
||||
{ printf ("\n\nLine %d: Incorrect sample A (#%d : %d should be %d).\n", __LINE__, k, data [k], orig [k]) ;
|
||||
oct_save_short (orig, data, datalen) ;
|
||||
oct_save_short (orig, data, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
half_max_abs = LCT_MAX (half_max_abs, abs (data [k] / 2)) ;
|
||||
@ -723,7 +723,7 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_short (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
if ((k = (int) sf_readf_short (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__,
|
||||
channels * sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
@ -747,7 +747,7 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
|
||||
/* Now test sf_seek function. */
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -768,7 +768,7 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
seekpos = BUFFER_SIZE / 10 ;
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -780,23 +780,23 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
test_readf_short_or_die (file, 0, data, 1, __LINE__) ;
|
||||
if (error_function (1.0 * data [0], 1.0 * orig [seekpos * channels], margin) || k != seekpos)
|
||||
{ printf ("\n\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_short failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
|
||||
oct_save_short (orig, data, datalen) ;
|
||||
oct_save_short (orig, data, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
/* Check seek backward from current position. */
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
k = (int) sf_seek (file, -20, SEEK_CUR) ;
|
||||
test_readf_short_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_short failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
|
||||
@ -806,13 +806,13 @@ lcomp_test_short (const char *filename, int filetype, int channels, double margi
|
||||
/* Check that read past end of file returns number of items. */
|
||||
sf_seek (file, sfinfo.frames, SEEK_SET) ;
|
||||
|
||||
if ((k = sf_readf_short (file, data, datalen)) != 0)
|
||||
if ((k = (int) sf_readf_short (file, data, datalen)) != 0)
|
||||
{ printf ("\n\nLine %d: Return value from sf_readf_short past end of file incorrect (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Check seek backward from end. */
|
||||
if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -858,7 +858,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
data = data_buffer.i ;
|
||||
orig = orig_buffer.i ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, max_val, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, max_val, channels, (int) datalen) ;
|
||||
|
||||
for (k = 0 ; k < channels * datalen ; k++)
|
||||
orig [k] = lrint (orig_buffer.d [k]) ;
|
||||
@ -910,7 +910,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
{ if (error_function (data [k] / scale, orig [k] / scale, margin))
|
||||
{ printf ("\nLine %d: Incorrect sample (#%d : %f should be %f).\n", __LINE__, k, data [k] / scale, orig [k] / scale) ;
|
||||
oct_save_int (orig, data, datalen) ;
|
||||
oct_save_int (orig, data, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
half_max_abs = LCT_MAX (half_max_abs, abs (data [k] / 2)) ;
|
||||
@ -921,7 +921,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
if ((k = (int) sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__,
|
||||
channels * sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
@ -946,7 +946,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
|
||||
/* Now test sf_seek function. */
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -967,7 +967,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
seekpos = BUFFER_SIZE / 10 ;
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %" PRId64 " failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -979,13 +979,13 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != 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) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
k = (int) 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, %" PRId64 ").\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
|
||||
@ -994,7 +994,7 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
/* Check seek backward from current position. */
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
k = (int) 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, %" PRId64 ").\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
|
||||
@ -1004,13 +1004,13 @@ lcomp_test_int (const char *filename, int filetype, int channels, double margin)
|
||||
/* Check that read past end of file returns number of items. */
|
||||
sf_seek (file, sfinfo.frames, SEEK_SET) ;
|
||||
|
||||
if ((k = sf_readf_int (file, data, datalen)) != 0)
|
||||
if ((k = (int) sf_readf_int (file, data, datalen)) != 0)
|
||||
{ printf ("\n\nLine %d: Return value from sf_readf_int past end of file incorrect (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Check seek backward from end. */
|
||||
if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1047,9 +1047,9 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
data = data_buffer.f ;
|
||||
orig = orig_buffer.f ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, (int) datalen) ;
|
||||
for (k = 0 ; k < channels * datalen ; k++)
|
||||
orig [k] = orig_buffer.d [k] ;
|
||||
orig [k] = (float) orig_buffer.d [k] ;
|
||||
|
||||
sfinfo.samplerate = SAMPLE_RATE ;
|
||||
sfinfo.frames = 123456789 ; /* Ridiculous value. */
|
||||
@ -1105,7 +1105,7 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
{ if (error_function (data [k], orig [k], margin))
|
||||
{ printf ("\nLine %d: Incorrect sample A (#%d : %f should be %f).\n", __LINE__, k, data [k], orig [k]) ;
|
||||
oct_save_float (orig, data, datalen) ;
|
||||
oct_save_float (orig, data, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
half_max_abs = LCT_MAX (half_max_abs, fabs (0.5 * data [k])) ;
|
||||
@ -1116,7 +1116,7 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_float (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
if ((k = (int) sf_readf_float (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__,
|
||||
channels * sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
@ -1141,7 +1141,7 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
|
||||
/* Now test sf_seek function. */
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1162,7 +1162,7 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
seekpos = BUFFER_SIZE / 10 ;
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1174,22 +1174,22 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
|
||||
if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_float failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
/* Check seek backward from current position. */
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
k = (int) sf_seek (file, -20, SEEK_CUR) ;
|
||||
test_readf_float_or_die (file, 0, data, 1, __LINE__) ;
|
||||
if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_float failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
|
||||
@ -1199,13 +1199,13 @@ lcomp_test_float (const char *filename, int filetype, int channels, double margi
|
||||
/* Check that read past end of file returns number of items. */
|
||||
sf_seek (file, sfinfo.frames, SEEK_SET) ;
|
||||
|
||||
if ((k = sf_readf_float (file, data, datalen)) != 0)
|
||||
if ((k = (int) sf_readf_float (file, data, datalen)) != 0)
|
||||
{ printf ("\n\nLine %d: Return value from sf_readf_float past end of file incorrect (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Check seek backward from end. */
|
||||
if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1242,7 +1242,7 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
data = data_buffer.d ;
|
||||
orig = orig_buffer.d ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, (int) datalen) ;
|
||||
for (k = 0 ; k < channels * datalen ; k++)
|
||||
orig [k] = orig_buffer.d [k] ;
|
||||
|
||||
@ -1300,7 +1300,7 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
{ if (error_function (data [k], orig [k], margin))
|
||||
{ printf ("\nLine %d: Incorrect sample A (#%d : %f should be %f).\n", __LINE__, k, data [k], orig [k]) ;
|
||||
oct_save_double (orig, data, datalen) ;
|
||||
oct_save_double (orig, data, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
half_max_abs = LCT_MAX (half_max_abs, ABS (0.5 * data [k])) ;
|
||||
@ -1311,7 +1311,7 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_double (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
if ((k = (int) sf_readf_double (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%" PRId64 " should be %d).\n", __LINE__,
|
||||
channels * sfinfo.frames - datalen, k) ;
|
||||
exit (1) ;
|
||||
@ -1336,7 +1336,7 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
|
||||
/* Now test sf_seek function. */
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1357,7 +1357,7 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
seekpos = BUFFER_SIZE / 10 ;
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1369,22 +1369,22 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
|
||||
if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_readf_double failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
/* Check seek backward from current position. */
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
k = (int) sf_seek (file, -20, SEEK_CUR) ;
|
||||
test_readf_double_or_die (file, 0, data, 1, __LINE__) ;
|
||||
if (error_function (data [0], orig [seekpos * channels], margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_readf_double failed (%f, %f) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
|
||||
@ -1394,13 +1394,13 @@ lcomp_test_double (const char *filename, int filetype, int channels, double marg
|
||||
/* Check that read past end of file returns number of items. */
|
||||
sf_seek (file, sfinfo.frames, SEEK_SET) ;
|
||||
|
||||
if ((k = sf_readf_double (file, data, datalen)) != 0)
|
||||
if ((k = (int) sf_readf_double (file, data, datalen)) != 0)
|
||||
{ printf ("\n\nLine %d: Return value from sf_readf_double past end of file incorrect (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Check seek backward from end. */
|
||||
if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1440,9 +1440,9 @@ channels = 1 ;
|
||||
data = data_buffer.s ;
|
||||
smooth = smooth_buffer.s ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, (int) datalen) ;
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
orig [k] = lrint (orig_buffer.d [k]) ;
|
||||
orig [k] = (short) lrint (orig_buffer.d [k]) ;
|
||||
|
||||
sfinfo.samplerate = SAMPLE_RATE ;
|
||||
sfinfo.frames = 123456789 ; /* Ridiculous value. */
|
||||
@ -1522,17 +1522,17 @@ channels = 1 ;
|
||||
test_readf_short_or_die (file, 0, data, datalen, __LINE__) ;
|
||||
|
||||
memcpy (smooth, orig, datalen * sizeof (short)) ;
|
||||
smoothed_diff_short (data, datalen) ;
|
||||
smoothed_diff_short (smooth, datalen) ;
|
||||
smoothed_diff_short (data, (unsigned int) datalen) ;
|
||||
smoothed_diff_short (smooth, (unsigned int) datalen) ;
|
||||
|
||||
half_max_abs = 0.0 ;
|
||||
half_max_abs = 0 ;
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
{ if (error_function (1.0 * data [k], 1.0 * smooth [k], margin))
|
||||
{ printf ("\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, data [k], smooth [k]) ;
|
||||
oct_save_short (orig, smooth, datalen) ;
|
||||
oct_save_short (orig, smooth, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
half_max_abs = LCT_MAX (half_max_abs, ABS (0.5 * data [k])) ;
|
||||
half_max_abs = (int) (LCT_MAX (half_max_abs, ABS (0.5 * data [k]))) ;
|
||||
} ;
|
||||
|
||||
if (half_max_abs < 1)
|
||||
@ -1540,7 +1540,7 @@ channels = 1 ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_read_short (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
if ((k = (int) sf_read_short (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %" PRId64 ").\n", __LINE__, k, sfinfo.frames - datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1555,7 +1555,7 @@ channels = 1 ;
|
||||
|
||||
/* Now test sf_seek function. */
|
||||
if (sfinfo.seekable)
|
||||
{ if ((k = sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1563,9 +1563,9 @@ channels = 1 ;
|
||||
for (m = 0 ; m < 3 ; m++)
|
||||
{ test_readf_short_or_die (file, m, data, datalen / 7, __LINE__) ;
|
||||
|
||||
smoothed_diff_short (data, datalen / 7) ;
|
||||
smoothed_diff_short (data, (unsigned int) (datalen / 7)) ;
|
||||
memcpy (smooth, orig + m * datalen / 7, datalen / 7 * sizeof (short)) ;
|
||||
smoothed_diff_short (smooth, datalen / 7) ;
|
||||
smoothed_diff_short (smooth, (unsigned int) (datalen / 7)) ;
|
||||
|
||||
for (k = 0 ; k < datalen / 7 ; k++)
|
||||
if (error_function (1.0 * data [k], 1.0 * smooth [k], margin))
|
||||
@ -1580,7 +1580,7 @@ channels = 1 ;
|
||||
seekpos = BUFFER_SIZE / 10 ;
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1591,22 +1591,22 @@ channels = 1 ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
test_readf_short_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_read_short failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
/* Check seek backward from current position. */
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
k = (int) sf_seek (file, -20, SEEK_CUR) ;
|
||||
test_readf_short_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_read_short failed (%d, %d) (%d, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
|
||||
@ -1616,14 +1616,14 @@ channels = 1 ;
|
||||
/* Check that read past end of file returns number of items. */
|
||||
sf_seek (file, sfinfo.frames, SEEK_SET) ;
|
||||
|
||||
if ((k = sf_read_short (file, data, datalen)) != 0)
|
||||
if ((k = (int) sf_read_short (file, data, datalen)) != 0)
|
||||
{ printf ("\n\nLine %d: Return value from sf_read_short past end of file incorrect (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Check seek backward from end. */
|
||||
|
||||
if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1662,7 +1662,7 @@ channels = 1 ;
|
||||
data = data_buffer.i ;
|
||||
smooth = smooth_buffer.i ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, 32000.0 * scale, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, 32000.0 * scale, channels, (int) datalen) ;
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
orig [k] = lrint (orig_buffer.d [k]) ;
|
||||
|
||||
@ -1740,14 +1740,14 @@ channels = 1 ;
|
||||
test_readf_int_or_die (file, 0, data, datalen, __LINE__) ;
|
||||
|
||||
memcpy (smooth, orig, datalen * sizeof (int)) ;
|
||||
smoothed_diff_int (data, datalen) ;
|
||||
smoothed_diff_int (smooth, datalen) ;
|
||||
smoothed_diff_int (data, (unsigned int) datalen) ;
|
||||
smoothed_diff_int (smooth, (unsigned int) datalen) ;
|
||||
|
||||
half_max_abs = abs (data [0] >> 16) ;
|
||||
for (k = 1 ; k < datalen ; k++)
|
||||
{ if (error_function (data [k] / scale, smooth [k] / scale, margin))
|
||||
{ printf ("\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, data [k], smooth [k]) ;
|
||||
oct_save_int (orig, smooth, datalen) ;
|
||||
oct_save_int (orig, smooth, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
half_max_abs = LCT_MAX (half_max_abs, abs (data [k] / 2)) ;
|
||||
@ -1758,7 +1758,7 @@ channels = 1 ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
if ((k = (int) sf_readf_int (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %" PRId64 ").\n", __LINE__, k, sfinfo.frames - datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1779,7 +1779,7 @@ channels = 1 ;
|
||||
|
||||
/* Now test sf_seek function. */
|
||||
if (sfinfo.seekable)
|
||||
{ if ((k = sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1787,9 +1787,9 @@ channels = 1 ;
|
||||
for (m = 0 ; m < 3 ; m++)
|
||||
{ test_readf_int_or_die (file, m, data, datalen / 7, __LINE__) ;
|
||||
|
||||
smoothed_diff_int (data, datalen / 7) ;
|
||||
smoothed_diff_int (data, (unsigned int) (datalen / 7)) ;
|
||||
memcpy (smooth, orig + m * datalen / 7, datalen / 7 * sizeof (int)) ;
|
||||
smoothed_diff_int (smooth, datalen / 7) ;
|
||||
smoothed_diff_int (smooth, (unsigned int) (datalen / 7)) ;
|
||||
|
||||
for (k = 0 ; k < datalen / 7 ; k++)
|
||||
if (error_function (data [k] / scale, smooth [k] / scale, margin))
|
||||
@ -1804,7 +1804,7 @@ channels = 1 ;
|
||||
seekpos = BUFFER_SIZE / 10 ;
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1815,22 +1815,22 @@ channels = 1 ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = (int) 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, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
/* Check seek backward from current position. */
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
k = (int) 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, %d).\n", __LINE__, data [0], orig [seekpos * channels], k, seekpos) ;
|
||||
@ -1840,14 +1840,14 @@ channels = 1 ;
|
||||
/* Check that read past end of file returns number of items. */
|
||||
sf_seek (file, sfinfo.frames, SEEK_SET) ;
|
||||
|
||||
if ((k = sf_readf_int (file, data, datalen)) != 0)
|
||||
if ((k = (int) sf_readf_int (file, data, datalen)) != 0)
|
||||
{ printf ("\n\nLine %d: Return value from sf_readf_int past end of file incorrect (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Check seek backward from end. */
|
||||
|
||||
if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -1908,9 +1908,9 @@ channels = 1 ;
|
||||
data = data_buffer.f ;
|
||||
smooth = smooth_buffer.f ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, 32000.0 / scale, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, 32000.0 / scale, channels, (int) datalen) ;
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
orig [k] = orig_buffer.d [k] ;
|
||||
orig [k] = (float) orig_buffer.d [k] ;
|
||||
|
||||
sfinfo.samplerate = SAMPLE_RATE ;
|
||||
sfinfo.frames = 123456789 ; /* Ridiculous value. */
|
||||
@ -1992,14 +1992,14 @@ channels = 1 ;
|
||||
test_read_float_or_die (file, 0, data, datalen, __LINE__) ;
|
||||
|
||||
memcpy (smooth, orig, datalen * sizeof (float)) ;
|
||||
smoothed_diff_float (data, datalen) ;
|
||||
smoothed_diff_float (smooth, datalen) ;
|
||||
smoothed_diff_float (data, (unsigned int) datalen) ;
|
||||
smoothed_diff_float (smooth, (unsigned int) datalen) ;
|
||||
|
||||
half_max_abs = fabs (data [0]) ;
|
||||
for (k = 1 ; k < datalen ; k++)
|
||||
{ if (error_function (data [k] * scale, smooth [k] * scale, margin))
|
||||
{ printf ("\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, (int) (data [k] * scale), (int) (smooth [k] * scale)) ;
|
||||
oct_save_float (orig, smooth, datalen) ;
|
||||
oct_save_float (orig, smooth, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
half_max_abs = LCT_MAX (half_max_abs, ABS (0.5 * data [k] * scale)) ;
|
||||
@ -2011,7 +2011,7 @@ channels = 1 ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_read_float (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
if ((k = (int) sf_read_float (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %" PRId64 ").\n", __LINE__, k, sfinfo.frames - datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -2026,7 +2026,7 @@ channels = 1 ;
|
||||
|
||||
/* Now test sf_seek function. */
|
||||
if (sfinfo.seekable)
|
||||
{ if ((k = sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -2034,9 +2034,9 @@ channels = 1 ;
|
||||
for (m = 0 ; m < 3 ; m++)
|
||||
{ test_read_float_or_die (file, 0, data, datalen / 7, __LINE__) ;
|
||||
|
||||
smoothed_diff_float (data, datalen / 7) ;
|
||||
smoothed_diff_float (data, (unsigned int) (datalen / 7)) ;
|
||||
memcpy (smooth, orig + m * datalen / 7, datalen / 7 * sizeof (float)) ;
|
||||
smoothed_diff_float (smooth, datalen / 7) ;
|
||||
smoothed_diff_float (smooth, (unsigned int) (datalen / 7)) ;
|
||||
|
||||
for (k = 0 ; k < datalen / 7 ; k++)
|
||||
if (error_function (data [k] * scale, smooth [k] * scale, margin))
|
||||
@ -2051,7 +2051,7 @@ channels = 1 ;
|
||||
seekpos = BUFFER_SIZE / 10 ;
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -2062,22 +2062,22 @@ channels = 1 ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
test_read_float_or_die (file, 0, data, channels, __LINE__) ;
|
||||
if (error_function (data [0] * scale, orig [seekpos * channels] * scale, margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_read_float failed (%d, %d) (%d, %d).\n", __LINE__, (int) (data [0] * scale), (int) (orig [seekpos * channels] * scale), k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
/* Check seek backward from current position. */
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
k = (int) sf_seek (file, -20, SEEK_CUR) ;
|
||||
test_read_float_or_die (file, 0, data, channels, __LINE__) ;
|
||||
if (error_function (data [0] * scale, orig [seekpos * channels] * scale, margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_read_float failed (%d, %d) (%d, %d).\n", __LINE__, (int) (data [0] * scale), (int) (orig [seekpos * channels] * scale), k, seekpos) ;
|
||||
@ -2087,14 +2087,14 @@ channels = 1 ;
|
||||
/* Check that read past end of file returns number of items. */
|
||||
sf_seek (file, sfinfo.frames, SEEK_SET) ;
|
||||
|
||||
if ((k = sf_read_float (file, data, datalen)) != 0)
|
||||
if ((k = (int) sf_read_float (file, data, datalen)) != 0)
|
||||
{ printf ("\n\nLine %d: Return value from sf_read_float past end of file incorrect (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Check seek backward from end. */
|
||||
|
||||
if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -2154,7 +2154,7 @@ channels = 1 ;
|
||||
data = data_buffer.d ;
|
||||
smooth = smooth_buffer.d ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, 32000.0 / scale, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, 32000.0 / scale, channels, (int) datalen) ;
|
||||
|
||||
sfinfo.samplerate = SAMPLE_RATE ;
|
||||
sfinfo.frames = 123456789 ; /* Ridiculous value. */
|
||||
@ -2237,14 +2237,14 @@ channels = 1 ;
|
||||
test_read_double_or_die (file, 0, data, datalen, __LINE__) ;
|
||||
|
||||
memcpy (smooth, orig, datalen * sizeof (double)) ;
|
||||
smoothed_diff_double (data, datalen) ;
|
||||
smoothed_diff_double (smooth, datalen) ;
|
||||
smoothed_diff_double (data, (unsigned int) datalen) ;
|
||||
smoothed_diff_double (smooth, (unsigned int) datalen) ;
|
||||
|
||||
half_max_abs = 0.0 ;
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
{ if (error_function (data [k] * scale, smooth [k] * scale, margin))
|
||||
{ printf ("\n\nLine %d: Incorrect sample (#%d : %d should be %d).\n", __LINE__, k, (int) (data [k] * scale), (int) (smooth [k] * scale)) ;
|
||||
oct_save_double (orig, smooth, datalen) ;
|
||||
oct_save_double (orig, smooth, (int) datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
half_max_abs = LCT_MAX (half_max_abs, 0.5 * fabs (data [k] * scale)) ;
|
||||
@ -2255,7 +2255,7 @@ channels = 1 ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_read_double (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
if ((k = (int) sf_read_double (file, data, datalen)) != sfinfo.frames - datalen)
|
||||
{ printf ("\n\nLine %d: Incorrect read length (%d should be %" PRId64 ").\n", __LINE__, k, sfinfo.frames - datalen) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -2270,7 +2270,7 @@ channels = 1 ;
|
||||
|
||||
/* Now test sf_seek function. */
|
||||
if (sfinfo.seekable)
|
||||
{ if ((k = sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ if ((k = (int) sf_seek (file, 0, SEEK_SET)) != 0)
|
||||
{ printf ("\n\nLine %d: Seek to start of file failed (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -2278,9 +2278,9 @@ channels = 1 ;
|
||||
for (m = 0 ; m < 3 ; m++)
|
||||
{ test_read_double_or_die (file, m, data, datalen / 7, __LINE__) ;
|
||||
|
||||
smoothed_diff_double (data, datalen / 7) ;
|
||||
smoothed_diff_double (data, (unsigned int) (datalen / 7)) ;
|
||||
memcpy (smooth, orig + m * datalen / 7, datalen / 7 * sizeof (double)) ;
|
||||
smoothed_diff_double (smooth, datalen / 7) ;
|
||||
smoothed_diff_double (smooth, (unsigned int) (datalen / 7)) ;
|
||||
|
||||
for (k = 0 ; k < datalen / 7 ; k++)
|
||||
if (error_function (data [k] * scale, smooth [k] * scale, margin))
|
||||
@ -2295,7 +2295,7 @@ channels = 1 ;
|
||||
seekpos = BUFFER_SIZE / 10 ;
|
||||
|
||||
/* Check seek from start of file. */
|
||||
if ((k = sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
if ((k = (int) sf_seek (file, seekpos, SEEK_SET)) != seekpos)
|
||||
{ printf ("Seek to start of file + %d failed (%d).\n", seekpos, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -2306,22 +2306,22 @@ channels = 1 ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((k = sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
if ((k = (int) sf_seek (file, 0, SEEK_CUR)) != seekpos + 1)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_CUR) with 0 offset failed (%d should be %d)\n", __LINE__, k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) + BUFFER_SIZE / 5 ;
|
||||
k = (int) sf_seek (file, BUFFER_SIZE / 5, SEEK_CUR) ;
|
||||
test_read_double_or_die (file, 0, data, channels, __LINE__) ;
|
||||
if (error_function (data [0] * scale, orig [seekpos * channels] * scale, margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (forwards, SEEK_CUR) followed by sf_read_double failed (%d, %d) (%d, %d).\n", __LINE__, (int) (data [0] * scale), (int) (orig [seekpos * channels] * scale), k, seekpos + 1) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
seekpos = sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
seekpos = (int) sf_seek (file, 0, SEEK_CUR) - 20 ;
|
||||
/* Check seek backward from current position. */
|
||||
k = sf_seek (file, -20, SEEK_CUR) ;
|
||||
k = (int) sf_seek (file, -20, SEEK_CUR) ;
|
||||
test_read_double_or_die (file, 0, data, channels, __LINE__) ;
|
||||
if (error_function (data [0] * scale, orig [seekpos * channels] * scale, margin) || k != seekpos)
|
||||
{ printf ("\nLine %d: sf_seek (backwards, SEEK_CUR) followed by sf_read_double failed (%d, %d) (%d, %d).\n", __LINE__, (int) (data [0] * scale), (int) (orig [seekpos * channels] * scale), k, seekpos) ;
|
||||
@ -2331,14 +2331,14 @@ channels = 1 ;
|
||||
/* Check that read past end of file returns number of items. */
|
||||
sf_seek (file, sfinfo.frames, SEEK_SET) ;
|
||||
|
||||
if ((k = sf_read_double (file, data, datalen)) != 0)
|
||||
if ((k = (int) sf_read_double (file, data, datalen)) != 0)
|
||||
{ printf ("\n\nLine %d: Return value from sf_read_double past end of file incorrect (%d).\n", __LINE__, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Check seek backward from end. */
|
||||
|
||||
if ((k = sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
if ((k = (int) sf_seek (file, 5 - sfinfo.frames, SEEK_END)) != 5)
|
||||
{ printf ("\n\nLine %d: sf_seek (SEEK_END) returned %d instead of %d.\n", __LINE__, k, 5) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
@ -2372,9 +2372,9 @@ read_raw_test (const char *filename, int filetype, int channels)
|
||||
orig = orig_buffer.s ;
|
||||
data = data_buffer.s ;
|
||||
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ;
|
||||
gen_signal_double (orig_buffer.d, 32000.0, channels, (int) datalen) ;
|
||||
for (k = 0 ; k < datalen ; k++)
|
||||
orig [k] = lrint (orig_buffer.d [k]) ;
|
||||
orig [k] = (short) lrint (orig_buffer.d [k]) ;
|
||||
|
||||
sfinfo.samplerate = SAMPLE_RATE ;
|
||||
sfinfo.frames = 123456789 ; /* Ridiculous value. */
|
||||
@ -2533,7 +2533,7 @@ smoothed_diff_float (float *data, unsigned int datalen)
|
||||
|
||||
/* Calculate the smoothed sample-to-sample difference. */
|
||||
for (k = 0 ; k < datalen - 1 ; k++)
|
||||
{ memory = 0.7 * memory + (1 - 0.7) * (data [k+1] - data [k]) ;
|
||||
{ memory = (float) (0.7 * memory + (1 - 0.7) * (data [k+1] - data [k])) ;
|
||||
data [k] = memory ;
|
||||
} ;
|
||||
data [datalen-1] = data [datalen-2] ;
|
||||
|
@ -161,7 +161,7 @@ multi_file_test (const char *filename, int *formats, int format_count)
|
||||
printf ("This offset : %" PRId64 "\n", embed_info.offset + embed_info.length) ;
|
||||
} ;
|
||||
|
||||
if (lseek (fd, embed_info.offset + embed_info.length, SEEK_SET) < 0)
|
||||
if (lseek (fd, (long) (embed_info.offset + embed_info.length), SEEK_SET) < 0)
|
||||
{ printf ("\n\nLine %d: lseek failed : %s\n", __LINE__, strerror (errno)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
@ -62,7 +62,7 @@ ogg_opus_short_test (void)
|
||||
|
||||
/* Convert to short. */
|
||||
for (k = 0 ; k < ARRAY_LEN (data_out.s) ; k++)
|
||||
data_out.s [k] = lrintf (data_out.f [k]) ;
|
||||
data_out.s [k] = (short) lrintf (data_out.f [k]) ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
|
@ -62,7 +62,7 @@ ogg_short_test (void)
|
||||
|
||||
/* Convert to shorteger. */
|
||||
for (k = 0 ; k < ARRAY_LEN (data_out.s) ; k++)
|
||||
data_out.s [k] = lrintf (data_out.f [k]) ;
|
||||
data_out.s [k] = (short) lrintf (data_out.f [k]) ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
|
@ -185,7 +185,7 @@ stdin_test (int typemajor, int count)
|
||||
} ;
|
||||
|
||||
total = 0 ;
|
||||
while ((k = sf_read_short (file, data + total, BUFFER_LEN - total)) > 0)
|
||||
while ((k = (int) sf_read_short (file, data + total, BUFFER_LEN - total)) > 0)
|
||||
total += k ;
|
||||
|
||||
if (total != count)
|
||||
|
@ -155,7 +155,7 @@ stdout_test (int typemajor, int count)
|
||||
|
||||
while (total < count)
|
||||
{ this_write = (count - total > 1024) ? 1024 : count - total ;
|
||||
if ((k = sf_write_short (file, data + total, this_write)) != this_write)
|
||||
if ((k = (int) sf_write_short (file, data + total, this_write)) != this_write)
|
||||
{ fprintf (stderr, "sf_write_short # %d failed with short write (%d -> %d)\n", count, this_write, k) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
@ -216,7 +216,7 @@ vio_test (const char *fname, int format)
|
||||
fflush (stdout) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
|
||||
dump_data_to_file (fname, vio_data.data, vio_data.length) ;
|
||||
dump_data_to_file (fname, vio_data.data, (unsigned int) vio_data.length) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user