Skip to content

Commit

Permalink
(doc) fix gzip streams incorrect MTIME value which is already in seco…
Browse files Browse the repository at this point in the history
…nds (#624)
  • Loading branch information
ddeschenes-1 authored Dec 14, 2024
1 parent 27385f5 commit 51c2e05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private boolean init(final boolean isFirstMember) throws IOException {
throw new IOException("Reserved flags are set in the .gz header");
}

parameters.setModificationTime(ByteUtils.fromLittleEndian(inData, 4) * 1000);
parameters.setModificationTime(ByteUtils.fromLittleEndian(inData, 4));
switch (inData.readUnsignedByte()) { // extra flags
case 2:
parameters.setCompressionLevel(Deflater.BEST_COMPRESSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private void writeHeader(final GzipParameters parameters) throws IOException {
buffer.putShort((short) GZIPInputStream.GZIP_MAGIC);
buffer.put((byte) Deflater.DEFLATED); // compression method (8: deflate)
buffer.put((byte) ((extra != null ? FEXTRA : 0) | (fileName != null ? FNAME : 0) | (comment != null ? FCOMMENT : 0))); // flags
buffer.putInt((int) (parameters.getModificationTime() / 1000));
buffer.putInt((int) (parameters.getModificationTime()));
// extra flags
final int compressionLevel = parameters.getCompressionLevel();
if (compressionLevel == Deflater.BEST_COMPRESSION) {
Expand Down

0 comments on commit 51c2e05

Please sign in to comment.