Skip to content

Commit

Permalink
Trim redundancy code (#196)
Browse files Browse the repository at this point in the history
The ZIP64 checking has already done in `getOffsetCentralDirectory()` and `getNumberOfEntriesInCentralDirectory()`, so that here could use `offSetStartCentralDir` and `centralDirEntryCount` directly.
  • Loading branch information
MrPans authored May 28, 2020
1 parent 089bd6e commit 7ced8aa
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/main/java/net/lingala/zip4j/headers/HeaderReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,7 @@ private CentralDirectory readCentralDirectory(RandomAccessFile zip4jRaf, RawIO r

long offSetStartCentralDir = HeaderUtil.getOffsetStartOfCentralDirectory(zipModel);
long centralDirEntryCount = getNumberOfEntriesInCentralDirectory(zipModel);

if (zipModel.isZip64Format()) {
offSetStartCentralDir = zipModel.getZip64EndOfCentralDirectoryRecord()
.getOffsetStartCentralDirectoryWRTStartDiskNumber();
centralDirEntryCount = (int) zipModel.getZip64EndOfCentralDirectoryRecord()
.getTotalNumberOfEntriesInCentralDirectory();
}


zip4jRaf.seek(offSetStartCentralDir);

byte[] shortBuff = new byte[2];
Expand Down

0 comments on commit 7ced8aa

Please sign in to comment.