Last Comment Bug 742581 - nsStyleCoord::GetCoordValue() signature is inconsistent (nscoord vs PRInt32)
: nsStyleCoord::GetCoordValue() signature is inconsistent (nscoord vs PRInt32)
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla14
Assigned To: Daniel Holbert [:dholbert]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-04 16:22 PDT by Daniel Holbert [:dholbert]
Modified: 2012-04-09 10:13 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix (827 bytes, patch)
2012-04-06 16:20 PDT, Daniel Holbert [:dholbert]
dbaron: review+
Details | Diff | Review

Description Daniel Holbert [:dholbert] 2012-04-04 16:22:20 PDT
I just noticed that the method-signature for nsStyleCoord::GetCoordValue doesn't match, between the function declaration & the function definition.  (nscoord vs PRInt32)

Relevant code:
> 90  class nsStyleCoord {
[...]
> 162   nscoord     GetCoordValue() const;
[...]
> 185 };
[...]
> 290 inline PRInt32 nsStyleCoord::GetCoordValue() const
> 291 {
> 292   NS_ASSERTION((mUnit == eStyleUnit_Coord), "not a coord value");
> 293   if (mUnit == eStyleUnit_Coord) {
> 294     return mValue.mInt;
> 295   }
> 296   return 0;
> 297 }

Of course, nscoord and PRInt32 end up evaluating to the same type, but we should make that consistent.
Comment 1 Daniel Holbert [:dholbert] 2012-04-04 16:24:27 PDT
This actually dates back to the original version of this file in CVS, from 1998, it looks like:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/style/nsStyleCoord.h&rev=3.1
Comment 2 Daniel Holbert [:dholbert] 2012-04-06 16:20:00 PDT
Created attachment 613017 [details] [diff] [review]
fix

This changes the definition to use "nscoord" (to match the function declaration).

This also makes it symmetric with SetCoordValue, which takes an nscoord-typed argument.
Comment 3 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2012-04-06 16:30:30 PDT
Comment on attachment 613017 [details] [diff] [review]
fix

r=dbaron
Comment 4 Daniel Holbert [:dholbert] 2012-04-06 17:26:05 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/be20d1f8c8a3
Comment 5 Matt Brubeck (:mbrubeck) 2012-04-09 10:13:08 PDT
https://hg.mozilla.org/mozilla-central/rev/be20d1f8c8a3

Note You need to log in before you can comment on or make changes to this bug.