Fix more signed/unsigned issues.

This commit is contained in:
Erik de Castro Lopo 2006-05-02 13:30:11 +00:00
parent 50823c0383
commit 5c9136b5b9
3 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,7 @@
2006-05-02 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/caf.c src/double64.c examples/sndfile-info.c
* src/caf.c src/double64.c examples/sndfile-info.c tests/virtual_io_test.c
tests/utils.tpl
Fix a couple of signed/unsigned problems.
2006-05-01 Erik de Castro Lopo <erikd AT mega-nerd DOT com>

View File

@ -31,6 +31,7 @@
#define SF_COUNT_TO_LONG(x) ((long) (x))
#define ARRAY_LEN(x) ((int) (sizeof (x)) / (sizeof ((x) [0])))
#define SIGNED_SIZEOF(x) ((int64_t) (sizeof (x)))
#define PIPE_INDEX(x) ((x) + 500)
#define PIPE_TEST_LEN 12345
@ -138,7 +139,6 @@ void test_seek_or_die
#define M_PI 3.14159265358979323846264338
#endif
#define SIGNED_SIZEOF(x) ((int) (sizeof (x)))
#define LOG_BUFFER_SIZE 2048
[+ FOR float_type +]

View File

@ -106,10 +106,10 @@ vfwrite (const void *ptr, sf_count_t count, void *user_data)
** This will break badly for files over 2Gig in length, but
** is sufficient for testing.
*/
if (vf->offset >= sizeof (vf->data))
if (vf->offset >= SIGNED_SIZEOF (vf->data))
return 0 ;
if (vf->offset + count > sizeof (vf->data))
if (vf->offset + count > SIGNED_SIZEOF (vf->data))
count = sizeof (vf->data) - vf->offset ;
memcpy (vf->data + vf->offset, ptr, (size_t) count) ;