File: 1007_object.patch

package info (click to toggle)
sccache 0.10.0-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,980 kB
  • sloc: sh: 358; cpp: 112; perl: 68; makefile: 32; ansic: 31
file content (46 lines) | stat: -rw-r--r-- 1,919 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Description: use newer branch of crate object
Author: Peter Michael Green <plugwash@debian.org>
Bug-Debian: https://bugs.debian.org/1090396
Last-Update: 2025-01-11
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -64,7 +64,7 @@
 mime = "0.3"
 num_cpus = "1.16"
 number_prefix = "0.4"
-object = "0.32"
+object = "0.36"
 once_cell = "1.19"
 opendal = { version = "0.52.0", optional = true, default-features = false }
 openssl = { version = "0.10.64", optional = true }
--- a/src/util.rs
+++ b/src/util.rs
@@ -356,19 +356,18 @@
             let archive_mmap =
                 unsafe { memmap2::MmapOptions::new().map_copy_read_only(&archive_file)? };
 
-            match macho::FatHeader::parse(&*archive_mmap) {
-                Ok(h) if h.magic.get(object::endian::BigEndian) == macho::FAT_MAGIC => {
-                    for arch in macho::FatHeader::parse_arch32(&*archive_mmap)? {
+            if let Ok(h) = object::read::macho::MachOFatFile32::parse(&*archive_mmap) {
+                    for arch in h.arches() {
                         hash_regular_archive(&mut m, arch.data(&*archive_mmap)?)?;
                     }
-                }
-                Ok(h) if h.magic.get(object::endian::BigEndian) == macho::FAT_MAGIC_64 => {
-                    for arch in macho::FatHeader::parse_arch64(&*archive_mmap)? {
+            } else if let Ok(h) = object::read::macho::MachOFatFile32::parse(&*archive_mmap) {
+
+                    for arch in h.arches() {
                         hash_regular_archive(&mut m, arch.data(&*archive_mmap)?)?;
                     }
-                }
+            } else {
                 // Not a FatHeader at all, regular archive.
-                _ => hash_regular_archive(&mut m, &archive_mmap)?,
+                hash_regular_archive(&mut m, &archive_mmap)?;
             }
             Ok(m.finish())
         })