Bug 1823375. Fix all variable shadowing warnings in imagelib. r=Zaggy1024,gfx-reviewers,nical

We can't actually enable the warning because there are some warnings generated by includes coming from outside of imagelib.

Note that change in AOMDecoder::Init is actually a behaviour change: the new behaviour is to return the error code if we fail to decode the alpha image. This matches what we do for the dav1d decoder.

Depends on D173000

Differential Revision: https://phabricator.services.mozilla.com/D173001
This commit is contained in:
Timothy Nikkel 2023-04-11 08:06:29 +00:00
parent 4f9e9e2fc9
commit 9d0226a146
3 changed files with 13 additions and 12 deletions

View File

@ -537,8 +537,8 @@ class Dav1dDecoder final : AVIFDecoderInterface {
MOZ_LOG(sAVIFLog, LogLevel::Verbose, ("[this=%p] Decoding alpha", this));
alphaPic = OwnedDav1dPicture(new Dav1dPicture());
Dav1dResult r = GetPicture(*mAlphaContext, *aSamples.mAlphaImage,
alphaPic.get(), aShouldSendTelemetry);
r = GetPicture(*mAlphaContext, *aSamples.mAlphaImage, alphaPic.get(),
aShouldSendTelemetry);
if (r != 0) {
return AsVariant(r);
}
@ -789,8 +789,8 @@ class AOMDecoder final : AVIFDecoderInterface {
MOZ_ASSERT(mAlphaContext.isSome());
aom_image_t* alphaImg = nullptr;
DecodeResult r = GetImage(*mAlphaContext, *aSamples.mAlphaImage,
&alphaImg, aShouldSendTelemetry);
r = GetImage(*mAlphaContext, *aSamples.mAlphaImage, &alphaImg,
aShouldSendTelemetry);
if (!IsDecodeSuccess(r)) {
return r;
}
@ -854,8 +854,8 @@ class AOMDecoder final : AVIFDecoderInterface {
if (aHasAlpha) {
// Init alpha decoder context
mAlphaContext.emplace();
aom_codec_err_t r = aom_codec_dec_init(
mAlphaContext.ptr(), iface, /* cfg = */ nullptr, /* flags = */ 0);
r = aom_codec_dec_init(mAlphaContext.ptr(), iface, /* cfg = */ nullptr,
/* flags = */ 0);
MOZ_LOG(sAVIFLog, r == AOM_CODEC_OK ? LogLevel::Verbose : LogLevel::Error,
("[this=%p] color decoder: aom_codec_dec_init -> %d, name = %s",
@ -863,6 +863,7 @@ class AOMDecoder final : AVIFDecoderInterface {
if (r != AOM_CODEC_OK) {
mAlphaContext.reset();
return r;
}
}

View File

@ -478,11 +478,11 @@ LexerTransition<nsJPEGDecoder::State> nsJPEGDecoder::ReadJPEGData(
if (mState == JPEG_DECOMPRESS_PROGRESSIVE) {
LOG_SCOPE((mozilla::LogModule*)sJPEGLog,
"nsJPEGDecoder::Write -- JPEG_DECOMPRESS_PROGRESSIVE case");
auto AllComponentsSeen = [](jpeg_decompress_struct& mInfo) {
auto AllComponentsSeen = [](jpeg_decompress_struct& info) {
bool all_components_seen = true;
if (mInfo.coef_bits) {
for (int c = 0; c < mInfo.num_components; ++c) {
bool current_component_seen = mInfo.coef_bits[c][0] != -1;
if (info.coef_bits) {
for (int c = 0; c < info.num_components; ++c) {
bool current_component_seen = info.coef_bits[c][0] != -1;
all_components_seen &= current_component_seen;
}
}

View File

@ -22,8 +22,8 @@ namespace mozilla::image {
#define JXL_TRY(expr) \
do { \
JxlDecoderStatus status = (expr); \
if (status != JXL_DEC_SUCCESS) { \
JxlDecoderStatus _status = (expr); \
if (_status != JXL_DEC_SUCCESS) { \
return Transition::TerminateFailure(); \
} \
} while (0);