Incorrect comparison in nsTableRowGroupFrame.cpp

RESOLVED DUPLICATE of bug 157153

Status

()

RESOLVED DUPLICATE of bug 157153
16 years ago
16 years ago

People

(Reporter: tenthumbs, Assigned: karnaze)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [whitebox])

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
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
(Reporter)

Comment 3

16 years ago
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.

 

Updated

16 years ago
Whiteboard: [whitebox]

Comment 4

16 years ago

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