Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5a3817e authored by Elliott Hughes's avatar Elliott Hughes Committed by android-build-merger
Browse files

Merge "StrictJarFile can use the new std::string libziparchive Next overload."

am: 9fa4e044

Change-Id: I31ec9f19d22e5608813ee45b1429647d9858c9ea
parents b441d257 9fa4e044
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ jlong StrictJarFile_nativeStartIteration(JNIEnv* env, jobject, jlong nativeHandl

jobject StrictJarFile_nativeNextEntry(JNIEnv* env, jobject, jlong iterationHandle) {
  ZipEntry data;
  ZipString entryName;
  std::string entryName;

  IterationHandle* handle = reinterpret_cast<IterationHandle*>(iterationHandle);
  const int32_t error = Next(*handle->CookieAddress(), &data, &entryName);
@@ -121,10 +121,7 @@ jobject StrictJarFile_nativeNextEntry(JNIEnv* env, jobject, jlong iterationHandl
    return NULL;
  }

  std::unique_ptr<char[]> entryNameCString(new char[entryName.name_length + 1]);
  memcpy(entryNameCString.get(), entryName.name, entryName.name_length);
  entryNameCString[entryName.name_length] = '\0';
  ScopedLocalRef<jstring> entryNameString(env, env->NewStringUTF(entryNameCString.get()));
  ScopedLocalRef<jstring> entryNameString(env, env->NewStringUTF(entryName.c_str()));

  return newZipEntry(env, data, entryNameString.get());
}