The plain Makefile was using -Wall, but the gyp build wasn't. This CL turns on
-Wall -Wextra and -Wno-unused in common.gypi. This revealed a lot of warnings
(and some actual bugs), all of which I fixed here. This is pretty mindless
stuff for the most part (order of intialization, missing initializers, && within
||, etc), but will allow us to build cleanly with -Wall and -Wextra (and
-Werror, if we so choose).
I put defaults into switches that were missing cases. I could put in the actual
missing enums instead if that's desired. I could also assert on missing enums
instead of break, if that's desired. I wasn't sure how to test the stuff in
"animator", so that should be looked at a bit more closely.
Review URL: http://codereview.appspot.com/4547055/
git-svn-id: http://skia.googlecode.com/svn/trunk@1386 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/animator/SkScriptDecompile.cpp b/src/animator/SkScriptDecompile.cpp
index d582d33..98db1fb 100644
--- a/src/animator/SkScriptDecompile.cpp
+++ b/src/animator/SkScriptDecompile.cpp
@@ -114,7 +114,7 @@
// check to see that there are no missing or duplicate entries
void SkScriptEngine2::ValidateDecompileTable() {
SkScriptEngine2::TypeOp op = SkScriptEngine2::kNop;
- int index;
+ size_t index;
for (index = 0; index < gOpNamesSize; index++) {
SkASSERT(gOpNames[index].fOp == op);
op = (SkScriptEngine2::TypeOp) (op + 1);
@@ -132,9 +132,9 @@
SkASSERT(length > 0);
const unsigned char* opCode = start;
do {
- SkASSERT(opCode - start < length);
+ SkASSERT((size_t)(opCode - start) < length);
SkScriptEngine2::TypeOp op = (SkScriptEngine2::TypeOp) *opCode++;
- SkASSERT(op < gOpNamesSize);
+ SkASSERT((size_t)op < gOpNamesSize);
SkDebugf("%d: %s", opCode - start - 1, gOpNames[op].fName);
switch (op) {
case SkScriptEngine2::kCallback: {
@@ -184,7 +184,7 @@
SkOperand2::OpType type;
memcpy(&type, opCode, sizeof(type));
opCode += sizeof(type);
- int index = 0;
+ size_t index = 0;
if (type == 0)
SkDebugf(" type: %s", gOperandNames[index].fName);
else {
@@ -211,6 +211,8 @@
goto done;
case SkScriptEngine2::kNop:
SkASSERT(0);
+ default:
+ break;
}
SkDebugf("\n");
} while (true);