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

Commit ace3371e authored by Elliott Hughes's avatar Elliott Hughes
Browse files

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

Bug: http://b/129068177
Test: treehugger
Change-Id: I44e89f0767723de7fce46dae58f2156fcd9a6362
parent 41537638
Loading
Loading
Loading
Loading
+2 −5
Original line number Original line 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) {
jobject StrictJarFile_nativeNextEntry(JNIEnv* env, jobject, jlong iterationHandle) {
  ZipEntry data;
  ZipEntry data;
  ZipString entryName;
  std::string entryName;


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


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


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