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/15 15:09:37 UTC

svn commit: r765174 - in /commons/sandbox/runtime/trunk/src/main/native: include/acr_private.h os/win32/syslog.c test/testcase.c

Author: mturk
Date: Wed Apr 15 13:09:36 2009
New Revision: 765174

URL: http://svn.apache.org/viewvc?rev=765174&view=rev
Log:
Some macro fixings

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c
    commons/sandbox/runtime/trunk/src/main/native/test/testcase.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h?rev=765174&r1=765173&r2=765174&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h Wed Apr 15 13:09:36 2009
@@ -71,22 +71,22 @@
 #define ACR_GB                  (ACR_MB * ACR_KB)
 #define ACR_TB                  (ACR_GB * ACR_KB)
 
-#define CSTR_TO_JSTRING(V)      (*_E)->NewStringUTF(_E, (char *)(V))
-#define WSTR_TO_JSTRING(V)      (*_E)->NewString(_E, (jchar *)(V), (jsize)wcslen((wchar_t *)(V)))
-#define ZSTR_TO_JSTRING(V, L)   (*_E)->NewString(_E, (jchar *)(V), (L))
+#define CSTR_TO_JSTRING(V)      (*_E)->NewStringUTF(_E, (const char *)(V))
+#define WSTR_TO_JSTRING(V)      (*_E)->NewString(_E, (const jchar *)(V), (jsize)wcslen((V)))
+#define ZSTR_TO_JSTRING(V, L)   (*_E)->NewString(_E, (const jchar *)(V), (L))
 
-#define CSTR_INICHAR(V)     \
+#define CSTR_DECLARE(V)     \
     const char *_c##V = V ? (const char *)((*_E)->GetStringUTFChars(_E, V, 0)) : NULL
 
 #define CSTR_RELEASE(V)     \
     if (_c##V) (*_E)->ReleaseStringUTFChars(_E, V, _c##V)
 
-#define WSTR_INICHAR(V)     \
+#define WSTR_DECLARE(V)     \
     jsize _wl##V = V ? (*_E)->GetStringLength(_E, V) : 0;  \
     const jchar *_ws##V = V ? (const jchar *)((*_E)->GetStringChars(_E, V, 0)) : NULL; \
     wchar_t *_w##V = NULL
 
-#define WSTR_GETCHAR(V)                                                 \
+#define WPTR_DECLARE(V)                                                 \
         _w##V = (wchar_t *)malloc((_wl##V + 1) * sizeof(wchar_t));      \
         if (_wl##V) wcsncpy(_w##V, (const wchar_t  *)_ws##V, _wl##V);   \
         _w##V[_wl##V] = 0
@@ -96,11 +96,12 @@
     if (_w##V) free (_w##V)
 
 #define RETURN_JCSTR(V)     \
-    if ((V)) return (*_E)->NewStringUTF((_E), (V));  \
+    if ((V)) return (*_E)->NewStringUTF((_E), (const char *)(V));   \
     else return NULL
 
 #define RETURN_JWSTR(V)     \
-    if ((V)) return (*_E)->NewString((_E), (V), wcslen((V)));  \
+    if ((V)) return (*_E)->NewString((_E), (const jchar *)(V),      \
+                                           (jsize)wcslen((V)));     \
     else return NULL
 
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c?rev=765174&r1=765173&r2=765174&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c Wed Apr 15 13:09:36 2009
@@ -97,7 +97,7 @@
 
 ACR_JNI_EXPORT_DECLARE(void, Syslog, init1)(ACR_JNISTDARGS, jstring domain)
 {
-    CSTR_INICHAR(domain);
+    CSTR_DECLARE(domain);
 
     UNREFERENCED_O;
 
@@ -110,10 +110,10 @@
                                            jint level,
                                            jstring msg)
 {
-    WSTR_INICHAR(msg);
+    WSTR_DECLARE(msg);
 
     UNREFERENCED_O;
-    WSTR_GETCHAR(msg);
+    WPTR_DECLARE(msg);
     do_syslog(level, J2W(msg), 0);
     WSTR_RELEASE(msg);
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/test/testcase.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testcase.c?rev=765174&r1=765173&r2=765174&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testcase.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testcase.c Wed Apr 15 13:09:36 2009
@@ -34,7 +34,7 @@
 
 ACR_JNI_EXPORT_DECLARE(void, TestPrivate, test001)(ACR_JNISTDARGS, jstring msg)
 {
-    CSTR_INICHAR(msg);
+    CSTR_DECLARE(msg);
     ACR_ThrowExceptionA(_E, THROW_NMARK, ACR_EX_EINVAL, J2S(msg));
     CSTR_RELEASE(msg);
 }
@@ -69,8 +69,8 @@
 
 ACR_JNI_EXPORT_DECLARE(jint, TestPrivate, test005)(ACR_JNISTDARGS, jstring s)
 {
-    WSTR_INICHAR(s);
-    WSTR_GETCHAR(s);
+    WSTR_DECLARE(s);
+    WPTR_DECLARE(s);
     WSTR_RELEASE(s);
 
     return W2L(s);
@@ -79,7 +79,7 @@
 ACR_JNI_EXPORT_DECLARE(jint, TestPrivate, test006)(ACR_JNISTDARGS, jstring s)
 {
     jint l;
-    CSTR_INICHAR(s);
+    CSTR_DECLARE(s);
 
     l = (jint)strlen(J2S(s));
     CSTR_RELEASE(s);
@@ -109,7 +109,7 @@
     void *d;
     acr_size_t l;
     jint rc = 0;
-    CSTR_INICHAR(s);
+    CSTR_DECLARE(s);
 
     t = ACR_TableMake(_E, THROW_FMARK, 1);
     ACR_TableSet(_E, THROW_FMARK, t, J2S(s), J2S(s), 0);