Reenable warnings in src/codec
BUG=skia:
Review URL: https://codereview.chromium.org/1400343005
diff --git a/gyp/images.gyp b/gyp/images.gyp
index 8dd3449..3c46ec1 100644
--- a/gyp/images.gyp
+++ b/gyp/images.gyp
@@ -131,6 +131,13 @@
'dependencies': [
'android_deps.gyp:png',
],
+ 'cflags' : [
+ # SkImageDecoder_libpng includes png.h.
+ # In the version of libpng that we use on Android (1.2.46),
+ # there is a missing space between a literal and an identifier
+ # in png.h, triggering a warning in C++11.
+ '-Wno-literal-suffix',
+ ],
'conditions': [
[ 'skia_android_framework == 0', {
'export_dependent_settings': [
diff --git a/gyp/libwebp.gyp b/gyp/libwebp.gyp
index 2978cd9..cff74f6 100644
--- a/gyp/libwebp.gyp
+++ b/gyp/libwebp.gyp
@@ -243,8 +243,6 @@
'include_dirs': [
'../third_party/externals/libwebp/src',
],
- 'cflags': [ '-w' ],
- 'xcode_settings': { 'WARNING_CFLAGS': [ '-w' ] },
},
'conditions': [
['OS!="win"', {'product_name': 'webp'}],
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp
index 2bc47b5..b173317 100644
--- a/src/codec/SkBmpMaskCodec.cpp
+++ b/src/codec/SkBmpMaskCodec.cpp
@@ -50,7 +50,7 @@
return result;
}
- uint32_t rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
+ int rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
if (rows != dstInfo.height()) {
*rowsDecoded = rows;
return kIncompleteInput;
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index e215095..67e262a 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -55,7 +55,7 @@
}
// Perform the decode
- uint32_t rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
+ int rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
if (rows != dstInfo.height()) {
// We set rowsDecoded equal to the height because the background has already
// been filled. RLE encodings sometimes skip pixels, so we always start by
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 9557609..fd4d6d1 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -55,7 +55,7 @@
if (kSuccess != result) {
return result;
}
- uint32_t rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
+ int rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
if (rows != dstInfo.height()) {
*rowsDecoded = rows;
return kIncompleteInput;
diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
index 0187891..03107ab 100644
--- a/src/codec/SkCodec_libgif.cpp
+++ b/src/codec/SkCodec_libgif.cpp
@@ -30,13 +30,6 @@
}
/*
- * Warning reporting function
- */
-static void gif_warning(const char* msg) {
- SkCodecPrintf("Gif Warning: %s\n", msg);
-}
-
-/*
* Error function
*/
static SkCodec::Result gif_error(const char* msg, SkCodec::Result result = SkCodec::kInvalidInput) {
@@ -189,6 +182,7 @@
SkIRect frameRect;
if (!GetDimensions(gif, &size, &frameRect)) {
gif_error("Invalid gif size.\n");
+ return false;
}
bool frameIsSubset = (size != frameRect.size());
@@ -237,6 +231,7 @@
: INHERITED(srcInfo, stream)
, fGif(gif)
, fSrcBuffer(new uint8_t[this->getInfo().width()])
+ , fFrameRect(frameRect)
// If it is valid, fTransIndex will be used to set fFillIndex. We don't know if
// fTransIndex is valid until we process the color table, since fTransIndex may
// be greater than the size of the color table.
@@ -244,10 +239,9 @@
// Default fFillIndex is 0. We will overwrite this if fTransIndex is valid, or if
// there is a valid background color.
, fFillIndex(0)
- , fFrameRect(frameRect)
, fFrameIsSubset(frameIsSubset)
- , fColorTable(NULL)
, fSwizzler(NULL)
+ , fColorTable(NULL)
{}
bool SkGifCodec::onRewind() {
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp
index 7d41623..f4d7556 100644
--- a/src/codec/SkCodec_libpng.cpp
+++ b/src/codec/SkCodec_libpng.cpp
@@ -287,8 +287,8 @@
}
// Now determine the default SkColorType and SkAlphaType and set required transforms
- SkColorType skColorType;
- SkAlphaType skAlphaType;
+ SkColorType skColorType = kUnknown_SkColorType;
+ SkAlphaType skAlphaType = kUnknown_SkAlphaType;
switch (colorType) {
case PNG_COLOR_TYPE_PALETTE:
skColorType = kIndex_8_SkColorType;
@@ -605,8 +605,8 @@
SkPngScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream,
png_structp png_ptr, png_infop info_ptr, int bitDepth)
: INHERITED(srcInfo, stream, png_ptr, info_ptr, bitDepth, 1)
- , fSrcRow(nullptr)
, fAlphaState(kUnknown_AlphaState)
+ , fSrcRow(nullptr)
{}
Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& options,
@@ -843,4 +843,3 @@
return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), png_ptr,
info_ptr, bitDepth, numberPasses);
}
-
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index 19ae4ea..900ab6f 100644
--- a/src/codec/SkCodec_wbmp.cpp
+++ b/src/codec/SkCodec_wbmp.cpp
@@ -92,8 +92,8 @@
SkWbmpCodec::SkWbmpCodec(const SkImageInfo& info, SkStream* stream)
: INHERITED(info, stream)
, fSrcRowBytes(get_src_row_bytes(this->getInfo().width()))
- , fColorTable(nullptr)
, fSwizzler(nullptr)
+ , fColorTable(nullptr)
{}
SkEncodedFormat SkWbmpCodec::onGetEncodedFormat() const {
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index d0d11b1..36a723f 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -381,7 +381,7 @@
}
void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) {
- SkSwizzler::SrcConfig srcConfig;
+ SkSwizzler::SrcConfig srcConfig = SkSwizzler::kUnknown;
switch (dstInfo.colorType()) {
case kGray_8_SkColorType:
srcConfig = SkSwizzler::kGray;
@@ -487,14 +487,17 @@
}
#ifndef TURBO_HAS_SKIP
-// TODO (msarett): Make this a member function and avoid reallocating the
-// memory buffer on each call to skip.
-#define jpeg_skip_scanlines(dinfo, count) \
- SkAutoMalloc storage(get_row_bytes(dinfo)); \
- uint8_t* storagePtr = static_cast<uint8_t*>(storage.get()); \
- for (int y = 0; y < count; y++) { \
- jpeg_read_scanlines(dinfo, &storagePtr, 1); \
+// TODO (msarett): Avoid reallocating the memory buffer on each call to skip.
+static uint32_t jpeg_skip_scanlines(dinfo, count) {
+ SkAutoMalloc storage(get_row_bytes(dinfo));
+ uint8_t* storagePtr = static_cast<uint8_t*>(storage.get());
+ for (int y = 0; y < count; y++) {
+ if (1 != jpeg_read_scanlines(dinfo, &storagePtr, 1)) {
+ return y;
+ }
}
+ return count;
+}
#endif
bool SkJpegCodec::onSkipScanlines(int count) {
@@ -503,5 +506,5 @@
return fDecoderMgr->returnFalse("setjmp");
}
- return count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
+ return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
}
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index 95ed1d7..ce2c946 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -700,8 +700,8 @@
, fX0(srcOffset)
, fSrcWidth(srcWidth)
, fDstWidth(srcWidth)
- , fBPP(bpp)
, fSampleX(1)
+ , fBPP(bpp)
{}
int SkSwizzler::onSetSampleX(int sampleX) {