aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Stiles <johnstiles@google.com>2021-06-24 18:05:10 -0400
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2021-06-25 11:05:59 +0000
commite58831cd9578805634b986b434a20757277b3a36 (patch)
treec667982cc4c74753b4419fbd71ce019d3d974bba
parent3a35f0b263cbdad011ffff6e5032f5996e946239 (diff)
downloadskia-e58831cd9578805634b986b434a20757277b3a36.tar.gz
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>
-rw-r--r--docs/examples/Bitmap_bytesPerPixel.cpp2
-rw-r--r--docs/examples/Bitmap_computeByteSize.cpp2
-rw-r--r--docs/examples/Bitmap_rowBytes.cpp3
-rw-r--r--docs/examples/Bitmap_shiftPerPixel.cpp2
-rw-r--r--docs/examples/Canvas_empty_constructor.cpp2
-rw-r--r--docs/examples/IRect_height64.cpp2
-rw-r--r--docs/examples/IRect_width64.cpp2
-rw-r--r--docs/examples/ImageInfo_bytesPerPixel.cpp2
-rw-r--r--docs/examples/ImageInfo_shiftPerPixel.cpp2
-rw-r--r--docs/examples/ImageInfo_validRowBytes.cpp2
-rw-r--r--docs/examples/Paint_move_operator.cpp2
-rw-r--r--docs/examples/Path_readFromMemory.cpp4
-rw-r--r--docs/examples/Pixmap_addr.cpp4
-rw-r--r--docs/examples/Pixmap_computeByteSize.cpp2
-rw-r--r--docs/examples/Pixmap_rowBytes.cpp2
-rw-r--r--docs/examples/Pixmap_shiftPerPixel.cpp2
-rw-r--r--docs/examples/Rect_equal_operator.cpp8
-rw-r--r--experimental/ngatoy/Cmds.h4
-rw-r--r--experimental/ngatoy/ngatoy.cpp4
-rw-r--r--experimental/skrive/src/Artboard.cpp4
-rw-r--r--experimental/skrive/src/SkRive.cpp4
-rw-r--r--fuzz/FuzzEncoders.cpp2
-rw-r--r--fuzz/FuzzMain.cpp4
-rw-r--r--include/core/SkTime.h4
-rw-r--r--include/core/SkTypes.h9
-rw-r--r--include/private/GrResourceKey.h2
-rw-r--r--modules/skottie/src/SkottieTool.cpp2
-rw-r--r--modules/skparagraph/samples/SampleParagraph.cpp17
-rw-r--r--modules/skparagraph/src/OneLineShaper.cpp21
-rw-r--r--modules/skplaintexteditor/app/editor_application.cpp2
-rw-r--r--modules/svg/src/SkSVGFilterContext.cpp2
-rw-r--r--modules/svg/src/SkSVGImage.cpp2
-rw-r--r--modules/svg/src/SkSVGRenderContext.cpp2
-rw-r--r--samplecode/SampleAudio.cpp2
-rw-r--r--samplecode/SampleCusp.cpp1
-rw-r--r--samplecode/SampleSVGFile.cpp2
-rw-r--r--src/core/SkResourceCache.cpp4
-rw-r--r--src/core/SkSharedMutex.cpp14
-rw-r--r--src/core/SkStream.cpp2
-rw-r--r--src/core/SkStrikeCache.cpp4
-rw-r--r--src/core/SkTextBlobTrace.cpp4
-rw-r--r--src/core/SkVM.cpp2
-rw-r--r--src/gpu/GrRecordingContextPriv.h2
-rw-r--r--src/gpu/d3d/GrD3DUtil.h16
-rw-r--r--src/gpu/vk/GrVkDescriptorPool.h6
-rw-r--r--src/gpu/vk/GrVkDescriptorSet.h5
-rw-r--r--src/gpu/vk/GrVkFramebuffer.h5
-rw-r--r--src/gpu/vk/GrVkImage.h4
-rw-r--r--src/gpu/vk/GrVkImageView.h5
-rw-r--r--src/gpu/vk/GrVkPipeline.h4
-rw-r--r--src/gpu/vk/GrVkRenderPass.h5
-rw-r--r--src/gpu/vk/GrVkSampler.h4
-rw-r--r--src/gpu/vk/GrVkSamplerYcbcrConversion.h5
-rw-r--r--src/gpu/vk/GrVkSemaphore.h5
-rw-r--r--src/pathops/SkPathOpsTSect.cpp4
-rw-r--r--src/pathops/SkPathWriter.cpp1
-rw-r--r--src/ports/SkFontHost_FreeType.cpp2
-rw-r--r--src/ports/SkFontHost_FreeType_common.cpp2
-rw-r--r--src/ports/SkFontHost_FreeType_common.h2
-rw-r--r--src/ports/SkFontMgr_android_parser.cpp8
-rw-r--r--src/sksl/SkSLOperators.h2
-rw-r--r--src/sksl/codegen/SkSLVMCodeGenerator.cpp4
-rw-r--r--src/utils/win/SkHRESULT.cpp2
-rw-r--r--tests/ClipperTest.cpp9
-rw-r--r--tests/EGLImageTest.cpp2
-rw-r--r--tests/PathOpsAngleIdeas.cpp3
-rw-r--r--tests/PathOpsAngleTest.cpp1
-rw-r--r--tests/PathOpsConicIntersectionTest.cpp3
-rw-r--r--tests/PathOpsConicLineIntersectionTest.cpp1
-rw-r--r--tests/PathOpsCubicIntersectionTest.cpp3
-rw-r--r--tests/PathOpsExtendedTest.cpp2
-rw-r--r--tests/PathOpsQuadLineIntersectionTest.cpp1
-rw-r--r--tests/ProcessorTest.cpp6
-rw-r--r--tests/RRectInPathTest.cpp4
-rw-r--r--tools/CrashHandler.cpp4
-rw-r--r--tools/SkSharingProc.cpp2
-rw-r--r--tools/fiddle/examples.h1
-rw-r--r--tools/sk_app/win/D3D12WindowContext_win.cpp16
-rw-r--r--tools/trace/SkDebugfTracer.cpp4
-rw-r--r--tools/viewer/SkottieSlide.cpp2
80 files changed, 177 insertions, 145 deletions
diff --git a/docs/examples/Bitmap_bytesPerPixel.cpp b/docs/examples/Bitmap_bytesPerPixel.cpp
index a0e92a14d3..db9d33f2d9 100644
--- a/docs/examples/Bitmap_bytesPerPixel.cpp
+++ b/docs/examples/Bitmap_bytesPerPixel.cpp
@@ -17,7 +17,7 @@ void draw(SkCanvas* canvas) {
} ) {
bitmap.setInfo(info.makeColorType(colorType));
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d\n",
- colors[colorType], 13 - strlen(colors[colorType]), " ",
+ colors[colorType], (int)(13 - strlen(colors[colorType])), " ",
bitmap.bytesPerPixel());
}
}
diff --git a/docs/examples/Bitmap_computeByteSize.cpp b/docs/examples/Bitmap_computeByteSize.cpp
index a43ffddb34..891396e144 100644
--- a/docs/examples/Bitmap_computeByteSize.cpp
+++ b/docs/examples/Bitmap_computeByteSize.cpp
@@ -9,7 +9,7 @@ void draw(SkCanvas* canvas) {
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: %13lld\n", width, height,
+ SkDebugf("width: %7d height: %7d computeByteSize: %13zu\n", width, height,
bitmap.computeByteSize());
}
}
diff --git a/docs/examples/Bitmap_rowBytes.cpp b/docs/examples/Bitmap_rowBytes.cpp
index ee6468a0bf..47041af884 100644
--- a/docs/examples/Bitmap_rowBytes.cpp
+++ b/docs/examples/Bitmap_rowBytes.cpp
@@ -7,7 +7,8 @@ void draw(SkCanvas* canvas) {
SkBitmap bitmap;
for (int rowBytes : { 2, 8 } ) {
bool result = bitmap.setInfo(SkImageInfo::MakeA8(4, 4), rowBytes);
- SkDebugf("setInfo returned:%s rowBytes:%d\n", result ? "true " : "false", bitmap.rowBytes());
+ SkDebugf("setInfo returned:%s rowBytes:%zu\n",
+ result ? "true " : "false", bitmap.rowBytes());
}
}
} // END FIDDLE
diff --git a/docs/examples/Bitmap_shiftPerPixel.cpp b/docs/examples/Bitmap_shiftPerPixel.cpp
index 72322112a2..a011f7eee5 100644
--- a/docs/examples/Bitmap_shiftPerPixel.cpp
+++ b/docs/examples/Bitmap_shiftPerPixel.cpp
@@ -17,7 +17,7 @@ void draw(SkCanvas* canvas) {
} ) {
bitmap.setInfo(info.makeColorType(colorType));
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "shiftPerPixel: %d\n",
- colors[colorType], 14 - strlen(colors[colorType]), " ",
+ colors[colorType], (int)(14 - strlen(colors[colorType])), " ",
bitmap.shiftPerPixel());
}
}
diff --git a/docs/examples/Canvas_empty_constructor.cpp b/docs/examples/Canvas_empty_constructor.cpp
index 3bc90ab6ef..72f2ca21ed 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 = \n", matrix == SkM44() ? "true" : "false");
+ SkDebugf("ctm is identity = %s\n", matrix == SkM44() ? "true" : "false");
}
void draw(SkCanvas* canvas) {
diff --git a/docs/examples/IRect_height64.cpp b/docs/examples/IRect_height64.cpp
index 3fafc07244..91aab2ebeb 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: %lld\n", large.height(), large.height64());
+ SkDebugf("height: %d height64: %" PRId64 "\n", large.height(), large.height64());
}
} // END FIDDLE
diff --git a/docs/examples/IRect_width64.cpp b/docs/examples/IRect_width64.cpp
index 9aa25d860a..25903b293e 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: %lld\n", large.width(), large.width64());
+ SkDebugf("width: %d width64: %" PRId64 "\n", large.width(), large.width64());
}
} // END FIDDLE
diff --git a/docs/examples/ImageInfo_bytesPerPixel.cpp b/docs/examples/ImageInfo_bytesPerPixel.cpp
index 29f2046160..b15034f67f 100644
--- a/docs/examples/ImageInfo_bytesPerPixel.cpp
+++ b/docs/examples/ImageInfo_bytesPerPixel.cpp
@@ -15,7 +15,7 @@ void draw(SkCanvas* canvas) {
} ) {
SkImageInfo info = SkImageInfo::Make(1, 1, colorType, kOpaque_SkAlphaType);
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "bytesPerPixel: %d\n",
- colors[colorType], 13 - strlen(colors[colorType]), " ",
+ colors[colorType], (int)(13 - strlen(colors[colorType])), " ",
info.bytesPerPixel());
}
}
diff --git a/docs/examples/ImageInfo_shiftPerPixel.cpp b/docs/examples/ImageInfo_shiftPerPixel.cpp
index f83e5f7792..e16a8964bb 100644
--- a/docs/examples/ImageInfo_shiftPerPixel.cpp
+++ b/docs/examples/ImageInfo_shiftPerPixel.cpp
@@ -30,7 +30,7 @@ void draw(SkCanvas* canvas) {
} ) {
SkImageInfo info = SkImageInfo::Make(1, 1, colorType, kOpaque_SkAlphaType);
SkDebugf("color: k" "%s" "_SkColorType" "%*s" "shiftPerPixel: %d\n",
- color_type(colorType), 14 - strlen(color_type(colorType)), " ",
+ color_type(colorType), (int)(14 - strlen(color_type(colorType))), " ",
info.shiftPerPixel());
}
}
diff --git a/docs/examples/ImageInfo_validRowBytes.cpp b/docs/examples/ImageInfo_validRowBytes.cpp
index d0f7cb848b..80fa00a473 100644
--- a/docs/examples/ImageInfo_validRowBytes.cpp
+++ b/docs/examples/ImageInfo_validRowBytes.cpp
@@ -6,7 +6,7 @@ REG_FIDDLE(ImageInfo_validRowBytes, 256, 256, true, 0) {
void draw(SkCanvas* canvas) {
SkImageInfo info = SkImageInfo::MakeN32Premul(16, 8);
for (size_t rowBytes = 60; rowBytes < 72; rowBytes += sizeof(SkPMColor)) {
- SkDebugf("validRowBytes(%llu): %s\n", rowBytes, info.validRowBytes(rowBytes) ?
+ SkDebugf("validRowBytes(%zu): %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 a9d86057e1..6b6f92b5ec 100644
--- a/docs/examples/Paint_move_operator.cpp
+++ b/docs/examples/Paint_move_operator.cpp
@@ -7,6 +7,6 @@ void draw(SkCanvas* canvas) {
SkPaint paint1, paint2;
paint1.setColor(SK_ColorRED);
paint2 = std::move(paint1);
- SkDebugf("SK_ColorRED == paint2.getColor()\n", SK_ColorRED == paint2.getColor() ? '=' : '!');
+ SkDebugf("SK_ColorRED %c= paint2.getColor()\n", SK_ColorRED == paint2.getColor() ? '=' : '!');
}
} // END FIDDLE
diff --git a/docs/examples/Path_readFromMemory.cpp b/docs/examples/Path_readFromMemory.cpp
index f576a48b6a..c9c41a7e18 100644
--- a/docs/examples/Path_readFromMemory.cpp
+++ b/docs/examples/Path_readFromMemory.cpp
@@ -12,9 +12,9 @@ void draw(SkCanvas* canvas) {
path.writeToMemory(storage.begin());
size_t wrongSize = size - 4;
size_t bytesRead = copy.readFromMemory(storage.begin(), wrongSize);
- SkDebugf("length = %u; returned by readFromMemory = %u\n", wrongSize, bytesRead);
+ SkDebugf("length = %zu; returned by readFromMemory = %zu\n", wrongSize, bytesRead);
size_t largerSize = size + 4;
bytesRead = copy.readFromMemory(storage.begin(), largerSize);
- SkDebugf("length = %u; returned by readFromMemory = %u\n", largerSize, bytesRead);
+ SkDebugf("length = %zu; returned by readFromMemory = %zu\n", largerSize, bytesRead);
}
} // END FIDDLE
diff --git a/docs/examples/Pixmap_addr.cpp b/docs/examples/Pixmap_addr.cpp
index 8e2fd2a8b3..eabe576405 100644
--- a/docs/examples/Pixmap_addr.cpp
+++ b/docs/examples/Pixmap_addr.cpp
@@ -9,10 +9,10 @@ void draw(SkCanvas* canvas) {
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%llx\n", pixmap.addr());
+ SkDebugf("pixels address: 0x%p\n", pixmap.addr());
SkPixmap inset;
if (pixmap.extractSubset(&inset, {128, 128, 512, 512})) {
- SkDebugf("inset address: 0x%llx\n", inset.addr());
+ SkDebugf("inset address: 0x%p\n", inset.addr());
}
}
} // END FIDDLE
diff --git a/docs/examples/Pixmap_computeByteSize.cpp b/docs/examples/Pixmap_computeByteSize.cpp
index eb0e5f99c5..b45d8feb08 100644
--- a/docs/examples/Pixmap_computeByteSize.cpp
+++ b/docs/examples/Pixmap_computeByteSize.cpp
@@ -9,7 +9,7 @@ void draw(SkCanvas* canvas) {
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: %13lld\n", width, height,
+ SkDebugf("width: %7d height: %7d computeByteSize: %13zu\n", width, height,
pixmap.computeByteSize());
}
}
diff --git a/docs/examples/Pixmap_rowBytes.cpp b/docs/examples/Pixmap_rowBytes.cpp
index 4cffbece8c..71a0abe157 100644
--- a/docs/examples/Pixmap_rowBytes.cpp
+++ b/docs/examples/Pixmap_rowBytes.cpp
@@ -7,7 +7,7 @@ void draw(SkCanvas* canvas) {
SkPixmap badPixmap = {SkImageInfo::MakeA8(4, 4), nullptr, 2};
SkPixmap okPixmap = {SkImageInfo::MakeA8(4, 4), nullptr, 8};
for (auto& pixmap : { badPixmap, okPixmap } ) {
- SkDebugf("rowBytes: %d minRowBytes: %d\n", pixmap.rowBytes(),
+ SkDebugf("rowBytes: %zu minRowBytes: %zu\n", pixmap.rowBytes(),
pixmap.info().minRowBytes());
}
}
diff --git a/docs/examples/Pixmap_shiftPerPixel.cpp b/docs/examples/Pixmap_shiftPerPixel.cpp
index cd48ad9929..f169df5f4e 100644
--- a/docs/examples/Pixmap_shiftPerPixel.cpp
+++ b/docs/examples/Pixmap_shiftPerPixel.cpp
@@ -29,7 +29,7 @@ void draw(SkCanvas* canvas) {
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), 10 - strlen(color_type(colorType)), " ",
+ color_type(colorType), (int)(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 d44dddcd1e..4f816bbd0c 100644
--- a/docs/examples/Rect_equal_operator.cpp
+++ b/docs/examples/Rect_equal_operator.cpp
@@ -8,11 +8,11 @@ void draw(SkCanvas* canvas) {
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,
- negZero.fLeft, negZero.fTop, negZero.fRight, negZero.fBottom,
test == negZero ? '=' : '!',
- test.fLeft == negZero.fLeft && test.fTop == negZero.fTop &&
- test.fRight == negZero.fRight && test.fBottom == negZero.fBottom ?
- "and are" : "yet are not");
+ 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");
};
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 ");
diff --git a/experimental/ngatoy/Cmds.h b/experimental/ngatoy/Cmds.h
index c29f564e0c..3bb35aaad8 100644
--- a/experimental/ngatoy/Cmds.h
+++ b/experimental/ngatoy/Cmds.h
@@ -108,8 +108,8 @@ public:
void dump() const override {
SkDebugf("%d: draw%s %d %d %d %d -- %d",
- fShape == Shape::kRect ? "Rect" : "Oval",
fID.toInt(),
+ fShape == Shape::kRect ? "Rect" : "Oval",
fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom,
fPaintersOrder.toUInt());
}
@@ -146,8 +146,8 @@ public:
void dump() const override {
SkDebugf("%d: clip%s %d %d %d %d",
- fShape == Shape::kRect ? "Rect" : "Oval",
fID.toInt(),
+ fShape == Shape::kRect ? "Rect" : "Oval",
fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom);
}
diff --git a/experimental/ngatoy/ngatoy.cpp b/experimental/ngatoy/ngatoy.cpp
index 7ca6f64d9c..b749e72969 100644
--- a/experimental/ngatoy/ngatoy.cpp
+++ b/experimental/ngatoy/ngatoy.cpp
@@ -223,13 +223,13 @@ static void check_order(int testID,
if (expectedOrder != actualOrder) {
SkDebugf("order mismatch in test %d:\n", testID);
- SkDebugf("E %d: ", expectedOrder.size());
+ SkDebugf("E %zu: ", expectedOrder.size());
for (auto t : expectedOrder) {
SkDebugf("%d", t.toInt());
}
SkDebugf("\n");
- SkDebugf("A %d: ", actualOrder.size());
+ SkDebugf("A %zu: ", actualOrder.size());
for (auto t : actualOrder) {
SkDebugf("%d", t.toInt());
}
diff --git a/experimental/skrive/src/Artboard.cpp b/experimental/skrive/src/Artboard.cpp
index a2122de4ae..ebe0fa410a 100644
--- a/experimental/skrive/src/Artboard.cpp
+++ b/experimental/skrive/src/Artboard.cpp
@@ -48,7 +48,7 @@ std::tuple<sk_sp<Component>, size_t> parse_component(StreamReader* sr) {
break;
}
- SkDebugf("!! unsupported node type: %d\n", block.type());
+ SkDebugf("!! unsupported node type: %d\n", (int)block.type());
return {nullptr, 0};
}
@@ -109,7 +109,7 @@ sk_sp<Artboard> parse_artboard(StreamReader* sr) {
ab->setRoot(parse_components(sr));
break;
default:
- SkDebugf("!! Unsupported block type: %d\n", block.type());
+ SkDebugf("!! Unsupported block type: %d\n", (int)block.type());
break;
}
}
diff --git a/experimental/skrive/src/SkRive.cpp b/experimental/skrive/src/SkRive.cpp
index 971b609d75..c71e7fbe82 100644
--- a/experimental/skrive/src/SkRive.cpp
+++ b/experimental/skrive/src/SkRive.cpp
@@ -26,7 +26,7 @@ void parse_artboards(const sk_sp<SkRive>& skrive, StreamReader* sr) {
break;
}
if (block.type() != StreamReader::BlockType::kActorArtboard) {
- SkDebugf("!! Unexpected artboard block type: %d\n", block.type());
+ SkDebugf("!! Unexpected artboard block type: %d\n", (int)block.type());
continue;
}
@@ -55,7 +55,7 @@ static sk_sp<SkRive> parse_skrive(std::unique_ptr<StreamReader> sr) {
parse_artboards(skrive, sr.get());
break;
default:
- SkDebugf("!! Unsupported block type: %d\n", block.type());
+ SkDebugf("!! Unsupported block type: %d\n", (int)block.type());
break;
}
}
diff --git a/fuzz/FuzzEncoders.cpp b/fuzz/FuzzEncoders.cpp
index 9cafc83828..01e3940da4 100644
--- a/fuzz/FuzzEncoders.cpp
+++ b/fuzz/FuzzEncoders.cpp
@@ -77,7 +77,7 @@ DEF_FUZZ(WEBPEncoder, fuzz) {
// and dump out a corpus for this fuzzer.
DEF_FUZZ(_MakeEncoderCorpus, fuzz) {
auto bytes = fuzz->fBytes;
- SkDebugf("bytes %d\n", bytes->size());
+ SkDebugf("bytes %zu\n", bytes->size());
auto img = SkImage::MakeFromEncoded(bytes);
if (nullptr == img.get()) {
SkDebugf("invalid image, could not decode\n");
diff --git a/fuzz/FuzzMain.cpp b/fuzz/FuzzMain.cpp
index c121ef99cd..6f6a535eba 100644
--- a/fuzz/FuzzMain.cpp
+++ b/fuzz/FuzzMain.cpp
@@ -667,7 +667,7 @@ static void fuzz_img(sk_sp<SkData> bytes, uint8_t scale, uint8_t mode) {
bitmap.rowBytes(), &options);
if (SkCodec::kSuccess != result) {
SkDebugf("[terminated] failed to start incremental decode "
- "in frame %d with error %d\n", i, result);
+ "in frame %zu with error %d\n", i, result);
return;
}
@@ -678,7 +678,7 @@ static void fuzz_img(sk_sp<SkData> bytes, uint8_t scale, uint8_t mode) {
break;
}
if (result == SkCodec::kSuccess) {
- SkDebugf("okay - decoded frame %d\n", i);
+ SkDebugf("okay - decoded frame %zu\n", i);
} else {
SkDebugf("[terminated] incremental decode failed with "
"error %d\n", result);
diff --git a/include/core/SkTime.h b/include/core/SkTime.h
index 55b823a42d..3da2c8c771 100644
--- a/include/core/SkTime.h
+++ b/include/core/SkTime.h
@@ -13,6 +13,8 @@
#include "include/core/SkTypes.h"
#include "include/private/SkMacros.h"
+#include <cinttypes>
+
class SkString;
/** \class SkTime
@@ -51,7 +53,7 @@ public:
, fNow(SkTime::GetMSecs()) {}
~SkAutoTime() {
uint64_t dur = static_cast<uint64_t>(SkTime::GetMSecs() - fNow);
- SkDebugf("%s %ld\n", fLabel ? fLabel : "", dur);
+ SkDebugf("%s %" PRIu64 "\n", fLabel ? fLabel : "", dur);
}
private:
const char* fLabel;
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 0b09cd35cb..781216e829 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -453,10 +453,15 @@
[[noreturn]] SK_API extern void sk_abort_no_print(void);
#ifndef SkDebugf
- SK_API void SkDebugf(const char format[], ...);
+ #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
#endif
#if defined(SK_BUILD_FOR_LIBFUZZER)
- SK_API inline void SkDebugf(const char format[], ...) {}
+ SK_API SK_PRINTF_LIKE(1, 2) inline void SkDebugf(const char format[], ...) {}
#endif
// SkASSERT, SkASSERTF and SkASSERT_RELEASE can be used as stand alone assertion expressions, e.g.
diff --git a/include/private/GrResourceKey.h b/include/private/GrResourceKey.h
index 52411fafde..fab99782b4 100644
--- a/include/private/GrResourceKey.h
+++ b/include/private/GrResourceKey.h
@@ -127,7 +127,7 @@ protected:
} else {
SkDebugf("hash: %d ", this->hash());
SkDebugf("domain: %d ", this->domain());
- SkDebugf("size: %dB ", this->internalSize());
+ SkDebugf("size: %zuB ", this->internalSize());
size_t dataCount = this->internalSize() / sizeof(uint32_t) - kMetaDataCnt;
for (size_t i = 0; i < dataCount; ++i) {
SkDebugf("%d ", fKey[SkTo<int>(kMetaDataCnt+i)]);
diff --git a/modules/skottie/src/SkottieTool.cpp b/modules/skottie/src/SkottieTool.cpp
index 80c91d4a36..d37fcd1488 100644
--- a/modules/skottie/src/SkottieTool.cpp
+++ b/modules/skottie/src/SkottieTool.cpp
@@ -214,7 +214,7 @@ public:
}
void report() const {
- SkDebugf("Animation loaded with %lu error%s, %lu warning%s.\n",
+ SkDebugf("Animation loaded with %zu error%s, %zu warning%s.\n",
fErrors.size(), fErrors.size() == 1 ? "" : "s",
fWarnings.size(), fWarnings.size() == 1 ? "" : "s");
diff --git a/modules/skparagraph/samples/SampleParagraph.cpp b/modules/skparagraph/samples/SampleParagraph.cpp
index d7c1e108c5..c83a84e55c 100644
--- a/modules/skparagraph/samples/SampleParagraph.cpp
+++ b/modules/skparagraph/samples/SampleParagraph.cpp
@@ -2073,14 +2073,16 @@ protected:
auto impl = static_cast<ParagraphImpl*>(paragraph.get());
for (auto& line : impl->lines()) {
if (this->isVerbose()) {
- SkDebugf("line[%d]: %f + %f\n", &line - impl->lines().begin(), line.offset().fX, line.shift());
+ SkDebugf("line[%d]: %f + %f\n", (int)(&line - impl->lines().begin()),
+ line.offset().fX, line.shift());
}
line.iterateThroughVisualRuns(true,
[&](const Run* run, SkScalar runOffset, TextRange textRange, SkScalar* width) {
*width = line.measureTextInsideOneRun(textRange, run, runOffset, 0, true, false).clip.width();
if (this->isVerbose()) {
- SkDebugf("%d[%d: %d) @%f + %f %s\n", run->index(),
- textRange.start, textRange.end, runOffset, *width, run->leftToRight() ? "left" : "right");
+ SkDebugf("%zu[%zu: %zu) @%f + %f %s\n",
+ run->index(), textRange.start, textRange.end, runOffset, *width,
+ run->leftToRight() ? "left" : "right");
}
return true;
});
@@ -2277,8 +2279,9 @@ protected:
{18, 22},
};
for (auto rect: rects) {
- auto results = paragraph->getRectsForRange(rect.first, rect.second, RectHeightStyle::kTight, RectWidthStyle::kTight);
- SkDebugf("[%d : %d) ", rect.first, rect.second);
+ auto results = paragraph->getRectsForRange(
+ rect.first, rect.second, RectHeightStyle::kTight, RectWidthStyle::kTight);
+ SkDebugf("[%zu : %zu) ", rect.first, rect.second);
if (!results.empty()) {
SkASSERT(results.size() == 1);
SkDebugf("[%f : %f]\n", results[0].rect.fLeft,results[0].rect.fRight);
@@ -2571,7 +2574,7 @@ protected:
size_t c = 0;
SkDebugf("clusters\n");
for (auto& cluster: clusters) {
- SkDebugf("%d: [%d:%d) %s\n", c++,
+ SkDebugf("%zu: [%zu:%zu) %s\n", c++,
cluster.textRange().start, cluster.textRange().end,
cluster.isSoftBreak() ? "soft" :
cluster.isHardBreak() ? "hard" :
@@ -2582,7 +2585,7 @@ protected:
size_t i = 0;
SkDebugf("lines\n");
for (auto& line : lines) {
- SkDebugf("%d: [%d:%d)\n", i++, line.trimmedText().start, line.trimmedText().end);
+ SkDebugf("%zu: [%zu:%zu)\n", i++, line.trimmedText().start, line.trimmedText().end);
}
}
diff --git a/modules/skparagraph/src/OneLineShaper.cpp b/modules/skparagraph/src/OneLineShaper.cpp
index 0b13f93a75..432739ed77 100644
--- a/modules/skparagraph/src/OneLineShaper.cpp
+++ b/modules/skparagraph/src/OneLineShaper.cpp
@@ -20,9 +20,9 @@ void OneLineShaper::commitRunBuffer(const RunInfo&) {
auto oldUnresolvedCount = fUnresolvedBlocks.size();
/*
- SkDebugf("Run [%d:%d)\n", fCurrentRun->fTextRange.start, fCurrentRun->fTextRange.end);
+ SkDebugf("Run [%zu:%zu)\n", fCurrentRun->fTextRange.start, fCurrentRun->fTextRange.end);
for (size_t i = 0; i < fCurrentRun->size(); ++i) {
- SkDebugf("[%d] %d %d %f\n", i, fCurrentRun->fGlyphs[i], fCurrentRun->fClusterIndexes[i], fCurrentRun->fPositions[i].fX);
+ SkDebugf("[%zu] %hu %u %f\n", i, fCurrentRun->fGlyphs[i], fCurrentRun->fClusterIndexes[i], fCurrentRun->fPositions[i].fX);
}
*/
// Find all unresolved blocks
@@ -56,10 +56,10 @@ void OneLineShaper::commitRunBuffer(const RunInfo&) {
#ifdef SK_DEBUG
void OneLineShaper::printState() {
- SkDebugf("Resolved: %d\n", fResolvedBlocks.size());
+ SkDebugf("Resolved: %zu\n", fResolvedBlocks.size());
for (auto& resolved : fResolvedBlocks) {
if (resolved.fRun == nullptr) {
- SkDebugf("[%d:%d) unresolved\n",
+ SkDebugf("[%zu:%zu) unresolved\n",
resolved.fText.start, resolved.fText.end);
continue;
}
@@ -67,16 +67,16 @@ void OneLineShaper::printState() {
if (resolved.fRun->fFont.getTypeface() != nullptr) {
resolved.fRun->fFont.getTypeface()->getFamilyName(&name);
}
- SkDebugf("[%d:%d) ", resolved.fGlyphs.start, resolved.fGlyphs.end);
- SkDebugf("[%d:%d) with %s\n",
+ SkDebugf("[%zu:%zu) ", resolved.fGlyphs.start, resolved.fGlyphs.end);
+ SkDebugf("[%zu:%zu) with %s\n",
resolved.fText.start, resolved.fText.end,
name.c_str());
}
auto size = fUnresolvedBlocks.size();
- SkDebugf("Unresolved: %d\n", size);
+ SkDebugf("Unresolved: %zu\n", size);
for (const auto& unresolved : fUnresolvedBlocks) {
- SkDebugf("[%d:%d)\n", unresolved.fText.start, unresolved.fText.end);
+ SkDebugf("[%zu:%zu)\n", unresolved.fText.start, unresolved.fText.end);
}
}
#endif
@@ -180,7 +180,8 @@ void OneLineShaper::finish(const Block& block, SkScalar height, SkScalar& advanc
auto glyphs = resolvedBlock.fGlyphs;
auto text = resolvedBlock.fText;
if (lastTextEnd != text.start) {
- SkDEBUGF("Text ranges mismatch: ...:%d] - [%d:%d] (%d-%d)\n", lastTextEnd, text.start, text.end, glyphs.start, glyphs.end);
+ SkDEBUGF("Text ranges mismatch: ...:%zu] - [%zu:%zu] (%zu-%zu)\n",
+ lastTextEnd, text.start, text.end, glyphs.start, glyphs.end);
SkASSERT(false);
}
lastTextEnd = text.end;
@@ -235,7 +236,7 @@ void OneLineShaper::finish(const Block& block, SkScalar height, SkScalar& advanc
advanceX = fAdvance.fX;
if (lastTextEnd != blockText.end) {
- SkDEBUGF("Last range mismatch: %d - %d\n", lastTextEnd, blockText.end);
+ SkDEBUGF("Last range mismatch: %zu - %zu\n", lastTextEnd, blockText.end);
SkASSERT(false);
}
}
diff --git a/modules/skplaintexteditor/app/editor_application.cpp b/modules/skplaintexteditor/app/editor_application.cpp
index 7ee67e1bf4..04097561f0 100644
--- a/modules/skplaintexteditor/app/editor_application.cpp
+++ b/modules/skplaintexteditor/app/editor_application.cpp
@@ -209,7 +209,7 @@ struct EditorLayer : public sk_app::Window::Layer {
switch (c) {
case 'p':
for (StringView str : fEditor.text()) {
- SkDebugf(">> '%.*s'\n", str.size, str.data);
+ SkDebugf(">> '%.*s'\n", (int)str.size, str.data);
}
return true;
case 's':
diff --git a/modules/svg/src/SkSVGFilterContext.cpp b/modules/svg/src/SkSVGFilterContext.cpp
index f39a94beae..310aa0b897 100644
--- a/modules/svg/src/SkSVGFilterContext.cpp
+++ b/modules/svg/src/SkSVGFilterContext.cpp
@@ -112,7 +112,7 @@ std::tuple<sk_sp<SkImageFilter>, SkSVGColorspace> SkSVGFilterContext::getInput(
break;
}
default:
- SkDebugf("unhandled filter input type %d\n", inputType.type());
+ SkDebugf("unhandled filter input type %d\n", (int)inputType.type());
break;
}
diff --git a/modules/svg/src/SkSVGImage.cpp b/modules/svg/src/SkSVGImage.cpp
index ce6ede1546..083d382090 100644
--- a/modules/svg/src/SkSVGImage.cpp
+++ b/modules/svg/src/SkSVGImage.cpp
@@ -47,7 +47,7 @@ static sk_sp<SkImage> LoadImage(const sk_sp<skresources::ResourceProvider>& rp,
break;
}
default:
- SkDebugf("error loading image: unhandled iri type %d\n", href.type());
+ SkDebugf("error loading image: unhandled iri type %d\n", (int)href.type());
return nullptr;
}
diff --git a/modules/svg/src/SkSVGRenderContext.cpp b/modules/svg/src/SkSVGRenderContext.cpp
index 6a988551c9..cd09fea0e2 100644
--- a/modules/svg/src/SkSVGRenderContext.cpp
+++ b/modules/svg/src/SkSVGRenderContext.cpp
@@ -67,7 +67,7 @@ SkScalar SkSVGLengthContext::resolve(const SkSVGLength& l, LengthType t) const {
case SkSVGLength::Unit::kPC:
return l.value() * fDPI * kPCMultiplier;
default:
- SkDebugf("unsupported unit type: <%d>\n", l.unit());
+ SkDebugf("unsupported unit type: <%d>\n", (int)l.unit());
return 0;
}
}
diff --git a/samplecode/SampleAudio.cpp b/samplecode/SampleAudio.cpp
index c09a816e52..a3347d7e3e 100644
--- a/samplecode/SampleAudio.cpp
+++ b/samplecode/SampleAudio.cpp
@@ -30,7 +30,7 @@ protected:
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 dd330028c0..9fb5a75cf5 100644
--- a/samplecode/SampleCusp.cpp
+++ b/samplecode/SampleCusp.cpp
@@ -162,7 +162,6 @@ protected:
// 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 bc1aaa9653..8b3444226e 100644
--- a/samplecode/SampleSVGFile.cpp
+++ b/samplecode/SampleSVGFile.cpp
@@ -29,7 +29,7 @@ protected:
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;
}
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 016c38cdc1..b8285edde6 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -412,7 +412,7 @@ void SkResourceCache::validate() const {
void SkResourceCache::dump() const {
this->validate();
- SkDebugf("SkResourceCache: count=%d bytes=%d %s\n",
+ SkDebugf("SkResourceCache: count=%d bytes=%zu %s\n",
fCount, fTotalBytesUsed, fDiscardableFactory ? "discardable" : "malloc");
}
@@ -581,7 +581,7 @@ void SkGraphics::PurgeResourceCache() {
/////////////
static void dump_visitor(const SkResourceCache::Rec& rec, void*) {
- SkDebugf("RC: %12s bytes %9lu discardable %p\n",
+ SkDebugf("RC: %12s bytes %9zu discardable %p\n",
rec.getCategory(), rec.bytesUsed(), rec.diagnostic_only_getDiscardable());
}
diff --git a/src/core/SkSharedMutex.cpp b/src/core/SkSharedMutex.cpp
index 5d34e42d9b..6ae129a6be 100644
--- a/src/core/SkSharedMutex.cpp
+++ b/src/core/SkSharedMutex.cpp
@@ -10,6 +10,8 @@
#include "include/core/SkTypes.h"
#include "include/private/SkSemaphore.h"
+#include <cinttypes>
+
#if !defined(__has_feature)
#define __has_feature(x) 0
#endif
@@ -132,10 +134,10 @@
SkAutoMutexExclusive l(fMu);
SkASSERTF(!fCurrentShared->find(threadID),
- "Thread %lx already has an shared lock\n", threadID);
+ "Thread %" PRIx64 " already has an shared lock\n", threadID);
if (!fWaitingExclusive->tryAdd(threadID)) {
- SkDEBUGFAILF("Thread %lx already has an exclusive lock\n", threadID);
+ SkDEBUGFAILF("Thread %" PRIx64 " already has an exclusive lock\n", threadID);
}
currentSharedCount = fCurrentShared->count();
@@ -162,7 +164,7 @@
SkAutoMutexExclusive l(fMu);
SkASSERT(0 == fCurrentShared->count());
if (!fWaitingExclusive->tryRemove(threadID)) {
- SkDEBUGFAILF("Thread %lx did not have the lock held.\n", threadID);
+ SkDEBUGFAILF("Thread %" PRIx64 " did not have the lock held.\n", threadID);
}
exclusiveWaitingCount = fWaitingExclusive->count();
sharedWaitingCount = fWaitingShared->count();
@@ -196,11 +198,11 @@
exclusiveWaitingCount = fWaitingExclusive->count();
if (exclusiveWaitingCount > 0) {
if (!fWaitingShared->tryAdd(threadID)) {
- SkDEBUGFAILF("Thread %lx was already waiting!\n", threadID);
+ SkDEBUGFAILF("Thread %" PRIx64 " was already waiting!\n", threadID);
}
} else {
if (!fCurrentShared->tryAdd(threadID)) {
- SkDEBUGFAILF("Thread %lx already holds a shared lock!\n", threadID);
+ SkDEBUGFAILF("Thread %" PRIx64 " already holds a shared lock!\n", threadID);
}
}
sharedQueueSelect = fSharedQueueSelect;
@@ -222,7 +224,7 @@
{
SkAutoMutexExclusive l(fMu);
if (!fCurrentShared->tryRemove(threadID)) {
- SkDEBUGFAILF("Thread %lx does not hold a shared lock.\n", threadID);
+ SkDEBUGFAILF("Thread %" PRIx64 " does not hold a shared lock.\n", threadID);
}
currentSharedCount = fCurrentShared->count();
waitingExclusiveCount = fWaitingExclusive->count();
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index ad1669872f..52fe06176c 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -428,7 +428,7 @@ bool SkFILEWStream::write(const void* buffer, size_t size)
if (sk_fwrite(buffer, size, fFILE) != size)
{
- SkDEBUGCODE(SkDebugf("SkFILEWStream failed writing %d bytes\n", size);)
+ SkDEBUGCODE(SkDebugf("SkFILEWStream failed writing %zu bytes\n", size);)
sk_fclose(fFILE);
fFILE = nullptr;
return false;
diff --git a/src/core/SkStrikeCache.cpp b/src/core/SkStrikeCache.cpp
index 1fce164dd1..19a745412f 100644
--- a/src/core/SkStrikeCache.cpp
+++ b/src/core/SkStrikeCache.cpp
@@ -58,7 +58,7 @@ void SkStrikeCache::Dump() {
SkDebugf("GlyphCache [ used budget ]\n");
SkDebugf(" bytes [ %8zu %8zu ]\n",
SkGraphics::GetFontCacheUsed(), SkGraphics::GetFontCacheLimit());
- SkDebugf(" count [ %8zu %8zu ]\n",
+ SkDebugf(" count [ %8d %8d ]\n",
SkGraphics::GetFontCacheCountUsed(), SkGraphics::GetFontCacheCountLimit());
int counter = 0;
@@ -342,7 +342,7 @@ void SkStrikeCache::validate() const {
SK_ABORT("fCacheCount != computedCount");
}
if (fTotalMemoryUsed != computedBytes) {
- SkDebugf("fTotalMemoryUsed: %d, computedBytes: %d", fTotalMemoryUsed, computedBytes);
+ SkDebugf("fTotalMemoryUsed: %zu, computedBytes: %zu", fTotalMemoryUsed, computedBytes);
SK_ABORT("fTotalMemoryUsed == computedBytes");
}
#endif
diff --git a/src/core/SkTextBlobTrace.cpp b/src/core/SkTextBlobTrace.cpp
index 7cd15e3387..88275427a6 100644
--- a/src/core/SkTextBlobTrace.cpp
+++ b/src/core/SkTextBlobTrace.cpp
@@ -63,8 +63,8 @@ void SkTextBlobTrace::DumpTrace(const std::vector<SkTextBlobTrace::Record>& trac
font.getScaleX(),
font.getSkewX(),
SkFontPriv::Flags(font),
- font.getEdging(),
- font.getHinting());
+ (int)font.getEdging(),
+ (int)font.getHinting());
uint32_t glyphCount = iter.glyphCount();
const uint16_t* glyphs = iter.glyphs();
for (uint32_t i = 0; i < glyphCount; i++) {
diff --git a/src/core/SkVM.cpp b/src/core/SkVM.cpp
index 840701d23a..bc49f16672 100644
--- a/src/core/SkVM.cpp
+++ b/src/core/SkVM.cpp
@@ -159,7 +159,7 @@ namespace skvm {
size_t fBytesWritten = 0;
bool write(const void* buffer, size_t size) override {
- SkDebugf("%.*s", size, buffer);
+ SkDebugf("%.*s", (int)size, (const char*)buffer);
fBytesWritten += size;
return true;
}
diff --git a/src/gpu/GrRecordingContextPriv.h b/src/gpu/GrRecordingContextPriv.h
index c52413aa82..cf3205e013 100644
--- a/src/gpu/GrRecordingContextPriv.h
+++ b/src/gpu/GrRecordingContextPriv.h
@@ -99,7 +99,7 @@ public:
return;
}
#endif
- SkDebugf(msg);
+ SkDebugf("%s", msg);
}
GrRecordingContext::Stats* stats() {
diff --git a/src/gpu/d3d/GrD3DUtil.h b/src/gpu/d3d/GrD3DUtil.h
index 52d98df3d7..faa407299e 100644
--- a/src/gpu/d3d/GrD3DUtil.h
+++ b/src/gpu/d3d/GrD3DUtil.h
@@ -13,14 +13,14 @@
#include "include/gpu/d3d/GrD3DTypes.h"
#include "include/private/GrTypesPriv.h"
-#define GR_D3D_CALL_ERRCHECK(X) \
- do { \
- HRESULT result = X; \
- SkASSERT(SUCCEEDED(result)); \
- if (!SUCCEEDED(result)) { \
- SkDebugf("Failed Direct3D call. Error: 0x%08x\n", result); \
- } \
- } while(false)
+#define GR_D3D_CALL_ERRCHECK(X) \
+ do { \
+ HRESULT result = X; \
+ SkASSERT(SUCCEEDED(result)); \
+ if (!SUCCEEDED(result)) { \
+ SkDebugf("Failed Direct3D call. Error: 0x%08lx\n", result); \
+ } \
+ } while (false)
static constexpr bool operator==(const D3D12_CPU_DESCRIPTOR_HANDLE & first,
const D3D12_CPU_DESCRIPTOR_HANDLE & second) {
diff --git a/src/gpu/vk/GrVkDescriptorPool.h b/src/gpu/vk/GrVkDescriptorPool.h
index 888dcb34d5..3afe8bb1d2 100644
--- a/src/gpu/vk/GrVkDescriptorPool.h
+++ b/src/gpu/vk/GrVkDescriptorPool.h
@@ -11,6 +11,8 @@
#include "include/gpu/vk/GrVkTypes.h"
#include "src/gpu/vk/GrVkManagedResource.h"
+#include <cinttypes>
+
class GrVkGpu;
/**
@@ -30,8 +32,8 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkDescriptorPool: %d, type %d (%d refs)\n", fDescPool, fType,
- this->getRefCnt());
+ SkDebugf("GrVkDescriptorPool: %" PRIdPTR ", type %d (%d refs)\n", (intptr_t)fDescPool,
+ fType, this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkDescriptorSet.h b/src/gpu/vk/GrVkDescriptorSet.h
index 38c4f2df5b..3e45d2cdd5 100644
--- a/src/gpu/vk/GrVkDescriptorSet.h
+++ b/src/gpu/vk/GrVkDescriptorSet.h
@@ -12,6 +12,8 @@
#include "src/gpu/vk/GrVkDescriptorSetManager.h"
#include "src/gpu/vk/GrVkManagedResource.h"
+#include <cinttypes>
+
class GrVkDescriptorPool;
class GrVkGpu;
@@ -28,7 +30,8 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkDescriptorSet: %d (%d refs)\n", fDescSet, this->getRefCnt());
+ SkDebugf("GrVkDescriptorSet: %" PRIdPTR " (%d refs)\n", (intptr_t)fDescSet,
+ this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkFramebuffer.h b/src/gpu/vk/GrVkFramebuffer.h
index 81b69899af..cf774cb11e 100644
--- a/src/gpu/vk/GrVkFramebuffer.h
+++ b/src/gpu/vk/GrVkFramebuffer.h
@@ -13,6 +13,8 @@
#include "src/gpu/vk/GrVkManagedResource.h"
#include "src/gpu/vk/GrVkResourceProvider.h"
+#include <cinttypes>
+
class GrVkAttachment;
class GrVkGpu;
class GrVkImageView;
@@ -57,7 +59,8 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkFramebuffer: %d (%d refs)\n", fFramebuffer, this->getRefCnt());
+ SkDebugf("GrVkFramebuffer: %" PRIdPTR " (%d refs)\n",
+ (intptr_t)fFramebuffer, this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkImage.h b/src/gpu/vk/GrVkImage.h
index cd99b0eb08..172ea9f5b0 100644
--- a/src/gpu/vk/GrVkImage.h
+++ b/src/gpu/vk/GrVkImage.h
@@ -17,6 +17,8 @@
#include "src/gpu/GrManagedResource.h"
#include "src/gpu/GrTexture.h"
+#include <cinttypes>
+
class GrVkGpu;
class GrVkTexture;
@@ -193,7 +195,7 @@ private:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkImage: %d (%d refs)\n", fImage, this->getRefCnt());
+ SkDebugf("GrVkImage: %" PRIdPTR " (%d refs)\n", (intptr_t)fImage, this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkImageView.h b/src/gpu/vk/GrVkImageView.h
index f36572484d..ec0a2ee9ec 100644
--- a/src/gpu/vk/GrVkImageView.h
+++ b/src/gpu/vk/GrVkImageView.h
@@ -12,6 +12,8 @@
#include "include/gpu/vk/GrVkTypes.h"
#include "src/gpu/vk/GrVkManagedResource.h"
+#include <cinttypes>
+
class GrVkSamplerYcbcrConversion;
struct GrVkYcbcrConversionInfo;
@@ -30,7 +32,8 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkImageView: %d (%d refs)\n", fImageView, this->getRefCnt());
+ SkDebugf("GrVkImageView: %" PRIdPTR " (%d refs)\n",
+ (intptr_t)fImageView, this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkPipeline.h b/src/gpu/vk/GrVkPipeline.h
index f8891b8b24..c218c8915d 100644
--- a/src/gpu/vk/GrVkPipeline.h
+++ b/src/gpu/vk/GrVkPipeline.h
@@ -14,6 +14,8 @@
#include "src/gpu/GrXferProcessor.h"
#include "src/gpu/vk/GrVkManagedResource.h"
+#include <cinttypes>
+
class GrPipeline;
class GrProgramInfo;
class GrRenderTarget;
@@ -74,7 +76,7 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkPipeline: %d (%d refs)\n", fPipeline, this->getRefCnt());
+ SkDebugf("GrVkPipeline: %" PRIdPTR " (%d refs)\n", (intptr_t)fPipeline, this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkRenderPass.h b/src/gpu/vk/GrVkRenderPass.h
index c6fbeeebbc..943cc9f634 100644
--- a/src/gpu/vk/GrVkRenderPass.h
+++ b/src/gpu/vk/GrVkRenderPass.h
@@ -12,6 +12,8 @@
#include "include/gpu/vk/GrVkTypes.h"
#include "src/gpu/vk/GrVkManagedResource.h"
+#include <cinttypes>
+
class GrProcessorKeyBuilder;
class GrVkGpu;
class GrVkRenderTarget;
@@ -164,7 +166,8 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkRenderPass: %d (%d refs)\n", fRenderPass, this->getRefCnt());
+ SkDebugf("GrVkRenderPass: %" PRIdPTR " (%d refs)\n",
+ (intptr_t)fRenderPass, this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkSampler.h b/src/gpu/vk/GrVkSampler.h
index 14790ca8dd..ff3727d894 100644
--- a/src/gpu/vk/GrVkSampler.h
+++ b/src/gpu/vk/GrVkSampler.h
@@ -12,7 +12,9 @@
#include "src/core/SkOpts.h"
#include "src/gpu/vk/GrVkManagedResource.h"
#include "src/gpu/vk/GrVkSamplerYcbcrConversion.h"
+
#include <atomic>
+#include <cinttypes>
class GrSamplerState;
class GrVkGpu;
@@ -53,7 +55,7 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkSampler: %d (%d refs)\n", fSampler, this->getRefCnt());
+ SkDebugf("GrVkSampler: %" PRIdPTR " (%d refs)\n", (intptr_t)fSampler, this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkSamplerYcbcrConversion.h b/src/gpu/vk/GrVkSamplerYcbcrConversion.h
index c4c7f868de..4296b7e2cf 100644
--- a/src/gpu/vk/GrVkSamplerYcbcrConversion.h
+++ b/src/gpu/vk/GrVkSamplerYcbcrConversion.h
@@ -13,6 +13,8 @@
#include "include/gpu/vk/GrVkTypes.h"
#include "src/core/SkOpts.h"
+#include <cinttypes>
+
class GrVkGpu;
class GrVkSamplerYcbcrConversion : public GrVkManagedResource {
@@ -53,7 +55,8 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkSamplerYcbcrConversion: %d (%d refs)\n", fYcbcrConversion, this->getRefCnt());
+ SkDebugf("GrVkSamplerYcbcrConversion: %" PRIdPTR " (%d refs)\n", (intptr_t)fYcbcrConversion,
+ this->getRefCnt());
}
#endif
diff --git a/src/gpu/vk/GrVkSemaphore.h b/src/gpu/vk/GrVkSemaphore.h
index 4e036074d2..f7c21837db 100644
--- a/src/gpu/vk/GrVkSemaphore.h
+++ b/src/gpu/vk/GrVkSemaphore.h
@@ -14,6 +14,8 @@
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/vk/GrVkManagedResource.h"
+#include <cinttypes>
+
class GrBackendSemaphore;
class GrVkGpu;
@@ -66,7 +68,8 @@ public:
#ifdef SK_TRACE_MANAGED_RESOURCES
void dumpInfo() const override {
- SkDebugf("GrVkSemaphore: %d (%d refs)\n", fSemaphore, this->getRefCnt());
+ SkDebugf("GrVkSemaphore: %" PRIdPTR " (%d refs)\n", (intptr_t)fSemaphore,
+ this->getRefCnt());
}
#endif
private:
diff --git a/src/pathops/SkPathOpsTSect.cpp b/src/pathops/SkPathOpsTSect.cpp
index 21f15fc9eb..1680584df0 100644
--- a/src/pathops/SkPathOpsTSect.cpp
+++ b/src/pathops/SkPathOpsTSect.cpp
@@ -40,7 +40,7 @@ void SkTCoincident::setPerp(const SkTCurve& c1, double t,
fMatch = cPt.approximatelyEqual(fPerpPt);
#if DEBUG_T_SECT
if (fMatch) {
- SkDebugf(""); // allow setting breakpoint
+ SkDebugf("%s", ""); // allow setting breakpoint
}
#endif
}
@@ -233,7 +233,7 @@ bool SkTSpan::initBounds(const SkTCurve& c) {
fDeleted = false;
#if DEBUG_T_SECT
if (fCollapsed) {
- SkDebugf(""); // for convenient breakpoints
+ SkDebugf("%s", ""); // for convenient breakpoints
}
#endif
return fBounds.valid();
diff --git a/src/pathops/SkPathWriter.cpp b/src/pathops/SkPathWriter.cpp
index 842cd2a4da..144fda98fc 100644
--- a/src/pathops/SkPathWriter.cpp
+++ b/src/pathops/SkPathWriter.cpp
@@ -364,7 +364,6 @@ void SkPathWriter::assemble() {
connect by following segments from one to the other, rather than introducing
a diagonal to connect the two.
*/
- SkDebugf("");
}
}
if (forward) {
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 02e5f751e3..3841638d2c 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1455,7 +1455,7 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) {
FT_Error err = FT_Load_Glyph(fFace, glyph.getGlyphID(), fLoadGlyphFlags);
if (err != 0) {
SK_TRACEFTR(err, "SkScalerContext_FreeType::generateImage: FT_Load_Glyph(glyph:%d "
- "width:%d height:%d rb:%d flags:%d) failed.",
+ "width:%d height:%d rb:%zu flags:%d) failed.",
glyph.getGlyphID(), glyph.width(), glyph.height(), glyph.rowBytes(),
fLoadGlyphFlags);
sk_bzero(glyph.fImage, glyph.imageSize());
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 4245ae7b80..ae88efa7a2 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -1070,7 +1070,7 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(
FT_Error err = FT_Render_Glyph(face->glyph, doVert ? FT_RENDER_MODE_LCD_V :
FT_RENDER_MODE_LCD);
if (err) {
- SK_TRACEFTR(err, "Could not render glyph %x.", face->glyph);
+ SK_TRACEFTR(err, "Could not render glyph %p.", face->glyph);
return;
}
diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h
index 1b5a72f6e4..5e97038372 100644
--- a/src/ports/SkFontHost_FreeType_common.h
+++ b/src/ports/SkFontHost_FreeType_common.h
@@ -27,7 +27,7 @@ typedef signed long FT_Pos;
#ifdef SK_DEBUG
const char* SkTraceFtrGetError(int);
#define SK_TRACEFTR(ERR, MSG, ...) \
- SkDebugf("%s:%lu:1: error: 0x%x '%s' " MSG "\n", __FILE__, __LINE__, ERR, \
+ SkDebugf("%s:%d:1: error: 0x%x '%s' " MSG "\n", __FILE__, __LINE__, ERR, \
SkTraceFtrGetError((int)(ERR)), __VA_ARGS__)
#else
#define SK_TRACEFTR(ERR, ...) do { sk_ignore_unused_variable(ERR); } while (false)
diff --git a/src/ports/SkFontMgr_android_parser.cpp b/src/ports/SkFontMgr_android_parser.cpp
index 85a4f1f9fc..396435c7d0 100644
--- a/src/ports/SkFontMgr_android_parser.cpp
+++ b/src/ports/SkFontMgr_android_parser.cpp
@@ -126,9 +126,11 @@ static bool memeq(const char* s1, const char* s2, size_t n1, size_t n2) {
#define SK_FONTMGR_ANDROID_PARSER_PREFIX "[SkFontMgr Android Parser] "
-#define SK_FONTCONFIGPARSER_WARNING(message, ...) \
- SkDebugf(SK_FONTMGR_ANDROID_PARSER_PREFIX "%s:%d:%d: warning: " message "\n", self->fFilename, \
- XML_GetCurrentLineNumber(self->fParser), XML_GetCurrentColumnNumber(self->fParser), \
+#define SK_FONTCONFIGPARSER_WARNING(message, ...) \
+ SkDebugf(SK_FONTMGR_ANDROID_PARSER_PREFIX "%s:%d:%d: warning: " message "\n", \
+ self->fFilename, \
+ (int)XML_GetCurrentLineNumber(self->fParser), \
+ (int)XML_GetCurrentColumnNumber(self->fParser), \
##__VA_ARGS__)
static bool is_whitespace(char c) {
diff --git a/src/sksl/SkSLOperators.h b/src/sksl/SkSLOperators.h
index a51985fd1c..4a936b0a41 100644
--- a/src/sksl/SkSLOperators.h
+++ b/src/sksl/SkSLOperators.h
@@ -22,7 +22,7 @@ public:
// Allow implicit conversion from Token::Kind, since this is just a utility wrapper on top.
Operator(Token::Kind t) : fKind(t) {
- SkASSERTF(this->isOperator(), "token-kind %d is not an operator", fKind);
+ SkASSERTF(this->isOperator(), "token-kind %d is not an operator", (int)fKind);
}
enum class Precedence {
diff --git a/src/sksl/codegen/SkSLVMCodeGenerator.cpp b/src/sksl/codegen/SkSLVMCodeGenerator.cpp
index 7aa2c02ca2..82cd65ba9d 100644
--- a/src/sksl/codegen/SkSLVMCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLVMCodeGenerator.cpp
@@ -644,7 +644,7 @@ Value SkVMGenerator::writeTypeConversion(const Value& src,
default:
break;
}
- SkDEBUGFAILF("Unsupported type conversion: %d -> %d", srcKind, dstKind);
+ SkDEBUGFAILF("Unsupported type conversion: %d -> %d", (int)srcKind, (int)dstKind);
return {};
}
@@ -1348,7 +1348,7 @@ Value SkVMGenerator::writeExpression(const Expression& e) {
Value SkVMGenerator::writeStore(const Expression& lhs, const Value& rhs) {
SkASSERTF(rhs.slots() == lhs.type().slotCount(),
- "lhs=%s (%s)\nrhs=%d slot",
+ "lhs=%s (%s)\nrhs=%zu slot",
lhs.type().description().c_str(), lhs.description().c_str(), rhs.slots());
// We need to figure out the collection of slots that we're storing into. The l-value (lhs)
diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp
index 2be633132d..43de3d6e8e 100644
--- a/src/utils/win/SkHRESULT.cpp
+++ b/src/utils/win/SkHRESULT.cpp
@@ -14,7 +14,7 @@ void SkTraceHR(const char* file, unsigned long line, HRESULT hr, const char* msg
if (msg) {
SkDebugf("%s\n", msg);
}
- SkDebugf("%s(%lu) : error 0x%x: ", file, line, hr);
+ SkDebugf("%s(%lu) : error 0x%lx: ", file, line, hr);
LPSTR errorText = nullptr;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
diff --git a/tests/ClipperTest.cpp b/tests/ClipperTest.cpp
index 53d3ba253f..043f63465a 100644
--- a/tests/ClipperTest.cpp
+++ b/tests/ClipperTest.cpp
@@ -100,7 +100,8 @@ static void test_intersectline(skiatest::Reporter* reporter) {
for (i = 0; i < SK_ARRAY_COUNT(gEmpty); i += 2) {
bool valid = SkLineClipper::IntersectLine(&gEmpty[i], gR, dst);
if (valid) {
- SkDebugf("----- [%d] %g %g -> %g %g\n", i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
+ SkDebugf("----- [%zu] %g %g -> %g %g\n",
+ i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
}
REPORTER_ASSERT(reporter, !valid);
}
@@ -124,7 +125,8 @@ static void test_intersectline(skiatest::Reporter* reporter) {
for (i = 0; i < SK_ARRAY_COUNT(gFull); i += 2) {
bool valid = SkLineClipper::IntersectLine(&gFull[i], gR, dst);
if (!valid || 0 != memcmp(&gFull[i], dst, sizeof(dst))) {
- SkDebugf("++++ [%d] %g %g -> %g %g\n", i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
+ SkDebugf("++++ [%zu] %g %g -> %g %g\n",
+ i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
}
REPORTER_ASSERT(reporter, valid && !memcmp(&gFull[i], dst, sizeof(dst)));
}
@@ -143,7 +145,8 @@ static void test_intersectline(skiatest::Reporter* reporter) {
for (i = 0; i < SK_ARRAY_COUNT(gPartial); i += 4) {
bool valid = SkLineClipper::IntersectLine(&gPartial[i], gR, dst);
if (!valid || 0 != memcmp(&gPartial[i+2], dst, sizeof(dst))) {
- SkDebugf("++++ [%d] %g %g -> %g %g\n", i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
+ SkDebugf("++++ [%zu] %g %g -> %g %g\n",
+ i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
}
REPORTER_ASSERT(reporter, valid &&
!memcmp(&gPartial[i+2], dst, sizeof(dst)));
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index ca658645de..aa176ac57b 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -197,7 +197,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
//TestReadPixels(reporter, context0, surfaceContext.get(), pixels.get(), "EGLImageTest-read");
- SkDebugf("type: %d\n", surfaceContext->asTextureProxy()->textureType());
+ SkDebugf("type: %d\n", (int)surfaceContext->asTextureProxy()->textureType());
// We should not be able to write to an EXTERNAL texture
TestWritePixels(reporter, context0, surfaceContext.get(), false, "EGLImageTest-write");
diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp
index a834c9e431..0b3623c524 100644
--- a/tests/PathOpsAngleIdeas.cpp
+++ b/tests/PathOpsAngleIdeas.cpp
@@ -334,9 +334,6 @@ static bool bruteMinT(skiatest::Reporter* reporter, const SkDQuad& quad1, const
rStep /= 2;
} while (rStep > FLT_EPSILON);
if (bestCCW < 0) {
- if (bestR >= maxRadius) {
- SkDebugf("");
- }
REPORTER_ASSERT(reporter, bestR < maxRadius);
return false;
}
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp
index 6aee50b84d..80a10f653a 100644
--- a/tests/PathOpsAngleTest.cpp
+++ b/tests/PathOpsAngleTest.cpp
@@ -521,6 +521,5 @@ DEF_TEST(PathOpsAngleAllOnOneSide, reporter) {
/* int result = */
PathOpsAngleTester::AllOnOneSide(*first->debugLastAngle(), *next->debugLastAngle());
// SkDebugf("i=%d result=%d\n", i , result);
- // SkDebugf("");
}
}
diff --git a/tests/PathOpsConicIntersectionTest.cpp b/tests/PathOpsConicIntersectionTest.cpp
index b9033f92d6..d8b9895ed0 100644
--- a/tests/PathOpsConicIntersectionTest.cpp
+++ b/tests/PathOpsConicIntersectionTest.cpp
@@ -311,9 +311,6 @@ static void oneOff(skiatest::Reporter* reporter, const ConicPts& conic1, const C
SkASSERT(ValidConic(c2));
SkIntersections intersections;
intersections.intersect(c1, c2);
- if (coin && intersections.used() != 2) {
- SkDebugf("");
- }
REPORTER_ASSERT(reporter, !coin || intersections.used() == 2);
double tt1, tt2;
SkDPoint xy1, xy2;
diff --git a/tests/PathOpsConicLineIntersectionTest.cpp b/tests/PathOpsConicLineIntersectionTest.cpp
index 40bb5f6993..11062138d3 100644
--- a/tests/PathOpsConicLineIntersectionTest.cpp
+++ b/tests/PathOpsConicLineIntersectionTest.cpp
@@ -88,7 +88,6 @@ static void testOneOffs(skiatest::Reporter* reporter) {
SkDPoint lineXY = line.ptAtT(lineT);
if (!conicXY.approximatelyEqual(lineXY)) {
conicXY.approximatelyEqual(lineXY);
- SkDebugf("");
}
REPORTER_ASSERT(reporter, conicXY.approximatelyEqual(lineXY));
}
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index 30a0b38fc0..6892a9d8a8 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -411,9 +411,6 @@ static void oneOff(skiatest::Reporter* reporter, const CubicPts& cubic1, const C
SkDebugf("sect%d,\n", index);
}
#endif
- if (coin && intersections.used() < 2) {
- SkDebugf("");
- }
REPORTER_ASSERT(reporter, !coin || intersections.used() >= 2);
double tt1, tt2;
SkDPoint xy1, xy2;
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index 2ceb5fa9c8..8fa0bba838 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -450,7 +450,7 @@ static bool check_for_duplicate_names(const char* testName) {
if (PathOpsDebug::gCheckForDuplicateNames) {
if (gUniqueNames.end() != std::find(gUniqueNames.begin(), gUniqueNames.end(),
std::string(testName))) {
- SkDebugf(""); // convenience for setting breakpoints
+ SkDebugf("%s", ""); // convenience for setting breakpoints
}
gUniqueNames.push_back(std::string(testName));
return true;
diff --git a/tests/PathOpsQuadLineIntersectionTest.cpp b/tests/PathOpsQuadLineIntersectionTest.cpp
index 0bef7d360f..d80cc38bdf 100644
--- a/tests/PathOpsQuadLineIntersectionTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionTest.cpp
@@ -98,7 +98,6 @@ static void testOneOffs(skiatest::Reporter* reporter) {
SkDPoint lineXY = line.ptAtT(lineT);
if (!quadXY.approximatelyEqual(lineXY)) {
quadXY.approximatelyEqual(lineXY);
- SkDebugf("");
}
REPORTER_ASSERT(reporter, quadXY.approximatelyEqual(lineXY));
}
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index de4a33bbc1..922c7d6ed4 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -777,13 +777,13 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
"0x%08x, processor: %s", failedPixelCount, kRenderSize * kRenderSize,
fpGenerator.initialSeed(), fp->dumpInfo().c_str());
if (!coverageMessage.isEmpty()) {
- INFOF(reporter, coverageMessage.c_str());
+ INFOF(reporter, "%s", coverageMessage.c_str());
}
if (!constMessage.isEmpty()) {
- INFOF(reporter, constMessage.c_str());
+ INFOF(reporter, "%s", constMessage.c_str());
}
if (!opaqueMessage.isEmpty()) {
- INFOF(reporter, opaqueMessage.c_str());
+ INFOF(reporter, "%s", opaqueMessage.c_str());
}
if (!loggedFirstWarning) {
SkString input;
diff --git a/tests/RRectInPathTest.cpp b/tests/RRectInPathTest.cpp
index a89d884859..45aa0a2047 100644
--- a/tests/RRectInPathTest.cpp
+++ b/tests/RRectInPathTest.cpp
@@ -63,7 +63,7 @@ static void path_contains_rrect_check(skiatest::Reporter* reporter, const SkRRec
SkPathDirection dir, unsigned start) {
SkRRect out = inner_path_contains_rrect(reporter, in, dir, start);
if (in != out) {
- SkDebugf("");
+ SkDebugf("%s", "");
}
REPORTER_ASSERT(reporter, in == out);
}
@@ -72,7 +72,7 @@ static void path_contains_rrect_nocheck(skiatest::Reporter* reporter, const SkRR
SkPathDirection dir, unsigned start) {
SkRRect out = inner_path_contains_rrect(reporter, in, dir, start);
if (in == out) {
- SkDebugf("");
+ SkDebugf("%s", "");
}
}
diff --git a/tools/CrashHandler.cpp b/tools/CrashHandler.cpp
index 75069b91e4..c498820c39 100644
--- a/tools/CrashHandler.cpp
+++ b/tools/CrashHandler.cpp
@@ -169,7 +169,7 @@
static LONG WINAPI handler(EXCEPTION_POINTERS* e) {
const DWORD code = e->ExceptionRecord->ExceptionCode;
- SkDebugf("\nCaught exception %u", code);
+ SkDebugf("\nCaught exception %lu", code);
for (size_t i = 0; i < SK_ARRAY_COUNT(kExceptions); i++) {
if (kExceptions[i].code == code) {
SkDebugf(" %s", kExceptions[i].name);
@@ -230,7 +230,7 @@
DWORD64 offset;
SymGetSymFromAddr64(hProcess, frame.AddrPC.Offset, &offset, symbol);
- SkDebugf("%s +%x\n", symbol->Name, offset);
+ SkDebugf("%s +%llx\n", symbol->Name, offset);
}
#endif //SK_WINUWP
diff --git a/tools/SkSharingProc.cpp b/tools/SkSharingProc.cpp
index 6ad9cfbb42..ee9b73facb 100644
--- a/tools/SkSharingProc.cpp
+++ b/tools/SkSharingProc.cpp
@@ -56,7 +56,7 @@ sk_sp<SkData> SkSharingSerialContext::serializeImage(SkImage* img, void* ctx) {
sk_sp<SkImage> SkSharingDeserialContext::deserializeImage(
const void* data, size_t length, void* ctx) {
if (!data || !length || !ctx) {
- SkDebugf("SkSharingDeserialContext::deserializeImage arguments invalid %p %d %p.\n",
+ SkDebugf("SkSharingDeserialContext::deserializeImage arguments invalid %p %zu %p.\n",
data, length, ctx);
// Return something so the rest of the debugger can proceed.
SkBitmap bm;
diff --git a/tools/fiddle/examples.h b/tools/fiddle/examples.h
index 86c293b257..8f2ff5ba8f 100644
--- a/tools/fiddle/examples.h
+++ b/tools/fiddle/examples.h
@@ -6,6 +6,7 @@
#include "tools/Registry.h"
#include "skia.h"
+#include <cinttypes>
#include <cmath>
#include <string>
diff --git a/tools/sk_app/win/D3D12WindowContext_win.cpp b/tools/sk_app/win/D3D12WindowContext_win.cpp
index 57168f444c..573b7ccc08 100644
--- a/tools/sk_app/win/D3D12WindowContext_win.cpp
+++ b/tools/sk_app/win/D3D12WindowContext_win.cpp
@@ -18,14 +18,14 @@
#include <dxgi1_4.h>
#include <wrl/client.h>
-#define GR_D3D_CALL_ERRCHECK(X) \
- do { \
- HRESULT result = X; \
- SkASSERT(SUCCEEDED(result)); \
- if (!SUCCEEDED(result)) { \
- SkDebugf("Failed Direct3D call. Error: 0x%08x\n", result); \
- } \
- } while(false)
+#define GR_D3D_CALL_ERRCHECK(X) \
+ do { \
+ HRESULT result = X; \
+ SkASSERT(SUCCEEDED(result)); \
+ if (!SUCCEEDED(result)) { \
+ SkDebugf("Failed Direct3D call. Error: 0x%08lx\n", result); \
+ } \
+ } while (false)
using namespace Microsoft::WRL;
diff --git a/tools/trace/SkDebugfTracer.cpp b/tools/trace/SkDebugfTracer.cpp
index 8db587b86b..837e0ed496 100644
--- a/tools/trace/SkDebugfTracer.cpp
+++ b/tools/trace/SkDebugfTracer.cpp
@@ -67,7 +67,7 @@ SkEventTracer::Handle SkDebugfTracer::addTraceEvent(char phase,
bool open = (phase == TRACE_EVENT_PHASE_COMPLETE);
if (open) {
const char* category = this->getCategoryGroupName(categoryEnabledFlag);
- SkDebugf("[% 2d]%s <%s> %s%s #%d {\n", fIndent.size(), fIndent.c_str(), category, name,
+ SkDebugf("[% 2d]%s <%s> %s%s #%d {\n", (int)fIndent.size(), fIndent.c_str(), category, name,
args.c_str(), fCnt);
fIndent.append(" ");
} else {
@@ -81,5 +81,5 @@ void SkDebugfTracer::updateTraceEventDuration(const uint8_t* categoryEnabledFlag
const char* name,
SkEventTracer::Handle handle) {
fIndent.resize(fIndent.size() - 1);
- SkDebugf("[% 2d]%s } %s\n", fIndent.size(), fIndent.c_str(), name);
+ SkDebugf("[% 2d]%s } %s\n", (int)fIndent.size(), fIndent.c_str(), name);
}
diff --git a/tools/viewer/SkottieSlide.cpp b/tools/viewer/SkottieSlide.cpp
index 031dde1e74..b3cc469e64 100644
--- a/tools/viewer/SkottieSlide.cpp
+++ b/tools/viewer/SkottieSlide.cpp
@@ -129,7 +129,7 @@ void SkottieSlide::load(SkScalar w, SkScalar h) {
}
void report() const {
- SkDebugf("Animation loaded with %lu error%s, %lu warning%s.\n",
+ SkDebugf("Animation loaded with %zu error%s, %zu warning%s.\n",
fErrors.size(), fErrors.size() == 1 ? "" : "s",
fWarnings.size(), fWarnings.size() == 1 ? "" : "s");