From 4a75a9df7c587d67f12ecb46e9a9035bdb808b11 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Fri, 6 Oct 2023 23:51:06 +0200 Subject: [PATCH] fix: eliminate type conversion warnings --- src/base/commandlineflags.h | 7 +++++-- src/logging_unittest.cc | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/base/commandlineflags.h b/src/base/commandlineflags.h index c011df411..f77012dc9 100644 --- a/src/base/commandlineflags.h +++ b/src/base/commandlineflags.h @@ -140,9 +140,12 @@ : memchr("tTyY1\0", getenv(envname)[0], 6) != nullptr) #define EnvToInt(envname, dflt) \ - (!getenv(envname) ? (dflt) : strtol(getenv(envname), nullptr, 10)) + (!getenv(envname) ? (dflt) \ + : static_cast(strtol(getenv(envname), nullptr, 10))) #define EnvToUInt(envname, dflt) \ - (!getenv(envname) ? (dflt) : strtoul(getenv(envname), nullptr, 10)) + (!getenv(envname) \ + ? (dflt) \ + : static_cast(strtoul(getenv(envname), nullptr, 10))) #endif // BASE_COMMANDLINEFLAGS_H__ diff --git a/src/logging_unittest.cc b/src/logging_unittest.cc index fff766070..c6aea7b08 100644 --- a/src/logging_unittest.cc +++ b/src/logging_unittest.cc @@ -894,7 +894,7 @@ struct MyLogger : public base::Logger { void Flush() override {} - uint32 LogSize() override { return data.length(); } + uint32 LogSize() override { return static_cast(data.length()); } private: bool* set_on_destruction_;