Always enforce format specifiers on SkDebugf.

Change-Id: Icba60060ab4dec45c8ef1b1e2f35056626adc0a7
Bug: skia:12143, 192062380
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428616
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
This commit is contained in:
John Stiles 2021-07-14 19:36:50 -04:00 committed by Skia Commit-Bot
parent 63fd35484e
commit 55f0d7acfa
2 changed files with 2 additions and 7 deletions

View File

@ -453,12 +453,7 @@
[[noreturn]] SK_API extern void sk_abort_no_print(void);
#ifndef SkDebugf
#if SKIA_IMPLEMENTATION
SK_API void SkDebugf(const char format[], ...) SK_PRINTF_LIKE(1, 2);
#else
// TODO(johnstiles): fix external code which misuses format specifiers
SK_API void SkDebugf(const char format[], ...);
#endif
SK_API void SkDebugf(const char format[], ...) SK_PRINTF_LIKE(1, 2);
#endif
#if defined(SK_BUILD_FOR_LIBFUZZER)
SK_API SK_PRINTF_LIKE(1, 2) inline void SkDebugf(const char format[], ...) {}

View File

@ -3549,7 +3549,7 @@ protected:
std::vector<LineMetrics> metrics;
paragraph->getLineMetrics(metrics);
for (auto& metric : metrics) {
SkDebugf("Line[%d:%d <= %d <=%d)\n", metric.fStartIndex, metric.fEndExcludingWhitespaces, metric.fEndIndex, metric.fEndIncludingNewline);
SkDebugf("Line[%zu:%zu <= %zu <= %zu)\n", metric.fStartIndex, metric.fEndExcludingWhitespaces, metric.fEndIndex, metric.fEndIncludingNewline);
}
}