src/windows/native/common/jni_util_md.c

Print this page




 120         // System.initProperties
 121         char *result = NULL;
 122         size_t len;
 123         const jchar* utf16 = (*env)->GetStringChars(env, jstr, NULL);
 124         len = wcstombs(NULL, utf16, (*env)->GetStringLength(env, jstr) * 4) + 1;
 125         if (len == -1)
 126             return NULL;
 127         result = (char*) malloc(len);
 128         if (result != NULL) {
 129             if (wcstombs(result, utf16, len) == -1)
 130                 return NULL;
 131             (*env)->ReleaseStringChars(env, jstr, utf16);
 132             if (isCopy)
 133                 *isCopy = JNI_TRUE;
 134         }
 135         return result;
 136     }
 137     else
 138         return NULL;
 139 }






 120         // System.initProperties
 121         char *result = NULL;
 122         size_t len;
 123         const jchar* utf16 = (*env)->GetStringChars(env, jstr, NULL);
 124         len = wcstombs(NULL, utf16, (*env)->GetStringLength(env, jstr) * 4) + 1;
 125         if (len == -1)
 126             return NULL;
 127         result = (char*) malloc(len);
 128         if (result != NULL) {
 129             if (wcstombs(result, utf16, len) == -1)
 130                 return NULL;
 131             (*env)->ReleaseStringChars(env, jstr, utf16);
 132             if (isCopy)
 133                 *isCopy = JNI_TRUE;
 134         }
 135         return result;
 136     }
 137     else
 138         return NULL;
 139 }
 140 
 141 void* getProcessHandle() {
 142   return (void*)GetModuleHandle(NULL);
 143 }