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

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 1a7076743f425366c6ce0b65e1f93aa2af062520
Author: zhengyu16 <[email protected]>
AuthorDate: Mon Jan 26 20:59:22 2026 +0800

    libarchive: add CONFIG_UTILS_LIBARCHIVE_ZIP64
    
    Disabling it saves 0.44K under LTO.
    
    Signed-off-by: zhengyu16 <[email protected]>
    Signed-off-by: tengshuangshuang <[email protected]>
---
 .../0011-add-config-utils-libarchive-zip64.patch   | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/system/libarchive/0011-add-config-utils-libarchive-zip64.patch 
b/system/libarchive/0011-add-config-utils-libarchive-zip64.patch
new file mode 100644
index 000000000..5a0606550
--- /dev/null
+++ b/system/libarchive/0011-add-config-utils-libarchive-zip64.patch
@@ -0,0 +1,75 @@
+diff --git a/libarchive/archive_read_support_format_zip.c 
b/libarchive/archive_read_support_format_zip.c
+index 280e1a0d..f53223a9 100644
+--- a/libarchive/archive_read_support_format_zip.c
++++ b/libarchive/archive_read_support_format_zip.c
+@@ -132,7 +132,9 @@ struct trad_enc_ctx {
+ #define ZIP_CENTRAL_DIRECTORY_ENCRYPTED       (1 << 13)
+ 
+ /* Bits used in flags. */
++#ifdef CONFIG_UTILS_LIBARCHIVE_ZIP64
+ #define LA_USED_ZIP64 (1 << 0)
++#endif
+ #define LA_FROM_CENTRAL_DIRECTORY (1 << 1)
+ 
+ #ifdef CONFIG_UTILS_LIBARCHIVE_ENCRYPTION
+@@ -561,6 +563,7 @@ process_extra(struct archive_read *a, struct archive_entry 
*entry,
+                   headerid, datasize);
+ #endif
+               switch (headerid) {
++#ifdef CONFIG_UTILS_LIBARCHIVE_ZIP64
+               case 0x0001:
+                       /* Zip64 extended information extra field. */
+                       zip_entry->flags |= LA_USED_ZIP64;
+@@ -613,6 +616,7 @@ process_extra(struct archive_read *a, struct archive_entry 
*entry,
+                        * on which file starts, but we don't handle
+                        * multi-volume Zip files. */
+                       break;
++#endif /* CONFIG_UTILS_LIBARCHIVE_ZIP64 */
+ #ifdef DEBUG
+               case 0x0017:
+               {
+@@ -3653,10 +3657,12 @@ 
archive_read_format_zip_read_data_skip_streamable(struct archive_read *a)
+                               else if (p[3] == '\007') { p += 1; }
+                               else if (p[3] == '\010' && p[2] == '\007'
+                                   && p[1] == 'K' && p[0] == 'P') {
++#ifdef CONFIG_UTILS_LIBARCHIVE_ZIP64
+                                       if (zip->entry->flags & LA_USED_ZIP64)
+                                               __archive_read_consume(a,
+                                                   p - buff + 24);
+                                       else
++#endif
+                                               __archive_read_consume(a,
+                                                   p - buff + 16);
+                                       return ARCHIVE_OK;
+@@ -3773,6 +3779,7 @@ read_eocd(struct zip *zip, const char *p, int64_t 
current_offset)
+       return 32;
+ }
+ 
++#ifdef CONFIG_UTILS_LIBARCHIVE_ZIP64
+ /*
+  * Examine Zip64 EOCD locator:  If it's valid, store the information
+  * from it.
+@@ -3821,6 +3828,7 @@ read_zip64_eocd(struct archive_read *a, struct zip *zip, 
const char *p)
+ 
+       return 32;
+ }
++#endif /* CONFIG_UTILS_LIBARCHIVE_ZIP64 */
+ 
+ static int
+ archive_read_format_zip_seekable_bid(struct archive_read *a, int best_bid)
+@@ -3857,6 +3865,7 @@ archive_read_format_zip_seekable_bid(struct archive_read 
*a, int best_bid)
+                       if (memcmp(p + i, "PK\005\006", 4) == 0) {
+                               int ret = read_eocd(zip, p + i,
+                                   current_offset + i);
++#ifdef CONFIG_UTILS_LIBARCHIVE_ZIP64
+                               /* Zip64 EOCD locator precedes
+                                * regular EOCD if present. */
+                               if (i >= 20 && memcmp(p + i - 20, "PK\006\007", 
4) == 0) {
+@@ -3864,6 +3873,7 @@ archive_read_format_zip_seekable_bid(struct archive_read 
*a, int best_bid)
+                                       if (ret_zip64 > ret)
+                                               ret = ret_zip64;
+                               }
++#endif
+                               return (ret);
+                       }
+                       i -= 4;

Reply via email to