<AWT Dev> <Swing Dev> RFR(XXS): 8163408: Fix wrong prototype of getNativeScaleFactor() in systemScale.h
Volker Simonis
volker.simonis at gmail.com
Wed Aug 10 16:51:50 UTC 2016
Hi Alexandr,
sorry, but I saw your answer too late. I just noticed Sergeys review
and pushed the fix jdk9/dev already.
On Wed, Aug 10, 2016 at 4:40 PM, Alexandr Scherbatiy
<alexandr.scherbatiy at oracle.com> wrote:
>
> Calling getNativeScaleFactor(NULL) leads that "com.ubuntu.user-interface"
> "scale-factor" and "com.canonical.Unity.Interface" "text-scale-factor"
> properties are just skipped in getDesktopScale(char *output_name) method
> from systemScale.c file. Should there be provided some default output screen
> name?
>
I'm not sure what the default screen name should be?
Anyway, I think the behavior without the fix was simply undefined
until now as we've provided no argument at all. It could even lead to
a crash if the first argument register happened to point to some
unaccessible memory.
If there's a simple default screen name, I agree that we should
provide that instead of NULL.
Regards,
Volker
> I am not sure that the fix can be pushed to the jdk9/dev repository. The
> usual practice is to always push it to the jdk9/client first.
>
> Thanks,
> Alexandr.
>
>
> On 8/9/2016 10:37 AM, Volker Simonis wrote:
>>
>> I've just send the RFR to the same list on which the offending change
>> 8149115 has been reviewed.
>>
>> But I'm fine with any list, as long as the change gets reviewed :)
>>
>> Regards,
>> Volker
>>
>> On Mon, Aug 8, 2016 at 10:39 PM, Alexander Scherbatiy
>> <alexandr.scherbatiy at oracle.com> wrote:
>>>
>>> The fix should be reviewed on the awt-dev alias.
>>>
>>>
>>> On 08/08/16 22:36, Volker Simonis wrote:
>>>>
>>>> Hi,
>>>>
>>>> can I please have a review for the following trivial fix:
>>>>
>>>> http://cr.openjdk.java.net/~simonis/webrevs/2016/8163408/
>>>> https://bugs.openjdk.java.net/browse/JDK-8163408
>>>>
>>>> I'd like to push this directly to jdk9/dev if possible because the
>>>> problem has already spread across all the other repos and I'd like to
>>>> fix it as fast as possible in all repos.
>>>>
>>>> The fix for "8149115: [hidpi] Linux: display-wise scaling factor
>>>> should probably be taken into account" changed the prototype for
>>>> getNativeScaleFactor() in systemScale.h from:
>>>>
>>>> int getNativeScaleFactor();
>>>>
>>>> to
>>>>
>>>> double getNativeScaleFactor();
>>>>
>>>> But forgot to add the "char*" parameter to the signature which is
>>>> required by the implementation in systemScale.c (and the various call
>>>> sites):
>>>>
>>>> double getNativeScaleFactor(char *output_name) {
>>>>
>>>> This leads to the following waring/error:
>>>>
>>>>
>>>>
>>>> /OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c:
>>>> In function ‘Ja
>>>> va_sun_awt_X11GraphicsDevice_getNativeScaleFactor’:
>>>>
>>>>
>>>> /OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c:2185:5:
>>>> error: c
>>>> all to function ‘getNativeScaleFactor’ without a real prototype
>>>> [-Werror=unprototyped-calls]
>>>> double scale = getNativeScaleFactor(name);
>>>> ^
>>>> In file included from
>>>>
>>>>
>>>> /OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Graphics
>>>> Env.c:46:0:
>>>>
>>>>
>>>> /OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/common/awt/systemscale/systemScale.h:29:8:
>>>> note: ‘
>>>> getNativeScaleFactor’ was declared here
>>>> double getNativeScaleFactor();
>>>> ^
>>>> cc1: all warnings being treated as errors
>>>>
>>>> If we fix that we will get:
>>>>
>>>>
>>>>
>>>> /usr/work/d046063/OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c:
>>>> In function ‘S
>>>> plashGetScaledImageName’:
>>>>
>>>>
>>>> /usr/work/d046063/OpenJDK/jdk9-hs-comp-s390x/jdk/src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c:809:5:
>>>> error: t
>>>> oo few arguments to function ‘getNativeScaleFactor’
>>>> *scaleFactor = getNativeScaleFactor();
>>>> ^
>>>>
>>>> I observed these warnings/errors with 4.8.5 and it is a miracle for me
>>>> why newer versions of GCC (apparently 4.9.2 which seems to be Oracles
>>>> officially supported compiler according to
>>>> https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms)
>>>> or gcc 5.4.0 whiohc I've tried on Ubuntu 16.04 don't detect this
>>>> problem?
>>>>
>>>> Thank you and best regards,
>>>> Volker
>>>
>>>
>
More information about the awt-dev
mailing list