From dfc867bab24e184f5093d4eabbac7d9c58cc6320 Mon Sep 17 00:00:00 2001 From: "sugoi@google.com" Date: Mon, 11 Mar 2013 18:45:12 +0000 Subject: [PATCH] Turning on warning as error on Linux Fixed the few remaining warnings and turned on warning as error on Linux. Explicitly turned off warning as error in libjpeg, cityhash and json. Review URL: https://codereview.chromium.org/12521010 git-svn-id: http://skia.googlecode.com/svn/trunk@8067 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gyp/common_conditions.gypi | 4 +--- gyp/jsoncpp.gyp | 5 +++++ gyp/libjpeg.gyp | 5 +++++ gyp/utils.gyp | 5 +++++ src/animator/SkDrawExtraPathEffect.cpp | 20 ++++++++++++++------ src/pdf/SkPDFCatalog.cpp | 5 ++++- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi index e379f27b9e..90662d146d 100644 --- a/gyp/common_conditions.gypi +++ b/gyp/common_conditions.gypi @@ -140,9 +140,7 @@ }, }, 'cflags': [ - # TODO(tony): Enable -Werror once all the strict-aliasing problems - # are fixed. - #'-Werror', + '-Werror', '-Wall', '-Wextra', # suppressions below here were added for clang diff --git a/gyp/jsoncpp.gyp b/gyp/jsoncpp.gyp index 07507d4954..254963999d 100644 --- a/gyp/jsoncpp.gyp +++ b/gyp/jsoncpp.gyp @@ -67,6 +67,11 @@ '-Werror', ], }], + ['skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', { + 'cflags!': [ + '-Werror', + ], + }], ], }, ], diff --git a/gyp/libjpeg.gyp b/gyp/libjpeg.gyp index a9d6aefa0b..394f2ee093 100644 --- a/gyp/libjpeg.gyp +++ b/gyp/libjpeg.gyp @@ -93,6 +93,11 @@ '-Werror', ], }], + ['OS in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', { + 'cflags!': [ + '-Werror', + ], + }], ], }, ], diff --git a/gyp/utils.gyp b/gyp/utils.gyp index ab725dfcc9..f98e6fc9ce 100644 --- a/gyp/utils.gyp +++ b/gyp/utils.gyp @@ -258,6 +258,11 @@ '-Werror', ], }], + ['skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', { + 'cflags!': [ + '-Werror', + ], + }], ], }, ], diff --git a/src/animator/SkDrawExtraPathEffect.cpp b/src/animator/SkDrawExtraPathEffect.cpp index 8cfde25804..e624d195c0 100644 --- a/src/animator/SkDrawExtraPathEffect.cpp +++ b/src/animator/SkDrawExtraPathEffect.cpp @@ -128,6 +128,9 @@ protected: apply->interpolate(*fMaker, SkScalarMulRound(distance, 1000)); matrix = (SkDrawMatrix*) apply->getScope(); } + if (matrix) { + m = matrix->getMatrix(); + } } SkScalar result = 0; SkAnimatorScript::EvaluateFloat(*fMaker, NULL, fDraw->spacing.c_str(), &result); @@ -228,14 +231,21 @@ public: } protected: - virtual void begin(const SkIRect& uvBounds, SkPath* ) - { + virtual void begin(const SkIRect& uvBounds, SkPath*) const SK_OVERRIDE { + const_cast(this)->setUVBounds(uvBounds); + } + + virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const SK_OVERRIDE { + const_cast(this)->addPath(loc, u, v, dst); + } + +private: + void setUVBounds(const SkIRect& uvBounds) { fUVBounds.set(SkIntToScalar(uvBounds.fLeft), SkIntToScalar(uvBounds.fTop), SkIntToScalar(uvBounds.fRight), SkIntToScalar(uvBounds.fBottom)); } - virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) - { + void addPath(const SkPoint& loc, int u, int v, SkPath* dst) { fLoc = loc; fU = u; fV = v; @@ -272,8 +282,6 @@ clearCallBack: fMaker->clearExtraPropertyCallBack(fDraw->fType); } -private: - static bool Get2D(const char* token, size_t len, void* s2D, SkScriptValue* value) { static const char match[] = "locX|locY|left|top|right|bottom|u|v" ; SkShape2DPathEffect* shape2D = (SkShape2DPathEffect*) s2D; diff --git a/src/pdf/SkPDFCatalog.cpp b/src/pdf/SkPDFCatalog.cpp index c0f6fb03b9..b26c923c16 100644 --- a/src/pdf/SkPDFCatalog.cpp +++ b/src/pdf/SkPDFCatalog.cpp @@ -128,8 +128,11 @@ int32_t SkPDFCatalog::emitXrefTable(SkWStream* stream, bool firstPage) { first++; } for (int i = first; i <= last; i++) { + // For 32 bits platforms, the maximum offset has to fit within off_t which is a 32 bits + // signed integer on these platforms. On other platforms, we can use the actual maximum. + SkDEBUGCODE(static const off_t kMaxOff = (sizeof(off_t) > 4) ? 10000000000 : 2147483647;) SkASSERT(fCatalog[i].fFileOffset > 0); - SkASSERT(fCatalog[i].fFileOffset <= 9999999999LL); + SkASSERT(fCatalog[i].fFileOffset < kMaxOff); stream->writeBigDecAsText(fCatalog[i].fFileOffset, 10); stream->writeText(" 00000 n \n"); } -- 2.34.1