aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-05-31 18:39:58 +0200
committerMichael Bien <[email protected]>2010-05-31 18:39:58 +0200
commitc9c1ab75ea5c5ef7feae32f20bed840c2e8feaf4 (patch)
tree78a60432fefb179f5df11bf3c41db7de6246404e
parent6ea8793685fd07747d0cc13495adb02a0ec494d8 (diff)
fixed handling of size_t which was broken since the introduction of Int64Buffer.
-rw-r--r--src/java/com/sun/gluegen/JavaEmitter.java4
-rw-r--r--test/junit/com/sun/gluegen/test.c3
-rw-r--r--test/junit/com/sun/gluegen/test.h3
3 files changed, 10 insertions, 0 deletions
diff --git a/src/java/com/sun/gluegen/JavaEmitter.java b/src/java/com/sun/gluegen/JavaEmitter.java
index f25c738..2a51a64 100644
--- a/src/java/com/sun/gluegen/JavaEmitter.java
+++ b/src/java/com/sun/gluegen/JavaEmitter.java
@@ -1279,6 +1279,10 @@ public class JavaEmitter implements GlueEmitter {
if (targetType.isVoid()) {
return JavaType.createForVoidPointer();
} else if (targetType.isInt()) {
+ // size_t is always a PointerBuffer since size is arch dependent
+ if ("size_t".equals(targetType.getName())) {
+ return JavaType.forNIOPointerBufferClass();
+ }
switch ((int) targetType.getSize(curMachDesc)) {
case 1: return JavaType.createForCCharPointer();
case 2: return JavaType.createForCShortPointer();
diff --git a/test/junit/com/sun/gluegen/test.c b/test/junit/com/sun/gluegen/test.c
index 06d5508..c511a53 100644
--- a/test/junit/com/sun/gluegen/test.c
+++ b/test/junit/com/sun/gluegen/test.c
@@ -8,6 +8,9 @@ int bufferTest(void * object) {
return 42;
}
+void pbTest(size_t * object) {
+}
+
int manyBuffersTest(void * object1, void * object2, void * object3, void * object4, void * object5) {
return 42;
}
diff --git a/test/junit/com/sun/gluegen/test.h b/test/junit/com/sun/gluegen/test.h
index 10399a6..cef2b7e 100644
--- a/test/junit/com/sun/gluegen/test.h
+++ b/test/junit/com/sun/gluegen/test.h
@@ -2,11 +2,14 @@
#define AL_FLANGER_DEFAULT_FEEDBACK (-0.5f)
typedef unsigned long foo;
+typedef unsigned long size_t;
int arrayTest(long context, foo * array );
int bufferTest(void * object);
+void pbTest(size_t * object);
+
int manyBuffersTest(void * object1, void * object2, void * object3, void * object4, void * object5);
int mixedTest(long context, void * object, foo * array );