int type = (int)ui.event_get_eventdatatype.invoke(eventPtr);
eventDataType = EventDataType.fromValue(type);
- if(eventDataPtr != MemorySegment.NULL) {
+ if(eventDataPtr.address() != 0) {
switch(eventDataType) {
case EventDataType.STRING: {
eventData = eventDataPtr.getString(0);
String[] files = new String[flistCount];
for (int i=0;i<flistCount;i++) {
MemorySegment cstr = (MemorySegment)ui.filelist_get.invoke(eventDataPtr, i);
- if(cstr != MemorySegment.NULL) {
+ if(cstr.address() != 0) {
long len = (long)ui.strlen.invoke(cstr);
cstr = cstr.reinterpret(len+1);
files[i] = cstr.getString(0);
* list getvaluefunc wrapper
*/
public static MemorySegment getValue(MemorySegment list, MemorySegment elm, int row, int col, MemorySegment userdata, MemorySegment freeValue) {
- if(userdata == MemorySegment.NULL) {
+ if(userdata.address() == 0) {
return MemorySegment.NULL;
}
// userdata: contains the context ptr and converter index
}
public static void sourceListGetValue(MemorySegment list, MemorySegment sublistData, MemorySegment rowData, int index, MemorySegment out_item, MemorySegment userdata) {
- if(userdata == MemorySegment.NULL || list == MemorySegment.NULL) {
+ if(userdata.address() == 0 || list.address() == 0) {
return;
}
ToolkitFuncs ui = ToolkitFuncs.getInstance();
try {
MemorySegment cstr = (MemorySegment)ui.getappdir.invoke();
- if(cstr == MemorySegment.NULL) {
+ if(cstr.address() == 0) {
return null;
}
long len = (long)ui.strlen.invoke(cstr);
try(Arena arena = Arena.ofConfined()) {
MemorySegment fileNameCstr = arena.allocateFrom(fileName);
MemorySegment cstr = (MemorySegment)ui.configfile.invoke(fileNameCstr);
- if(cstr == MemorySegment.NULL) {
+ if(cstr.address() == 0) {
return null;
}
long len = (long)ui.strlen.invoke(cstr);
ToolkitFuncs ui = ToolkitFuncs.getInstance();
try {
MemorySegment cstr = (MemorySegment) ui.string_get.invoke(valuePtr);
+ if(cstr.address() == 0) {
+ return "";
+ }
long length = (long)ui.strlen.invoke(cstr);
cstr = cstr.reinterpret(length+1);
if (cstr != null && cstr.address() != 0) {
} catch (Throwable e) {
throw new RuntimeException(e);
}
- return null;
+ return "";
}
public void setString(String string) {
ToolkitFuncs ui = ToolkitFuncs.getInstance();
try {
MemorySegment cstr = (MemorySegment) ui.text_get.invoke(valuePtr);
+ if(cstr.address() == 0) {
+ return "";
+ }
long length = (long)ui.strlen.invoke(cstr);
cstr = cstr.reinterpret(length+1);
if (cstr != null && cstr.address() != 0) {