Closed
Bug 819280
Opened 13 years ago
Closed 12 years ago
Fix GCC warnings in Windows accessibility code
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
RESOLVED
FIXED
mozilla20
People
(Reporter: jacek, Assigned: jacek)
Details
Attachments
(2 files)
12.64 KB,
patch
|
tbsaunde
:
review+
|
Details | Diff | Splinter Review |
3.42 KB,
patch
|
tbsaunde
:
review+
|
Details | Diff | Splinter Review |
Now that accessibility compiles with mingw, we may fix some warnings. Most of them are noise (like -Wreorder, -Wsign-compare), but there are some bits worth clean up (unused variable, missing MOZ_FINAL) and one real problem (deleting interface pointer instead of object instance pointer).
Attachment #689637 -
Flags: review?(trev.saunders)
Comment 1•13 years ago
|
||
Comment on attachment 689637 [details] [diff] [review]
fix
>+ NS_ASSERTION(gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY] == kEVENT_LAST_ENTRY,
> "MSAA event map skewed");
it'd be nice if you converted this to a static assert while you were here.
>+ ChildrenEnumVariant(AccessibleWrap* aAnchor) : mRefCnt(0), mAnchorAcc(aAnchor),
>+ mCurAcc(mAnchorAcc->GetChildAt(0)), mCurIndex(0) { }
if we start care about win64 some day we should reorder the members for better packing instead of this, but it seems tricky to do with the macros, so don't worry about it.
>- if (aTargetIndex < 0 || aTargetIndex >= mTargets.Length() || !aTarget)
>+ if (aTargetIndex < 0 || aTargetIndex >= (long)mTargets.Length() || !aTarget)
please cast aTargetIndex to unsigned since you just checked that its > 0.
>- for (LONG i = 0; i < ArrayLength(ids); i++)
>+ for (LONG i = 0; i < (LONG)ArrayLength(ids); i++)
why not just use uint32_t ?
Attachment #689637 -
Flags: review?(trev.saunders) → review+
Assignee | ||
Comment 2•13 years ago
|
||
Thanks for review.
(In reply to Trevor Saunders (:tbsaunde) from comment #1)
> Comment on attachment 689637 [details] [diff] [review]
> fix
>
> >+ NS_ASSERTION(gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY] == kEVENT_LAST_ENTRY,
> > "MSAA event map skewed");
>
> it'd be nice if you converted this to a static assert while you were here.
This can't be simply replaced to static assert, because accessing an element of gWinEventMap is not evaluated statically. We could have instead a static assert using sizeof(gWinEventMap) and comparing its elem count to nsIAccessibleEvent::EVENT_LAST_ENTRY, but this would test a different thing.
> >- if (aTargetIndex < 0 || aTargetIndex >= mTargets.Length() || !aTarget)
> >+ if (aTargetIndex < 0 || aTargetIndex >= (long)mTargets.Length() || !aTarget)
>
> please cast aTargetIndex to unsigned since you just checked that its > 0.
Fixed.
> >- for (LONG i = 0; i < ArrayLength(ids); i++)
> >+ for (LONG i = 0; i < (LONG)ArrayLength(ids); i++)
>
> why not just use uint32_t ?
Because &i is used as parameter to SafeArrayPutElement, which is of LONG* type.
Assignee | ||
Comment 3•13 years ago
|
||
Comment 4•13 years ago
|
||
(In reply to Jacek Caban from comment #2)
> Thanks for review.
>
> (In reply to Trevor Saunders (:tbsaunde) from comment #1)
> > Comment on attachment 689637 [details] [diff] [review]
> > fix
> >
> > >+ NS_ASSERTION(gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY] == kEVENT_LAST_ENTRY,
> > > "MSAA event map skewed");
> >
> > it'd be nice if you converted this to a static assert while you were here.
>
> This can't be simply replaced to static assert, because accessing an element
> of gWinEventMap is not evaluated statically. We could have instead a static
> assert using sizeof(gWinEventMap) and comparing its elem count to
> nsIAccessibleEvent::EVENT_LAST_ENTRY, but this would test a different thing.
true, but just as useful a thing imo, and then we could remove the last entry from the array.
Comment 5•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Assignee | ||
Comment 6•13 years ago
|
||
(In reply to Trevor Saunders (:tbsaunde) from comment #4)
> true, but just as useful a thing imo, and then we could remove the last
> entry from the array.
OK, I will attach a patch (I hope it's fine to reopen this bug for such a small change).
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 7•13 years ago
|
||
Attachment #692259 -
Flags: review?(trev.saunders)
Comment 8•13 years ago
|
||
Comment on attachment 692259 [details] [diff] [review]
Change NS_ASSERTION to MOZ_STATIC_ASSERT
>+ MOZ_STATIC_ASSERT(sizeof(gWinEventMap)/sizeof(gWinEventMap[0]) == nsIAccessibleEvent::EVENT_LAST_ENTRY,
>+ "MSAA event map skewed");
I guess you can't use ArrayLength() because of no constexpr?
thank you for fixing this, sory reviewing took a couple days.
Attachment #692259 -
Flags: review?(trev.saunders) → review+
Assignee | ||
Comment 9•13 years ago
|
||
(In reply to Trevor Saunders (:tbsaunde) from comment #8)
> I guess you can't use ArrayLength() because of no constexpr?
Yes, that was the reason.
https://hg.mozilla.org/integration/mozilla-inbound/rev/b62655d36be4
Comment 10•12 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 13 years ago → 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•