skdiff: cap return value at 255 to avoid automatic 'wrapping' (%256) of return value
Review URL: https://codereview.appspot.com/6409045
git-svn-id: http://skia.googlecode.com/svn/trunk@4629 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp
index f20475a..eea0e0d 100644
--- a/tools/skdiff_main.cpp
+++ b/tools/skdiff_main.cpp
@@ -1307,5 +1307,9 @@
Result type = failOnTheseResultTypes[i];
num_failing_results += summary.fResultsOfType[type].count();
}
- return num_failing_results;
+
+ // On Linux (and maybe other platforms too), any results outside of the
+ // range [0...255] are wrapped (mod 256). Do the conversion ourselves, to
+ // make sure that we only return 0 when there were no failures.
+ return (num_failing_results > 255) ? 255 : num_failing_results;
}