[cleanup] Remove some std::to_string usages
Remove usages of `std::to_string` where appropriate. Bug: 335672557 Change-Id: I5015c7f7d7881a6c82db4219aefee0567413f826 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5937214 Reviewed-by: Siye Liu <siliu@microsoft.com> Commit-Queue: Ho Cheung <hocheung@chromium.org> Reviewed-by: Daniel Nicoara <dnicoara@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Nina Satragno <nsatragno@chromium.org> Reviewed-by: Paul Semel <paulsemel@chromium.org> Reviewed-by: Joe Downing <joedow@chromium.org> Cr-Commit-Position: refs/heads/main@{#1371996}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4e0fd3177f
commit
42097f6604
PRESUBMIT.py
base
device/fido
gpu
media
remoting/host/linux
testing/libfuzzer
fuzzers
proto
research
domatolpm
templates
ui
12
PRESUBMIT.py
12
PRESUBMIT.py
@ -752,23 +752,11 @@ _BANNED_CPP_FUNCTIONS: Sequence[BanRule] = (
|
||||
[
|
||||
# TODO(crbug.com/335672557): Please do not add to this list. Existing
|
||||
# uses should removed.
|
||||
"base/linux_util.cc",
|
||||
"device/fido/mock_fido_device.cc",
|
||||
"gpu/command_buffer/tests/gl_webgl_multi_draw_test.cc",
|
||||
"gpu/config/gpu_control_list.cc",
|
||||
"media/audio/win/core_audio_util_win.cc",
|
||||
"media/gpu/android/media_codec_video_decoder.cc",
|
||||
"media/gpu/vaapi/vaapi_wrapper.cc",
|
||||
"remoting/host/linux/certificate_watcher_unittest.cc",
|
||||
"testing/libfuzzer/fuzzers/url_parse_proto_fuzzer.cc",
|
||||
"testing/libfuzzer/proto/url_proto_converter.cc",
|
||||
"third_party/blink/renderer/core/css/parser/css_proto_converter.cc",
|
||||
"third_party/blink/renderer/core/editing/ime/edit_context.cc",
|
||||
"third_party/blink/renderer/platform/graphics/bitmap_image_test.cc",
|
||||
"tools/binary_size/libsupersize/viewer/caspian/diff_test.cc",
|
||||
"tools/binary_size/libsupersize/viewer/caspian/tree_builder_test.cc",
|
||||
"ui/base/ime/win/tsf_text_store.cc",
|
||||
"ui/ozone/platform/drm/gpu/hardware_display_plane.cc",
|
||||
_THIRD_PARTY_EXCEPT_BLINK
|
||||
],
|
||||
),
|
||||
|
@ -154,7 +154,7 @@ void SetLinuxDistro(const std::string& distro) {
|
||||
}
|
||||
|
||||
bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) {
|
||||
// 25 > strlen("/proc//task") + strlen(std::to_string(INT_MAX)) + 1 = 22
|
||||
// 25 > strlen("/proc//task") + strlen(base::NumberToString(INT_MAX)) + 1 = 22
|
||||
char buf[25];
|
||||
strings::SafeSPrintf(buf, "/proc/%d/task", pid);
|
||||
return GetThreadsFromProcessDir(buf, tids);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/location.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "components/apdu/apdu_response.h"
|
||||
#include "components/cbor/writer.h"
|
||||
@ -131,8 +132,8 @@ void MockFidoDevice::StubGetId() {
|
||||
// Use a counter to keep the device ID unique.
|
||||
static size_t i = 0;
|
||||
EXPECT_CALL(*this, GetId())
|
||||
.WillRepeatedly(
|
||||
testing::Return(base::StrCat({"mockdevice", std::to_string(i++)})));
|
||||
.WillRepeatedly(testing::Return(
|
||||
base::StrCat({"mockdevice", base::NumberToString(i++)})));
|
||||
}
|
||||
|
||||
void MockFidoDevice::ExpectCtap2CommandAndRespondWith(
|
||||
|
@ -7,9 +7,11 @@
|
||||
#include <GLES2/gl2extchromium.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "gpu/command_buffer/client/gles2_implementation.h"
|
||||
#include "gpu/command_buffer/client/shared_memory_limits.h"
|
||||
#include "gpu/command_buffer/tests/gl_manager.h"
|
||||
@ -83,7 +85,7 @@ TEST_F(GLWebGLMultiDrawTest, MultiDrawLargerThanTransferBuffer) {
|
||||
}
|
||||
|
||||
std::string vertex_source =
|
||||
"#define SIZE " + std::to_string(canvas_size()) + "\n";
|
||||
"#define SIZE " + base::NumberToString(canvas_size()) + "\n";
|
||||
vertex_source += "#extension GL_ANGLE_multi_draw : require\n";
|
||||
vertex_source += R"(
|
||||
attribute vec2 a_position;
|
||||
|
@ -372,7 +372,7 @@ bool GpuControlList::More::Contains(const GPUInfo& gpu_info) const {
|
||||
return false;
|
||||
}
|
||||
if (gpu_count.IsSpecified()) {
|
||||
if (!gpu_count.Contains(std::to_string(gpu_info.GpuCount()))) {
|
||||
if (!gpu_count.Contains(base::NumberToString(gpu_info.GpuCount()))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/scoped_co_mem.h"
|
||||
@ -202,7 +203,7 @@ std::string ChannelMaskToString(DWORD channel_mask) {
|
||||
if (channel_mask != KSAUDIO_SPEAKER_DIRECTOUT) {
|
||||
std::bitset<8 * sizeof(DWORD)> mask(channel_mask);
|
||||
ss += " (";
|
||||
ss += std::to_string(mask.count());
|
||||
ss += base::NumberToString(mask.count());
|
||||
ss += ")";
|
||||
}
|
||||
return ss;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/bind_post_task.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/time/time.h"
|
||||
@ -1076,7 +1077,7 @@ bool MediaCodecVideoDecoder::DequeueOutput() {
|
||||
}
|
||||
DVLOG(3) << "DequeueOutputBuffer(): pts="
|
||||
<< (eos ? "EOS"
|
||||
: std::to_string(presentation_time.InMilliseconds()));
|
||||
: base::NumberToString(presentation_time.InMilliseconds()));
|
||||
|
||||
if (eos) {
|
||||
if (eos_decode_cb_) {
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/pattern.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
@ -3180,7 +3181,7 @@ void VaapiWrapper::PreSandboxInitialization(bool allow_disabling_global_lock) {
|
||||
|
||||
VADisplayStateSingleton::PreSandboxInitialization();
|
||||
|
||||
const std::string va_suffix(std::to_string(VA_MAJOR_VERSION + 1));
|
||||
const std::string va_suffix(base::NumberToString(VA_MAJOR_VERSION + 1));
|
||||
StubPathMap paths;
|
||||
|
||||
paths[kModuleVa].push_back(std::string("libva.so.") + va_suffix);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -81,7 +82,7 @@ class CertificateWatcherTest : public testing::Test {
|
||||
}
|
||||
|
||||
void TouchFileTask(const char* filename) {
|
||||
std::string testWriteString = std::to_string(rand());
|
||||
std::string testWriteString = base::NumberToString(rand());
|
||||
base::FilePath path = temp_dir_.GetPath().AppendASCII(filename);
|
||||
|
||||
if (base::PathExists(path)) {
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "base/i18n/icu_util.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
// clang-format off
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
// clang-format on
|
||||
|
||||
// Includes *not* copied from url_parse_fuzzer.cc
|
||||
// Contains DEFINE_BINARY_PROTO_FUZZER, a macro we use to define our target
|
||||
// function.
|
||||
@ -85,7 +89,7 @@ std::string protobuf_to_string(const url_proto::Url& url) {
|
||||
// that it is preceded by the host and then ":".
|
||||
if (url.has_port())
|
||||
// Convert url.port() from an unsigned 32 bit int before appending it.
|
||||
url_string += ":" + std::to_string(url.port());
|
||||
url_string += ":" + base::NumberToString(url.port());
|
||||
}
|
||||
|
||||
// Append the path segments to the url, with each segment separated by
|
||||
|
@ -46,7 +46,10 @@ if (!is_cronet_build) {
|
||||
"url_proto_converter.cc",
|
||||
"url_proto_converter.h",
|
||||
]
|
||||
deps = [ ":url_proto" ]
|
||||
deps = [
|
||||
":url_proto",
|
||||
"//base",
|
||||
]
|
||||
}
|
||||
|
||||
proto_library("skia_image_filter_proto") {
|
||||
|
@ -4,8 +4,10 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "testing/libfuzzer/proto/url.pb.h"
|
||||
|
||||
namespace url_proto {
|
||||
@ -62,7 +64,7 @@ std::string Convert(const url_proto::Url& url) {
|
||||
// that it is preceded by the host and then ":".
|
||||
if (url.has_port())
|
||||
// Convert url.port() from an unsigned 32 bit int before appending it.
|
||||
url_string += ":" + std::to_string(url.port());
|
||||
url_string += ":" + base::NumberToString(url.port());
|
||||
}
|
||||
|
||||
// Append the path segments to the url, with each segment separated by
|
||||
|
@ -28,7 +28,7 @@ template <typename From, typename To>
|
||||
const To& min = std::numeric_limits<To>::min(),
|
||||
const To& max = std::numeric_limits<To>::max()) {
|
||||
To conv = arg;
|
||||
return std::to_string(std::clamp(conv, min, max));
|
||||
return base::NumberToString(std::clamp(conv, min, max));
|
||||
}
|
||||
|
||||
[[maybe_unused]] std::string handle_float(domatolpm::Context* ctx [[maybe_unused]], const float& arg) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "base/win/scoped_variant.h"
|
||||
#include "components/stylus_handwriting/win/features.h"
|
||||
@ -372,8 +373,9 @@ HRESULT TSFTextStore::GetTextExt(TsViewCookie view_cookie,
|
||||
return TS_E_INVALIDPOS;
|
||||
}
|
||||
|
||||
TRACE_EVENT1("ime", "TSFTextStore::GetTextExt", "start, end",
|
||||
std::to_string(acp_start) + ", " + std::to_string(acp_end));
|
||||
TRACE_EVENT1(
|
||||
"ime", "TSFTextStore::GetTextExt", "start, end",
|
||||
base::NumberToString(acp_start) + ", " + base::NumberToString(acp_end));
|
||||
|
||||
// According to a behavior of notepad.exe and wordpad.exe, top left corner of
|
||||
// rect indicates a first character's one, and bottom right corner of rect
|
||||
@ -1354,8 +1356,8 @@ void TSFTextStore::CalculateTextandSelectionDiffAndNotifyIfNeeded() {
|
||||
if (notify_text_change && text_changed) {
|
||||
TRACE_EVENT2(
|
||||
"ime", "TSFTextStore::CalculateTextandSelectionDiffAndNotifyIfNeeded",
|
||||
"text_change_start", std::to_string(text_change.acpStart),
|
||||
"text_change_end", std::to_string(text_change.acpNewEnd));
|
||||
"text_change_start", base::NumberToString(text_change.acpStart),
|
||||
"text_change_end", base::NumberToString(text_change.acpNewEnd));
|
||||
text_store_acp_sink_->OnTextChange(0, &text_change);
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/trace_event/traced_value.h"
|
||||
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
|
||||
@ -64,7 +65,7 @@ std::vector<gfx::Size> ParseSupportedCursorSizes(drmModePropertyBlobPtr blob) {
|
||||
std::string IdSetToString(const base::flat_set<uint32_t>& ids) {
|
||||
std::vector<std::string> string_ids;
|
||||
for (auto id : ids)
|
||||
string_ids.push_back(std::to_string(id));
|
||||
string_ids.push_back(base::NumberToString(id));
|
||||
return "[" + base::JoinString(string_ids, ", ") + "]";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user