Fix runtime/printf lint

This Cl changes a hardcoded 4 to sizeof(buf) and re-enables the
runtime/printf lint.

Bug: dawn:1339
Change-Id: Iaeeab2bc0d500c1aa8085352e7b26febb810bd4e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86863
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
dan sinclair 2022-04-19 08:42:58 +00:00 committed by Dawn LUCI CQ
parent cccadddcb0
commit 3878a30828
2 changed files with 1 additions and 2 deletions

View File

@ -8,7 +8,6 @@ filter=-runtime/arrays
filter=-runtime/explicit filter=-runtime/explicit
filter=-runtime/indentation_namespace filter=-runtime/indentation_namespace
filter=-runtime/int filter=-runtime/int
filter=-runtime/printf
filter=-runtime/threadsafe_fn filter=-runtime/threadsafe_fn
filter=-whitespace/blank_line filter=-whitespace/blank_line
filter=-whitespace/comments filter=-whitespace/comments

View File

@ -95,7 +95,7 @@ namespace {
auto byteView = reinterpret_cast<const uint8_t*>(buffer + index); auto byteView = reinterpret_cast<const uint8_t*>(buffer + index);
for (unsigned int b = 0; b < kBytes; ++b) { for (unsigned int b = 0; b < kBytes; ++b) {
char buf[4]; char buf[4];
snprintf(buf, 4, "%02X ", byteView[b]); snprintf(buf, sizeof(buf), "%02X ", byteView[b]);
result << buf; result << buf;
} }
} }