shithub: dav1d

Download patch

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

Cast the output from strtoul to unsigned int

On platforms where unsigned long is 64 bit, the implicit conversion
to unsigned int can warn if such warnings are enabled.

Add casts to incidate that this is known/intended.

--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -521,7 +521,7 @@
             fprintf(stderr, "]\n");
             return 0;
         } else {
-            state.seed = strtoul(argv[1], NULL, 10);
+            state.seed = (unsigned int) strtoul(argv[1], NULL, 10);
         }
 
         argc--;
--- a/tools/dav1d_cli_parse.c
+++ b/tools/dav1d_cli_parse.c
@@ -134,7 +134,7 @@
 
 static unsigned parse_unsigned(char *optarg, const int option, const char *app) {
     char *end;
-    const unsigned res = strtoul(optarg, &end, 0);
+    const unsigned res = (unsigned) strtoul(optarg, &end, 0);
     if (*end || end == optarg) error(app, optarg, option, "an integer");
     return res;
 }
@@ -193,9 +193,9 @@
     char *end;
     unsigned res;
     if (!strncmp(optarg, "0x", 2)) {
-        res = strtoul(&optarg[2], &end, 16);
+        res = (unsigned) strtoul(&optarg[2], &end, 16);
     } else {
-        res = strtoul(optarg, &end, 0);
+        res = (unsigned) strtoul(optarg, &end, 0);
     }
 
     if (*end || end == optarg) {
--- a/tools/output/md5.c
+++ b/tools/output/md5.c
@@ -230,7 +230,7 @@
             char *ignore;
             memcpy(t, p, 2);
             p += 2;
-            val = strtoul(t, &ignore, 16);
+            val = (unsigned) strtoul(t, &ignore, 16);
             abcd[i] |= val << (8 * j);
         }
     }