Closed Bug 166359 Opened 22 years ago Closed 22 years ago

Incorrect comparison in nsTableRowGroupFrame.cpp

Categories

(Core :: Layout: Tables, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 157153

People

(Reporter: tenthumbs, Assigned: karnaze)

Details

(Whiteboard: [whitebox])

Attachments

(1 file)

In mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp, gcc3.1.1 says:

nsTableRowGroupFrame.cpp: In member function `void
   nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext*,
   nsHTMLReflowMetrics&, const nsHTMLReflowState&, nsTableRowFrame*)':
nsTableRowGroupFrame.cpp:820: warning: comparison of unsigned expression < 0 
   is always false

The code is:

nscoord rowExtra = PR_MAX(0, rInfo.pctHeight - rInfo.height);

Since rInfo.pctHeight - rInfo.height is unsigned, its value will be used 
whether it's right or not.
to correct component.
Assignee: attinasi → karnaze
Component: Layout → HTMLTables
QA Contact: petersen → amar
If it were me, I would do

  nscoord rowExtra = (rInfo.pctHeight > rInfo.height)  
                     ? rInfo.pctHeight - rInfo.height
                     : 0;

but the patch should work as it is.

The comment about subtracting unsigneds isn't really right. It's not 
that it's bad but that it's always positive.

 
Whiteboard: [whitebox]

*** This bug has been marked as a duplicate of 157153 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: