This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit 16e9af2718804cf4926d4d59bca8f7ab9f167320 Author: Gary Gregory <[email protected]> AuthorDate: Tue Jul 14 13:27:04 2026 -0400 Merge if statements --- .../archivers/cpio/CpioArchiveInputStream.java | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java index 321ab10bc..f258b2e6b 100644 --- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java @@ -143,29 +143,14 @@ public static boolean matches(final byte[] signature, final int length) { } // Check Ascii (String) values // 3037 3037 30nn - if (signature[0] != 0x30) { - return false; - } - if (signature[1] != 0x37) { - return false; - } - if (signature[2] != 0x30) { - return false; - } - if (signature[3] != 0x37) { + if (signature[0] != 0x30 || signature[1] != 0x37 || signature[2] != 0x30 || signature[3] != 0x37) { return false; } if (signature[4] != 0x30) { return false; } // Check last byte - if (signature[5] == 0x31) { - return true; - } - if (signature[5] == 0x32) { - return true; - } - if (signature[5] == 0x37) { + if (signature[5] == 0x31 || signature[5] == 0x32 || signature[5] == 0x37) { return true; } return false; @@ -419,7 +404,7 @@ private long readBinaryLong(final int length, final boolean swapHalfWord) throws return CpioUtil.byteArray2long(tmp, swapHalfWord); } - private String readEntryName(int lengthWithNull) throws IOException { + private String readEntryName(final int lengthWithNull) throws IOException { final int length = ArchiveUtils.checkEntryNameLength(lengthWithNull - 1, getMaxEntryNameLength(), "CPIO"); // don't include trailing NUL in file name to decode final byte[] tmpBuffer = readRange(length);
