SF3436102 convert 32 bit memory pointers to 64 bit where not already converted.

This commit is contained in:
clay_shooter
2012-03-14 02:48:21 +00:00
parent b6df041915
commit 8726f3a7df
13 changed files with 152 additions and 102 deletions

View File

@@ -1,6 +1,45 @@
<HTML> <HTML>
<BODY> <BODY>
<!-- ---------- -->
<h2>JACOB 1.17</h2>
<h3>What's New</h3>
<ul>
<li>
No new features
</li>
</ul>
<h3>Tracked Changes</h3>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" >
<tr>
<td colspan="2"><b>Bugs</b></td>
</tr>
<tr>
<td width="13%" valign="top">3436102</td>
<td width="87%" valign="top">Fix memory pointer that was 32 bit. Causes defects in 64 bit systems above 2GB</td>
</tr>
<tr>
<td width="13%" valign="top">&nbsp;</td>
<td width="87%" valign="top">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><b>Patches</b></td>
</tr>
<tr>
<td width="13%" valign="top">&nbsp;</td>
<td width="87%" valign="top">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><b>Feature Requests</b></td>
</tr>
<tr>
<tr>
<td width="13%" valign="top"></td>
<td width="87%" valign="top"></td>
</tr>
</table>
<!-- --------- --> <!-- --------- -->
<h2>JACOB 1.16</h2> <h2>JACOB 1.16</h2>

View File

@@ -37,8 +37,8 @@ extern "C"
IDispatch *extractDispatch(JNIEnv *env, jobject arg) IDispatch *extractDispatch(JNIEnv *env, jobject arg)
{ {
jclass argClass = env->GetObjectClass(arg); jclass argClass = env->GetObjectClass(arg);
jfieldID ajf = env->GetFieldID( argClass, DISP_FLD, "I"); jfieldID ajf = env->GetFieldID( argClass, DISP_FLD, "J");
jint anum = env->GetIntField(arg, ajf); jlong anum = env->GetLongField(arg, ajf);
IDispatch *v = (IDispatch *)anum; IDispatch *v = (IDispatch *)anum;
return v; return v;
} }
@@ -76,7 +76,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Dispatch_QueryInterface
} }
jclass autoClass = env->FindClass("com/jacob/com/Dispatch"); jclass autoClass = env->FindClass("com/jacob/com/Dispatch");
jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(I)V"); jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(J)V");
// construct a Dispatch object to return // construct a Dispatch object to return
// I am copying the pointer to java // I am copying the pointer to java
// jacob-msg 1817 - SF 1053871 : QueryInterface already called AddRef!! // jacob-msg 1817 - SF 1053871 : QueryInterface already called AddRef!!
@@ -94,7 +94,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_createInstanceNative
(JNIEnv *env, jobject _this, jstring _progid) (JNIEnv *env, jobject _this, jstring _progid)
{ {
jclass clazz = env->GetObjectClass(_this); jclass clazz = env->GetObjectClass(_this);
jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "I"); jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "J");
// if we used env->GetStringChars() would that let us drop the conversion? // if we used env->GetStringChars() would that let us drop the conversion?
const char *progid = env->GetStringUTFChars(_progid, NULL); const char *progid = env->GetStringUTFChars(_progid, NULL);
@@ -150,7 +150,7 @@ doDisp:
} }
// CoCreateInstance called AddRef // CoCreateInstance called AddRef
punk->Release(); punk->Release();
env->SetIntField(_this, jf, (unsigned int)pIDispatch); env->SetLongField(_this, jf, (jlong)pIDispatch);
} }
/** /**
@@ -161,7 +161,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_getActiveInstanceNative
(JNIEnv *env, jobject _this, jstring _progid) (JNIEnv *env, jobject _this, jstring _progid)
{ {
jclass clazz = env->GetObjectClass(_this); jclass clazz = env->GetObjectClass(_this);
jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "I"); jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "J");
// if we used env->GetStringChars() would that let us drop the conversion? // if we used env->GetStringChars() would that let us drop the conversion?
const char *progid = env->GetStringUTFChars(_progid, NULL); const char *progid = env->GetStringUTFChars(_progid, NULL);
@@ -193,7 +193,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_getActiveInstanceNative
} }
// GetActiveObject called AddRef // GetActiveObject called AddRef
punk->Release(); punk->Release();
env->SetIntField(_this, jf, (unsigned int)pIDispatch); env->SetLongField(_this, jf, (jlong)pIDispatch);
} }
/** /**
@@ -204,7 +204,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_coCreateInstanceNative
(JNIEnv *env, jobject _this, jstring _progid) (JNIEnv *env, jobject _this, jstring _progid)
{ {
jclass clazz = env->GetObjectClass(_this); jclass clazz = env->GetObjectClass(_this);
jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "I"); jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "J");
// if we used env->GetStringChars() would that let us drop the conversion? // if we used env->GetStringChars() would that let us drop the conversion?
const char *progid = env->GetStringUTFChars(_progid, NULL); const char *progid = env->GetStringUTFChars(_progid, NULL);
@@ -235,7 +235,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_coCreateInstanceNative
} }
// CoCreateInstance called AddRef // CoCreateInstance called AddRef
punk->Release(); punk->Release();
env->SetIntField(_this, jf, (unsigned int)pIDispatch); env->SetLongField(_this, jf, (jlong)pIDispatch);
} }
/** /**
@@ -245,13 +245,13 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Dispatch_release
(JNIEnv *env, jobject _this) (JNIEnv *env, jobject _this)
{ {
jclass clazz = env->GetObjectClass(_this); jclass clazz = env->GetObjectClass(_this);
jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "I"); jfieldID jf = env->GetFieldID( clazz, DISP_FLD, "J");
jint num = env->GetIntField(_this, jf); jlong num = env->GetLongField(_this, jf);
IDispatch *disp = (IDispatch *)num; IDispatch *disp = (IDispatch *)num;
if (disp) { if (disp) {
disp->Release(); disp->Release();
env->SetIntField(_this, jf, (unsigned int)0); env->SetIntField(_this, jf, 0ll);
} }
} }

View File

@@ -44,8 +44,8 @@ BOOL MapEventIIDs(IID*, CComBSTR **, DISPID **, int *, LPOLESTR , LPTYPEINFO );
EventProxy *extractProxy(JNIEnv *env, jobject arg) EventProxy *extractProxy(JNIEnv *env, jobject arg)
{ {
jclass argClass = env->GetObjectClass(arg); jclass argClass = env->GetObjectClass(arg);
jfieldID ajf = env->GetFieldID( argClass, PROXY_FLD, "I"); jfieldID ajf = env->GetFieldID( argClass, PROXY_FLD, "J");
jint anum = env->GetIntField(arg, ajf); jlong anum = env->GetLongField(arg, ajf);
EventProxy *v = (EventProxy *)anum; EventProxy *v = (EventProxy *)anum;
return v; return v;
} }
@@ -56,9 +56,9 @@ EventProxy *extractProxy(JNIEnv *env, jobject arg)
void putProxy(JNIEnv *env, jobject arg, EventProxy *ep) void putProxy(JNIEnv *env, jobject arg, EventProxy *ep)
{ {
jclass argClass = env->GetObjectClass(arg); jclass argClass = env->GetObjectClass(arg);
jfieldID ajf = env->GetFieldID( argClass, PROXY_FLD, "I"); jfieldID ajf = env->GetFieldID( argClass, PROXY_FLD, "J");
jint anum = env->GetIntField(arg, ajf); jlong anum = env->GetLongField(arg, ajf);
env->SetIntField(arg, ajf, (jint)ep); env->SetLongField(arg, ajf, (jlong)ep);
} }

View File

@@ -35,8 +35,8 @@ extern "C"
IStream *extractStream(JNIEnv *env, jobject arg) IStream *extractStream(JNIEnv *env, jobject arg)
{ {
jclass argClass = env->GetObjectClass(arg); jclass argClass = env->GetObjectClass(arg);
jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "I"); jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "J");
jint anum = env->GetIntField(arg, ajf); jlong anum = env->GetLongField(arg, ajf);
IStream *v = (IStream *)anum; IStream *v = (IStream *)anum;
return v; return v;
} }
@@ -56,8 +56,8 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchProxy_MarshalIntoStream
} }
// store the stream pointer on the object // store the stream pointer on the object
jclass argClass = env->GetObjectClass(_this); jclass argClass = env->GetObjectClass(_this);
jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "I"); jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "J");
env->SetIntField(_this, ajf, (jint)ps); env->SetLongField(_this, ajf, (jlong)ps);
} }
JNIEXPORT jobject JNICALL Java_com_jacob_com_DispatchProxy_MarshalFromStream JNIEXPORT jobject JNICALL Java_com_jacob_com_DispatchProxy_MarshalFromStream
@@ -74,8 +74,8 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_DispatchProxy_MarshalFromStream
// zero out the stream pointer on the object // zero out the stream pointer on the object
// since the stream can only be read once // since the stream can only be read once
jclass argClass = env->GetObjectClass(_this); jclass argClass = env->GetObjectClass(_this);
jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "I"); jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "J");
env->SetIntField(_this, ajf, (unsigned int)0); env->SetLongField(_this, ajf, 0ll);
if (!SUCCEEDED(hr)) if (!SUCCEEDED(hr))
{ {
@@ -83,7 +83,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_DispatchProxy_MarshalFromStream
return NULL; return NULL;
} }
jclass autoClass = env->FindClass("com/jacob/com/Dispatch"); jclass autoClass = env->FindClass("com/jacob/com/Dispatch");
jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(I)V"); jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(J)V");
// construct a Dispatch object to return // construct a Dispatch object to return
// I am copying the pointer to java // I am copying the pointer to java
if (pD) pD->AddRef(); if (pD) pD->AddRef();
@@ -98,8 +98,8 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchProxy_release
if (ps) { if (ps) {
ps->Release(); ps->Release();
jclass argClass = env->GetObjectClass(_this); jclass argClass = env->GetObjectClass(_this);
jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "I"); jfieldID ajf = env->GetFieldID( argClass, "m_pStream", "J");
env->SetIntField(_this, ajf, (unsigned int)0); env->SetLongField(_this, ajf, 0ll);
} }
} }

View File

@@ -40,8 +40,8 @@ IEnumVARIANT* extractEnumVariant(JNIEnv* env, jobject arg)
{ {
jfieldID FID_pIEnumVARIANT = 0; jfieldID FID_pIEnumVARIANT = 0;
jclass clazz = env->GetObjectClass(arg); jclass clazz = env->GetObjectClass(arg);
FID_pIEnumVARIANT = env->GetFieldID(clazz, "m_pIEnumVARIANT", "I"); FID_pIEnumVARIANT = env->GetFieldID(clazz, "m_pIEnumVARIANT", "J");
return (IEnumVARIANT*)env->GetIntField(arg, FID_pIEnumVARIANT); return (IEnumVARIANT*)env->GetLongField(arg, FID_pIEnumVARIANT);
} }
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
@@ -107,8 +107,8 @@ Java_com_jacob_com_EnumVariant_release(JNIEnv* env, jobject _this)
self->Release(); self->Release();
jfieldID FID_pIEnumVARIANT = 0; jfieldID FID_pIEnumVARIANT = 0;
jclass clazz = env->GetObjectClass(_this); jclass clazz = env->GetObjectClass(_this);
FID_pIEnumVARIANT = env->GetFieldID(clazz, "m_pIEnumVARIANT", "I"); FID_pIEnumVARIANT = env->GetFieldID(clazz, "m_pIEnumVARIANT", "J");
env->SetIntField(_this, FID_pIEnumVARIANT, (unsigned int)0); env->SetLongField(_this, FID_pIEnumVARIANT, 0ll);
} }
} }

View File

@@ -60,8 +60,8 @@ static SAFEARRAY *makeArray(int vt, int nDims, long *lb, long *cel)
VARIANT *extractWrapper(JNIEnv *env, jobject arg) VARIANT *extractWrapper(JNIEnv *env, jobject arg)
{ {
jclass argClass = env->GetObjectClass(arg); jclass argClass = env->GetObjectClass(arg);
jfieldID vf = env->GetFieldID( argClass, V_FLD, "I"); jfieldID vf = env->GetFieldID( argClass, V_FLD, "J");
jint vnum = env->GetIntField(arg, vf); jlong vnum = env->GetLongField(arg, vf);
if (vnum != NULL) if (vnum != NULL)
{ {
// if vnum is not NULL, then there is a Variant wrapper present // if vnum is not NULL, then there is a Variant wrapper present
@@ -111,8 +111,8 @@ void setSA(JNIEnv *env, jobject arg, SAFEARRAY *sa, int copy)
// construct a variant to hold the result // construct a variant to hold the result
// the variant then owns the array // the variant then owns the array
jclass argClass = env->GetObjectClass(arg); jclass argClass = env->GetObjectClass(arg);
jfieldID ajf = env->GetFieldID( argClass, V_FLD, "I"); jfieldID ajf = env->GetFieldID( argClass, V_FLD, "J");
jint vnum = env->GetIntField(arg, ajf); jlong vnum = env->GetLongField(arg, ajf);
VARIANT *v = (VARIANT *)vnum; VARIANT *v = (VARIANT *)vnum;
if (v == NULL) if (v == NULL)
{ {
@@ -123,7 +123,7 @@ void setSA(JNIEnv *env, jobject arg, SAFEARRAY *sa, int copy)
SafeArrayGetVartype(sa, &vt); SafeArrayGetVartype(sa, &vt);
V_VT(v) = VT_ARRAY | vt; V_VT(v) = VT_ARRAY | vt;
V_ARRAY(v) = copy ? copySA(sa) : sa; V_ARRAY(v) = copy ? copySA(sa) : sa;
env->SetIntField(arg, ajf, (unsigned int)v); env->SetLongField(arg, ajf, (jlong)v);
} }
/* /*
@@ -187,10 +187,10 @@ JNIEXPORT void JNICALL Java_com_jacob_com_SafeArray_destroy
// case free the variant, but if there is just a raw SA, then // case free the variant, but if there is just a raw SA, then
// the owning variant will free it // the owning variant will free it
jclass saClass = env->GetObjectClass(_this); jclass saClass = env->GetObjectClass(_this);
jfieldID jf = env->GetFieldID(saClass, V_FLD, "I"); jfieldID jf = env->GetFieldID(saClass, V_FLD, "J");
VariantClear(v); VariantClear(v);
delete v; delete v;
env->SetIntField(_this, jf, (unsigned int)0); env->SetIntField(_this, jf, 0ll);
} }
} }

View File

@@ -37,8 +37,8 @@ extern "C"
VARIANT *extractVariant(JNIEnv *env, jobject arg) VARIANT *extractVariant(JNIEnv *env, jobject arg)
{ {
jclass argClass = env->GetObjectClass(arg); jclass argClass = env->GetObjectClass(arg);
jfieldID ajf = env->GetFieldID( argClass, VARIANT_FLD, "I"); jfieldID ajf = env->GetFieldID( argClass, VARIANT_FLD, "J");
jint anum = env->GetIntField(arg, ajf); jlong anum = env->GetLongField(arg, ajf);
VARIANT *v = (VARIANT *)anum; VARIANT *v = (VARIANT *)anum;
return v; return v;
} }
@@ -47,7 +47,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_release
(JNIEnv *env, jobject _this) (JNIEnv *env, jobject _this)
{ {
jclass clazz = env->GetObjectClass(_this); jclass clazz = env->GetObjectClass(_this);
jfieldID jf = env->GetFieldID(clazz, VARIANT_FLD, "I"); jfieldID jf = env->GetFieldID(clazz, VARIANT_FLD, "J");
VARIANT *v = extractVariant(env, _this); VARIANT *v = extractVariant(env, _this);
if (v) { if (v) {
// fix byref leak // fix byref leak
@@ -75,10 +75,10 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_init
(JNIEnv *env, jobject _this) (JNIEnv *env, jobject _this)
{ {
jclass clazz = env->GetObjectClass(_this); jclass clazz = env->GetObjectClass(_this);
jfieldID jf = env->GetFieldID( clazz, VARIANT_FLD, "I"); jfieldID jf = env->GetFieldID( clazz, VARIANT_FLD, "J");
VARIANT *v = new VARIANT(); VARIANT *v = new VARIANT();
VariantInit(v); VariantInit(v);
env->SetIntField(_this, jf, (unsigned int)v); env->SetLongField(_this, jf, (jlong)v);
} }
@@ -102,8 +102,8 @@ void zeroVariant(JNIEnv *env, jobject _this)
delete v; delete v;
jclass clazz = env->GetObjectClass(_this); jclass clazz = env->GetObjectClass(_this);
jfieldID jf = env->GetFieldID(clazz, VARIANT_FLD, "I"); jfieldID jf = env->GetFieldID(clazz, VARIANT_FLD, "J");
env->SetIntField(_this, jf, (unsigned int)0); env->SetLongField(_this, jf, 0ll);
} }
@@ -177,7 +177,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toEnumVariant
} }
jclass autoClass = env->FindClass("com/jacob/com/EnumVariant"); jclass autoClass = env->FindClass("com/jacob/com/EnumVariant");
jmethodID autoCons = jmethodID autoCons =
env->GetMethodID(autoClass, "<init>", "(I)V"); env->GetMethodID(autoClass, "<init>", "(J)V");
// construct an Unknown object to return // construct an Unknown object to return
IUnknown *unk = V_UNKNOWN(v); IUnknown *unk = V_UNKNOWN(v);
IEnumVARIANT *ie; IEnumVARIANT *ie;
@@ -406,7 +406,7 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toVariantDispatch
} }
jclass autoClass = env->FindClass("com/jacob/com/Dispatch"); jclass autoClass = env->FindClass("com/jacob/com/Dispatch");
jmethodID autoCons = jmethodID autoCons =
env->GetMethodID(autoClass, "<init>", "(I)V"); env->GetMethodID(autoClass, "<init>", "(J)V");
// construct a Dispatch object to return // construct a Dispatch object to return
IDispatch *disp = V_DISPATCH(v); IDispatch *disp = V_DISPATCH(v);
// I am copying the pointer to java // I am copying the pointer to java
@@ -1099,7 +1099,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantVariant
* Added 1.12 pre 6 * Added 1.12 pre 6
* *
* */ * */
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantVariant JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantVariant
(JNIEnv *env, jobject _this) (JNIEnv *env, jobject _this)
{ {
@@ -1117,7 +1117,7 @@ JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantVariant
// enclosed. This relies on the java layer to zero out its ref to this // enclosed. This relies on the java layer to zero out its ref to this
// enclosed variant before the gc can come along and free the memory out from // enclosed variant before the gc can come along and free the memory out from
// under this enclosing variant. // under this enclosing variant.
return (unsigned int)refVar; return (jlong)refVar;
} }
return NULL; return NULL;

View File

@@ -541,7 +541,7 @@ JNIEXPORT void JNICALL Java_com_jacob_com_Variant_putVariantVariant
* Method: getVariantVariant * Method: getVariantVariant
* Signature: ()I * Signature: ()I
*/ */
JNIEXPORT jint JNICALL Java_com_jacob_com_Variant_getVariantVariant JNIEXPORT jlong JNICALL Java_com_jacob_com_Variant_getVariantVariant
(JNIEnv *, jobject); (JNIEnv *, jobject);
/* /*

View File

@@ -50,7 +50,7 @@ public class Dispatch extends JacobObject {
* directly to get the dispatch id. You really can't rename it or make it * directly to get the dispatch id. You really can't rename it or make it
* private * private
*/ */
public int m_pDispatch; public long m_pDispatch;
/** program Id passed in by ActiveX components in their constructor */ /** program Id passed in by ActiveX components in their constructor */
private String programId = null; private String programId = null;
@@ -198,7 +198,7 @@ public class Dispatch extends JacobObject {
* *
* @param pDisp * @param pDisp
*/ */
protected Dispatch(int pDisp) { protected Dispatch(long pDisp) {
m_pDispatch = pDisp; m_pDispatch = pDisp;
} }

View File

@@ -32,7 +32,7 @@ public class DispatchProxy extends JacobObject {
/** /**
* Comment for <code>m_pStream</code> * Comment for <code>m_pStream</code>
*/ */
public int m_pStream; public long m_pStream;
/** /**
* Marshals the passed in dispatch into the stream * Marshals the passed in dispatch into the stream
@@ -67,6 +67,7 @@ public class DispatchProxy extends JacobObject {
* *
* @see java.lang.Object#finalize() * @see java.lang.Object#finalize()
*/ */
@Override
public void finalize() { public void finalize() {
safeRelease(); safeRelease();
} }
@@ -76,6 +77,7 @@ public class DispatchProxy extends JacobObject {
* *
* @see com.jacob.com.JacobObject#safeRelease() * @see com.jacob.com.JacobObject#safeRelease()
*/ */
@Override
public void safeRelease() { public void safeRelease() {
super.safeRelease(); super.safeRelease();
if (m_pStream != 0) { if (m_pStream != 0) {

View File

@@ -25,13 +25,14 @@ package com.jacob.com;
*/ */
public class EnumVariant extends JacobObject implements public class EnumVariant extends JacobObject implements
java.util.Enumeration<Variant> { java.util.Enumeration<Variant> {
private int m_pIEnumVARIANT; /** pointer to windows memory */
private long m_pIEnumVARIANT;
private final Variant[] m_recBuf = new Variant[1]; private final Variant[] m_recBuf = new Variant[1];
// this only gets called from JNI // this only gets called from JNI
// //
protected EnumVariant(int pIEnumVARIANT) { protected EnumVariant(long pIEnumVARIANT) {
m_pIEnumVARIANT = pIEnumVARIANT; m_pIEnumVARIANT = pIEnumVARIANT;
} }
@@ -41,8 +42,10 @@ public class EnumVariant extends JacobObject implements
public EnumVariant(Dispatch disp) { public EnumVariant(Dispatch disp) {
int[] hres = new int[1]; int[] hres = new int[1];
// SF 3377279 // SF 3377279
// Added Dispatch.Method to the invoke flags to call _NewEnum. There are some // Added Dispatch.Method to the invoke flags to call _NewEnum. There are
// non-conforming legacy implementations that expose _NewEnum as a method. // some
// non-conforming legacy implementations that expose _NewEnum as a
// method.
Variant evv = Dispatch.invokev(disp, DispatchIdentifier.DISPID_NEWENUM, Variant evv = Dispatch.invokev(disp, DispatchIdentifier.DISPID_NEWENUM,
Dispatch.Get | Dispatch.Method, new Variant[0], hres); Dispatch.Get | Dispatch.Method, new Variant[0], hres);
if (evv.getvt() != Variant.VariantObject) if (evv.getvt() != Variant.VariantObject)
@@ -132,6 +135,7 @@ public class EnumVariant extends JacobObject implements
* *
* @see java.lang.Object#finalize() * @see java.lang.Object#finalize()
*/ */
@Override
protected void finalize() { protected void finalize() {
safeRelease(); safeRelease();
} }
@@ -141,6 +145,7 @@ public class EnumVariant extends JacobObject implements
* *
* @see com.jacob.com.JacobObject#safeRelease() * @see com.jacob.com.JacobObject#safeRelease()
*/ */
@Override
public void safeRelease() { public void safeRelease() {
super.safeRelease(); super.safeRelease();
if (m_pIEnumVARIANT != 0) { if (m_pIEnumVARIANT != 0) {

View File

@@ -25,8 +25,8 @@ package com.jacob.com;
* were a later addition. * were a later addition.
*/ */
public class SafeArray extends JacobObject { public class SafeArray extends JacobObject {
/** The super secret int that is actually the pointer to windows memory */ /** The super secret long that is actually the pointer to windows memory */
int m_pV = 0; long m_pV = 0;
/** /**
* Constructor. Why does this exist? Yeah, someone will post on sourceforge * Constructor. Why does this exist? Yeah, someone will post on sourceforge
@@ -114,6 +114,7 @@ public class SafeArray extends JacobObject {
return new String(ja); return new String(ja);
} }
@Override
public native Object clone(); public native Object clone();
/** /**
@@ -126,6 +127,7 @@ public class SafeArray extends JacobObject {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override
protected void finalize() { protected void finalize() {
safeRelease(); safeRelease();
} }
@@ -211,8 +213,8 @@ public class SafeArray extends JacobObject {
/** /**
* get boolean value from N-dimensional array * get boolean value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native boolean getBoolean(int indices[]); public native boolean getBoolean(int indices[]);
@@ -248,8 +250,8 @@ public class SafeArray extends JacobObject {
/** /**
* get byte value from N-dimensional array * get byte value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native byte getByte(int indices[]); public native byte getByte(int indices[]);
@@ -284,8 +286,8 @@ public class SafeArray extends JacobObject {
/** /**
* get char value from N-dimensional array * get char value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native char getChar(int indices[]); public native char getChar(int indices[]);
@@ -320,8 +322,8 @@ public class SafeArray extends JacobObject {
/** /**
* get double value from N-dimensional array * get double value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native double getDouble(int indices[]); public native double getDouble(int indices[]);
@@ -367,8 +369,8 @@ public class SafeArray extends JacobObject {
/** /**
* get float value from N-dimensional array * get float value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native float getFloat(int indices[]); public native float getFloat(int indices[]);
@@ -405,8 +407,8 @@ public class SafeArray extends JacobObject {
/** /**
* get int value from N-dimensional array * get int value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native int getInt(int indices[]); public native int getInt(int indices[]);
@@ -448,8 +450,8 @@ public class SafeArray extends JacobObject {
/** /**
* get long value from N-dimensional array * get long value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native long getLong(int indices[]); public native long getLong(int indices[]);
@@ -516,8 +518,8 @@ public class SafeArray extends JacobObject {
/** /**
* get short value from N-dimensional array * get short value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native short getShort(int indices[]); public native short getShort(int indices[]);
@@ -554,8 +556,8 @@ public class SafeArray extends JacobObject {
/** /**
* get String value from N-dimensional array * get String value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native String getString(int indices[]); public native String getString(int indices[]);
@@ -603,8 +605,8 @@ public class SafeArray extends JacobObject {
/** /**
* get Variant value from N-dimensional array * get Variant value from N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @return the value at the specified location * @return the value at the specified location
*/ */
public native Variant getVariant(int indices[]); public native Variant getVariant(int indices[]);
@@ -654,6 +656,7 @@ public class SafeArray extends JacobObject {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override
public void safeRelease() { public void safeRelease() {
super.safeRelease(); super.safeRelease();
if (m_pV != 0) { if (m_pV != 0) {
@@ -679,8 +682,8 @@ public class SafeArray extends JacobObject {
/** /**
* set boolean value in N-dimensional array * set boolean value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setBoolean(int indices[], boolean c); public native void setBoolean(int indices[], boolean c);
@@ -716,8 +719,8 @@ public class SafeArray extends JacobObject {
/** /**
* set byte value in N-dimensional array * set byte value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setByte(int indices[], byte c); public native void setByte(int indices[], byte c);
@@ -752,8 +755,8 @@ public class SafeArray extends JacobObject {
/** /**
* set char value in N-dimensional array * set char value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setChar(int indices[], char c); public native void setChar(int indices[], char c);
@@ -788,8 +791,8 @@ public class SafeArray extends JacobObject {
/** /**
* set double value in N-dimensional array * set double value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setDouble(int indices[], double c); public native void setDouble(int indices[], double c);
@@ -825,8 +828,8 @@ public class SafeArray extends JacobObject {
/** /**
* set float value in N-dimensional array * set float value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setFloat(int indices[], float c); public native void setFloat(int indices[], float c);
@@ -864,8 +867,8 @@ public class SafeArray extends JacobObject {
/** /**
* set int value in N-dimensional array * set int value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setInt(int indices[], int c); public native void setInt(int indices[], int c);
@@ -910,8 +913,8 @@ public class SafeArray extends JacobObject {
/** /**
* set long value in N-dimensional array * set long value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setLong(int indices[], long c); public native void setLong(int indices[], long c);
@@ -963,8 +966,8 @@ public class SafeArray extends JacobObject {
/** /**
* set short value in N-dimensional array * set short value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setShort(int indices[], short c); public native void setShort(int indices[], short c);
@@ -1006,8 +1009,8 @@ public class SafeArray extends JacobObject {
/** /**
* set Stringvalue in N-dimensional array * set Stringvalue in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param c * @param c
*/ */
public native void setString(int indices[], String c); public native void setString(int indices[], String c);
@@ -1043,8 +1046,8 @@ public class SafeArray extends JacobObject {
/** /**
* set Variant value in N-dimensional array * set Variant value in N-dimensional array
* *
* @param indices - * @param indices
* length must equal Dimension of SafeArray * - length must equal Dimension of SafeArray
* @param v * @param v
*/ */
public native void setVariant(int indices[], Variant v); public native void setVariant(int indices[], Variant v);
@@ -1121,6 +1124,7 @@ public class SafeArray extends JacobObject {
* *
* @return String contents of variant * @return String contents of variant
*/ */
@Override
public String toString() { public String toString() {
String s = ""; String s = "";
int ndim = getNumDim(); int ndim = getNumDim();

View File

@@ -161,7 +161,7 @@ public class Variant extends JacobObject {
/** /**
* Pointer to MS struct. * Pointer to MS struct.
*/ */
int m_pVariant = 0; long m_pVariant = 0;
/** /**
* public constructor, initializes and sets type to VariantEmpty * public constructor, initializes and sets type to VariantEmpty
@@ -846,7 +846,7 @@ public class Variant extends JacobObject {
JacobObject.debug("About to call getVariantVariant()"); JacobObject.debug("About to call getVariantVariant()");
} }
Variant enclosedVariant = new Variant(); Variant enclosedVariant = new Variant();
int enclosedVariantMemory = getVariantVariant(); long enclosedVariantMemory = getVariantVariant();
enclosedVariant.m_pVariant = enclosedVariantMemory; enclosedVariant.m_pVariant = enclosedVariantMemory;
Object enclosedVariantAsJava = enclosedVariant.toJavaObject(); Object enclosedVariantAsJava = enclosedVariant.toJavaObject();
// zero out the reference to the underlying windows memory so that // zero out the reference to the underlying windows memory so that
@@ -1020,7 +1020,7 @@ public class Variant extends JacobObject {
* *
* @return Variant one of the VT_Variant types * @return Variant one of the VT_Variant types
*/ */
private native int getVariantVariant(); private native long getVariantVariant();
/** /**
* Reports the type of the underlying Variant object * Reports the type of the underlying Variant object