unicode-ize

This commit is contained in:
Doug MacEachern 2007-04-05 15:06:13 +00:00
parent 676be63f35
commit 3c82da72c2
1 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,8 @@
*/ */
#ifdef WIN32 #ifdef WIN32
#define UNICODE
#define _UNICODE
#include "win32bindings.h" #include "win32bindings.h"
#include "javasigar.h" #include "javasigar.h"
@ -34,14 +36,15 @@ JNIEXPORT jint SIGAR_JNI(win32_LocaleInfo_getSystemDefaultLCID)
JNIEXPORT jstring SIGAR_JNI(win32_LocaleInfo_getAttribute) JNIEXPORT jstring SIGAR_JNI(win32_LocaleInfo_getAttribute)
(JNIEnv *env, jclass objcls, jint lcid, jint attr) (JNIEnv *env, jclass objcls, jint lcid, jint attr)
{ {
char value[8192]; TCHAR value[8192];
int retval = int retval =
GetLocaleInfo(lcid, GetLocaleInfo(lcid,
attr, attr,
value, sizeof(value)); value, sizeof(value));
if (retval) { if (retval) {
return env->NewStringUTF(value); int len = lstrlen(value);
return env->NewString((const jchar *)value, len);
} }
else { else {
return NULL; return NULL;