This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 5cd730ea7 Refactor NUL magic char
5cd730ea7 is described below

commit 5cd730ea7931518c352c6c5addb586dd72213924
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Jan 28 14:00:19 2025 -0500

    Refactor NUL magic char
---
 .../commons/compress/archivers/cpio/CpioArchiveOutputStream.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
index 6287de6e4..e7e6e5b5d 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
@@ -68,6 +68,11 @@
  */
 public class CpioArchiveOutputStream extends 
ArchiveOutputStream<CpioArchiveEntry> implements CpioConstants {
 
+    /**
+     * The NUL character.
+     */
+    private static final char NUL = '\0';
+
     private CpioArchiveEntry entry;
 
     /**
@@ -379,7 +384,7 @@ private void writeBinaryLong(final long number, final int 
length, final boolean
      */
     private void writeCString(final byte[] str) throws IOException {
         out.write(str);
-        out.write('\0');
+        out.write(NUL);
         count(str.length + 1);
     }
 

Reply via email to