diff options
-rw-r--r-- | src/net/java/games/gluegen/CMethodBindingEmitter.java | 6 | ||||
-rw-r--r-- | src/net/java/games/gluegen/cgram/types/CompoundType.java | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/net/java/games/gluegen/CMethodBindingEmitter.java b/src/net/java/games/gluegen/CMethodBindingEmitter.java index b9cc0091e..8abcdcd78 100644 --- a/src/net/java/games/gluegen/CMethodBindingEmitter.java +++ b/src/net/java/games/gluegen/CMethodBindingEmitter.java @@ -609,7 +609,7 @@ public class CMethodBindingEmitter extends FunctionEmitter writer.print(" "); emitGetStringUTFChars(writer, "(jstring) _tmpObj", - "(const char*)"+convName+"_copy[_copyIndex]"); + convName+"_copy[_copyIndex]"); } else if (isNIOBufferClass(subArrayElementJavaType)) { @@ -781,7 +781,7 @@ public class CMethodBindingEmitter extends FunctionEmitter } // free the main array - writer.print(" free("); + writer.print(" free((void*) "); writer.print(convName+"_copy"); writer.println(");"); } // end of cleaning up copied data @@ -1251,7 +1251,7 @@ public class CMethodBindingEmitter extends FunctionEmitter Class elementType = javaType.getJavaClass().getComponentType(); if (javaType.isArray() && javaType.getJavaClass().getComponentType() == java.lang.String.class) { - writer.print(" char **"); + writer.print(" const char **"); } else { writer.print(ptrTypeString); } diff --git a/src/net/java/games/gluegen/cgram/types/CompoundType.java b/src/net/java/games/gluegen/cgram/types/CompoundType.java index d86fa9148..e57400e33 100644 --- a/src/net/java/games/gluegen/cgram/types/CompoundType.java +++ b/src/net/java/games/gluegen/cgram/types/CompoundType.java @@ -76,7 +76,7 @@ public class CompoundType extends Type { } else if (getName() != null) { hashcode = getName().hashCode(); } else { - hashcode = System.identityHashCode(this); + hashcode = 0; } computedHashcode = true; @@ -90,8 +90,9 @@ public class CompoundType extends Type { } CompoundType t = (CompoundType) arg; return (super.equals(arg) && - kind == t.kind && - listsEqual(fields, t.fields)); + (structName == t.structName || (structName != null && structName.equals(t.structName))) && + kind == t.kind && + listsEqual(fields, t.fields)); } /** Returns the struct name of this CompoundType, i.e. the "foo" in |