Silence warning after f5e315ccf1a.
(clang 3.3):
../tools/PictureRenderer.cpp:350:13: error: variable 'hash' is used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (!generatedHash) {
^~~~~~~~~~~~~~
../tools/PictureRenderer.cpp:354:53: note: uninitialized use occurs here
jsonSummaryPtr->add(outputFilename.c_str(), hash);
^~~~
../tools/PictureRenderer.cpp:350:9: note: remove the 'if' if its condition is always true
if (!generatedHash) {
^~~~~~~~~~~~~~~~~~~~
../tools/PictureRenderer.cpp:334:18: note: initialize the variable 'hash' to silence this warning
uint64_t hash;
^
= 0
The warning is wrong, but the compiler does have a point: generatedHash is always false at that point.
R=epoger@google.com
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/196823004
git-svn-id: http://skia.googlecode.com/svn/trunk@13869 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index f62a05d..9cb43f7 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -347,10 +347,10 @@
// we could combine results of different config types without conflicting filenames.
if (NULL != jsonSummaryPtr) {
- if (!generatedHash) {
- SkAssertResult(SkBitmapHasher::ComputeDigest(bitmap, &hash));
- generatedHash = true;
- }
+ SkASSERT(!generatedHash);
+ SkAssertResult(SkBitmapHasher::ComputeDigest(bitmap, &hash));
+ generatedHash = true;
+
jsonSummaryPtr->add(outputFilename.c_str(), hash);
}