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 14:53:30 UTC
svn commit: r765172 - 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 12:53:29 2009
New Revision: 765172
URL: http://svn.apache.org/viewvc?rev=765172&view=rev
Log:
Rename some macros so they make more sense
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=765172&r1=765171&r2=765172&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 12:53:29 2009
@@ -75,18 +75,18 @@
#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_GETCHAR(V) \
+#define CSTR_INICHAR(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_GETCHAR(V) \
+#define WSTR_INICHAR(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_DOALLOC(V) \
+#define WSTR_GETCHAR(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
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=765172&r1=765171&r2=765172&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 12:53:29 2009
@@ -97,7 +97,7 @@
ACR_JNI_EXPORT_DECLARE(void, Syslog, init1)(ACR_JNISTDARGS, jstring domain)
{
- CSTR_GETCHAR(domain);
+ CSTR_INICHAR(domain);
UNREFERENCED_O;
@@ -110,10 +110,10 @@
jint level,
jstring msg)
{
- WSTR_GETCHAR(msg);
+ WSTR_INICHAR(msg);
UNREFERENCED_O;
- WSTR_DOALLOC(msg);
+ WSTR_GETCHAR(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=765172&r1=765171&r2=765172&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 12:53:29 2009
@@ -34,7 +34,7 @@
ACR_JNI_EXPORT_DECLARE(void, TestPrivate, test001)(ACR_JNISTDARGS, jstring msg)
{
- CSTR_GETCHAR(msg);
+ CSTR_INICHAR(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_DOALLOC(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_GETCHAR(s);
+ CSTR_INICHAR(s);
l = (jint)strlen(J2S(s));
CSTR_RELEASE(s);
@@ -109,7 +109,7 @@
void *d;
acr_size_t l;
jint rc = 0;
- CSTR_GETCHAR(s);
+ CSTR_INICHAR(s);
t = ACR_TableMake(_E, THROW_FMARK, 1);
ACR_TableSet(_E, THROW_FMARK, t, J2S(s), J2S(s), 0);