forked from trustwallet/wallet-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTWJNIString.cpp
More file actions
20 lines (17 loc) · 732 Bytes
/
Copy pathTWJNIString.cpp
File metadata and controls
20 lines (17 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright © 2017-2019 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
#include <assert.h>
#include <string.h>
#include "TWJNIString.h"
jstring _Nonnull TWStringJString(TWString *_Nonnull string, JNIEnv *env) {
return env->NewStringUTF(TWStringUTF8Bytes(string));
}
TWString *_Nonnull TWStringCreateWithJString(JNIEnv *env, jstring _Nonnull string) {
auto chars = env->GetStringUTFChars(string, nullptr);
auto twstring = TWStringCreateWithUTF8Bytes(chars);
env->ReleaseStringUTFChars(string, chars);
return twstring;
}