Skip to content

Commit fbcf235

Browse files
committed
Skip creating slices when using segment/string-data utils
1 parent 152426b commit fbcf235

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/main/java/software/coley/lljzip/format/model/CentralDirectoryFileHeader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public void read(@Nonnull MemorySegment data, long offset) throws ZipParseExcept
120120
throw new ZipParseException(t, ZipParseException.Type.OTHER);
121121
}
122122
try {
123-
fileComment = StringData.of(readSlice(data, offset, 46 + fileNameLength + extraFieldLength, fileCommentLength));
123+
fileComment = StringData.of(data, offset + 46 + fileNameLength + extraFieldLength, fileCommentLength);
124124
} catch (IndexOutOfBoundsException ex) {
125125
throw new ZipParseException(ex, ZipParseException.Type.IOOBE_CEN_COMMENT);
126126
} catch (Throwable t) {

src/main/java/software/coley/lljzip/format/model/EndOfCentralDirectory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void read(@Nonnull MemorySegment data, long offset) {
6767
setCentralDirectorySize(readQuad(data, offset + 12));
6868
setCentralDirectoryOffset(readQuad(data, offset + 16));
6969
setZipCommentLength(readWord(data, offset + 20));
70-
zipComment = StringData.of(data.asSlice(offset + 22, zipCommentLength));
70+
zipComment = StringData.of(data, offset + 22, zipCommentLength);
7171
}
7272

7373
@Override

src/main/java/software/coley/lljzip/format/model/LocalFileHeader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void read(@Nonnull MemorySegment data, long offset) throws ZipParseExcept
8888
throw new ZipParseException(t, ZipParseException.Type.OTHER);
8989
}
9090
try {
91-
fileName = StringData.of(readSlice(data, offset, MIN_FIXED_SIZE, fileNameLength));
91+
fileName = StringData.of(data, offset + MIN_FIXED_SIZE, fileNameLength);
9292
} catch (IndexOutOfBoundsException ex) {
9393
throw new ZipParseException(ex, ZipParseException.Type.IOOBE_FILE_NAME);
9494
} catch (Throwable t) {

0 commit comments

Comments
 (0)