You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/25 08:09:40 UTC
svn commit: r768477 - in /commons/sandbox/runtime/trunk/src/main:
java/org/apache/commons/runtime/ java/org/apache/commons/runtime/io/
native/os/darwin/ native/os/hpux/ native/os/linux/ native/os/solaris/
native/os/win32/ native/shared/
Author: mturk
Date: Sat Apr 25 06:09:39 2009
New Revision: 768477
URL: http://svn.apache.org/viewvc?rev=768477&view=rev
Log:
Use byref for filling the values
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java
commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c
commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c
commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c
commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c
commons/sandbox/runtime/trunk/src/main/native/shared/error.c
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Native.java Sat Apr 25 06:09:39 2009
@@ -42,7 +42,7 @@
* of the library properly initialize.
* </p>
* @return {@code true} if the library was properly initialized.
- * @throws {@code Throwable} in case of error.
+ * @throws Throwable in case of error.
*/
public static boolean initialize()
throws Throwable
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Platform.java Sat Apr 25 06:09:39 2009
@@ -33,10 +33,12 @@
/*
* Get Platform integer property value.
*/
- private static native int[] intProp();
+ private static native void init0(int[] p);
static {
- int [] i = intProp();
+ int [] i = new int[32];
+ init0(i);
+
SIZEOF_INT = i[0];
SIZEOF_LONG = i[1];
SIZEOF_SIZE_T = i[2];
@@ -75,7 +77,7 @@
/**
- * Platfrom data model (@code 32} or {@code 64} bits.
+ * Platfrom data model {@code 32} or {@code 64} bits.
*/
public static final int DATA_MODEL;
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/Status.java Sat Apr 25 06:09:39 2009
@@ -32,10 +32,12 @@
/*
* Get Platform dependent error codes.
*/
- private static native int[] initerr0();
+ private static native void init0(int[] i);
static {
- int [] i = initerr0();
+ int [] i = new int[32];
+ init0(i);
+
EACCES = i[1];
EEXIST = i[2];
ENAMETOOLONG = i[3];
Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/platform.c Sat Apr 25 06:09:39 2009
@@ -22,10 +22,10 @@
static const char unknown[] = "unknown";
-ACR_JNI_EXPORT_DECLARE(jintArray, Platform, intProp)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(void, Platform, init0)(ACR_JNISTDARGS,
+ jintArray p)
{
- jintArray ra;
- int ia[32];
+ jint ia[32];
UNREFERENCED_O;
@@ -42,9 +42,5 @@
ia[6] = PATH_MAX;
ia[7] = PATH_MAX;
- ra = (*_E)->NewIntArray(_E, 32);
- if (ra) {
- (*_E)->SetIntArrayRegion(_E, ra, 0, 32, ia);
- }
- return ra;
+ (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/platform.c Sat Apr 25 06:09:39 2009
@@ -22,10 +22,10 @@
static const char unknown[] = "unknown";
-ACR_JNI_EXPORT_DECLARE(jintArray, Platform, intProp)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(void, Platform, init0)(ACR_JNISTDARGS,
+ jintArray p)
{
- jintArray ra;
- int ia[32];
+ jint ia[32];
UNREFERENCED_O;
@@ -42,9 +42,5 @@
ia[6] = PATH_MAX;
ia[7] = PATH_MAX;
- ra = (*_E)->NewIntArray(_E, 32);
- if (ra) {
- (*_E)->SetIntArrayRegion(_E, ra, 0, 32, ia);
- }
- return ra;
+ (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/platform.c Sat Apr 25 06:09:39 2009
@@ -22,10 +22,10 @@
static const char unknown[] = "unknown";
-ACR_JNI_EXPORT_DECLARE(jintArray, Platform, intProp)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(void, Platform, init0)(ACR_JNISTDARGS,
+ jintArray p)
{
- jintArray ra;
- int ia[32];
+ jint ia[32];
UNREFERENCED_O;
@@ -42,9 +42,5 @@
ia[6] = PATH_MAX;
ia[7] = PATH_MAX;
- ra = (*_E)->NewIntArray(_E, 32);
- if (ra) {
- (*_E)->SetIntArrayRegion(_E, ra, 0, 32, ia);
- }
- return ra;
+ (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/platform.c Sat Apr 25 06:09:39 2009
@@ -22,10 +22,10 @@
static const char unknown[] = "unknown";
-ACR_JNI_EXPORT_DECLARE(jintArray, Platform, intProp)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(void, Platform, init0)(ACR_JNISTDARGS,
+ jintArray p)
{
- jintArray ra;
- int ia[32];
+ jint ia[32];
UNREFERENCED_O;
@@ -42,9 +42,5 @@
ia[6] = PATH_MAX;
ia[7] = PATH_MAX;
- ra = (*_E)->NewIntArray(_E, 32);
- if (ra) {
- (*_E)->SetIntArrayRegion(_E, ra, 0, 32, ia);
- }
- return ra;
+ (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c Sat Apr 25 06:09:39 2009
@@ -22,10 +22,11 @@
static const char unknown[] = "unknown";
-ACR_JNI_EXPORT_DECLARE(jintArray, Platform, intProp)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(void, Platform, init0)(ACR_JNISTDARGS,
+ jintArray p)
{
- jintArray ra;
- int ia[32];
+ jint ia[32];
+
UNREFERENCED_O;
ia[0] = sizeof(int);
@@ -41,9 +42,5 @@
ia[6] = 248;
ia[7] = 32760;
- ra = (*_E)->NewIntArray(_E, 32);
- if (ra) {
- (*_E)->SetIntArrayRegion(_E, ra, 0, 32, ia);
- }
- return ra;
+ (*_E)->SetIntArrayRegion(_E, p, 0, 16, &ia[0]);
}
Modified: commons/sandbox/runtime/trunk/src/main/native/shared/error.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/error.c?rev=768477&r1=768476&r2=768477&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Sat Apr 25 06:09:39 2009
@@ -469,10 +469,11 @@
}
}
-ACR_JNI_EXPORT_DECLARE(jintArray, io_Status, initerr0)(ACR_JNISTDARGS)
+ACR_JNI_EXPORT_DECLARE(void, io_Status, init0)(ACR_JNISTDARGS,
+ jintArray ra)
{
- jintArray ra;
- int i[32];
+ jint i[32];
+
UNREFERENCED_O;
i[0] = 0;
@@ -503,9 +504,5 @@
i[25] = ACR_ENOTEMPTY;
i[26] = ACR_EAFNOSUPPORT;
- ra = (*_E)->NewIntArray(_E, 32);
- if (ra) {
- (*_E)->SetIntArrayRegion(_E, ra, 0, 32, i);
- }
- return ra;
+ (*_E)->SetIntArrayRegion(_E, ra, 0, 32, &i[0]);
}