ref: ef2b5a4ac39b586bf63473916641cedc0761a414
parent: 93a6c6ea96219101f0d57e38584971952d65b567
author: robs <robs>
date: Sun Mar 16 16:51:03 EDT 2008
use sox_read_b_buf when expect to hit EOF
--- a/src/adpcms.c
+++ b/src/adpcms.c
@@ -194,7 +194,7 @@
state->store.flag = 0;
++n;
}
- while (n < len && sox_readb(ft, &byte) == SOX_SUCCESS) {
+ while (n < len && sox_read_b_buf(ft, &byte, 1) == 1) {
word = adpcm_decode(byte >> 4, &state->encoder);
*buffer++ = SOX_SIGNED_16BIT_TO_SAMPLE(word, ft->clips);
--- a/src/au.c
+++ b/src/au.c
@@ -97,7 +97,7 @@
unsigned char in_byte;
if (p->in_bits < (int)ft->encoding.bits_per_sample) {
- if (sox_readb(ft, &in_byte) == SOX_EOF) {
+ if (sox_read_b_buf(ft, &in_byte, 1) != 1) {
*code = 0;
return -1;
}
--- a/src/cvsd.c
+++ b/src/cvsd.c
@@ -234,7 +234,7 @@
while (done < nsamp) {
if (!p->bit.cnt) {
- if (sox_readb(ft, &(p->bit.shreg)) == SOX_EOF)
+ if (sox_read_b_buf(ft, &(p->bit.shreg), 1) != 1)
return done;
p->bit.cnt = 8;
p->bit.mask = 1;
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -161,7 +161,6 @@
return 0; /* Don't know if this can happen... */
if (sox_readb(ft, &sample_rate) == SOX_EOF)
{
- sox_fail_errno(ft,SOX_EOF,"unexpected EOF at start of HCOM data");
return (0);
}
p->sample = sample_rate;
--- a/src/lpc10.c
+++ b/src/lpc10.c
@@ -104,7 +104,7 @@
/* Unpack the array bits into coded_frame. */
for (i = 0; i < len; i++) {
if (i % 8 == 0) {
- sox_readb(ft, &c);
+ sox_read_b_buf(ft, &c, 1);
if (sox_eof(ft)) {
return (i);
}
--- a/src/tx16w.c
+++ b/src/tx16w.c
@@ -90,7 +90,7 @@
}
/* This is dumb but portable, just count the bytes til EOF */
- while (sox_readb(ft, (unsigned char *)&trash) != SOX_EOF)
+ while (sox_read_b_buf(ft, (unsigned char *)&trash, 1) == 1)
num_samp_bytes++;
num_samp_bytes -= 32; /* calculate num samples by sub header size */
sox_seeki(ft, 0, 0); /* rewind file */