equal
deleted
inserted
replaced
114 |
114 |
115 char* getStringPlatformChars(JNIEnv* env, jstring jstr) { |
115 char* getStringPlatformChars(JNIEnv* env, jstring jstr) { |
116 char *result = NULL; |
116 char *result = NULL; |
117 size_t len; |
117 size_t len; |
118 const jchar* utf16 = env->GetStringChars(jstr, NULL); |
118 const jchar* utf16 = env->GetStringChars(jstr, NULL); |
119 len = wcstombs(NULL, utf16, env->GetStringLength(jstr) * 4) + 1; |
119 len = wcstombs(NULL, (const wchar_t*)utf16, env->GetStringLength(jstr) * 4) + 1; |
120 if (len == -1) |
120 if (len == -1) |
121 return NULL; |
121 return NULL; |
122 result = (char*) malloc(len); |
122 result = (char*) malloc(len); |
123 if (wcstombs(result, utf16, len) == -1) |
123 if (wcstombs(result, (const wchar_t*)utf16, len) == -1) |
124 return NULL; |
124 return NULL; |
125 env->ReleaseStringChars(jstr, utf16); |
125 env->ReleaseStringChars(jstr, utf16); |
126 return result; |
126 return result; |
127 } |
127 } |
128 |
128 |
638 |
638 |
639 free(szCommand); |
639 free(szCommand); |
640 } |
640 } |
641 |
641 |
642 |
642 |
643 void getParent(const TCHAR *path, TCHAR *dest) { |
643 void getParent(TCHAR *path, TCHAR *dest) { |
644 char* lastSlash = max(strrchr(path, '\\'), strrchr(path, '/')); |
644 char* lastSlash = max(strrchr(path, '\\'), strrchr(path, '/')); |
645 if (lastSlash == NULL) { |
645 if (lastSlash == NULL) { |
646 *dest = NULL; |
646 *dest = NULL; |
647 return; |
647 return; |
648 } |
648 } |