shithub: dav1d

Download patch

ref: 4d9c990e3703ce49da5f5e6bbc8dea0638f46cfa
parent: 46d092ae6ac62284e5bdde4d0808aca4ab7410a9
author: Martin Storsjö <martin@martin.st>
date: Thu Nov 21 18:08:12 EST 2019

section5: use signed type for seeking backwards

Should fix failures of 'section5' sample on 32-bit systems.

--- a/meson.build
+++ b/meson.build
@@ -98,6 +98,7 @@
     cdata.set('UNICODE',                1) # Define to 1 for Unicode (Wide Chars) APIs
     cdata.set('_UNICODE',               1) # Define to 1 for Unicode (Wide Chars) APIs
     cdata.set('__USE_MINGW_ANSI_STDIO', 1) # Define to force use of MinGW printf
+    cdata.set('_CRT_DECLARE_NONSTDC_NAMES', 1) # Define to get off_t from sys/types.h on MSVC
     if cc.has_function('fseeko', prefix : '#include <stdio.h>', args : test_args)
         cdata.set('_FILE_OFFSET_BITS', 64) # Not set by default by Meson on Windows
     else
--- a/tools/input/section5.c
+++ b/tools/input/section5.c
@@ -32,6 +32,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/types.h>
 
 #include "dav1d/headers.h"
 
@@ -157,7 +158,7 @@
         fseeko(c->f, len, SEEK_CUR); // skip packet, we'll read it below
     }
 
-    fseeko(c->f, -total_bytes, SEEK_CUR);
+    fseeko(c->f, -(off_t)total_bytes, SEEK_CUR);
     uint8_t *ptr = dav1d_data_create(data, total_bytes);
     if (!ptr) return -1;
     if (fread(ptr, total_bytes, 1, c->f) != 1) {