From 7edda76d3c1671327a154559db05e51d31240a7a Mon Sep 17 00:00:00 2001 From: Joe Freeman Date: Sun, 10 Jun 2018 14:01:56 -0400 Subject: [PATCH] Bug 132 32 bit pointers not coerced to 64 bit correctly --- jacob/jni/Dispatch.cpp | 3 ++- jacob/jni/DispatchProxy.cpp | 3 ++- jacob/jni/Variant.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jacob/jni/Dispatch.cpp b/jacob/jni/Dispatch.cpp index 1181895..c823559 100644 --- a/jacob/jni/Dispatch.cpp +++ b/jacob/jni/Dispatch.cpp @@ -81,7 +81,8 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_QueryInterface // I am copying the pointer to java // jacob-msg 1817 - SF 1053871 : QueryInterface already called AddRef!! //if (disp) disp->AddRef(); - jobject newAuto = env->NewObject(autoClass, autoCons, disp); + // jacobproject/bug/132 + jobject newAuto = env->NewObject(autoClass, autoCons, (jlong)(uintptr_t)disp); return newAuto; } diff --git a/jacob/jni/DispatchProxy.cpp b/jacob/jni/DispatchProxy.cpp index c6b5e77..5418469 100644 --- a/jacob/jni/DispatchProxy.cpp +++ b/jacob/jni/DispatchProxy.cpp @@ -87,7 +87,8 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_DispatchProxy_MarshalFromStream // construct a Dispatch object to return // I am copying the pointer to java if (pD) pD->AddRef(); - jobject newAuto = env->NewObject(autoClass, autoCons, pD); + // jacobproject/bug/132 + jobject newAuto = env->NewObject(autoClass, autoCons, (jlong)(uintptr_t)pD); return newAuto; } diff --git a/jacob/jni/Variant.cpp b/jacob/jni/Variant.cpp index ab118ad..390dbb0 100644 --- a/jacob/jni/Variant.cpp +++ b/jacob/jni/Variant.cpp @@ -190,7 +190,8 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toEnumVariant // SF-1674179 fix EnumVariants memory leak // AJ: yes, but the QueryInterface call above already incremented the reference //if (ie) ie->AddRef(); - jobject newAuto = env->NewObject(autoClass, autoCons, ie); + // jacobproject/bug/132 + jobject newAuto = env->NewObject(autoClass, autoCons, (jlong)(uintptr_t)ie); return newAuto; } return NULL; @@ -411,7 +412,8 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantDispatch IDispatch *disp = V_DISPATCH(v); // I am copying the pointer to java if (disp) disp->AddRef(); - jobject newAuto = env->NewObject(autoClass, autoCons, disp); + // jacobproject/bug/132 + jobject newAuto = env->NewObject(autoClass, autoCons, (jlong)(uintptr_t)disp); return newAuto; } return NULL;