From d372cdcea3b3a0ba4b49180695c4e6b0e2d074a5 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 19 Aug 2024 00:34:03 +0200 Subject: Increase the samba implemetation With the exception of openDir, largely untested. --- libs/samba/src/main/cpp/jni.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libs/samba/src/main/cpp/jni.cpp') 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 UTF8ToString(JNIEnv* env, const std::string& str) { return {env, env->NewStringUTF(str.c_str())}; } +LocalRef CreateArray(JNIEnv* env, const Ref& element_class, std::vector> objects) { + auto ret = LocalRef(env, env->NewObjectArray(static_cast(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 -- cgit v1.2.3-70-g09d2