Revert "Add format-specifier warnings to SkDebugf."
This reverts commit e58831cd9578805634b986b434a20757277b3a36.
Reason for revert: looks like breaking a few build bots
Original change's description:
> 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>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: I07848c1bf8992925c9498e916744d0840355a077
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421917
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
diff --git a/docs/examples/Bitmap_bytesPerPixel.cpp b/docs/examples/Bitmap_bytesPerPixel.cpp
index db9d33f..a0e92a1 100644
--- a/docs/examples/Bitmap_bytesPerPixel.cpp
+++ b/docs/examples/Bitmap_bytesPerPixel.cpp
@@ -17,7 +17,7 @@
} ) {
bitmap.setInfo(info.makeColorType(colorType));
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d\n",
- colors[colorType], (int)(13 - strlen(colors[colorType])), " ",
+ colors[colorType], 13 - strlen(colors[colorType]), " ",
bitmap.bytesPerPixel());
}
}
diff --git a/docs/examples/Bitmap_computeByteSize.cpp b/docs/examples/Bitmap_computeByteSize.cpp
index 891396e..a43ffdd 100644
--- a/docs/examples/Bitmap_computeByteSize.cpp
+++ b/docs/examples/Bitmap_computeByteSize.cpp
@@ -9,7 +9,7 @@
for (int height: { 1, 1000, 1000000 } ) {
SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
bitmap.setInfo(imageInfo, width * 5);
- SkDebugf("width: %7d height: %7d computeByteSize: %13zu\n", width, height,
+ SkDebugf("width: %7d height: %7d computeByteSize: %13lld\n", width, height,
bitmap.computeByteSize());
}
}
diff --git a/docs/examples/Bitmap_rowBytes.cpp b/docs/examples/Bitmap_rowBytes.cpp
index 47041af..ee6468a 100644
--- a/docs/examples/Bitmap_rowBytes.cpp
+++ b/docs/examples/Bitmap_rowBytes.cpp
@@ -7,8 +7,7 @@
SkBitmap bitmap;
for (int rowBytes : { 2, 8 } ) {
bool result = bitmap.setInfo(SkImageInfo::MakeA8(4, 4), rowBytes);
- SkDebugf("setInfo returned:%s rowBytes:%zu\n",
- result ? "true " : "false", bitmap.rowBytes());
+ SkDebugf("setInfo returned:%s rowBytes:%d\n", result ? "true " : "false", bitmap.rowBytes());
}
}
} // END FIDDLE
diff --git a/docs/examples/Bitmap_shiftPerPixel.cpp b/docs/examples/Bitmap_shiftPerPixel.cpp
index a011f7e..7232211 100644
--- a/docs/examples/Bitmap_shiftPerPixel.cpp
+++ b/docs/examples/Bitmap_shiftPerPixel.cpp
@@ -17,7 +17,7 @@
} ) {
bitmap.setInfo(info.makeColorType(colorType));
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "shiftPerPixel: %d\n",
- colors[colorType], (int)(14 - strlen(colors[colorType])), " ",
+ colors[colorType], 14 - strlen(colors[colorType]), " ",
bitmap.shiftPerPixel());
}
}
diff --git a/docs/examples/Canvas_empty_constructor.cpp b/docs/examples/Canvas_empty_constructor.cpp
index 72f2ca2..3bc90ab 100644
--- a/docs/examples/Canvas_empty_constructor.cpp
+++ b/docs/examples/Canvas_empty_constructor.cpp
@@ -5,7 +5,7 @@
REG_FIDDLE(Canvas_empty_constructor, 256, 256, true, 0) {
static void check_for_rotated_ctm(const SkCanvas* canvas) {
const SkM44 matrix = canvas->getLocalToDevice();
- SkDebugf("ctm is identity = %s\n", matrix == SkM44() ? "true" : "false");
+ SkDebugf("ctm is identity = \n", matrix == SkM44() ? "true" : "false");
}
void draw(SkCanvas* canvas) {
diff --git a/docs/examples/IRect_height64.cpp b/docs/examples/IRect_height64.cpp
index 91aab2e..3fafc07 100644
--- a/docs/examples/IRect_height64.cpp
+++ b/docs/examples/IRect_height64.cpp
@@ -5,6 +5,6 @@
REG_FIDDLE(IRect_height64, 256, 256, true, 0) {
void draw(SkCanvas* canvas) {
SkIRect large = { 1, -2147483647, 2, 2147483644 };
- SkDebugf("height: %d height64: %" PRId64 "\n", large.height(), large.height64());
+ SkDebugf("height: %d height64: %lld\n", large.height(), large.height64());
}
} // END FIDDLE
diff --git a/docs/examples/IRect_width64.cpp b/docs/examples/IRect_width64.cpp
index 25903b2..9aa25d8 100644
--- a/docs/examples/IRect_width64.cpp
+++ b/docs/examples/IRect_width64.cpp
@@ -5,6 +5,6 @@
REG_FIDDLE(IRect_width64, 256, 256, true, 0) {
void draw(SkCanvas* canvas) {
SkIRect large = { -2147483647, 1, 2147483644, 2 };
- SkDebugf("width: %d width64: %" PRId64 "\n", large.width(), large.width64());
+ SkDebugf("width: %d width64: %lld\n", large.width(), large.width64());
}
} // END FIDDLE
diff --git a/docs/examples/ImageInfo_bytesPerPixel.cpp b/docs/examples/ImageInfo_bytesPerPixel.cpp
index b15034f..29f2046 100644
--- a/docs/examples/ImageInfo_bytesPerPixel.cpp
+++ b/docs/examples/ImageInfo_bytesPerPixel.cpp
@@ -15,7 +15,7 @@
} ) {
SkImageInfo info = SkImageInfo::Make(1, 1, colorType, kOpaque_SkAlphaType);
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d\n",
- colors[colorType], (int)(13 - strlen(colors[colorType])), " ",
+ colors[colorType], 13 - strlen(colors[colorType]), " ",
info.bytesPerPixel());
}
}
diff --git a/docs/examples/ImageInfo_shiftPerPixel.cpp b/docs/examples/ImageInfo_shiftPerPixel.cpp
index e16a896..f83e5f7 100644
--- a/docs/examples/ImageInfo_shiftPerPixel.cpp
+++ b/docs/examples/ImageInfo_shiftPerPixel.cpp
@@ -30,7 +30,7 @@
} ) {
SkImageInfo info = SkImageInfo::Make(1, 1, colorType, kOpaque_SkAlphaType);
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "shiftPerPixel: %d\n",
- color_type(colorType), (int)(14 - strlen(color_type(colorType))), " ",
+ color_type(colorType), 14 - strlen(color_type(colorType)), " ",
info.shiftPerPixel());
}
}
diff --git a/docs/examples/ImageInfo_validRowBytes.cpp b/docs/examples/ImageInfo_validRowBytes.cpp
index 80fa00a..d0f7cb8 100644
--- a/docs/examples/ImageInfo_validRowBytes.cpp
+++ b/docs/examples/ImageInfo_validRowBytes.cpp
@@ -6,7 +6,7 @@
void draw(SkCanvas* canvas) {
SkImageInfo info = SkImageInfo::MakeN32Premul(16, 8);
for (size_t rowBytes = 60; rowBytes < 72; rowBytes += sizeof(SkPMColor)) {
- SkDebugf("validRowBytes(%zu): %s\n", rowBytes, info.validRowBytes(rowBytes) ?
+ SkDebugf("validRowBytes(%llu): %s\n", rowBytes, info.validRowBytes(rowBytes) ?
"true" : "false");
}
}
diff --git a/docs/examples/Paint_move_operator.cpp b/docs/examples/Paint_move_operator.cpp
index 6b6f92b..a9d8605 100644
--- a/docs/examples/Paint_move_operator.cpp
+++ b/docs/examples/Paint_move_operator.cpp
@@ -7,6 +7,6 @@
SkPaint paint1, paint2;
paint1.setColor(SK_ColorRED);
paint2 = std::move(paint1);
- SkDebugf("SK_ColorRED %c= paint2.getColor()\n", SK_ColorRED == paint2.getColor() ? '=' : '!');
+ SkDebugf("SK_ColorRED == paint2.getColor()\n", SK_ColorRED == paint2.getColor() ? '=' : '!');
}
} // END FIDDLE
diff --git a/docs/examples/Path_readFromMemory.cpp b/docs/examples/Path_readFromMemory.cpp
index c9c41a7..f576a48 100644
--- a/docs/examples/Path_readFromMemory.cpp
+++ b/docs/examples/Path_readFromMemory.cpp
@@ -12,9 +12,9 @@
path.writeToMemory(storage.begin());
size_t wrongSize = size - 4;
size_t bytesRead = copy.readFromMemory(storage.begin(), wrongSize);
- SkDebugf("length = %zu; returned by readFromMemory = %zu\n", wrongSize, bytesRead);
+ SkDebugf("length = %u; returned by readFromMemory = %u\n", wrongSize, bytesRead);
size_t largerSize = size + 4;
bytesRead = copy.readFromMemory(storage.begin(), largerSize);
- SkDebugf("length = %zu; returned by readFromMemory = %zu\n", largerSize, bytesRead);
+ SkDebugf("length = %u; returned by readFromMemory = %u\n", largerSize, bytesRead);
}
} // END FIDDLE
diff --git a/docs/examples/Pixmap_addr.cpp b/docs/examples/Pixmap_addr.cpp
index eabe576..8e2fd2a 100644
--- a/docs/examples/Pixmap_addr.cpp
+++ b/docs/examples/Pixmap_addr.cpp
@@ -9,10 +9,10 @@
SkPixmap pixmap(SkImageInfo::Make(image->width(), image->height(), kN32_SkColorType,
image->alphaType()), (const void*) &pixels.front(), image->width() * 4);
image->readPixels(nullptr, pixmap, 0, 0);
- SkDebugf("pixels address: 0x%p\n", pixmap.addr());
+ SkDebugf("pixels address: 0x%llx\n", pixmap.addr());
SkPixmap inset;
if (pixmap.extractSubset(&inset, {128, 128, 512, 512})) {
- SkDebugf("inset address: 0x%p\n", inset.addr());
+ SkDebugf("inset address: 0x%llx\n", inset.addr());
}
}
} // END FIDDLE
diff --git a/docs/examples/Pixmap_computeByteSize.cpp b/docs/examples/Pixmap_computeByteSize.cpp
index b45d8fe..eb0e5f9 100644
--- a/docs/examples/Pixmap_computeByteSize.cpp
+++ b/docs/examples/Pixmap_computeByteSize.cpp
@@ -9,7 +9,7 @@
for (int height: { 1, 1000, 1000000 } ) {
SkImageInfo imageInfo = SkImageInfo::MakeN32(width, height, kPremul_SkAlphaType);
pixmap.reset(imageInfo, nullptr, width * 5);
- SkDebugf("width: %7d height: %7d computeByteSize: %13zu\n", width, height,
+ SkDebugf("width: %7d height: %7d computeByteSize: %13lld\n", width, height,
pixmap.computeByteSize());
}
}
diff --git a/docs/examples/Pixmap_rowBytes.cpp b/docs/examples/Pixmap_rowBytes.cpp
index 71a0abe..4cffbec 100644
--- a/docs/examples/Pixmap_rowBytes.cpp
+++ b/docs/examples/Pixmap_rowBytes.cpp
@@ -7,7 +7,7 @@
SkPixmap badPixmap = {SkImageInfo::MakeA8(4, 4), nullptr, 2};
SkPixmap okPixmap = {SkImageInfo::MakeA8(4, 4), nullptr, 8};
for (auto& pixmap : { badPixmap, okPixmap } ) {
- SkDebugf("rowBytes: %zu minRowBytes: %zu\n", pixmap.rowBytes(),
+ SkDebugf("rowBytes: %d minRowBytes: %d\n", pixmap.rowBytes(),
pixmap.info().minRowBytes());
}
}
diff --git a/docs/examples/Pixmap_shiftPerPixel.cpp b/docs/examples/Pixmap_shiftPerPixel.cpp
index f169df5..cd48ad9 100644
--- a/docs/examples/Pixmap_shiftPerPixel.cpp
+++ b/docs/examples/Pixmap_shiftPerPixel.cpp
@@ -29,7 +29,7 @@
kGray_8_SkColorType, kRGBA_F16_SkColorType } ) {
SkPixmap pixmap(info.makeColorType(colorType), nullptr, 4);
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d shiftPerPixel: %d\n",
- color_type(colorType), (int)(10 - strlen(color_type(colorType))), " ",
+ color_type(colorType), 10 - strlen(color_type(colorType)), " ",
pixmap.info().bytesPerPixel(), pixmap.shiftPerPixel());
}
}
diff --git a/docs/examples/Rect_equal_operator.cpp b/docs/examples/Rect_equal_operator.cpp
index 4f816bb..d44dddc 100644
--- a/docs/examples/Rect_equal_operator.cpp
+++ b/docs/examples/Rect_equal_operator.cpp
@@ -8,11 +8,11 @@
SkRect negZero = {-0.0f, -0.0f, 2, 2};
SkDebugf("{%g, %g, %g, %g} %c= {%g, %g, %g, %g} %s numerically equal\n",
test.fLeft, test.fTop, test.fRight, test.fBottom,
- test == negZero ? '=' : '!',
negZero.fLeft, negZero.fTop, negZero.fRight, negZero.fBottom,
- (test.fLeft == negZero.fLeft && test.fTop == negZero.fTop &&
- test.fRight == negZero.fRight && test.fBottom == negZero.fBottom) ?
- "and are" : "yet are not");
+ test == negZero ? '=' : '!',
+ test.fLeft == negZero.fLeft && test.fTop == negZero.fTop &&
+ test.fRight == negZero.fRight && test.fBottom == negZero.fBottom ?
+ "and are" : "yet are not");
};
SkRect tests[] = {{0, 0, 2, 2}, {-0, -0, 2, 2}, {0.0f, 0.0f, 2, 2}};
SkDebugf("tests are %s" "equal\n", tests[0] == tests[1] && tests[1] == tests[2] ? "" : "not ");