From 3e338da871f2b472c72ae6b2788937cd2ca0110a Mon Sep 17 00:00:00 2001 From: Laszlo Ashin Date: Sat, 8 Nov 2008 13:10:15 +0100 Subject: wavpack: check last_byte in push_back_byte() method At this moment the wavpack lib doesn't use the return value of the push_back function, which has an equivalent meaning of the return value of ungetc(). This is a lucky situation, because so far it simply returned with 1 as a hard coded value. From now on the function will return EOF on error. (This function makes exactly one byte pushable back.) --- src/decoder/wavpack_plugin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c index 40eca3972..675143753 100644 --- a/src/decoder/wavpack_plugin.c +++ b/src/decoder/wavpack_plugin.c @@ -408,8 +408,12 @@ wavpack_input_set_pos_rel(void *id, int32_t delta, int mode) static int wavpack_input_push_back_byte(void *id, int c) { - wpin(id)->last_byte = c; - return 1; + if (wpin(id)->last_byte == EOF) { + wpin(id)->last_byte = c; + return c; + } else { + return EOF; + } } static uint32_t -- cgit v1.2.3