Skip to content

Commit 1a781e9

Browse files
authored
[libc] Add missing casts in StrtolTest (#119054)
The a0c4f85 change replaced the local int_to_b36_char function returning `char` with uses of the __support function of the same name that returns `int`. The uses of the old local function lacked the casts that all other uses of the shared function of the same name had. Add them.
1 parent 110b891 commit 1a781e9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

libc/test/src/stdlib/StrtolTest.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test {
200200
char small_string[4] = {'\0', '\0', '\0', '\0'};
201201
for (int base = 2; base <= 36; ++base) {
202202
for (int first_digit = 0; first_digit <= 36; ++first_digit) {
203-
small_string[0] =
204-
LIBC_NAMESPACE::internal::int_to_b36_char(first_digit);
203+
small_string[0] = static_cast<char>(
204+
LIBC_NAMESPACE::internal::int_to_b36_char(first_digit));
205205
if (first_digit < base) {
206206
LIBC_NAMESPACE::libc_errno = 0;
207207
ASSERT_EQ(func(small_string, nullptr, base),
@@ -217,11 +217,11 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test {
217217

218218
for (int base = 2; base <= 36; ++base) {
219219
for (int first_digit = 0; first_digit <= 36; ++first_digit) {
220-
small_string[0] =
221-
LIBC_NAMESPACE::internal::int_to_b36_char(first_digit);
220+
small_string[0] = static_cast<char>(
221+
LIBC_NAMESPACE::internal::int_to_b36_char(first_digit));
222222
for (int second_digit = 0; second_digit <= 36; ++second_digit) {
223-
small_string[1] =
224-
LIBC_NAMESPACE::internal::int_to_b36_char(second_digit);
223+
small_string[1] = static_cast<char>(
224+
LIBC_NAMESPACE::internal::int_to_b36_char(second_digit));
225225
if (first_digit < base && second_digit < base) {
226226
LIBC_NAMESPACE::libc_errno = 0;
227227
ASSERT_EQ(
@@ -244,14 +244,14 @@ struct StrtoTest : public LIBC_NAMESPACE::testing::Test {
244244

245245
for (int base = 2; base <= 36; ++base) {
246246
for (int first_digit = 0; first_digit <= 36; ++first_digit) {
247-
small_string[0] =
248-
LIBC_NAMESPACE::internal::int_to_b36_char(first_digit);
247+
small_string[0] = static_cast<char>(
248+
LIBC_NAMESPACE::internal::int_to_b36_char(first_digit));
249249
for (int second_digit = 0; second_digit <= 36; ++second_digit) {
250-
small_string[1] =
251-
LIBC_NAMESPACE::internal::int_to_b36_char(second_digit);
250+
small_string[1] = static_cast<char>(
251+
LIBC_NAMESPACE::internal::int_to_b36_char(second_digit));
252252
for (int third_digit = 0; third_digit <= limit; ++third_digit) {
253-
small_string[2] =
254-
LIBC_NAMESPACE::internal::int_to_b36_char(third_digit);
253+
small_string[2] = static_cast<char>(
254+
LIBC_NAMESPACE::internal::int_to_b36_char(third_digit));
255255

256256
if (first_digit < base && second_digit < base &&
257257
third_digit < base) {

0 commit comments

Comments
 (0)