Closed
Bug 851556
Opened 11 years ago
Closed 11 years ago
GestureEventListener.cpp:140:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Categories
(Core :: Graphics: Layers, defect)
Core
Graphics: Layers
Tracking
()
RESOLVED
FIXED
mozilla22
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
1.08 KB,
patch
|
drs
:
review+
|
Details | Diff | Splinter Review |
Build warning: { /mozilla/gfx/layers/ipc/GestureEventListener.cpp: In member function ‘nsEventStatus mozilla::layers::GestureEventListener::HandleInputEvent(const mozilla::InputData&)’: /mozilla/gfx/layers/ipc/GestureEventListener.cpp:140:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] /mozilla/gfx/layers/ipc/GestureEventListener.cpp:142:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] } This is from these comparisons: > 140 if (event.mTime - mTapStartTime <= MAX_TAP_TIME) { > 141 if (mState == GESTURE_WAITING_DOUBLE_TAP && > 142 event.mTime - mLastTapEndTime > MAX_TAP_TIME) { https://mxr.mozilla.org/mozilla-central/source/gfx/layers/ipc/GestureEventListener.cpp#140 "event.mTime" is a uint32_t, and "mTapStartTime" is a uint64_t -- so the left side of the comparisons ends up having type uint64_t. MAX_TAP_TIME is an int (i.e. it's signed), for some reason. It's only got one usage outside of the two lines quoted above -- it's passed to PostDelayedTask here: https://mxr.mozilla.org/mozilla-central/source/gfx/layers/ipc/GestureEventListener.cpp#171 and *there* it's used as an int. We could easily make it an unsigned value, though, and just let PostDelayedTask implicitly convert it to an int. (It's not anywhere near UINT32_MAX, so unsigned --> signed conversion will do the right thing.) SO: I think we should just make MAX_TAP_TIME unsigned, possibly "uint32_t" to match event.mTime, so that the comparisons against it won't trigger build warnings.
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #725458 -
Flags: review?(bugzilla)
Comment 2•11 years ago
|
||
Comment on attachment 725458 [details] [diff] [review] fix v1 Review of attachment 725458 [details] [diff] [review]: ----------------------------------------------------------------- Cool! Thanks for the fix.
Attachment #725458 -
Flags: review?(bugzilla) → review+
Assignee | ||
Comment 3•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ff9313fd56e4
Flags: in-testsuite-
Comment 4•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ff9313fd56e4
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in
before you can comment on or make changes to this bug.
Description
•