changeset 17815:f68026915934

8186261: 4 JNI primitive type mismatch defect groups in XlibWrapper.c Reviewed-by: azvegint
author serb
date Thu, 24 Aug 2017 11:30:13 -0700
parents 737070667c78
children 66539c09c053
files src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c
diffstat 1 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Wed Aug 23 12:05:28 2017 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Thu Aug 24 11:30:13 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -535,7 +535,8 @@
 }
 
 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEvents
-(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong bits_to_change, jlong values_for_bits)
+(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong bits_to_change,
+              jlong values_for_bits)
 {
     AWT_CHECK_HAVE_LOCK();
     XkbSelectEvents((Display *) jlong_to_ptr(display), (unsigned int)device,
@@ -543,7 +544,8 @@
                    (unsigned long)values_for_bits);
 }
 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEventDetails
-(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong event_type, jlong bits_to_change, jlong values_for_bits)
+(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong event_type,
+              jlong bits_to_change, jlong values_for_bits)
 {
     AWT_CHECK_HAVE_LOCK();
     XkbSelectEventDetails((Display *) jlong_to_ptr(display), (unsigned int)device,
@@ -555,21 +557,26 @@
 (JNIEnv *env, jclass clazz, jlong display, jlong opcode_rtrn, jlong event_rtrn,
               jlong error_rtrn, jlong major_in_out, jlong minor_in_out)
 {
+    Bool status;
     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
-    return XkbQueryExtension( (Display *) jlong_to_ptr(display),
-                       (int *) jlong_to_ptr(opcode_rtrn),
-                       (int *) jlong_to_ptr(event_rtrn),
-                       (int *) jlong_to_ptr(error_rtrn),
-                       (int *) jlong_to_ptr(major_in_out),
-                       (int *) jlong_to_ptr(minor_in_out));
+    status = XkbQueryExtension((Display *) jlong_to_ptr(display),
+                               (int *) jlong_to_ptr(opcode_rtrn),
+                               (int *) jlong_to_ptr(event_rtrn),
+                               (int *) jlong_to_ptr(error_rtrn),
+                               (int *) jlong_to_ptr(major_in_out),
+                               (int *) jlong_to_ptr(minor_in_out));
+    return status ? JNI_TRUE : JNI_FALSE;
 }
 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
 (JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
 {
+    Bool status;
     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     *((int *)jlong_to_ptr(lib_major_in_out)) =  XkbMajorVersion;
     *((int *)jlong_to_ptr(lib_minor_in_out)) =  XkbMinorVersion;
-    return  XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
+    status = XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out),
+                               (int *)jlong_to_ptr(lib_minor_in_out));
+    return status ? JNI_TRUE : JNI_FALSE;
 }
 
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetMap
@@ -603,8 +610,10 @@
                               (unsigned int *)jlong_to_ptr(mods_rtrn),
                                (KeySym *)jlong_to_ptr(keysym_rtrn));
     //printf("native,  input: keycode:0x%0X; mods:0x%0X\n", keycode, mods);
-    //printf("native, output:  keysym:0x%0X; mods:0x%0X\n", *(unsigned int *)jlong_to_ptr(keysym_rtrn), *(unsigned int *)jlong_to_ptr(mods_rtrn));
-    return b;
+    //printf("native, output:  keysym:0x%0X; mods:0x%0X\n",
+    //       *(unsigned int *)jlong_to_ptr(keysym_rtrn),
+    //       *(unsigned int *)jlong_to_ptr(mods_rtrn));
+    return b ? JNI_TRUE : JNI_FALSE;
 }
 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat
 (JNIEnv *env, jclass clazz, jlong display, jboolean detectable)
@@ -2222,13 +2231,13 @@
 Java_sun_awt_X11_XlibWrapper_XShapeQueryExtension
 (JNIEnv *env, jclass clazz, jlong display, jlong event_base_return, jlong error_base_return)
 {
-    jboolean status;
+    Bool status;
 
     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
 
     status = XShapeQueryExtension((Display *)jlong_to_ptr(display),
             (int *)jlong_to_ptr(event_base_return), (int *)jlong_to_ptr(error_base_return));
-    return status;
+    return status ? JNI_TRUE : JNI_FALSE;
 }
 
 /*