Skip to content

Commit

Permalink
fix PERFETTO_UNLIKELY scopes
Browse files Browse the repository at this point in the history
otherwise vsnprintf errors will be ignored

Change-Id: I8d04e95df4185fbc2d49d988bb3f1712a7fcbc13
  • Loading branch information
two-heart committed Nov 3, 2024
1 parent 3e4dbdc commit 8a2b235
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/base/string_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ 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;
va_start(args, 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;
}
Expand Down

0 comments on commit 8a2b235

Please sign in to comment.