<Swing Dev> RFR(XXS): 8163408: Fix wrong prototype of getNativeScaleFactor() in systemScale.h

Volker Simonis volker.simonis at gmail.com
Mon Aug 8 18:36:51 UTC 2016


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 swing-dev mailing list