Bug 1143994 - Fix some -Wunreachable-code and -Wswitch warnings in imagelib. r=seth

This commit is contained in:
Chris Peterson 2015-03-16 21:02:15 -07:00
parent 2b28b2ad66
commit 66b64b4907
4 changed files with 7 additions and 13 deletions

View File

@ -31,7 +31,6 @@ typedef enum {
gif_image_header,
gif_image_header_continue,
gif_image_colormap,
gif_image_body,
gif_lzw_start,
gif_lzw,
gif_sub_block,
@ -107,4 +106,3 @@ typedef struct gif_struct {
} gif_struct;
#endif // mozilla_image_decoders_GIF2_H

View File

@ -1118,7 +1118,9 @@ nsGIFDecoder2::WriteInternal(const char* aBuffer, uint32_t aCount)
// We shouldn't ever get here.
default:
break;
MOZ_ASSERT_UNREACHABLE("Unexpected mGIFStruct.state");
PostDecoderError(NS_ERROR_UNEXPECTED);
return;
}
}
@ -1155,8 +1157,6 @@ done:
mLastFlushedRow = mCurrentRow;
mLastFlushedPass = mCurrentPass;
}
return;
}
bool
@ -1189,6 +1189,5 @@ nsGIFDecoder2::SpeedHistogram()
return Telemetry::IMAGE_DECODE_SPEED_GIF;
}
} // namespace image
} // namespace mozilla

View File

@ -85,7 +85,6 @@ METHODDEF(void) my_error_exit (j_common_ptr cinfo);
// Normal JFIF markers can't have more bytes than this.
#define MAX_JPEG_MARKER_LENGTH (((uint32_t)1 << 16) - 1)
nsJPEGDecoder::nsJPEGDecoder(RasterImage* aImage,
Decoder::DecodeStyle aDecodeStyle)
: Decoder(aImage)
@ -394,7 +393,6 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount)
PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG,
("} (unknown colorpsace (3))"));
return;
break;
}
}
@ -421,7 +419,6 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount)
}
}
PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG,
(" JPEGDecoderAccounting: nsJPEGDecoder::"
"Write -- created image frame with %ux%u pixels",
@ -451,7 +448,6 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount)
return; // I/O suspension
}
// If this is a progressive JPEG ...
mState = mInfo.buffered_image ?
JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL;
@ -735,7 +731,6 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
"Didn't send downscaler's invalidation");
}
// Override the standard error method in the IJG JPEG decoder code.
METHODDEF(void)
my_error_exit (j_common_ptr cinfo)
@ -839,7 +834,6 @@ skip_input_data (j_decompress_ptr jd, long num_bytes)
}
}
/******************************************************************************/
/* data source manager method
This is called whenever bytes_in_buffer has reached zero and more
@ -959,7 +953,6 @@ term_source (j_decompress_ptr jd)
} // namespace image
} // namespace mozilla
///*************** Inverted CMYK -> RGB conversion *************************
/// Input is (Inverted) CMYK stored as 4 bytes per pixel.
/// Output is RGB stored as 3 bytes per pixel.

View File

@ -403,6 +403,7 @@ FrameAnimator::DoBlend(nsIntRect* aDirtyRect,
// Calculate area that needs updating
switch (prevFrameData.mDisposalMethod) {
default:
MOZ_ASSERT_UNREACHABLE("Unexpected DisposalMethod");
case DisposalMethod::NOT_SPECIFIED:
case DisposalMethod::KEEP:
*aDirtyRect = nextFrameData.mRect;
@ -536,6 +537,9 @@ FrameAnimator::DoBlend(nsIntRect* aDirtyRect,
break;
default:
MOZ_ASSERT_UNREACHABLE("Unexpected DisposalMethod");
case DisposalMethod::NOT_SPECIFIED:
case DisposalMethod::KEEP:
// Copy previous frame into compositingFrame before we put the new
// frame on top
// Assumes that the previous frame represents a full frame (it could be