[macports-ports] branch master updated: qt4-mac: Fix pointer comparison with 0.

Rainer Müller raimue at macports.org
Sun May 28 17:32:01 UTC 2017


On 05/28/2017 05:34 PM, Mihai Moldovan wrote:
> On 05/27/2017 11:08 AM, Ryan Schmidt wrote:
>>> diff --git a/aqua/qt4-mac/files/patch-fix_pointer_comparison_to_0.diff b/aqua/qt4-mac/files/patch-fix_pointer_comparison_to_0.diff
>>>
>>> new file mode 100644
>>>
>>> index 0000000..4ed86aa
>>>
>>> --- /dev/null
>>>
>>> +++ b/aqua/qt4-mac/files/patch-fix_pointer_comparison_to_0.diff
>>>
>>> @@ -0,0 +1,22 @@
>>>
>>> +--- src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp.orig
>>>
>>> ++++ src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp
>>>
>>> +@@ -74,7 +74,7 @@
>>>
>>> +     RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(imgTag, document));
>>>
>>> +     if (optionalWidth)
>>>
>>> +         image->setWidth(*optionalWidth);
>>>
>>> +-    if (optionalHeight > 0)
>>>
>>> ++    if (optionalHeight)
>>>
>>> +         image->setHeight(*optionalHeight);
>>>
>>> +     return image.release();
>>>
>>> + }
>>
>> I agree that this change looks equivalent, but:
> 
> Strictly speaking, even > 0 is not equivalent to ((optionalHeight) =>
> (optionalHeight != 0)) for this signed type.

It is actually a const int * optionalHeight. Comparing a pointer is to an int is
bogus and therefore the compiler complains about this expression. The fix in
this hunk seems fine to me.

This hunk seems to originate at WebKit upstream and merely trickled down to Qt:
https://trac.webkit.org/changeset/113848/webkit

Rainer


More information about the macports-dev mailing list