[Webkit-unassigned] [Bug 28355] Replace MAX()/MIN() macros with type-safe std::max()/min() templates

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Aug 16 15:53:07 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=28355





--- Comment #2 from David Kilzer (ddkilzer) <ddkilzer at webkit.org>  2009-08-16 15:53:06 PDT ---
(In reply to comment #1)
> (From update of attachment 34925 [details])
> > +        <http://webkit.org/b/00000> Replace MAX()/MIN() macros with type-safe std::max()/min() templates
> 
> Presumably this will transform into this bug’s URL?

Yes.  I'm currently doing it manually, but one day bugzilla-tool will do the
replacement automatically.  I already updated the ChangeLogs after creating
this bug.

> > +        * platform/graphics/mac/SimpleFontDataMac.mm: Added using
> > +        std::max statment.
> 
> Typo: statment.

Fixed.

> In new files, it is common to just add “using namespace std;”.

Fixed.  I filed:  <http://webkit.org/b/28370>.

> > +        <http://webkit.org/b/00000> Replace MAX()/MIN() macros with type-safe std::max()/min() templates
> 
> URL…

Already fixed.

> > +            deliveryBytes = static_cast<int32>(min(static_cast<NSUInteger>(deliveryBytes), [subdata length]));
> 
> This is an odd combination of casts. You can do “min<int32>(deliveryBytes,
> [subdata length])” instead.

I was keeping the original behavior of the statement.  Fixed.

> > -                    dataLength = MIN((unsigned)[contentLength intValue], dataLength);
> > +                    dataLength = min(static_cast<unsigned>([contentLength intValue]), dataLength);
> 
> I prefer min<unsigned>(…).

Fixed.

> > -            imageSize.width = MAX(MAX_DRAG_LABEL_WIDTH + DRAG_LABEL_BORDER_X * 2.0f, MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP);
> > +            imageSize.width = max(MAX_DRAG_LABEL_WIDTH + DRAG_LABEL_BORDER_X * 2.0f, MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP);
> 
> While you’re here, you may just drop the “.0f”.

Fixed.

> > -            imageSize.width = MAX(labelSize.width + DRAG_LABEL_BORDER_X * 2.0f, urlStringSize.width + DRAG_LABEL_BORDER_X * 2.0f);
> > +            imageSize.width = max(labelSize.width + DRAG_LABEL_BORDER_X * 2.0f, urlStringSize.width + DRAG_LABEL_BORDER_X * 2.0f);
> 
> Ditto.

Fixed.

> > +        maxWidth = min(static_cast<CGFloat>(400), windowFrame.size.width);
> 
> Can be done as min<CGFloat>(…).

Fixed.

> r=me but please consider at least changing to “using namespace std;”.

Thanks for the review!

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list