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

Alex Brachet via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Jan 10 08:42:12 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb1372fe7b088: [libc] Fix -Wimplicit-int-conversion warnings (authored by abrachet).
Herald added a project: libc-project.

Changed prior to commit:
  https://reviews.llvm.org/D140492?vs=484644&id=487820#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140492/new/

https://reviews.llvm.org/D140492

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


Index: libc/src/__support/integer_to_string.h
===================================================================
--- libc/src/__support/integer_to_string.h
+++ libc/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: libc/src/__support/StringUtil/message_mapper.h
===================================================================
--- libc/src/__support/StringUtil/message_mapper.h
+++ libc/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.487820.patch
Type: text/x-patch
Size: 1142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230110/fbd63326/attachment-0001.bin>


More information about the libc-commits mailing list