This commit is contained in:
Erik de Castro Lopo 2007-04-16 23:47:37 +10:00
commit bb59db8135
5 changed files with 15 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2007-04-16 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/double64.c
Fix clipping of double to short conversions on 64 bit systems.
* src/flac.c regtest/database.c tests/cpp_test.cc
Fix compile warnings for 64 bit systems.
2007-04-15 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/wav.c src/wav_w64.c

View File

@ -185,8 +185,8 @@ db_add_file (REG_DB * db_handle, const char * filepath)
snprintf (db->cmdbuf, sizeof (db->cmdbuf), "insert into sndfile "
"(fname, fpath, srate, frames, channels, format, checksum, logbuf) values"
"('%s','%s',%d,'%lld', %d, '0x%08x', '0x%08x', '%s');",
db->filename, db->pathname, info.samplerate, info.frames, info.channels, info.format, checksum, db->logbuf) ;
"('%s','%s',%d,'%ld', %d, '0x%08x', '0x%08x', '%s');",
db->filename, db->pathname, info.samplerate, (long) info.frames, info.channels, info.format, checksum, db->logbuf) ;
if (strlen (db->cmdbuf) >= sizeof (db->cmdbuf) - 1)
{ printf ("strlen (db->cmdbuf) too long.\n") ;
@ -368,7 +368,7 @@ check_file_by_ekey (REGTEST_DB * db, int ekey)
if (strcmp (result [k], "frames") == 0)
{ if (strtoll (result [k + cols], NULL, 10) == info.frames)
continue ;
printf ("\n\nError : frames doesn't match : %s == %lld\n", result [k + cols], info.frames) ;
printf ("\n\nError : frames doesn't match : %s == %ld\n", result [k + cols], (long) info.frames) ;
} ;
if (strcmp (result [k], "channels") == 0)

View File

@ -493,7 +493,7 @@ d2s_clip_array (const double *src, int count, short *dest, double scale)
if (CPU_CLIPS_POSITIVE == 0 && tmp > 32767.0)
dest [count] = SHRT_MAX ;
else if (CPU_CLIPS_NEGATIVE == 0 && tmp < 32768.0)
else if (CPU_CLIPS_NEGATIVE == 0 && tmp < -32768.0)
dest [count] = SHRT_MIN ;
else
dest [count] = lrint (tmp) ;

View File

@ -422,7 +422,7 @@ static FLAC__StreamEncoderWriteStatus
sf_flac_enc_write_callback (const FLAC__StreamEncoder * UNUSED (encoder), const FLAC__byte buffer [], size_t bytes, unsigned UNUSED (samples), unsigned UNUSED (current_frame), void *client_data)
{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ;
if (psf_fwrite (buffer, 1, bytes, psf) == bytes && psf->error == 0)
if (psf_fwrite (buffer, 1, bytes, psf) == (sf_count_t) bytes && psf->error == 0)
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK ;
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR ;

View File

@ -123,8 +123,8 @@ read_file (const char * filename, int format)
} ;
if (file.frames () != ARRAY_LEN (sbuffer) * 4)
{ printf ("\n\n%s %d : Error : frames %ld should be %u.\n\n", __func__, __LINE__,
SF_COUNT_TO_LONG (file.frames ()), ARRAY_LEN (sbuffer) * 4 / 2) ;
{ printf ("\n\n%s %d : Error : frames %ld should be %lu.\n\n", __func__, __LINE__,
SF_COUNT_TO_LONG (file.frames ()), (long unsigned int) ARRAY_LEN (sbuffer) * 4 / 2) ;
exit (1) ;
} ;