diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-09-25 12:12:52 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-09-25 12:12:52 -0400 |
commit | a01ce1fdb6ad3a12ed23e5bb7226b96dbb6c86c5 (patch) | |
tree | f8184ff2b6c133ae1520fd0308098f7123072730 | |
parent | 99aa8aa5b88fb4867827824844707e74aecc24e1 (diff) | |
download | eclipse.platform.swt-a01ce1fdb6ad3a12ed23e5bb7226b96dbb6c86c5.tar.gz eclipse.platform.swt-a01ce1fdb6ad3a12ed23e5bb7226b96dbb6c86c5.tar.xz eclipse.platform.swt-a01ce1fdb6ad3a12ed23e5bb7226b96dbb6c86c5.zip |
Bug 377107 - no 32bits vm for JDK7 - comment#2
6 files changed, 71 insertions, 38 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c index 39272ca3a4..c6837207e8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c @@ -11107,6 +11107,31 @@ fail: } #endif +#if (!defined(NO_MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2II) && !defined(JNI64)) || (!defined(NO_MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2JI) && defined(JNI64)) +#ifndef JNI64 +JNIEXPORT void JNICALL OS_NATIVE(MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) +#else +JNIEXPORT void JNICALL OS_NATIVE(MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2JI)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) +#endif +{ + SAFEARRAY _arg0, *lparg0=NULL; +#ifndef JNI64 + OS_NATIVE_ENTER(env, that, MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2II_FUNC); +#else + OS_NATIVE_ENTER(env, that, MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2JI_FUNC); +#endif + if (arg0) if ((lparg0 = getSAFEARRAYFields(env, arg0, &_arg0)) == NULL) goto fail; + MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2); +fail: + if (arg0 && lparg0) setSAFEARRAYFields(env, arg0, lparg0); +#ifndef JNI64 + OS_NATIVE_EXIT(env, that, MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2II_FUNC); +#else + OS_NATIVE_EXIT(env, that, MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2JI_FUNC); +#endif +} +#endif + #if (!defined(NO_MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2II) && !defined(JNI64)) || (!defined(NO_MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2JI) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c index 724a3c517d..122bfc6fff 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c @@ -1093,6 +1093,11 @@ char * OS_nativeFunctionNames[] = { "MoveMemory__Lorg_eclipse_swt_internal_win32_RECT_2_3JI", #endif #ifndef JNI64 + "MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2II", +#else + "MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2JI", +#endif +#ifndef JNI64 "MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2II", #else "MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2JI", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h index 47434909fb..5f47247125 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h @@ -1103,6 +1103,11 @@ typedef enum { MoveMemory__Lorg_eclipse_swt_internal_win32_RECT_2_3JI_FUNC, #endif #ifndef JNI64 + MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2II_FUNC, +#else + MoveMemory__Lorg_eclipse_swt_internal_win32_SAFEARRAY_2JI_FUNC, +#endif +#ifndef JNI64 MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2II_FUNC, #else MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2JI_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java index b9512389ae..ea9bc64063 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java @@ -5338,6 +5338,11 @@ public static final native void MoveMemory (long /*int*/ Destination, SAFEARRAY * @param Destination cast=(PVOID) * @param Source cast=(CONST VOID *),flags=no_out */ +public static final native void MoveMemory (SAFEARRAY Destination, long /*int*/ Source, int Length); +/** + * @param Destination cast=(PVOID) + * @param Source cast=(CONST VOID *),flags=no_out + */ public static final native void MoveMemory (long /*int*/ Destination, TRIVERTEX Source, int Length); /** * @param Destination cast=(PVOID) diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java index 7f26516e90..a8c3768d7a 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java @@ -129,18 +129,18 @@ class EventDispatch { this.eventID = eventID; createCOMInterfaces(); } - int /*long*/ getAddress() { + long /*int*/ getAddress() { return iDispatch.getAddress(); } private void createCOMInterfaces() { iDispatch = new COMObject(new int[]{2, 0, 0, 1, 3, 4, 8}){ - public int /*long*/ method0(int /*long*/[] args) {return QueryInterface(args[0], args[1]);} - public int /*long*/ method1(int /*long*/[] args) {return AddRef();} - public int /*long*/ method2(int /*long*/[] args) {return Release();} + public long /*int*/ method0(long /*int*/[] args) {return QueryInterface(args[0], args[1]);} + public long /*int*/ method1(long /*int*/[] args) {return AddRef();} + public long /*int*/ method2(long /*int*/[] args) {return Release();} // method3 GetTypeInfoCount - not implemented // method4 GetTypeInfo - not implemented // method5 GetIDsOfNames - not implemented - public int /*long*/ method6(int /*long*/[] args) {return Invoke((int)/*64*/args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], args[4], args[5], args[6], args[7]);} + public long /*int*/ method6(long /*int*/[] args) {return Invoke((int)/*64*/args[0], args[1], (int)/*64*/args[2], (int)/*64*/args[3], args[4], args[5], args[6], args[7]);} }; } private void disposeCOMInterfaces() { @@ -153,7 +153,7 @@ class EventDispatch { refCount++; return refCount; } - private int Invoke(int dispIdMember, int /*long*/ riid, int lcid, int dwFlags, int /*long*/ pDispParams, int /*long*/ pVarResult, int /*long*/ pExcepInfo, int /*long*/ pArgErr) { + private int Invoke(int dispIdMember, long /*int*/ riid, int lcid, int dwFlags, long /*int*/ pDispParams, long /*int*/ pVarResult, long /*int*/ pExcepInfo, long /*int*/ pArgErr) { switch (eventID) { case onhelp: System.out.println("onhelp"); break; case onclick: System.out.println("onclick"); break; @@ -175,17 +175,17 @@ class EventDispatch { } return COM.S_OK; } - private int QueryInterface(int /*long*/ riid, int /*long*/ ppvObject) { + private int QueryInterface(long /*int*/ riid, long /*int*/ ppvObject) { if (riid == 0 || ppvObject == 0) return COM.E_INVALIDARG; GUID guid = new GUID(); COM.MoveMemory(guid, riid, GUID.sizeof); if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDispatch)) { - COM.MoveMemory(ppvObject, new int /*long*/[] {iDispatch.getAddress()}, OS.PTR_SIZEOF); + COM.MoveMemory(ppvObject, new long /*int*/[] {iDispatch.getAddress()}, OS.PTR_SIZEOF); AddRef(); return COM.S_OK; } - COM.MoveMemory(ppvObject, new int /*long*/[] {0}, OS.PTR_SIZEOF); + COM.MoveMemory(ppvObject, new long /*int*/[] {0}, OS.PTR_SIZEOF); return COM.E_NOINTERFACE; } int Release() { diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java index 2d2f23ed40..1a7cfee4f8 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java @@ -127,7 +127,7 @@ static String readSafeArray(Variant variantByRef) { // Read a safearray that contains data of // type VT_UI1 (unsigned shorts) which contains // a text stream. - int pPostData = variantByRef.getByRef(); + long /*int*/ pPostData = variantByRef.getByRef(); short[] vt_type = new short[1]; OS.MoveMemory(vt_type, pPostData, 2); String result = null; @@ -137,21 +137,15 @@ static String readSafeArray(Variant variantByRef) { vt_type = new short[1]; OS.MoveMemory(vt_type, pVariant[0], 2); if (vt_type[0] == (short)(OLE.VT_ARRAY | OLE.VT_UI1)) { - int[] pSafearray = new int[1]; - OS.MoveMemory(pSafearray, pVariant[0] + 8, 4); - short[] cDims = new short[1]; - OS.MoveMemory(cDims, pSafearray[0], 2); - int[] pvData = new int[1]; - OS.MoveMemory(pvData, pSafearray[0] + 12, 4); - int safearrayboundOffset = 0; - for (int i = 0; i < cDims[0]; i++) { - int[] cElements = new int[1]; - OS.MoveMemory(cElements, pSafearray[0] + 16 + safearrayboundOffset, 4); - safearrayboundOffset += 8; - int cchWideChar = OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, pvData[0], -1, null, 0); + long /*int*/ [] pSafearray = new long /*int*/[1]; + OS.MoveMemory(pSafearray, pVariant[0] + 8, OS.PTR_SIZEOF); + SAFEARRAY safeArray = new SAFEARRAY(); + OS.MoveMemory(safeArray, pSafearray[0], SAFEARRAY.sizeof); + for (int i = 0; i < safeArray.cDims; i++) { + int cchWideChar = OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, safeArray.pvData, -1, null, 0); if (cchWideChar == 0) return null; char[] lpWideCharStr = new char [cchWideChar - 1]; - OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, pvData[0], -1, lpWideCharStr, lpWideCharStr.length); + OS.MultiByteToWideChar (CodePage, OS.MB_PRECOMPOSED, safeArray.pvData, -1, lpWideCharStr, lpWideCharStr.length); result = new String(lpWideCharStr); } } @@ -175,28 +169,27 @@ static Variant writeSafeArray (String string) { string.getChars(0, count, chars, 0); int cchMultiByte = OS.WideCharToMultiByte(CodePage, 0, chars, -1, null, 0, null, null); if (cchMultiByte == 0) return null; - int pvData = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, cchMultiByte); + long /*int*/ pvData = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, cchMultiByte); OS.WideCharToMultiByte(CodePage, 0, chars, -1, pvData, cchMultiByte, null, null); int cElements1 = cchMultiByte; int lLbound1 = 0; // Create a safearray in memory - // 12 bytes for cDims, fFeatures and cbElements + 4 bytes for pvData + number of dimensions * (size of safearraybound) - int sizeofSafeArray = 12 + 4 + 1*8; - int pSafeArray = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, sizeofSafeArray); - // Copy the data into the safe array - int offset = 0; - OS.MoveMemory(pSafeArray + offset, new short[] {cDims}, 2); offset += 2; - OS.MoveMemory(pSafeArray + offset, new short[] {fFeatures}, 2); offset += 2; - OS.MoveMemory(pSafeArray + offset, new int[] {cbElements}, 4); offset += 4; - OS.MoveMemory(pSafeArray + offset, new int[] {0}, 4); offset += 4; - OS.MoveMemory(pSafeArray + offset, new int[] {pvData}, 4); offset += 4; - OS.MoveMemory(pSafeArray + offset, new int[] {cElements1}, 4); offset += 4; - OS.MoveMemory(pSafeArray + offset, new int[] {lLbound1}, 4); offset += 4; + long /*int*/ pSafeArray = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, SAFEARRAY.sizeof); + SAFEARRAY safeArray = new SAFEARRAY(); + safeArray.cDims = cDims; + safeArray.fFeatures = fFeatures; + safeArray.cbElements = cbElements; + safeArray.pvData = pvData; + SAFEARRAYBOUND safeArrayBound = new SAFEARRAYBOUND(); + safeArray.rgsabound = safeArrayBound; + safeArrayBound.cElements = cElements1; + safeArrayBound.lLbound = lLbound1; + OS.MoveMemory (pSafeArray, safeArray, SAFEARRAY.sizeof); // Create a variant in memory to hold the safearray - int pVariant = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof); + long /*int*/ pVariant = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof); short vt = (short)(OLE.VT_ARRAY | OLE.VT_UI1); OS.MoveMemory(pVariant, new short[] {vt}, 2); - OS.MoveMemory(pVariant + 8, new int[]{pSafeArray}, 4); + OS.MoveMemory(pVariant + 8, new long /*int*/[]{pSafeArray}, OS.PTR_SIZEOF); // Create a by ref variant Variant variantByRef = new Variant(pVariant, (short)(OLE.VT_BYREF | OLE.VT_VARIANT)); return variantByRef; |