[libc-commits] [PATCH] D140492: [libc] Fix -Wimplicit-int-conversion warnings

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Dec 21 12:16:55 PST 2022


abrachet created this revision.
abrachet added a reviewer: michaelrj.
Herald added subscribers: ecnelises, tschuett.
Herald added a project: All.
abrachet requested review of this revision.

https://reviews.llvm.org/D140492

Files:
  src/__support/StringUtil/message_mapper.h
  src/__support/integer_to_string.h


Index: src/__support/integer_to_string.h
===================================================================
--- src/__support/integer_to_string.h
+++ src/__support/integer_to_string.h
@@ -59,7 +59,7 @@
     } else {
       for (; uval > 0; --buffptr, uval /= conv_base) {
         uintmax_t digit = (uval % conv_base);
-        buffer[buffptr - 1] = digit < 10 ? digit + '0' : digit + a - 10;
+        buffer[buffptr - 1] = static_cast<char>(digit < 10 ? digit + '0' : digit + a - 10);
       }
     }
     len = buffer.size() - buffptr;
Index: src/__support/StringUtil/message_mapper.h
===================================================================
--- src/__support/StringUtil/message_mapper.h
+++ src/__support/StringUtil/message_mapper.h
@@ -45,7 +45,7 @@
     for (size_t i = 0; i < raw_array_len; ++i)
       string_mappings[raw_array[i].num] = raw_array[i].msg;
 
-    size_t string_array_index = 0;
+    int string_array_index = 0;
     for (size_t cur_num = 0; cur_num < ARR_SIZE; ++cur_num) {
       if (string_mappings[cur_num].size() != 0) {
         msg_offsets[cur_num] = string_array_index;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140492.484644.patch
Type: text/x-patch
Size: 1112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221221/0366a2a1/attachment.bin>


More information about the libc-commits mailing list