diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-08-19 00:34:03 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-08-19 00:34:03 +0200 |
| commit | d372cdcea3b3a0ba4b49180695c4e6b0e2d074a5 (patch) | |
| tree | f3442d2a56afd362d172cef096c878a5e7311066 /libs/samba/src/main/cpp/jni.cpp | |
| parent | b0d90f32974f6473552d8b1bf5387f9fc4995970 (diff) | |
Increase the samba implemetation
With the exception of openDir, largely untested.
Diffstat (limited to 'libs/samba/src/main/cpp/jni.cpp')
| -rw-r--r-- | libs/samba/src/main/cpp/jni.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/samba/src/main/cpp/jni.cpp b/libs/samba/src/main/cpp/jni.cpp index be13df7..30f03a9 100644 --- a/libs/samba/src/main/cpp/jni.cpp +++ b/libs/samba/src/main/cpp/jni.cpp @@ -97,4 +97,14 @@ LocalRef<jstring> UTF8ToString(JNIEnv* env, const std::string& str) { return {env, env->NewStringUTF(str.c_str())}; } +LocalRef<jobjectArray> CreateArray(JNIEnv* env, const Ref<jclass>& element_class, std::vector<LocalRef<jobject>> objects) { + auto ret = LocalRef<jobjectArray>(env, env->NewObjectArray(static_cast<jsize>(objects.size()), element_class.get(), nullptr)); + ABORT_IF_NULL(env, ret); + jsize i = 0; + for (auto&& obj : objects) { + env->SetObjectArrayElement(ret.get(), i++, obj.release()); + } + return ret; +} + } // namespace jni |
