Towards enabling -Werror in skia on Linux
Review URL: http://codereview.appspot.com/5516044/
git-svn-id: http://skia.googlecode.com/svn/trunk@2983 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 059ec47..024ad0f 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -327,7 +327,7 @@
SkString outDir;
SkBitmap::Config outConfig = SkBitmap::kNo_Config;
- GLHelper* glHelper;
+ GLHelper* glHelper = NULL;
const char* configName = "";
Backend backend = kRaster_Backend; // for warning
int configCount = SK_ARRAY_COUNT(gConfigs);
diff --git a/gm/arithmode.cpp b/gm/arithmode.cpp
index 4002798..ea015c6 100644
--- a/gm/arithmode.cpp
+++ b/gm/arithmode.cpp
@@ -27,7 +27,7 @@
SkBitmap bm = make_bm();
SkCanvas canvas(bm);
SkPaint paint;
- SkPoint pts[] = { 0, 0, SkIntToScalar(WW), SkIntToScalar(HH) };
+ SkPoint pts[] = { {0, 0}, {SkIntToScalar(WW), SkIntToScalar(HH)} };
SkColor colors[] = {
SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN,
SK_ColorRED, SK_ColorMAGENTA, SK_ColorWHITE
@@ -43,7 +43,7 @@
SkBitmap bm = make_bm();
SkCanvas canvas(bm);
SkPaint paint;
- SkPoint pts[] = { 0, SkIntToScalar(HH), SkIntToScalar(WW), 0 };
+ SkPoint pts[] = { {0, SkIntToScalar(HH)}, {SkIntToScalar(WW), 0} };
SkColor colors[] = {
SK_ColorBLUE, SK_ColorYELLOW, SK_ColorBLACK, SK_ColorGREEN, SK_ColorGRAY
};
diff --git a/gm/tablecolorfilter.cpp b/gm/tablecolorfilter.cpp
index c882fe6..df33337 100644
--- a/gm/tablecolorfilter.cpp
+++ b/gm/tablecolorfilter.cpp
@@ -19,7 +19,7 @@
SkCanvas canvas(*bm);
SkPaint paint;
- SkPoint pts[] = { 0, 0, SkIntToScalar(W), SkIntToScalar(H) };
+ SkPoint pts[] = { {0, 0}, {SkIntToScalar(W), SkIntToScalar(H)} };
SkColor colors[] = {
SK_ColorBLACK, SK_ColorGREEN, SK_ColorCYAN,
SK_ColorRED, 0, SK_ColorBLUE, SK_ColorWHITE
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 1a7c672..c3d96ffe 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -87,7 +87,10 @@
'cflags': ['-O2']
},
},
- 'cflags': [
+ 'cflags': [
+ # TODO(tony): Enable -Werror once all the strict-aliasing problems
+ # are fixed.
+ #'-Werror',
'-Wall',
'-Wextra',
'-Wno-unused',
diff --git a/src/animator/SkAnimateActive.cpp b/src/animator/SkAnimateActive.cpp
index f429903..4177aa0 100644
--- a/src/animator/SkAnimateActive.cpp
+++ b/src/animator/SkAnimateActive.cpp
@@ -142,9 +142,12 @@
SkAnimateBase* animate = fAnimators[index];
SkMSec duration = animate->dur;
SkState& state = fState[index];
- if (state.fMode == SkApply::kMode_immediate || state.fMode == SkApply::kMode_create)
+ switch (state.fMode) {
+ case SkApply::kMode_immediate:
+ case SkApply::kMode_create:
duration = state.fSteps ? state.fSteps * SK_MSec1 : 1;
-// else if (state.fMode == SkApply::kMode_hold) {
+ break;
+// case SkApply::kMode_hold: {
// int entries = animate->entries();
// SkScriptValue value;
// value.fOperand = animate->getValues()[entries - 1];
@@ -152,7 +155,9 @@
// bool result = SkScriptEngine::ConvertTo(NULL, SkType_Int, &value);
// SkASSERT(result);
// duration = value.fOperand.fS32 * SK_MSec1;
-// }
+// break;
+// }
+ }
state.fDuration = duration;
SkMSec maxTime = state.fBegin + duration;
if (fMaxTime < maxTime)
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index afbcdef..6bde3b2 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -171,7 +171,7 @@
size_t raw = SkPackBits::Unpack8(storage, size, fStorage);
SkASSERT(raw <= sizeof(fStorage));
- int count = gCountNibBits[fFlags & 0xF];
+ size_t count = gCountNibBits[fFlags & 0xF];
SkASSERT(raw == count * 256);
}
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index dfe0d4b..4191c4a 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -403,7 +403,7 @@
class AutoRenderTargetRestore : public ::GrNoncopyable {
public:
- AutoRenderTargetRestore() : fDrawState(NULL) {}
+ AutoRenderTargetRestore() : fDrawState(NULL), fSavedTarget(NULL) {}
AutoRenderTargetRestore(GrDrawState* ds, GrRenderTarget* newTarget) {
fDrawState = NULL;
this->set(ds, newTarget);
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 404c762..465fbe1 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -473,7 +473,7 @@
SkTDArray<BFChar> bfcharEntries;
SkTDArray<BFRange> bfrangeEntries;
- BFRange currentRangeEntry;
+ BFRange currentRangeEntry = {0, 0, 0};
bool rangeEmpty = true;
const int count = glyphToUnicode.count();
diff --git a/tests/EmptyPathTest.cpp b/tests/EmptyPathTest.cpp
index b0b26b5..b126076 100644
--- a/tests/EmptyPathTest.cpp
+++ b/tests/EmptyPathTest.cpp
@@ -48,7 +48,7 @@
}
// success means we drew everywhere or nowhere (depending on shouldDraw)
- bool success = shouldDraw ? (~0 == andValue) : (0 == orValue);
+ bool success = shouldDraw ? (~0U == andValue) : (0 == orValue);
if (!success) {
SkString str;
diff --git a/tests/ScalarTest.cpp b/tests/ScalarTest.cpp
index 2f0aa0b..d2c05ab 100644
--- a/tests/ScalarTest.cpp
+++ b/tests/ScalarTest.cpp
@@ -100,10 +100,10 @@
isFinite2_mulzeroadd
};
- int i, n = SK_ARRAY_COUNT(data);
+ size_t i, n = SK_ARRAY_COUNT(data);
for (i = 0; i < n; ++i) {
- for (int k = 0; k < SK_ARRAY_COUNT(gProc1); ++k) {
+ for (size_t k = 0; k < SK_ARRAY_COUNT(gProc1); ++k) {
const Rec& rec = data[i];
bool finite = gProc1[k](rec.fValue);
REPORTER_ASSERT(reporter, rec.fIsFinite == finite);
@@ -112,12 +112,12 @@
for (i = 0; i < n; ++i) {
const Rec& rec0 = data[i];
- for (int j = 0; j < n; ++j) {
+ for (size_t j = 0; j < n; ++j) {
const Rec& rec1 = data[j];
- for (int k = 0; k < SK_ARRAY_COUNT(gProc1); ++k) {
+ for (size_t k = 0; k < SK_ARRAY_COUNT(gProc1); ++k) {
IsFiniteProc1 proc1 = gProc1[k];
- for (int m = 0; m < SK_ARRAY_COUNT(gProc2); ++m) {
+ for (size_t m = 0; m < SK_ARRAY_COUNT(gProc2); ++m) {
bool finite = gProc2[m](rec0.fValue, rec1.fValue, proc1);
bool finite2 = rec0.fIsFinite && rec1.fIsFinite;
REPORTER_ASSERT(reporter, finite2 == finite);