Reenable warnings in src/codec

BUG=skia:

Review URL: https://codereview.chromium.org/1400343005
This commit is contained in:
msarett 2015-10-15 06:41:06 -07:00 committed by Commit bot
parent 74ec8d47b5
commit f724b99435
10 changed files with 30 additions and 29 deletions

View File

@ -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': [

View File

@ -243,8 +243,6 @@
'include_dirs': [
'../third_party/externals/libwebp/src',
],
'cflags': [ '-w' ],
'xcode_settings': { 'WARNING_CFLAGS': [ '-w' ] },
},
'conditions': [
['OS!="win"', {'product_name': 'webp'}],

View File

@ -50,7 +50,7 @@ SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo,
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;

View File

@ -55,7 +55,7 @@ SkCodec::Result SkBmpRLECodec::onGetPixels(const SkImageInfo& dstInfo,
}
// 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

View File

@ -55,7 +55,7 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
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;

View File

@ -29,13 +29,6 @@ bool SkGifCodec::IsGif(SkStream* stream) {
return false;
}
/*
* Warning reporting function
*/
static void gif_warning(const char* msg) {
SkCodecPrintf("Gif Warning: %s\n", msg);
}
/*
* Error function
*/
@ -189,6 +182,7 @@ bool SkGifCodec::ReadHeader(SkStream* stream, SkCodec** codecOut, GifFileType**
SkIRect frameRect;
if (!GetDimensions(gif, &size, &frameRect)) {
gif_error("Invalid gif size.\n");
return false;
}
bool frameIsSubset = (size != frameRect.size());
@ -237,6 +231,7 @@ SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType
: 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 @@ SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType
// 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() {

View File

@ -287,8 +287,8 @@ static bool read_header(SkStream* stream, png_structp* png_ptrp,
}
// 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 @@ public:
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 @@ SkCodec* SkPngCodec::NewFromStream(SkStream* stream) {
return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), png_ptr,
info_ptr, bitDepth, numberPasses);
}

View File

@ -92,8 +92,8 @@ bool SkWbmpCodec::readRow(uint8_t* row) {
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 {

View File

@ -381,7 +381,7 @@ SkCodec::Result SkJpegCodec::onGetPixels(const SkImageInfo& dstInfo,
}
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 @@ int SkJpegCodec::onGetScanlines(void* dst, int count, size_t rowBytes) {
}
#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 @@ bool SkJpegCodec::onSkipScanlines(int count) {
return fDecoderMgr->returnFalse("setjmp");
}
return count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
}

View File

@ -700,8 +700,8 @@ SkSwizzler::SkSwizzler(RowProc proc, const SkPMColor* ctable, int srcOffset, int
, fX0(srcOffset)
, fSrcWidth(srcWidth)
, fDstWidth(srcWidth)
, fBPP(bpp)
, fSampleX(1)
, fBPP(bpp)
{}
int SkSwizzler::onSetSampleX(int sampleX) {