commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r824691 - in /commons/sandbox/runtime/trunk/src/main/native: include/acr_string.h os/win32/dir.c os/win32/finfo.c shared/string.c
Date Tue, 13 Oct 2009 11:13:22 GMT
Author: mturk
Date: Tue Oct 13 11:13:21 2009
New Revision: 824691

URL: http://svn.apache.org/viewvc?rev=824691&view=rev
Log:
For win32 always use UTF-8 strings

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/finfo.c
    commons/sandbox/runtime/trunk/src/main/native/shared/string.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h?rev=824691&r1=824690&r2=824691&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h Tue Oct 13 11:13:21
2009
@@ -99,6 +99,12 @@
  */
 ACR_DECLARE(jstring) ACR_NewJavaStringA(JNIEnv *env, const char *s);
 
+/** Convert UTF-8 encoded string to java string
+ * @param env Current JNI environment.
+ * @param s String to convert.
+ */
+ACR_DECLARE(jstring) ACR_NewJavaStringU(JNIEnv *env, const char *s);
+
 /** Convert platform string to MbString object
  * @param env Current JNI environment.
  * @param s String to convert.

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c?rev=824691&r1=824690&r2=824691&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/dir.c Tue Oct 13 11:13:21 2009
@@ -74,7 +74,7 @@
                         continue;
                     }
                     /* Not at end of dir */
-                    rv = ACR_NewJavaStringA(_E, dp->d_name);
+                    rv = ACR_NewJavaStringU(_E, dp->d_name);
                 }
                 else
                     break;

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/finfo.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/finfo.c?rev=824691&r1=824690&r2=824691&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/finfo.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/finfo.c Tue Oct 13 11:13:21 2009
@@ -168,7 +168,7 @@
                                             int type)
 {
     jstring name;
-    if ((name = ACR_NewJavaStringA(_E, fname)))
+    if ((name = ACR_NewJavaStringU(_E, fname)))
         return (*_E)->NewObject(_E, _clazzn.i, J4MID(0001), type);
     else
         return NULL;

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/string.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/string.c?rev=824691&r1=824690&r2=824691&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/string.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/string.c Tue Oct 13 11:13:21 2009
@@ -1134,6 +1134,17 @@
     return rv;
 }
 
+ACR_DECLARE(jstring) ACR_NewJavaStringU(JNIEnv *_E, const char *str)
+{
+    if (!str)
+        return NULL;
+    if ((*_E)->EnsureLocalCapacity(_E, 2) < 0) {
+        /* JNI out of memory error */
+        return NULL;
+    }
+    return new_string_utf_8(_E, str);
+}
+
 /* Match = 0, NoMatch = 1, Abort = -1
  * Based loosely on sections of wildmat.c by Rich Salz
  */



Mime
View raw message