[babl] Fix warn in CHECK_CONV_FLOAT



commit 53d086b07ee557d9280c532bbceb8e4c27e54a81
Author: Axel Viala <axel viala darnuria eu>
Date:   Fri Mar 25 15:18:08 2022 +0100

    Fix warn in CHECK_CONV_FLOAT

 tests/common.inc | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/tests/common.inc b/tests/common.inc
index bca5056f8..2016d048c 100644
--- a/tests/common.inc
+++ b/tests/common.inc
@@ -1,26 +1,23 @@
-
+#include <stdlib.h>
 #include <math.h>
 #include "babl/babl-introspect.h"
 
 #define CHECK_CONV(test_name, componenttype, src_fmt, dst_fmt, src_pix, expected_pix) \
   {       \
-  const Babl *fish;       \
-  int i;       \
-  fish = babl_fish (src_fmt, dst_fmt);       \
+  const Babl *fish = babl_fish (src_fmt, dst_fmt);       \
   if (!fish)       \
     {       \
       printf ("  %s failed to make fish\n", test_name);       \
       OK = 0;       \
     }       \
-  for (i = 0; i < sizeof(src_pix)/sizeof(src_pix[0]); i ++)       \
+  for (size_t i = 0; i < sizeof(src_pix)/sizeof(src_pix[0]); i ++)       \
     {       \
-      int c;\
       componenttype result[10];       \
       babl_process (fish, src_pix[i], result, 1);       \
-      for (c = 0; c < sizeof(expected_pix[i])/sizeof(expected_pix[i][0]); c++) \
+      for (size_t c = 0; c < sizeof(expected_pix[i])/sizeof(expected_pix[i][0]); c++) \
       if (result[c] != expected_pix[i][c])       \
         {       \
-          printf (" %s failed #%i[%i]  got %i expected %i\n", test_name, i, c, result[c], 
expected_pix[i][c]);       \
+          printf (" %s failed #%li[%li]  got %i expected %i\n", test_name, i, c, result[c], 
expected_pix[i][c]);       \
           OK = 0;          \
           babl_introspect((Babl *)fish); \
         }       \
@@ -29,23 +26,20 @@
 
 #define CHECK_CONV_FLOAT(test_name, componenttype, max_error, src_fmt, dst_fmt, src_pix, expected_pix) \
   {       \
-  const Babl *fish;       \
-  int i;       \
-  fish = babl_fish (src_fmt, dst_fmt);       \
+  const Babl *fish = babl_fish (src_fmt, dst_fmt);       \
   if (!fish)       \
     {       \
       printf ("  %s failed to make fish\n", test_name);       \
       OK = 0;       \
     }       \
-  for (i = 0; i < sizeof(src_pix)/sizeof(src_pix[0]); i ++)       \
+  for (size_t i = 0; i < sizeof(src_pix)/sizeof(src_pix[0]); i ++)       \
     {       \
-      int c;\
       componenttype result[10];       \
       babl_process (fish, src_pix[i], result, 1);       \
-      for (c = 0; c < sizeof(expected_pix[i])/sizeof(expected_pix[i][0]); c++) \
+      for (size_t c = 0; c < sizeof(expected_pix[i])/sizeof(expected_pix[i][0]); c++) \
       if (fabs(result[c] - expected_pix[i][c]) > max_error)       \
         {       \
-          printf (" %s failed #%i[%i]  got %lf expected %lf\n", test_name, i, c, result[c], 
expected_pix[i][c]);       \
+          printf (" %s failed #%li[%li]  got %lf expected %lf\n", test_name, i, c, result[c], 
expected_pix[i][c]);       \
           OK = 0;          \
           babl_introspect((Babl *)fish); \
         }       \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]