Add an SK_PRINTF_LIKE macro, which declares a function to have printf-like
semantics, allowing gcc and clang to check the format string against the
arguments. Enable its use on SkString (printf, appendf, and prependf). Also
define an SK_SIZE_T_SPECIFIER macro so there's a cross-platform way of
printing a size_t.
Review URL: http://codereview.appspot.com/6375043/
git-svn-id: http://skia.googlecode.com/svn/trunk@4485 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 8b8a954..fe7c6d5 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -518,7 +518,7 @@
// the dual source output has no canonical var name, have to
// declare an output, which is incompatible with gl_FragColor/gl_FragData.
bool dualSourceOutputWritten = false;
- segments.fHeader.printf(GrGetGLSLVersionDecl(gl.binding(),
+ segments.fHeader.append(GrGetGLSLVersionDecl(gl.binding(),
gl.glslGeneration()));
GrGLShaderVar colorOutput;
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 57ee799..d1db4e2 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -133,15 +133,15 @@
SkString* str) {
switch (enc) {
case SkPaint::kUTF8_TextEncoding:
- str->printf("\"%.*s\"%s", SkMax32(len, 32), text,
+ str->printf("\"%.*s\"%s", SkMax32(len, 32), (const char*) text,
len > 32 ? "..." : "");
break;
case SkPaint::kUTF16_TextEncoding:
- str->printf("\"%.*S\"%s", SkMax32(len, 32), text,
+ str->printf("\"%.*S\"%s", SkMax32(len, 32), (const wchar_t*) text,
len > 64 ? "..." : "");
break;
case SkPaint::kUTF32_TextEncoding:
- str->printf("\"%.*S\"%s", SkMax32(len, 32), text,
+ str->printf("\"%.*S\"%s", SkMax32(len, 32), (const wchar_t*) text,
len > 128 ? "..." : "");
break;
case SkPaint::kGlyphID_TextEncoding: