ref: 2c06d673b0e7f41d57ca7a0e175b630887ac3575
parent: a5824b582b9501209821871ce9a78b75c19f1cc2
author: robs <robs>
date: Sun Nov 4 17:04:48 EST 2007
Fix spurious 'Premature EOF' message
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,7 @@
o Fix mixer with >4 numbers, and mixer -3 behaving as mixer -4. (robs)
o Fix [1748909] sox does not report remaining playtime of mp3s. (robs)
o Fix failure to read AIFF files with empty MARK chunk. (robs)
+ o Fix spurious 'Premature EOF' message in some circumstances. (robs)
Internal improvements:
--- a/src/soxio.c
+++ b/src/soxio.c
@@ -397,7 +397,7 @@
sox_format_t * ft, ctype *buf, sox_size_t len) \
{ \
sox_size_t n, nread; \
- if ((nread = sox_readbuf(ft, buf, len * size)) != len * size) \
+ if ((nread = sox_readbuf(ft, buf, len * size)) != len * size && ferror(ft->fp)) \
sox_fail_errno(ft, errno, sox_readerr); \
nread /= size; \
for (n = 0; n < nread; n++) \
@@ -416,7 +416,7 @@
{ \
sox_size_t n, nread; \
uint8_t *data = xmalloc(size * len); \
- if ((nread = sox_readbuf(ft, data, len * size)) != len * size) \
+ if ((nread = sox_readbuf(ft, data, len * size)) != len * size && ferror(ft->fp)) \
sox_fail_errno(ft, errno, sox_readerr); \
nread /= size; \
for (n = 0; n < nread; n++) { \