8198895: Compilation errors in java.desktop with VS 2017
authorserb
Mon, 19 Mar 2018 14:16:23 -0700
changeset 49303 440ba068d981
parent 49302 c7009f375ddc
child 49304 3d076898ccf0
8198895: Compilation errors in java.desktop with VS 2017 Reviewed-by: prr
src/java.desktop/share/native/libfontmanager/sunFont.c
src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp
src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp
src/java.desktop/windows/native/libawt/windows/awt_List.cpp
src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp
src/java.desktop/windows/native/libawt/windows/awt_Window.cpp
--- a/src/java.desktop/share/native/libfontmanager/sunFont.c	Mon Mar 19 13:46:42 2018 -0700
+++ b/src/java.desktop/share/native/libfontmanager/sunFont.c	Mon Mar 19 14:16:23 2018 -0700
@@ -219,7 +219,7 @@
      * accelerated glyph cache cells as we do in freeInt/LongMemory().
      */
     if (ptr != 0) {
-        free((void*)ptr);
+        free((void*)((intptr_t)ptr));
     }
 }
 
@@ -257,13 +257,13 @@
     if (ptrs) {
         for (i=0; i< len; i++) {
             if (ptrs[i] != 0) {
-                GlyphInfo *ginfo = (GlyphInfo *)ptrs[i];
+                GlyphInfo *ginfo = (GlyphInfo *)((intptr_t)ptrs[i]);
                 if (ginfo->cellInfo != NULL &&
                     ginfo->managed == MANAGED_GLYPH) {
                     // invalidate this glyph's accelerated cache cell
                     AccelGlyphCache_RemoveAllCellInfos(ginfo);
                 }
-                free((void*)ginfo);
+                free(ginfo);
             }
         }
         (*env)->ReleasePrimitiveArrayCritical(env, jmemArray, ptrs, JNI_ABORT);
--- a/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Mon Mar 19 13:46:42 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Mon Mar 19 14:16:23 2018 -0700
@@ -7127,9 +7127,9 @@
 {
     TRY;
 
-    return (jboolean)AwtToolkit::GetInstance().SyncCall(
+    return (jboolean)((intptr_t)AwtToolkit::GetInstance().SyncCall(
         (void *(*)(void *))AwtComponent::_NativeHandlesWheelScrolling,
-        env->NewGlobalRef(self));
+        env->NewGlobalRef(self)));
     // global ref is deleted in _NativeHandlesWheelScrolling
 
     CATCH_BAD_ALLOC_RET(NULL);
@@ -7148,9 +7148,9 @@
 
     jobject selfGlobalRef = env->NewGlobalRef(self);
 
-    return (jboolean)AwtToolkit::GetInstance().SyncCall(
+    return (jboolean)((intptr_t)AwtToolkit::GetInstance().SyncCall(
         (void*(*)(void*))AwtComponent::_IsObscured,
-        (void *)selfGlobalRef);
+        (void *)selfGlobalRef));
     // selfGlobalRef is deleted in _IsObscured
 
     CATCH_BAD_ALLOC_RET(NULL);
--- a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp	Mon Mar 19 13:46:42 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp	Mon Mar 19 14:16:23 2018 -0700
@@ -92,7 +92,7 @@
     JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c);
     JNU_ReleaseStringPlatformChars(env, verb_j, verb_c);
 
-    if ((int)retval <= 32) {
+    if ((int)((intptr_t)retval) <= 32) {
         // ShellExecute failed.
         LPTSTR buffer = NULL;
         int len = ::FormatMessage(
--- a/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Mon Mar 19 13:46:42 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Mon Mar 19 14:16:23 2018 -0700
@@ -1607,7 +1607,7 @@
             DWORD fThread = ::GetWindowThreadProcessId(fHWnd, NULL);
             if (fThread != AwtToolkit::GetInstance().MainThread()) {
                 // check if this thread has been already blocked
-                BlockedThreadStruct *blockedThread = (BlockedThreadStruct *)sm_BlockedThreads.get((void *)fThread);
+                BlockedThreadStruct *blockedThread = (BlockedThreadStruct *)sm_BlockedThreads.get((void *)((intptr_t)fThread));
                 if (blocked) {
                     if (blockedThread == NULL) {
                         blockedThread = new BlockedThreadStruct;
@@ -1616,7 +1616,7 @@
                                                                       0, fThread);
                         blockedThread->mouseHook = ::SetWindowsHookEx(WH_MOUSE, (HOOKPROC)AwtDialog::MouseHookProc_NonTT,
                                                                       0, fThread);
-                        sm_BlockedThreads.put((void *)fThread, blockedThread);
+                        sm_BlockedThreads.put((void *)((intptr_t)fThread), blockedThread);
                     } else {
                         blockedThread->framesCount++;
                     }
@@ -1628,7 +1628,7 @@
                         if ((blockedThread->framesCount) == 1) {
                             ::UnhookWindowsHookEx(blockedThread->modalHook);
                             ::UnhookWindowsHookEx(blockedThread->mouseHook);
-                            sm_BlockedThreads.remove((void *)fThread);
+                            sm_BlockedThreads.remove((void *)((intptr_t)fThread));
                             delete blockedThread;
                         } else {
                             blockedThread->framesCount--;
--- a/src/java.desktop/windows/native/libawt/windows/awt_List.cpp	Mon Mar 19 13:46:42 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_List.cpp	Mon Mar 19 14:16:23 2018 -0700
@@ -823,9 +823,9 @@
 
     jobject selfGlobalRef = env->NewGlobalRef(self);
 
-    return (jint)AwtToolkit::GetInstance().SyncCall(
+    return (jint)((intptr_t)AwtToolkit::GetInstance().SyncCall(
         (void *(*)(void *))AwtList::_GetMaxWidth,
-        (void *)selfGlobalRef);
+        (void *)selfGlobalRef));
     // selfGlobalRef is deleted in _GetMaxWidth
 
     CATCH_BAD_ALLOC_RET(0);
@@ -1011,8 +1011,8 @@
     ses->list = env->NewGlobalRef(self);
     ses->index = index;
 
-    return (jboolean)AwtToolkit::GetInstance().SyncCall(
-        (void *(*)(void *))AwtList::_IsSelected, ses);
+    return (jboolean)((intptr_t)AwtToolkit::GetInstance().SyncCall(
+        (void *(*)(void *))AwtList::_IsSelected, ses));
     // global ref and ses are deleted in _IsSelected
 
     CATCH_BAD_ALLOC_RET(FALSE);
--- a/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp	Mon Mar 19 13:46:42 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp	Mon Mar 19 14:16:23 2018 -0700
@@ -1106,7 +1106,7 @@
           if (comp != NULL)
           {
               comp->SetInputMethod(self, useNativeCompWindow);
-              comp->ImmAssociateContext((HIMC)context);
+              comp->ImmAssociateContext((HIMC)((intptr_t)context));
           }
 
           if (peer != NULL) {
@@ -3139,7 +3139,7 @@
         (m_touchKbrdExeFilePath != NULL)) {
         HINSTANCE retVal = ::ShellExecute(NULL, _T("open"),
             m_touchKbrdExeFilePath, NULL, NULL, SW_SHOW);
-        if ((int)retVal <= 32) {
+        if ((int)((intptr_t)retVal) <= 32) {
             DTRACE_PRINTLN1("AwtToolkit::ShowTouchKeyboard: Failed"
                 ", retVal='%d'", (int)retVal);
         }
--- a/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp	Mon Mar 19 13:46:42 2018 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp	Mon Mar 19 14:16:23 2018 -0700
@@ -3915,8 +3915,8 @@
     rfs->component = selfGlobalRef;
     rfs->isMouseEventCause = isMouseEventCause;
 
-    return (jboolean)AwtToolkit::GetInstance().SyncCall(
-        (void*(*)(void*))AwtWindow::_RequestWindowFocus, rfs);
+    return (jboolean)((intptr_t)AwtToolkit::GetInstance().SyncCall(
+        (void*(*)(void*))AwtWindow::_RequestWindowFocus, rfs));
     // global refs and rfs are deleted in _RequestWindowFocus
 
     CATCH_BAD_ALLOC_RET(JNI_FALSE);