From 8a2b235d7f9c47da849a0996d50fc08311985fcd Mon Sep 17 00:00:00 2001 From: two-heart Date: Sun, 3 Nov 2024 18:20:45 +0100 Subject: [PATCH] fix PERFETTO_UNLIKELY scopes otherwise vsnprintf errors will be ignored Change-Id: I8d04e95df4185fbc2d49d988bb3f1712a7fcbc13 --- src/base/string_utils.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/string_utils.cc b/src/base/string_utils.cc index e8845d1ed3..c93a8f1549 100644 --- a/src/base/string_utils.cc +++ b/src/base/string_utils.cc @@ -257,7 +257,7 @@ bool UTF8ToWide(const std::string& source, std::wstring& output) { #endif // PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) size_t SprintfTrunc(char* dst, size_t dst_size, const char* fmt, ...) { - if (PERFETTO_UNLIKELY(dst_size) == 0) + if (PERFETTO_UNLIKELY(dst_size == 0)) return 0; va_list args; @@ -265,7 +265,7 @@ size_t SprintfTrunc(char* dst, size_t dst_size, const char* fmt, ...) { int src_size = vsnprintf(dst, dst_size, fmt, args); va_end(args); - if (PERFETTO_UNLIKELY(src_size) <= 0) { + if (PERFETTO_UNLIKELY(src_size <= 0)) { dst[0] = '\0'; return 0; }