[libc] Fix type errors on Windows

Fix the errors caused by having some numbers too large for a 32 bit
number in the tests for windows. Also fix the base causing some type
confusion.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D108653

GitOrigin-RevId: 6bbfd6a9c1847f94ab94604d228b989891d2133a
diff --git a/test/src/stdlib/strtol_test.cpp b/test/src/stdlib/strtol_test.cpp
index c6633e5..b611503 100644
--- a/test/src/stdlib/strtol_test.cpp
+++ b/test/src/stdlib/strtol_test.cpp
@@ -46,18 +46,18 @@
   ASSERT_EQ(errno, 0);
   EXPECT_EQ(str_end - negative, ptrdiff_t(4));
 
-  const char *big_number = "123456789012345";
+  const char *big_number = "1234567890";
   errno = 0;
-  ASSERT_EQ(__llvm_libc::strtol(big_number, &str_end, 10), 123456789012345l);
+  ASSERT_EQ(__llvm_libc::strtol(big_number, &str_end, 10), 1234567890l);
   ASSERT_EQ(errno, 0);
-  EXPECT_EQ(str_end - big_number, ptrdiff_t(15));
+  EXPECT_EQ(str_end - big_number, ptrdiff_t(10));
 
-  const char *big_negative_number = "-123456789012345";
+  const char *big_negative_number = "-1234567890";
   errno = 0;
   ASSERT_EQ(__llvm_libc::strtol(big_negative_number, &str_end, 10),
-            -123456789012345l);
+            -1234567890l);
   ASSERT_EQ(errno, 0);
-  EXPECT_EQ(str_end - big_negative_number, ptrdiff_t(16));
+  EXPECT_EQ(str_end - big_negative_number, ptrdiff_t(11));
 
   const char *too_big_number = "123456789012345678901";
   errno = 0;
@@ -155,7 +155,7 @@
 
 TEST(LlvmLibcStrToLTest, DecodeInOtherBases) {
   char small_string[4] = {'\0', '\0', '\0', '\0'};
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (long base = 2; base <= 36; ++base) {
     for (long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       if (first_digit < base) {
@@ -171,7 +171,7 @@
     }
   }
 
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (long base = 2; base <= 36; ++base) {
     for (long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       for (long second_digit = 0; second_digit <= 36; ++second_digit) {
@@ -195,7 +195,7 @@
     }
   }
 
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (long base = 2; base <= 36; ++base) {
     for (long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       for (long second_digit = 0; second_digit <= 36; ++second_digit) {
diff --git a/test/src/stdlib/strtoll_test.cpp b/test/src/stdlib/strtoll_test.cpp
index 1bb3c2a..f46524b 100644
--- a/test/src/stdlib/strtoll_test.cpp
+++ b/test/src/stdlib/strtoll_test.cpp
@@ -179,7 +179,7 @@
 
 TEST(LlvmLibcStrToLLTest, DecodeInOtherBases) {
   char small_string[4] = {'\0', '\0', '\0', '\0'};
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (long long base = 2; base <= 36; ++base) {
     for (long long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       if (first_digit < base) {
@@ -195,7 +195,7 @@
     }
   }
 
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (long long base = 2; base <= 36; ++base) {
     for (long long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       for (long long second_digit = 0; second_digit <= 36; ++second_digit) {
@@ -219,7 +219,7 @@
     }
   }
 
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (long long base = 2; base <= 36; ++base) {
     for (long long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       for (long long second_digit = 0; second_digit <= 36; ++second_digit) {
diff --git a/test/src/stdlib/strtoul_test.cpp b/test/src/stdlib/strtoul_test.cpp
index 5b93832..0ae6594 100644
--- a/test/src/stdlib/strtoul_test.cpp
+++ b/test/src/stdlib/strtoul_test.cpp
@@ -147,7 +147,7 @@
 
 TEST(LlvmLibcStrToULTest, DecodeInOtherBases) {
   char small_string[4] = {'\0', '\0', '\0', '\0'};
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (unsigned long base = 2; base <= 36; ++base) {
     for (unsigned long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       if (first_digit < base) {
@@ -163,7 +163,7 @@
     }
   }
 
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (unsigned long base = 2; base <= 36; ++base) {
     for (unsigned long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       for (unsigned long second_digit = 0; second_digit <= 36; ++second_digit) {
@@ -187,7 +187,7 @@
     }
   }
 
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (unsigned long base = 2; base <= 36; ++base) {
     for (unsigned long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       for (unsigned long second_digit = 0; second_digit <= 36; ++second_digit) {
diff --git a/test/src/stdlib/strtoull_test.cpp b/test/src/stdlib/strtoull_test.cpp
index a552042..2dc7872 100644
--- a/test/src/stdlib/strtoull_test.cpp
+++ b/test/src/stdlib/strtoull_test.cpp
@@ -155,7 +155,7 @@
 
 TEST(LlvmLibcStrToULLTest, DecodeInOtherBases) {
   char small_string[4] = {'\0', '\0', '\0', '\0'};
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (unsigned long long base = 2; base <= 36; ++base) {
     for (unsigned long long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       if (first_digit < base) {
@@ -171,7 +171,7 @@
     }
   }
 
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (unsigned long long base = 2; base <= 36; ++base) {
     for (unsigned long long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       for (unsigned long long second_digit = 0; second_digit <= 36;
@@ -196,7 +196,7 @@
     }
   }
 
-  for (unsigned int base = 2; base <= 36; ++base) {
+  for (unsigned long long base = 2; base <= 36; ++base) {
     for (unsigned long long first_digit = 0; first_digit <= 36; ++first_digit) {
       small_string[0] = int_to_b36_char(first_digit);
       for (unsigned long long second_digit = 0; second_digit <= 36;