From 307eb9097b779ee2281b18b1b30024e43ddda71e Mon Sep 17 00:00:00 2001 From: Samuel Audet Date: Mon, 6 Jun 2022 20:38:17 +0900 Subject: [PATCH] * Let `Generator` treat `long` return values `@ByVal` or `@ByRef` with `@Cast("...*")` (issue #576) --- CHANGELOG.md | 2 +- src/main/java/org/bytedeco/javacpp/tools/Generator.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70a531eff..f0746f5da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ * Define default `SHARED_PTR_NAMESPACE`, `UNIQUE_PTR_NAMESPACE`, `OPTIONAL_NAMESPACE` to `std` on supported compilers ([issue #577](https://github.com/bytedeco/javacpp/issues/577)) - * Let `Generator` dereference `long` arguments `@ByVal` or `@ByRef` with `@Cast("...*")` ([issue #576](https://github.com/bytedeco/javacpp/issues/576)) + * Let `Generator` treat `long` arguments and return values `@ByVal` or `@ByRef` with `@Cast("...*")` ([issue #576](https://github.com/bytedeco/javacpp/issues/576)) * Add `BytePointer.getUnsigned()` and `putUnsigned()` methods for convenience ([pull #574](https://github.com/bytedeco/javacpp/pull/574)) * Let `Parser` consider `alignas` as an explicit attribute to be ignored by default ([issue bytedeco/javacpp-presets#1168](https://github.com/bytedeco/javacpp-presets/issues/1168)) * Add "org.bytedeco.javacpp.findLibraries" system property to disable search for libraries ([pull #565](https://github.com/bytedeco/javacpp/pull/565)) diff --git a/src/main/java/org/bytedeco/javacpp/tools/Generator.java b/src/main/java/org/bytedeco/javacpp/tools/Generator.java index 7fb7ee8e3..a6e7b5359 100644 --- a/src/main/java/org/bytedeco/javacpp/tools/Generator.java +++ b/src/main/java/org/bytedeco/javacpp/tools/Generator.java @@ -2415,6 +2415,8 @@ String returnBefore(MethodInformation methodInfo) { returnPrefix = typeName[0] + " rval" + typeName[1] + " = " + cast; if ((returnBy instanceof ByPtr) || (returnBy instanceof ByPtrRef)) { returnPrefix += "*"; + } else if ((returnBy instanceof ByVal || returnBy instanceof ByRef) && cast.endsWith("*)")) { + returnPrefix += "&"; } } else if (Enum.class.isAssignableFrom(methodInfo.returnType)) { accessesEnums = true;