Add format-specifier warnings to SkDebugf.
This CL fixes up many existing format-specifier violations in Skia.
Note that GCC has a warning for formatting nothing, so existing calls to
`SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
These were apparently meant to be used as a place to set a breakpoint.
Some of our clients also use SkDebug with bad format specifiers, so this
check is currently only enabled when SKIA_IMPLEMENTATION is true.
Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
Bug: skia:12143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/samplecode/SampleAudio.cpp b/samplecode/SampleAudio.cpp
index c09a816..a3347d7 100644
--- a/samplecode/SampleAudio.cpp
+++ b/samplecode/SampleAudio.cpp
@@ -30,7 +30,7 @@
SkDebugf("make: dur:%g time%g state:%d",
fPlayer->duration(),
fPlayer->time(),
- fPlayer->state());
+ (int)fPlayer->state());
}
fBar = { 10, 10, 510, 30 };
diff --git a/samplecode/SampleCusp.cpp b/samplecode/SampleCusp.cpp
index dd33002..9fb5a75 100644
--- a/samplecode/SampleCusp.cpp
+++ b/samplecode/SampleCusp.cpp
@@ -162,7 +162,6 @@
// draw time to make it easier to guess when the bad cubic was drawn
std::string timeStr = std::to_string((float) (curTime - start) / 1000.f);
canvas->drawSimpleText(timeStr.c_str(), timeStr.size(), SkTextEncoding::kUTF8, 20, 20, SkFont(), SkPaint());
- SkDebugf("");
}
bool onAnimate(double nanos) override {
diff --git a/samplecode/SampleSVGFile.cpp b/samplecode/SampleSVGFile.cpp
index bc1aaa9..8b34442 100644
--- a/samplecode/SampleSVGFile.cpp
+++ b/samplecode/SampleSVGFile.cpp
@@ -29,7 +29,7 @@
void onOnceBeforeDraw() override {
SkFILEStream svgStream(fPath.c_str());
if (!svgStream.isValid()) {
- SkDebugf("file not found: \"path\"\n", fPath.c_str());
+ SkDebugf("file not found: \"%s\"\n", fPath.c_str());
return;
}