shithub: dav1d

Download patch

ref: e3d028fb9b56a0553564b504726515b23582f7b4
parent: 95233f9e9f688243cc3fd863c76c68a1e0821170
author: Martin Storsjö <martin@martin.st>
date: Thu Feb 7 10:19:45 EST 2019

Use size_t as return value type for strlen() consistently

--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -127,7 +127,7 @@
     CheckasmFuncVersion *current_func_ver;
     const char *current_test_name;
     const char *bench_pattern;
-    int bench_pattern_len;
+    size_t bench_pattern_len;
     int num_checked;
     int num_failed;
     int nop_time;
@@ -420,7 +420,7 @@
         }
     } else {
         /* Allocate and insert a new node into the tree */
-        const int name_length = strlen(name);
+        const size_t name_length = strlen(name);
         f = *root = checkasm_malloc(sizeof(CheckasmFunc) + name_length);
         memcpy(f->name, name, name_length + 1);
     }
@@ -636,10 +636,11 @@
 /* Print the outcome of all tests performed since
  * the last time this function was called */
 void checkasm_report(const char *const name, ...) {
-    static int prev_checked, prev_failed, max_length;
+    static int prev_checked, prev_failed;
+    static size_t max_length;
 
     if (state.num_checked > prev_checked) {
-        int pad_length = max_length + 4;
+        int pad_length = (int) max_length + 4;
         va_list arg;
 
         print_cpu_name();
@@ -660,7 +661,7 @@
     } else if (!state.cpu_flag) {
         /* Calculate the amount of padding required
          * to make the output vertically aligned */
-        int length = strlen(state.current_test_name);
+        size_t length = strlen(state.current_test_name);
         va_list arg;
 
         va_start(arg, name);
--- a/tools/input/input.c
+++ b/tools/input/input.c
@@ -57,7 +57,7 @@
 }
 
 static const char *find_extension(const char *const f) {
-    const int l = strlen(f);
+    const size_t l = strlen(f);
 
     if (l == 0) return NULL;
 
--- a/tools/output/output.c
+++ b/tools/output/output.c
@@ -59,7 +59,7 @@
 }
 
 static const char *find_extension(const char *const f) {
-    const int l = strlen(f);
+    const size_t l = strlen(f);
 
     if (l == 0) return NULL;