Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfixes an mips start #63

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed archive/jffi-Darwin.jar
Binary file not shown.
Binary file removed archive/jffi-aarch64-Linux.jar
Binary file not shown.
Binary file modified archive/jffi-arm-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-i386-FreeBSD.jar
Binary file not shown.
Binary file modified archive/jffi-i386-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-i386-OpenBSD.jar
Binary file not shown.
Binary file removed archive/jffi-i386-SunOS.jar
Binary file not shown.
Binary file removed archive/jffi-i386-Windows.jar
Binary file not shown.
Binary file added archive/jffi-mips-Linux.jar
Binary file not shown.
Binary file added archive/jffi-mipsel-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-ppc-AIX.jar
Binary file not shown.
Binary file removed archive/jffi-ppc-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-ppc64-AIX.jar
Binary file not shown.
Binary file removed archive/jffi-ppc64-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-ppc64le-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-s390x-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-sparc-SunOS.jar
Binary file not shown.
Binary file removed archive/jffi-sparcv9-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-sparcv9-SunOS.jar
Binary file not shown.
Binary file removed archive/jffi-x86_64-FreeBSD.jar
Binary file not shown.
Binary file modified archive/jffi-x86_64-Linux.jar
Binary file not shown.
Binary file removed archive/jffi-x86_64-OpenBSD.jar
Binary file not shown.
Binary file removed archive/jffi-x86_64-SunOS.jar
Binary file not shown.
Binary file removed archive/jffi-x86_64-Windows.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<os arch="powerpc"/>
<os arch="sparc"/>
<os arch="arm"/>
<os arch="mips"/>
<os arch="mipsel"/>
</or>
</condition>
<condition property="run.jvm.model" value="">
Expand Down
2 changes: 1 addition & 1 deletion jni/jffi/Exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ const char* jffi_IllegalArgumentException = "java/lang/IllegalArgumentException"
const char* jffi_NullPointerException = "java/lang/NullPointerException";
const char* jffi_OutOfBoundsException = "java/lang/IndexOutOfBoundsException";
const char* jffi_OutOfMemoryException = "java/lang/OutOfMemoryError";
const char* jffi_RuntimeException = "java/lang/RuntimeError";
const char* jffi_RuntimeException = "java/lang/RuntimeException";
const char* jffi_UnsatisfiedLinkException = "java/lang/UnsatisfiedLinkError";

4 changes: 0 additions & 4 deletions jni/jffi/FastNumericInvoker.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@


/* for return values <= sizeof(long), need to use an ffi_sarg sized return value */
#if BYTE_ORDER == BIG_ENDIAN
# define RETVAL(retval, ctx) ((ctx->cif.rtype)->size > sizeof(ffi_sarg) ? (retval).j : (retval).sarg)
#else
# define RETVAL(retval, ctx) ((retval).j)
#endif

#define MAX_STACK_ARRAY (1024)

Expand Down
17 changes: 13 additions & 4 deletions jni/jffi/LongDouble.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "jffi.h"
#include "Exception.h"
#include "com_kenai_jffi_Foreign.h"
#include <locale.h>

static void
jffi_encodeLongDouble(JNIEnv *env, long double ld, jbyteArray array, jint arrayOffset, jint arrayLength)
Expand Down Expand Up @@ -77,11 +78,15 @@ Java_com_kenai_jffi_Foreign_longDoubleFromString(JNIEnv *env, jobject self, jstr
long double ld;
char* tmp;
jsize len;

len = (*env)->GetStringUTFLength(env, str);
tmp = alloca(len + 1);
(*env)->GetStringUTFRegion(env, str, 0, len, tmp);
locale_t myLocale = newlocale (LC_ALL, "C", (locale_t) 0);
locale_t old_locale = uselocale(myLocale);
ld = strtold(tmp, NULL);
uselocale(old_locale);
freelocale(myLocale);
jffi_encodeLongDouble(env, ld, array, arrayOffset, arrayLength);
}

Expand All @@ -91,7 +96,11 @@ jffi_longDoubleToString(JNIEnv *env,
{
char tmp[256];

locale_t myLocale = newlocale (LC_ALL, "C", (locale_t) 0);
locale_t old_locale = uselocale(myLocale);
sprintf(tmp, fmt, jffi_decodeLongDouble(env, array, arrayOffset, arrayLength));
uselocale(old_locale);
freelocale(myLocale);
return (*env)->NewStringUTF(env, tmp);
}

Expand All @@ -104,7 +113,7 @@ JNIEXPORT jstring JNICALL
Java_com_kenai_jffi_Foreign_longDoubleToEngineeringString(JNIEnv *env, jobject self,
jbyteArray array, jint arrayOffset, jint arrayLength)
{
return jffi_longDoubleToString(env, array, arrayOffset, arrayLength, "%.35Le");
return jffi_longDoubleToString(env, array, arrayOffset, arrayLength, "%.60Le");
}

/*
Expand All @@ -116,7 +125,7 @@ JNIEXPORT jstring JNICALL
Java_com_kenai_jffi_Foreign_longDoubleToPlainString(JNIEnv *env, jobject self,
jbyteArray array, jint arrayOffset, jint arrayLength)
{
return jffi_longDoubleToString(env, array, arrayOffset, arrayLength, "%.35Lf");
return jffi_longDoubleToString(env, array, arrayOffset, arrayLength, "%.60Le");
}

/*
Expand All @@ -128,7 +137,7 @@ JNIEXPORT jstring JNICALL
Java_com_kenai_jffi_Foreign_longDoubleToString(JNIEnv *env, jobject self,
jbyteArray array, jint arrayOffset, jint arrayLength)
{
return jffi_longDoubleToString(env, array, arrayOffset, arrayLength, "%.35Lg");
return jffi_longDoubleToString(env, array, arrayOffset, arrayLength, "%.60Lg");
}

/*
Expand Down
Loading