mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
C backend: fix passing NULL arrays to native methods
This commit is contained in:
parent
f828d049c4
commit
8cd96d2da2
|
@ -507,7 +507,7 @@ public class CodeGenerationVisitor implements ExprVisitor, StatementVisitor {
|
|||
writer.print(")");
|
||||
stringTemporaries.add(tmp);
|
||||
} else if (isPrimitiveArray(type)) {
|
||||
writer.print("ARRAY_DATA(");
|
||||
writer.print("ARRAY_DATAN(");
|
||||
expr.getArguments().get(i).acceptVisitor(this);
|
||||
writer.print(", ").printStrictType(((ValueType.Array) type).getItemType()).print(")");
|
||||
} else if (isPrimitiveBuffer(type)) {
|
||||
|
|
|
@ -66,6 +66,7 @@ static inline int32_t compare_double(double a, double b) {
|
|||
#define ALIGN(addr, alignment) ((void*) (((uintptr_t) (addr) + ((alignment) - 1)) / (alignment) * (alignment)))
|
||||
#define ARRAY_LENGTH(array) (((JavaArray*) (array))->size)
|
||||
#define ARRAY_DATA(array, type) ((type*) ALIGN((((JavaArray*) (array)) + 1), sizeof(type)))
|
||||
#define ARRAY_DATAN(array, type) (array != NULL ? ARRAY_DATA(array, type) : NULL)
|
||||
#define ARRAY_AT(array, type, index) (((type*) ARRAY_DATA(array, type))[index])
|
||||
|
||||
static void* throwClassCastException();
|
||||
|
|
Loading…
Reference in New Issue
Block a user