OSDN Git Service

tunerec: fix mrb_put remaining bytes calculation, include ctype.h
authorLong.inus <long.inus@hotmail.co.jp>
Sun, 15 Dec 2013 19:26:03 +0000 (04:26 +0900)
committerLong.inus <long.inus@hotmail.co.jp>
Sun, 15 Dec 2013 19:26:03 +0000 (04:26 +0900)
tunerec/tunerec.c

index d1ea2af..a30bfe9 100755 (executable)
@@ -15,6 +15,7 @@
 #include <pthread.h>
 #include <stdbool.h>
 #include <string.h>
+#include <ctype.h>
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #ifndef DTV_STREAM_ID
@@ -95,7 +96,7 @@ bool mrb_get(mrb* rb, char *target, size_t size) {
                // RingBuffer underflow.
                return false;
        }
-       if ( rb->rb_rt + size <= rb->rb_wt ) {
+       if ( rb->rb_rt + size <= RING_BUFFER_SIZE ) {
                // read bytes + newly taken bytes <= buffer max size
                memcpy(target, rb->rb_ptr + rb->rb_rt, size);
                rb->rb_rt = rb->rb_rt + size;