Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8163408

Fix wrong prototype of getNativeScaleFactor() in systemScale.h

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b132

      Description

      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?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              simonis Volker Simonis
              Reporter:
              simonis Volker Simonis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: