Skip to content

Commit

Permalink
updated "Promote float varargs to double" bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marco2357 committed Jan 26, 2016
1 parent d1f179a commit 7f54d4c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Bug Fixes
* [#536](https://github.com/java-native-access/jna/pull/536): Fixed bug in determining the Library and options associated with types defined outside of a Library - [@twall](https://github.com/twall).
* [#531](https://github.com/java-native-access/jna/pull/531): Ensure direct-mapped callbacks use the right calling convention - [@twall](https://github.com/twall).
* [#566](https://github.com/java-native-access/jna/pull/566): Fix return type of Native#loadLibrary to match unconstrained generic [@lgoldstein](https://github.com/lgoldstein)
* [#584](https://github.com/java-native-access/jna/pull/584): Promote float varargs to double - [@marco2357](https://github.com/marco2357).

Release 4.2.1
=============
Expand Down
3 changes: 2 additions & 1 deletion native/testlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,8 @@ addInt32VarArgs(const char *fmt, ...) {
case 'c':
sum += (int) va_arg(ap, int);
break;
case 'f':
case 'f': // float (promoted to ‘double’ when passed through ‘...’)
case 'F': // double
sum += va_arg(ap, double);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion test/com/sun/jna/VarArgsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void testDoubleVarArgs() {
double arg1 = 1;
double arg2 = 2;
assertEquals("VarArgs not added correctly", (int)arg1 + (int)arg2,
lib.addInt32VarArgs("ff", Double.valueOf(arg1), Double.valueOf(arg2)));
lib.addInt32VarArgs("FF", Double.valueOf(arg1), Double.valueOf(arg2)));
}
public void testStringVarArgs() {
Object[] args = new Object[] { "Test" };
Expand Down

0 comments on commit 7f54d4c

Please sign in to comment.