commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1092104 - in /commons/sandbox/runtime/trunk/src/main: native/os/win32/platform.c test/org/apache/commons/runtime/TestString.java
Date Thu, 14 Apr 2011 10:32:51 GMT
Author: mturk
Date: Thu Apr 14 10:32:50 2011
New Revision: 1092104

URL: http://svn.apache.org/viewvc?rev=1092104&view=rev
Log:
Implement win32 Platform and fix native String test

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/platform.c
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java

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=1092104&r1=1092103&r2=1092104&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 Thu Apr 14 10:32:50
2011
@@ -18,4 +18,51 @@
 #include "acr/port.h"
 
 extern int acr_native_codepage;
+extern LPOSVERSIONINFOEXA acr_osver;
 
+ACR_JNI_EXPORT(void, Platform, init0)(JNI_STDARGS, jint cp)
+{
+    UNREFERENCED_STDARGS;
+
+    acr_native_codepage = cp;
+    if (acr_native_codepage == -1) {
+        acr_native_codepage = ACR_CP_DEFAULT;
+    }
+}
+
+ACR_JNI_EXPORT(void, Platform, init1)(JNI_STDARGS, jintArray p)
+{
+    jint ia[16];
+
+    UNREFERENCED_OBJECT;
+    (*env)->GetIntArrayRegion(env, p, 0, 16, ia);
+
+    ia[0]  = ISIZEOF(int);
+    ia[1]  = ISIZEOF(long);
+    ia[2]  = ISIZEOF(size_t);
+    ia[3]  = ISIZEOF(void *);
+    ia[4]  = ISIZEOF(wchar_t);
+#if CC_SIZEOF_VOIDP == 8
+    ia[5]  = 64;
+#else
+    ia[5]  = 32;
+#endif
+    ia[6]  = PATH_MAX - 2;
+    ia[7]  = PATH_MAX;
+    ia[8]  = (jint)getpagesize();
+    ia[9]  = ia[8];
+
+    (*env)->SetIntArrayRegion(env, p, 0, 16, ia);
+}
+
+ACR_JNI_EXPORT(jboolean, Platform, supported0)(JNI_STDARGS)
+{
+    UNREFERENCED_STDARGS;
+    if (acr_osver->dwMajorVersion < 5)
+        return JNI_FALSE;
+    if (acr_osver->dwMajorVersion == 5 &&
+        acr_osver->dwMinorVersion < 1)
+        return JNI_FALSE;
+    else
+        return JNI_TRUE;
+}

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java?rev=1092104&r1=1092103&r2=1092104&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestString.java
Thu Apr 14 10:32:50 2011
@@ -30,15 +30,17 @@ public class TestString
 
     @Test(groups = { "private" })
     public void getStrlenA()
+        throws Exception
     {
-        String s = new String(gUIF);
+        String s = new String(gUIF, 0, 6, "UTF-8");
         Assert.assertEquals(6, test0(s));
     }
 
     @Test(groups = { "private" })
     public void getStrlenW()
+        throws Exception
     {
-        String s = new String(gUIF);
+        String s = new String(gUIF, 0, 6, "UTF-8");
         Assert.assertEquals(5, test1(s));
     }
 



Mime
View raw message