replace gm_fprintf() calls with SkDebugf()
BUG=skia:1221
R=bsalomon@google.com
Author: epoger@google.com
Review URL: https://codereview.chromium.org/181933002
git-svn-id: http://skia.googlecode.com/svn/trunk@13613 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gm_expectations.cpp b/gm/gm_expectations.cpp
index c7bab92..f46a572 100644
--- a/gm/gm_expectations.cpp
+++ b/gm/gm_expectations.cpp
@@ -27,18 +27,6 @@
namespace skiagm {
- void gm_fprintf(FILE *stream, const char format[], ...) {
- va_list args;
- va_start(args, format);
- fprintf(stream, "GM: ");
- vfprintf(stream, format, args);
-#ifdef SK_BUILD_FOR_WIN
- if (stderr == stream || stdout == stream) {
- fflush(stream);
- }
-#endif
- va_end(args);
- }
Json::Value CreateJsonTree(Json::Value expectedResults,
Json::Value actualResultsFailed,
@@ -66,21 +54,20 @@
GmResultDigest::GmResultDigest(const Json::Value &jsonTypeValuePair) {
fIsValid = false;
if (!jsonTypeValuePair.isArray()) {
- gm_fprintf(stderr, "found non-array json value when parsing GmResultDigest: %s\n",
- jsonTypeValuePair.toStyledString().c_str());
+ SkDebugf("found non-array json value when parsing GmResultDigest: %s\n",
+ jsonTypeValuePair.toStyledString().c_str());
DEBUGFAIL_SEE_STDERR;
} else if (2 != jsonTypeValuePair.size()) {
- gm_fprintf(stderr, "found json array with wrong size when parsing GmResultDigest: %s\n",
- jsonTypeValuePair.toStyledString().c_str());
+ SkDebugf("found json array with wrong size when parsing GmResultDigest: %s\n",
+ jsonTypeValuePair.toStyledString().c_str());
DEBUGFAIL_SEE_STDERR;
} else {
// TODO(epoger): The current implementation assumes that the
// result digest is always of type kJsonKey_Hashtype_Bitmap_64bitMD5
Json::Value jsonHashValue = jsonTypeValuePair[1];
if (!jsonHashValue.isIntegral()) {
- gm_fprintf(stderr,
- "found non-integer jsonHashValue when parsing GmResultDigest: %s\n",
- jsonTypeValuePair.toStyledString().c_str());
+ SkDebugf("found non-integer jsonHashValue when parsing GmResultDigest: %s\n",
+ jsonTypeValuePair.toStyledString().c_str());
DEBUGFAIL_SEE_STDERR;
} else {
fHashDigest = jsonHashValue.asUInt64();
@@ -153,10 +140,9 @@
if (ignoreFailure.isNull()) {
fIgnoreFailure = kDefaultIgnoreFailure;
} else if (!ignoreFailure.isBool()) {
- gm_fprintf(stderr, "found non-boolean json value"
- " for key '%s' in element '%s'\n",
- kJsonKey_ExpectedResults_IgnoreFailure,
- jsonElement.toStyledString().c_str());
+ SkDebugf("found non-boolean json value for key '%s' in element '%s'\n",
+ kJsonKey_ExpectedResults_IgnoreFailure,
+ jsonElement.toStyledString().c_str());
DEBUGFAIL_SEE_STDERR;
fIgnoreFailure = kDefaultIgnoreFailure;
} else {
@@ -167,10 +153,9 @@
if (allowedDigests.isNull()) {
// ok, we'll just assume there aren't any AllowedDigests to compare against
} else if (!allowedDigests.isArray()) {
- gm_fprintf(stderr, "found non-array json value"
- " for key '%s' in element '%s'\n",
- kJsonKey_ExpectedResults_AllowedDigests,
- jsonElement.toStyledString().c_str());
+ SkDebugf("found non-array json value for key '%s' in element '%s'\n",
+ kJsonKey_ExpectedResults_AllowedDigests,
+ jsonElement.toStyledString().c_str());
DEBUGFAIL_SEE_STDERR;
} else {
for (Json::ArrayIndex i=0; i<allowedDigests.size(); i++) {
@@ -255,14 +240,14 @@
/*static*/ bool JsonExpectationsSource::Parse(const char *jsonPath, Json::Value *jsonRoot) {
SkFILEStream inFile(jsonPath);
if (!inFile.isValid()) {
- gm_fprintf(stderr, "unable to read JSON file %s\n", jsonPath);
+ SkDebugf("unable to read JSON file %s\n", jsonPath);
DEBUGFAIL_SEE_STDERR;
return false;
}
SkAutoDataUnref dataRef(ReadFileIntoSkData(inFile));
if (NULL == dataRef.get()) {
- gm_fprintf(stderr, "error reading JSON file %s\n", jsonPath);
+ SkDebugf("error reading JSON file %s\n", jsonPath);
DEBUGFAIL_SEE_STDERR;
return false;
}
@@ -271,7 +256,7 @@
size_t size = dataRef.get()->size();
Json::Reader reader;
if (!reader.parse(bytes, bytes+size, *jsonRoot)) {
- gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath);
+ SkDebugf("error parsing JSON file %s\n", jsonPath);
DEBUGFAIL_SEE_STDERR;
return false;
}