blob: bc6b605fe916d8bc7ef6898a9e348a5debdc452a [file] [log] [blame]
#include "examples/android/java/bazel/jni_dep.h"
#include <stdlib.h>
#include <string.h>
jstring NewStringLatin1(JNIEnv *env, const char *str) {
int len = strlen(str);
jchar *str1;
str1 = reinterpret_cast<jchar *>(malloc(len * sizeof(jchar)));
for (int i = 0; i < len; i++) {
str1[i] = (unsigned char)str[i];
}
jstring result = env->NewString(str1, len);
free(str1);
return result;
}