File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,6 @@ namespace jni {
3434 return JClass (cls);
3535 }
3636
37- JObject Env::new_string (const char * str) {
38- auto jstr = env->NewStringUTF (str);
39- handle_exception ();
40- return JObject (jstr);
41- }
42-
4337 bool Env::exception_check () {
4438 return env->ExceptionCheck ();
4539 }
@@ -85,10 +79,16 @@ namespace jni {
8579 return env->IsSameObject (obj_1.obj , obj_2.obj );
8680 }
8781
82+ JObject Env::new_string (const char * str) {
83+ auto jstr = env->NewStringUTF (str);
84+ handle_exception ();
85+ return JObject (jstr);
86+ }
87+
8888 String Env::from_jstring (jni::JString str) {
8989 auto jstr = (jstring) str.obj ;
9090 auto utfString = env->GetStringUTFChars (jstr, nullptr );
91- auto ret = String (utfString);
91+ String ret = String::utf8 (utfString);
9292 handle_exception ();
9393 env->ReleaseStringUTFChars (jstr, utfString);
9494 return ret;
Original file line number Diff line number Diff line change @@ -215,8 +215,7 @@ class BufferToVariant {
215215 } else {
216216 uint32_t size {decode_uint32 (byte_buffer->get_cursor ())};
217217 byte_buffer->increment_position (INT_SIZE);
218- String str;
219- str.parse_utf8 (reinterpret_cast <const char *>(byte_buffer->get_cursor ()), size);
218+ String str = String::utf8 (reinterpret_cast <const char *>(byte_buffer->get_cursor ()), size);
220219 byte_buffer->increment_position (size);
221220 return Variant (str);
222221 }
You can’t perform that action at this time.
0 commit comments