AndroidCommon: Resolve -Wsign-compare warning

This commit is contained in:
Lioncash 2023-12-11 18:06:40 -05:00
parent f97316a1e6
commit 4bef3b93b4
1 changed files with 3 additions and 2 deletions

View File

@ -19,8 +19,9 @@ jobjectArray VectorToJStringArray(JNIEnv* env, const std::vector<std::string>& v
template <typename T, typename F>
jobjectArray VectorToJObjectArray(JNIEnv* env, const std::vector<T>& vector, jclass clazz, F f)
{
jobjectArray result = env->NewObjectArray(vector.size(), clazz, nullptr);
for (jsize i = 0; i < vector.size(); ++i)
const auto vector_size = static_cast<jsize>(vector.size());
jobjectArray result = env->NewObjectArray(vector_size, clazz, nullptr);
for (jsize i = 0; i < vector_size; ++i)
{
jobject obj = f(env, vector[i]);
env->SetObjectArrayElement(result, i, obj);