diff options
author | Piotr Jastrzebski <haaawk@google.com> | 2014-08-07 12:42:26 +0100 |
---|---|---|
committer | Piotr Jastrzebski <haaawk@google.com> | 2014-08-08 08:24:33 +0100 |
commit | 8c585e912ae4fd7b0b6f5a2e2ddabed6c70289cf (patch) | |
tree | 1b708f2000f505989973c515a0297f52b996eb0a | |
parent | 16e0e17c53f24e694314bec7a658f650d206da58 (diff) | |
download | libcore-8c585e912ae4fd7b0b6f5a2e2ddabed6c70289cf.zip libcore-8c585e912ae4fd7b0b6f5a2e2ddabed6c70289cf.tar.gz libcore-8c585e912ae4fd7b0b6f5a2e2ddabed6c70289cf.tar.bz2 |
Remove nameLength field from ZipEntry.
It seems that this field is never used outside the internal constructor so it
can be a local variable instead.
Change-Id: I2aa26fb3fd13c571224a9aee14c7eea93e5c9591
-rw-r--r-- | luni/src/main/java/java/util/zip/ZipEntry.java | 7 | ||||
-rw-r--r-- | luni/src/main/native/java_util_jar_StrictJarFile.cpp | 10 |
2 files changed, 6 insertions, 11 deletions
diff --git a/luni/src/main/java/java/util/zip/ZipEntry.java b/luni/src/main/java/java/util/zip/ZipEntry.java index 217cc3c..d007b0f 100644 --- a/luni/src/main/java/java/util/zip/ZipEntry.java +++ b/luni/src/main/java/java/util/zip/ZipEntry.java @@ -52,7 +52,6 @@ public class ZipEntry implements ZipConstants, Cloneable { byte[] extra; - int nameLength = -1; long localHeaderRelOffset = -1; long dataOffset = -1; @@ -69,7 +68,7 @@ public class ZipEntry implements ZipConstants, Cloneable { ZipEntry(String name, String comment, long crc, long compressedSize, long size, int compressionMethod, int time, int modDate, byte[] extra, - int nameLength, long localHeaderRelOffset, long dataOffset) { + long localHeaderRelOffset, long dataOffset) { this.name = name; this.comment = comment; this.crc = crc; @@ -79,7 +78,6 @@ public class ZipEntry implements ZipConstants, Cloneable { this.time = time; this.modDate = modDate; this.extra = extra; - this.nameLength = nameLength; this.localHeaderRelOffset = localHeaderRelOffset; this.dataOffset = dataOffset; } @@ -340,7 +338,6 @@ public class ZipEntry implements ZipConstants, Cloneable { compressionMethod = ze.compressionMethod; modDate = ze.modDate; extra = ze.extra; - nameLength = ze.nameLength; localHeaderRelOffset = ze.localHeaderRelOffset; dataOffset = ze.dataOffset; } @@ -412,7 +409,7 @@ public class ZipEntry implements ZipConstants, Cloneable { compressedSize = ((long) it.readInt()) & 0xffffffffL; size = ((long) it.readInt()) & 0xffffffffL; - nameLength = it.readShort() & 0xffff; + int nameLength = it.readShort() & 0xffff; int extraLength = it.readShort() & 0xffff; int commentByteCount = it.readShort() & 0xffff; diff --git a/luni/src/main/native/java_util_jar_StrictJarFile.cpp b/luni/src/main/native/java_util_jar_StrictJarFile.cpp index 7611749..5a282e8 100644 --- a/luni/src/main/native/java_util_jar_StrictJarFile.cpp +++ b/luni/src/main/native/java_util_jar_StrictJarFile.cpp @@ -32,11 +32,10 @@ static void throwIoException(JNIEnv* env, const int32_t errorCode) { jniThrowException(env, "java/io/IOException", ErrorCodeString(errorCode)); } -static jobject newZipEntry(JNIEnv* env, const ZipEntry& entry, jstring entryName, - const uint16_t nameLength) { +static jobject newZipEntry(JNIEnv* env, const ZipEntry& entry, jstring entryName) { ScopedLocalRef<jclass> zipEntryClass(env, env->FindClass("java/util/zip/ZipEntry")); const jmethodID zipEntryCtor = env->GetMethodID(zipEntryClass.get(), "<init>", - "(Ljava/lang/String;Ljava/lang/String;JJJIII[BIJJ)V"); + "(Ljava/lang/String;Ljava/lang/String;JJJIII[BJJ)V"); return env->NewObject(zipEntryClass.get(), zipEntryCtor, @@ -49,7 +48,6 @@ static jobject newZipEntry(JNIEnv* env, const ZipEntry& entry, jstring entryName static_cast<jint>(0), // time static_cast<jint>(0), // modData NULL, // byte[] extra - static_cast<jint>(nameLength), static_cast<jlong>(-1), // local header offset static_cast<jlong>(entry.offset)); } @@ -135,7 +133,7 @@ static jobject StrictJarFile_nativeNextEntry(JNIEnv* env, jobject, jlong iterati entryNameCString[entryName.name_length] = '\0'; ScopedLocalRef<jstring> entryNameString(env, env->NewStringUTF(entryNameCString.get())); - return newZipEntry(env, data, entryNameString.get(), entryName.name_length); + return newZipEntry(env, data, entryNameString.get()); } static jobject StrictJarFile_nativeFindEntry(JNIEnv* env, jobject, jlong nativeHandle, @@ -152,7 +150,7 @@ static jobject StrictJarFile_nativeFindEntry(JNIEnv* env, jobject, jlong nativeH return NULL; } - return newZipEntry(env, data, entryName, entryNameChars.size()); + return newZipEntry(env, data, entryName); } static void StrictJarFile_nativeClose(JNIEnv*, jobject, jlong nativeHandle) { |