Author: mturk Date: Wed Oct 21 13:27:50 2009 New Revision: 828008 URL: http://svn.apache.org/viewvc?rev=828008&view=rev Log: Make nativepath private
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h commons/sandbox/runtime/trunk/src/main/native/os/win32/path.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=828008&r1=828007&r2=828008&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 Oct 21 13:27:50 2009 @@ -118,18 +118,6 @@ (*_E)->ReleaseByteArrayElements(_E, V, (jbyte *)_c##V, JNI_ABORT); \ } } else ACR_ThrowException(_E, THROW_FMARK, ACR_EX_ENULL, 0) -#define WITH_WPATH(V) \ - if ((V)) { \ - wchar_t _b##V[ACR_MBUFF_SIZ]; \ - wchar_t *_w##V = ACR_GetJavaNativePathW(_E, (V), _b##V); \ - if (!_w##V) goto _cw##V; - -#define WITH_ZWPATH(V) \ - if (_E) { \ - wchar_t _b##V[ACR_MBUFF_SIZ]; \ - wchar_t *_w##V = ACR_GetJavaNativePathW(_E, (V), _b##V); \ - if (!_w##V && (V)) goto _cw##V; - #define WITH_WSTR(V) \ if ((V)) { \ wchar_t _b##V[ACR_MBUFF_SIZ]; \ Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h?rev=828008&r1=828007&r2=828008&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h (original) +++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h Wed Oct 21 13:27:50 2009 @@ -119,6 +119,30 @@ } else (void)0 /** + * Local functions from path.c + */ +wchar_t * acr_GetJavaNativePathW(JNIEnv *, jstring, wchar_t *); +jstring acr_NewJavaNativePathW(JNIEnv *, const wchar_t *); + +#define WITH_WPATH(V) \ + if ((V)) { \ + wchar_t _b##V[ACR_MBUFF_SIZ]; \ + wchar_t *_w##V = acr_GetJavaNativePathW(_E, (V), _b##V); \ + if (!_w##V) goto _cw##V; + +#define WITH_ZWPATH(V) \ + if (_E) { \ + wchar_t _b##V[ACR_MBUFF_SIZ]; \ + wchar_t *_w##V = acr_GetJavaNativePathW(_E, (V), _b##V); \ + if (!_w##V && (V)) goto _cw##V; + +#define END_WITH_WPATH(V) \ + _cw##V : \ + if (_w##V && _w##V != _b##V) x_free (_w##V); \ + } else ACR_ThrowException(_E, THROW_FMARK, ACR_EX_ENULL, 0) + + +/** * Local functions from wusec.c */ PSID ACR_GetSidFromAccountName(LPCWSTR name, PSID_NAME_USE sidtype); Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c?rev=828008&r1=828007&r2=828008&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/path.c Wed Oct 21 13:27:50 2009 @@ -25,6 +25,7 @@ #include "acr_descriptor.h" #include "acr_file.h" +#include <direct.h> /* For _getdrive() */ /** * Win32 file path functions * @@ -61,14 +62,14 @@ } } -ACR_DECLARE(wchar_t *) ACR_GetJavaNativePathW(JNIEnv *_E, jstring str, wchar_t *b) +wchar_t * acr_GetJavaNativePathW(JNIEnv *_E, jstring str, wchar_t *b) { size_t srclen; size_t retlen; - const jchar *sr; + const jchar *sr; + const wchar_t *srcstr; wchar_t *rv = NULL; wchar_t *retstr; - wchar_t *srcstr; if (!str) { return NULL; @@ -152,7 +153,7 @@ return rv; } -ACR_DECLARE(jstring) ACR_NewJavaNativePathW(JNIEnv *_E, const wchar_t *s) +jstring acr_NewJavaNativePathW(JNIEnv *_E, const wchar_t *s) { jstring r = NULL; if (s) { @@ -161,10 +162,11 @@ wchar_t buff[ACR_MBUFF_SIZ]; size_t retlen = wcslen(s); - if (l > ACR_MBUFF_LEN) { + if (retlen > ACR_MBUFF_LEN) { srcstr = ACR_StrdupW(_E, THROW_FMARK, s); if (!srcstr) return NULL; + } else { wcscpy(buff, s); srcstr = buff;