Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2012-09-25 16:12:52 +0000
committerSilenio Quarti2012-09-25 16:12:52 +0000
commita01ce1fdb6ad3a12ed23e5bb7226b96dbb6c86c5 (patch)
treef8184ff2b6c133ae1520fd0308098f7123072730 /examples
parent99aa8aa5b88fb4867827824844707e74aecc24e1 (diff)
downloadeclipse.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
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet123.java18
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet186.java51
2 files changed, 31 insertions, 38 deletions
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;

Back to the top