Closed Bug 504929 Opened 15 years ago Closed 15 years ago

Fix "warning: comparison between signed and unsigned integer expressions" in nsDOMWindowUtils.cpp

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

(Whiteboard: [build_warning])

Attachments

(1 file)

Attached patch fix (deleted) — Splinter Review
When compiling nsDOMWindowUtils.cpp (in mozilla-central), I get these warnings: /mozilla/dom/base/nsDOMWindowUtils.cpp: In member function ‘virtual nsresult nsDOMWindowUtils::CompareCanvases(nsIDOMHTMLCanvasElement*, nsIDOMHTMLCanvasElement*, PRUint32*, PRUint32*)’: /mozilla/dom/base/nsDOMWindowUtils.cpp:662: warning: comparison between signed and unsigned integer expressions /mozilla/dom/base/nsDOMWindowUtils.cpp:663: warning: comparison between signed and unsigned integer expressions /mozilla/dom/base/nsDOMWindowUtils.cpp:664: warning: comparison between signed and unsigned integer expressions /mozilla/dom/base/nsDOMWindowUtils.cpp:665: warning: comparison between signed and unsigned integer expressions The warnings happen because "abs()" returns a *signed* integer, and we implicitly compare its result to an *unsigned* integer using PR_MAX. Trivial fix: Just cast the result of abs() to be unsigned. It's guaranteed to be non-negative anyway, since it's an absolute value. :)
Attachment #389197 - Flags: review?(vladimir)
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
This was fixed a while back, as part of bug 530300. Resolving as WORKSFORME & adding dependency.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Depends on: 530300
Resolution: --- → WORKSFORME
Whiteboard: [build_warning]
Attachment #389197 - Flags: review?(vladimir)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: