Closed Bug 908514 Opened 6 years ago Closed 6 years ago

Fix warnings in nsICODecoder.cpp

Categories

(Core :: ImageLib, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: seth, Assigned: seth)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 3 obsolete files)

nsICODecoder.cpp always generates warnings when compiling imagelib, which causes unnecessary debugging friction. There are two issues:

- Self-assignment warnings, caused by macros in EndianMacros.h.
- Cast-alignment warnings, which can be avoided through the use of a temporary variable.
Attachment #794781 - Attachment is obsolete: true
Actually, I changed my mind about the approach to fixing the self-assignment warnings. Let's just get rid of those macros altogether and replace them with template functions.
Proposed patch. This renames EndianMacros.h to Endian.h and replaces all of the macros with template functions. The bodies of the template functions are taken directly from the original macros.
Attachment #794813 - Flags: review?(jmuizelaar)
This is a tiny patch to fix a cast alignment warning in nsICODecoder.cpp.
Attachment #794815 - Flags: review?(jmuizelaar)
Looks like there is some bustage. Will look into this tomorrow.
Why don't you use mfbt/Endian.h?
(In reply to Masatoshi Kimura [:emk] from comment #7)
> Why don't you use mfbt/Endian.h?

I was going suggest the same.
Didn't know it existed. That's great. I'll switch it over.
Redid the patch to use MFBT's Endian.h and fixed known orange tests.
Attachment #796363 - Flags: review?(jmuizelaar)
Attachment #794813 - Attachment is obsolete: true
Attachment #794813 - Flags: review?(jmuizelaar)
The new version of part 1 naturally takes care of the warning handled by the old part 2, but while verifying this I discovered that there's another warning produced by gcc in image/decoders. This new part 2 takes care of that warning by explicitly initializing a variable.
Attachment #796365 - Flags: review?(jmuizelaar)
Attachment #794815 - Attachment is obsolete: true
Attachment #794815 - Flags: review?(jmuizelaar)
Attachment #796363 - Flags: review?(jmuizelaar) → review+
Attachment #796365 - Flags: review?(jmuizelaar) → review+
https://hg.mozilla.org/mozilla-central/rev/1f846fad9b0f
https://hg.mozilla.org/mozilla-central/rev/20287656b048
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.