Skip to content

Commit

Permalink
fix: don't depend on file.getFilePointer() while seeking
Browse files Browse the repository at this point in the history
  • Loading branch information
iyxan23 committed Feb 8, 2024
1 parent fc24ceb commit c7c1872
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/main/java/com/iyxan23/zipalignjava/ZipAlign.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c7c1872

Please sign in to comment.