shithub: dav1d

Download patch

ref: b1d571f1bc9b31e86cc4e09d004d86558026cde4
parent: 4aa735b242a72139c7816a52870658f205218674
author: Martin Storsjö <[email protected]>
date: Thu Feb 7 10:23:10 EST 2019

tools: Store return values from fread() in a size_t

In annexb_read, the res variable was used both for the return
from fread() (which is size_t, unsigned) and from leb128 (which
returns a signed int); remove the return value assignment
altogether as it wasn't used.

--- a/tools/input/annexb.c
+++ b/tools/input/annexb.c
@@ -103,7 +103,7 @@
     if (!ptr) return -1;
     c->temporal_unit_size -= len + res;
     c->frame_unit_size -= len + res;
-    if ((res = fread(ptr, len, 1, c->f)) != 1) {
+    if (fread(ptr, len, 1, c->f) != 1) {
         fprintf(stderr, "Failed to read frame data: %s\n", strerror(errno));
         dav1d_data_unref(data);
         return -1;
--- a/tools/input/ivf.c
+++ b/tools/input/ivf.c
@@ -55,7 +55,7 @@
 static int ivf_open(IvfInputContext *const c, const char *const file,
                     unsigned fps[2], unsigned *const num_frames)
 {
-    int res;
+    size_t res;
     uint8_t hdr[32];
 
     memset(c, 0, sizeof(*c));
@@ -97,7 +97,7 @@
 static int ivf_read(IvfInputContext *const c, Dav1dData *const buf) {
     uint8_t data[8];
     uint8_t *ptr;
-    int res;
+    size_t res;
 
     const int64_t off = ftello(c->f);
     if ((res = fread(data, 4, 1, c->f)) != 1)