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 2011/04/09 17:57:33 UTC
svn commit: r1090615 - in /commons/sandbox/runtime/trunk/src/main/native:
include/acr/string.h shared/iofd.c shared/native.c
Author: mturk
Date: Sat Apr 9 15:57:33 2011
New Revision: 1090615
URL: http://svn.apache.org/viewvc?rev=1090615&view=rev
Log:
Modify string access macros to allow explicit null strings
Modified:
commons/sandbox/runtime/trunk/src/main/native/include/acr/string.h
commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c
commons/sandbox/runtime/trunk/src/main/native/shared/native.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=1090615&r1=1090614&r2=1090615&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 Sat Apr 9 15:57:33 2011
@@ -38,27 +38,27 @@
#define J2S(V) _s##V
#define WITH_WSTR(V) \
- if (1) { \
+ do { \
wchar_t _b##V[ACR_MBUFF_SIZ]; \
- wchar_t *_s##V = AcrGetJavaStringW(_E, (V), _b##V); \
- if (_s##V == 0) goto _j##V;
+ wchar_t *_s##V = AcrGetJavaStringW(_E, V, _b##V); \
+ if (_s##V == 0 && V != 0) goto _e##V;
#define WITH_CSTR(V) \
- if (1) { \
+ do { \
char _b##V[ACR_PBUFF_SIZ]; \
- char *_s##V = AcrGetJavaStringA(_E, (V), _b##V); \
- if (_s##V == 0) goto _j##V;
+ char *_s##V = AcrGetJavaStringA(_E, V, _b##V); \
+ if (_s##V == 0 && V != 0) goto _e##V;
#define WITH_USTR(V) \
- if (1) { \
+ do { \
char _b##V[ACR_PBUFF_SIZ]; \
- char *_s##V = AcrGetJavaStringU(_E, (V), _b##V); \
- if (_s##V == 0) goto _j##V;
+ char *_s##V = AcrGetJavaStringU(_E, V, _b##V); \
+ if (_s##V == 0 && V != 0) goto _e##V;
#define DONE_WITH_STR(V) \
- _j##V : \
+ _e##V : \
if (_s##V != 0 && _s##V != _b##V) AcrFree(_s##V); \
- } else (void)(0)
+ } while(0)
#ifdef __cplusplus
Modified: commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c?rev=1090615&r1=1090614&r2=1090615&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c Sat Apr 9 15:57:33 2011
@@ -54,8 +54,8 @@ J_DECLARE_F_ID(0000) = {
#if defined(WINDOWS)
J_DECLARE_F_ID(0001) = {
- -1,
- -1,
+ INVALID_FIELD_OFFSET,
+ INVALID_FIELD_OFFSET,
0,
"handle",
"J"
Modified: commons/sandbox/runtime/trunk/src/main/native/shared/native.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/native.c?rev=1090615&r1=1090614&r2=1090615&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/native.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/native.c Sat Apr 9 15:57:33 2011
@@ -28,6 +28,8 @@ ACR_JNI_EXPORT(jboolean, Native, isdbg0)
ACR_JNI_EXPORT(jboolean, Native, init0)(JNI_STDARGS)
{
+ if (_loaded)
+ return JNI_TRUE;
if (AcrLoadRuntimeClasses(_E) != 0)
return JNI_FALSE;
_loaded = JNI_TRUE;