Skip to content

Commit

Permalink
Merge pull request #618 from matthiasblaesing/safearray
Browse files Browse the repository at this point in the history
Implement SAFEARRAY access and bugfix VARIANT
  • Loading branch information
dblock committed Mar 27, 2016
2 parents 1064a27 + 57bf211 commit 7843544
Show file tree
Hide file tree
Showing 14 changed files with 2,122 additions and 270 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Features
* [#608](https://github.com/java-native-access/jna/pull/608): Mavenize the build process - change parent and native pom artifactId/name to differentiate in IDE and build tools. - [@bhamail](https://github.com/bhamail)
* [#613](https://github.com/java-native-access/jna/pull/613): Make `com.sun.jna.platform.win32.Win32Exception` extend `com.sun.jna.LastErrorException` - [@lgoldstein](https://github.com/lgoldstein).
* [#614](https://github.com/java-native-access/jna/pull/614): Added standard `com.sun.jna.platform.win32.Kernel32Util.closeHandle()` method that throws a `com.sun.jna.platform.win32.Win32Exception` if failed to close the handle - [@lgoldstein](https://github.com/lgoldstein).
* [#618](https://github.com/java-native-access/jna/pull/618): Implement SAFEARRAY access and bugfix VARIANT - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#616](https://github.com/java-native-access/jna/pull/616): Allow access to base interfaces (most important IDispatch) via ProxyObject and improve binding by allowing to use dispId for the call - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#621](https://github.com/java-native-access/jna/pull/621): Added TYPEFLAGS-constants for `wTypeFlags` in `com.sun.jna.platform.win32.OaIdl.TYPEATTR` - [@SevenOf9Sleeper](https://github.com/SevenOf9Sleeper).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ protected boolean getBooleanProperty(String propertyName) {
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
this.getIDispatch(), propertyName);

return (((VARIANT_BOOL) result.getValue()).intValue() != 0);
return result.booleanValue();
}

/**
Expand Down Expand Up @@ -179,7 +179,7 @@ protected int getIntProperty(String propertyName) {
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
this.getIDispatch(), propertyName);

return ((LONG) result.getValue()).intValue();
return result.intValue();
}

/**
Expand All @@ -194,7 +194,7 @@ protected short getShortProperty(String propertyName) {
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
this.getIDispatch(), propertyName);

return ((SHORT) result.getValue()).shortValue();
return result.shortValue();
}

/**
Expand All @@ -209,7 +209,7 @@ protected String getStringProperty(String propertyName) {
this.oleMethod(OleAuto.DISPATCH_PROPERTYGET, result,
this.getIDispatch(), propertyName);

return result.getValue().toString();
return result.stringValue();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package com.sun.jna.platform.win32.COM.util;

import com.sun.jna.platform.win32.OaIdl.VARIANT_BOOL;
import com.sun.jna.platform.win32.OleAuto;
import com.sun.jna.platform.win32.Variant;
import java.lang.reflect.InvocationHandler;
Expand Down Expand Up @@ -100,6 +101,8 @@ public static Object toJavaObject(VARIANT value, Class targetClass) {
}
if (vobj instanceof WinDef.BOOL) {
return ((WinDef.BOOL) vobj).booleanValue();
} else if (vobj instanceof VARIANT_BOOL) {
return ((VARIANT_BOOL) vobj).booleanValue();
} else if (vobj instanceof WinDef.LONG) {
return ((WinDef.LONG) vobj).longValue();
} else if (vobj instanceof WinDef.SHORT) {
Expand Down
Loading

0 comments on commit 7843544

Please sign in to comment.