]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: fix to use `uint32_t` where necessary
authorViktor Szakats <commit@vsz.me>
Wed, 7 Jan 2026 15:45:48 +0000 (16:45 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 7 Jan 2026 16:01:06 +0000 (17:01 +0100)
Fixes MS-DOS DJGPP buidls, possibly others.

Follow-up to e70436a88a7ba16f6a49237054dde41f181fd9c4 #20200
Follow-up to 4701a6d2ae9f0b66a0feac4061868e944353449b #19695

Closes #20210

tests/unit/unit1616.c
tests/unit/unit3211.c
tests/unit/unit3212.c
tests/unit/unit3213.c

index d898444613cee28a41272f9464c81399863251f0..a8381594aa4d446be7e70938af666f4e2fd559b7 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "uint-hash.h"
 
-static void t1616_mydtor(unsigned int id, void *elem)
+static void t1616_mydtor(uint32_t id, void *elem)
 {
   int *ptr = (int *)elem;
   (void)id;
@@ -53,8 +53,8 @@ static CURLcode test_unit1616(const char *arg)
   int *value2;
   bool ok;
 
-  unsigned int key = 20;
-  unsigned int key2 = 25;
+  uint32_t key = 20;
+  uint32_t key2 = 25;
 
   value = curlx_malloc(sizeof(int));
   abort_unless(value != NULL, "Out of memory");
index 689edb7b2b3f6483e60a9e983a20206edaffab2b..40cad2fe9b17b8a83de9d14daf10c612ed48a309 100644 (file)
 #include "uint-bset.h"
 #include "curl_trc.h"
 
-static void check_set(const char *name, unsigned int capacity,
-                      const unsigned int *s, size_t slen)
+static void check_set(const char *name, uint32_t capacity,
+                      const uint32_t *s, size_t slen)
 {
   struct uint32_bset bset;
   size_t i, j;
-  unsigned int n, c;
+  uint32_t n, c;
 
-  curl_mfprintf(stderr, "test %s, capacity=%u, %zu numbers\n",
+  curl_mfprintf(stderr, "test %s, capacity=%" PRIu32 ", %zu numbers\n",
                 name, capacity, slen);
   Curl_uint32_bset_init(&bset);
   fail_unless(!Curl_uint32_bset_resize(&bset, capacity), "bset resize failed");
@@ -63,7 +63,8 @@ static void check_set(const char *name, unsigned int capacity,
   for(i = 1; i < slen; ++i) {
     fail_unless(Curl_uint32_bset_next(&bset, n, &n), "next failed");
     if(n != s[i]) {
-      curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
+      curl_mfprintf(stderr, "expected next to be %" PRIu32
+                    ", not %" PRIu32 "\n", s[i], n);
       fail_unless(n == s[i], "next not correct number");
     }
   }
@@ -127,11 +128,11 @@ static CURLcode test_unit3211(const char *arg)
 {
   UNITTEST_BEGIN_SIMPLE
 
-  static const unsigned int s1[] = {
+  static const uint32_t s1[] = {
     /* spread numbers, some at slot edges */
     0, 1, 4, 17, 63, 64, 65, 66, 90, 99,
   };
-  static const unsigned int s2[] = {
+  static const uint32_t s2[] = {
     /* set with all bits in slot1 set */
     64, 65, 66, 67, 68, 69, 70, 71,
     72, 73, 74, 75, 76, 77, 78, 79,
index 3af35f0c575b2ab8aa37906d7a247423fe85d654..1f965f1b82afec63bf7d4e7cec2fd53c4734b93d 100644 (file)
@@ -48,7 +48,7 @@ static CURLcode test_unit3212(const char *arg)
 
   UNITTEST_BEGIN(t3212_setup(&tbl))
 
-  unsigned int i, key, n;
+  uint32_t i, key, n;
   void *entry;
 
   fail_unless(Curl_uint32_tbl_capacity(&tbl) == TBL_SIZE, "wrong capacity");
index c3ec3958e83e5c9999bfb1a989d25d17f71fc292..7cd2d78c9178a7c6f0c0a33f7e2d792286b9cc90 100644 (file)
 #include "curl_trc.h"
 #include "unitprotos.h"
 
-static void check_spbset(const char *name, const unsigned int *s, size_t slen)
+static void check_spbset(const char *name, const uint32_t *s, size_t slen)
 {
   struct uint32_spbset bset;
   size_t i, j;
-  unsigned int n, c;
+  uint32_t c, n;
 
   curl_mfprintf(stderr, "test %s, %zu numbers\n", name, slen);
 
@@ -60,7 +60,8 @@ static void check_spbset(const char *name, const unsigned int *s, size_t slen)
   for(i = 1; i < slen; ++i) {
     fail_unless(Curl_uint32_spbset_next(&bset, n, &n), "next failed");
     if(n != s[i]) {
-      curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
+      curl_mfprintf(stderr, "expected next to be %" PRIu32
+                    ", not %" PRIu32 "\n", s[i], n);
       fail_unless(n == s[i], "next not correct number");
     }
   }
@@ -96,11 +97,11 @@ static CURLcode test_unit3213(const char *arg)
 {
   UNITTEST_BEGIN_SIMPLE
 
-  static const unsigned int s1[] = {
+  static const uint32_t s1[] = {
     /* spread numbers, some at slot edges */
     0, 1, 4, 17, 63, 64, 65, 66, 90, 99,
   };
-  static const unsigned int s2[] = {
+  static const uint32_t s2[] = {
     /* set with all bits in slot1 set */
     64, 65, 66, 67, 68, 69, 70, 71,
     72, 73, 74, 75, 76, 77, 78, 79,
@@ -111,7 +112,7 @@ static CURLcode test_unit3213(const char *arg)
     112, 113, 114, 115, 116, 117, 118, 119,
     120, 121, 122, 123, 124, 125, 126, 127,
   };
-  static const unsigned int s3[] = {
+  static const uint32_t s3[] = {
     /* very spread numbers */
     2232, 5167, 8204, 8526, 8641, 10056, 10140, 10611,
     10998, 11626, 13735, 15539, 17947, 24295, 27833, 30318,