bug in Java JNI file iowkitjni.c affecting 64b linux

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

homberghp
Beiträge: 1
Registriert: Sa Okt 08, 2011 3:37 pm
Wohnort: Venlo, Netherlands

bug in Java JNI file iowkitjni.c affecting 64b linux

Beitragvon homberghp » So Okt 09, 2011 3:14 pm

Hello,

I found that custom IO warrior modules I have been using successfully with both windows, mac and Linux do not function properly under
a 64 bit version of linux (in my case Ubuntu 11.04).

I found the methods to convert between Handles and JLongs to be suspect, in particular
jlong HandleToJLong(IOWKIT_HANDLE handle)
{
return (jlong) ((int) handle);
}

IOWKIT_HANDLE JLongToHandle(jlong handle)
{
return (IOWKIT_HANDLE) ((int) handle);
}
I think the (int) casts are misplaced.

After some searching I found that the following change in code helps:
#define HandleToJLong(h) ((jlong)(h))
#define JLongToHandle(h) ((IOWKIT_HANDLE)(h))
which is consistent with the definitions of the types jlong and IOWKIT_HANDLE.

This has also the side effect that it is a macro expansion, saving the call return overhead in the original.

I was able to test it under 32 bit Linux (my office laptop) and my home pc which runs the said 64 bit ubuntu version.)
It would be nice if someone would update the iowarrior SDK distribution.
Kind regards,

Pieter van den Hombergh.
BTW we are using the iowarrior in our courses since 2007 as you may find onhttp://prj32.fontysvenlo.org.
preparat alveo http://www.alveo-akuna.pl

Zurück zu „IO-Warrior English“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast