From c7c18722d051bb761c96e89b25c2f9859fe0223a Mon Sep 17 00:00:00 2001 From: Iyxan23 Date: Thu, 8 Feb 2024 20:30:49 +0700 Subject: [PATCH] fix: don't depend on `file.getFilePointer()` while seeking --- src/main/java/com/iyxan23/zipalignjava/ZipAlign.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/iyxan23/zipalignjava/ZipAlign.java b/src/main/java/com/iyxan23/zipalignjava/ZipAlign.java index e73c522..4b406d8 100644 --- a/src/main/java/com/iyxan23/zipalignjava/ZipAlign.java +++ b/src/main/java/com/iyxan23/zipalignjava/ZipAlign.java @@ -254,7 +254,6 @@ public static void alignZip(RandomAccessFile file, OutputStream out, int alignme soAligned = true; } - file.seek(entryStart + 46); // go back to our prev location } // if this file is uncompressed, and it has not been aligned, we align it @@ -284,11 +283,9 @@ public static void alignZip(RandomAccessFile file, OutputStream out, int alignme fileNameLen + extraFieldLen )); } - - file.seek(entryStart + 46); // go back to our prev location } - file.seek(file.getFilePointer() + entry_fileNameLen + entry_extraFieldLen + entry_commentLen); + file.seek(entryStart + 46 + entry_fileNameLen + entry_extraFieldLen + entry_commentLen); } // done analyzing! now we're going to stream the aligned zip