Eliminate Linux compile warnings throughout animator/ with variable
initializations, missing braces.
git-svn-id: http://skia.googlecode.com/svn/trunk@1991 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/animator/SkAnimateSet.cpp b/src/animator/SkAnimateSet.cpp
index da27c3b..d0b4dfc 100644
--- a/src/animator/SkAnimateSet.cpp
+++ b/src/animator/SkAnimateSet.cpp
@@ -78,8 +78,9 @@
SkASSERT(fValues.getType() == outType);
if (fFieldInfo->fType == SkType_Array)
comps = fValues.count();
- else
+ else {
SkASSERT(fValues.count() == comps);
+ }
}
if (formula.size() > 0) {
comps = 1;
diff --git a/src/animator/SkAnimatorScript.cpp b/src/animator/SkAnimatorScript.cpp
index 7fdb048..6aae006 100644
--- a/src/animator/SkAnimatorScript.cpp
+++ b/src/animator/SkAnimatorScript.cpp
@@ -465,7 +465,7 @@
scriptValue->fOperand.fString = SkNEW_ARGS(SkString, (boxedValue->value));
} break;
default: {
- const char* id;
+ const char* id = NULL;
bool success = maker->findKey(displayable, &id);
SkASSERT(success);
scriptValue->fOperand.fString = SkNEW_ARGS(SkString, (id));
diff --git a/src/animator/SkBase64.cpp b/src/animator/SkBase64.cpp
index 5f72ac8..076f649 100644
--- a/src/animator/SkBase64.cpp
+++ b/src/animator/SkBase64.cpp
@@ -74,7 +74,8 @@
padTwo = true;
break;
} while (byte < 4);
- int two, three;
+ int two = 0;
+ int three = 0;
if (writeDestination) {
int one = (uint8_t) (bytes[0] << 2);
two = bytes[1];
diff --git a/src/animator/SkDisplayApply.cpp b/src/animator/SkDisplayApply.cpp
index d3c24a5..d54ee26 100644
--- a/src/animator/SkDisplayApply.cpp
+++ b/src/animator/SkDisplayApply.cpp
@@ -138,8 +138,9 @@
animator->packARGB(&values->fScalar, count, &converted);
values = converted.begin();
count = converted.count();
- } else
+ } else {
SkASSERT(count == 1);
+ }
}
// SkASSERT(type == SkType_ARGB || type == SkType_String ||info->isSettable());
if (type == SkType_String || type == SkType_DynamicString)
diff --git a/src/animator/SkMemberInfo.cpp b/src/animator/SkMemberInfo.cpp
index 00b4af9..7fae503 100644
--- a/src/animator/SkMemberInfo.cpp
+++ b/src/animator/SkMemberInfo.cpp
@@ -89,8 +89,9 @@
if (dispArray->values.count() <= index)
return false;
type = dispArray->values.getType();
- } else
+ } else {
SkASSERT(0); // incomplete
+ }
size_t byteSize = GetSize(type);
memcpy(value, valuePtr + index * byteSize, byteSize);
return true;
@@ -257,7 +258,7 @@
SkASSERT(success);
if (scriptValue.fType == SkType_Displayable) {
if (type == SkType_String) {
- const char* charPtr;
+ const char* charPtr = NULL;
maker.findKey(scriptValue.fOperand.fDisplayable, &charPtr);
scriptValue.fOperand.fString = new SkString(charPtr);
scriptValue.fType = SkType_String;
diff --git a/src/animator/SkScript.cpp b/src/animator/SkScript.cpp
index e2a7908..aa06169 100644
--- a/src/animator/SkScript.cpp
+++ b/src/animator/SkScript.cpp
@@ -184,6 +184,7 @@
noInitialSuppress.fOperator = kUnassigned;
noInitialSuppress.fOpStackDepth = 0;
noInitialSuppress.fSuppress = false;
+ noInitialSuppress.fElse = 0;
fSuppressStack.push(noInitialSuppress);
*fOpStack.push() = kParen;
fTrackArray.appendClear();
@@ -1218,6 +1219,7 @@
suppress.fSuppress = true;
suppress.fOperator = match;
suppress.fOpStackDepth = fOpStack.count();
+ suppress.fElse = false;
fSuppressStack.push(suppress);
} else {
fTypeStack.pop();
diff --git a/src/animator/SkScriptTokenizer.cpp b/src/animator/SkScriptTokenizer.cpp
index 9224435..b7c1634 100644
--- a/src/animator/SkScriptTokenizer.cpp
+++ b/src/animator/SkScriptTokenizer.cpp
@@ -505,8 +505,9 @@
}
lastPush = false;
continue;
- } else
+ } else {
SkASSERT(token_length(script) > 0);
+ }
}
if (lastPush != false && fTokenLength > 0) {
if (ch == '(') {
@@ -1038,8 +1039,9 @@
SkASSERT(fValueStack.top().fType == SkOperand2::kS32); // !!! add error handling, and conversion to int?
addTokenValue(fValueStack.top(), kAccumulator);
fValueStack.pop();
- } else
+ } else {
SkASSERT(fAccumulatorType == SkOperand2::kS32);
+ }
// if 'and', write beq goto opcode after end of predicate (after to bool)
// if 'or', write bne goto to bool
addToken(op == kLogicalAnd ? kLogicalAndInt : kLogicalOrInt);
@@ -1133,8 +1135,8 @@
else if (value2.fType == SkOperand2::kString)
typeOp = (TypeOp) (typeOp + 2);
SkDynamicMemoryWStream stream;
- SkOperand2::OpType saveType;
- SkBool saveOperand;
+ SkOperand2::OpType saveType = SkOperand2::kNoType;
+ SkBool saveOperand = false;
if (constantOperands) {
fActiveStream = &stream;
saveType = fAccumulatorType;