diff --git a/Cargo.lock b/Cargo.lock index 1acdc0b5..ec066d85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -563,7 +563,7 @@ dependencies = [ "maybe-owned", "rustix 1.1.5", "rustix-linux-procfs", - "windows-sys 0.61.2", + "windows-sys 0.60.2", "winx", ] @@ -1171,7 +1171,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1476,10 +1476,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", - "js-sys", "libc", "r-efi 6.0.0", - "wasm-bindgen", ] [[package]] @@ -2814,7 +2812,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3416,7 +3414,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3715,7 +3713,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -3797,10 +3795,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.3", + "getrandom 0.3.4", "once_cell", "rustix 1.1.5", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -4247,9 +4245,9 @@ dependencies = [ [[package]] name = "typed-path" -version = "0.13.0" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" +checksum = "54ec2755506471f54baf5e4bb5499d8e510cc1caf271270e778a736bd2d7336c" [[package]] name = "typeid" @@ -4265,7 +4263,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" dependencies = [ "memoffset", "tempfile", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -4784,7 +4782,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -5487,18 +5485,16 @@ dependencies = [ [[package]] name = "zip" -version = "9.2.0" +version = "9.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f5b58784007ff6e5f280ec82c8596686a3b9b5dd5836c63288d4479f84728b9" +checksum = "6e04976da629d3b04204ba8105b396a193af8ad2583b2c79bfb3ab8af580a11e" dependencies = [ "crc32fast", "flate2", - "getrandom 0.4.3", "indexmap", "memchr", "nix", "typed-path", - "windows-sys 0.61.2", "zopfli", ] diff --git a/crates/formats/src/mesh_import/fbx.rs b/crates/formats/src/mesh_import/fbx.rs index 43fea71e..d7dd46fc 100644 --- a/crates/formats/src/mesh_import/fbx.rs +++ b/crates/formats/src/mesh_import/fbx.rs @@ -445,7 +445,7 @@ pub(crate) fn read(bytes: &[u8]) -> Result { if zip.len() > MAX_ZIP_ENTRIES { return Err(FormatError::TooLarge(format!("the FBX package has more than {MAX_ZIP_ENTRIES} entries"))); } - let name = zip.file_names().filter(|n| super::extension(n) == "fbx").min_by_key(|n| zip.index_for_name(n)).map(str::to_string); + let name = zip.file_names().flatten().filter(|n| super::extension(n) == "fbx").min_by_key(|n| zip.index_for_name(n)).map(Cow::into_owned); let name = name.ok_or_else(|| malformed(KIND, "the package contains no FBX file"))?; let fbx = zip_entry(&mut zip, &name, MAX_MESH_FILE_BYTES) .ok_or_else(|| FormatError::TooLarge("the packaged FBX is unreadable or larger than 2 GiB".into()))?; diff --git a/crates/formats/src/mesh_import/usd/mod.rs b/crates/formats/src/mesh_import/usd/mod.rs index fc1544bb..e7f9d0fe 100644 --- a/crates/formats/src/mesh_import/usd/mod.rs +++ b/crates/formats/src/mesh_import/usd/mod.rs @@ -228,8 +228,8 @@ fn read_usdz(bytes: &[u8]) -> Result<(Layer, Package<'_>)> { if zip.len() > MAX_ZIP_ENTRIES { return Err(FormatError::TooLarge(format!("the usdz package has more than {MAX_ZIP_ENTRIES} entries"))); } - let name = zip.file_names().filter(|n| matches!(super::extension(n).as_str(), "usda" | "usdc" | "usd")).min_by_key(|n| zip.index_for_name(n)); - let name = name.ok_or_else(|| malformed(KIND, "the usdz package contains no USD layer"))?.to_string(); + let name = zip.file_names().flatten().filter(|n| matches!(super::extension(n).as_str(), "usda" | "usdc" | "usd")).min_by_key(|n| zip.index_for_name(n)); + let name = name.ok_or_else(|| malformed(KIND, "the usdz package contains no USD layer"))?.into_owned(); let dir = name.rsplit_once('/').map_or("", |(d, _)| d).to_string(); let mut package = Package { zip, dir }; let data = package.read(&name, MAX_MESH_FILE_BYTES).ok_or_else(|| FormatError::TooLarge("the usdz layer is unreadable or larger than 2 GiB".into()))?; diff --git a/crates/formats/src/mesh_import/usd/tests.rs b/crates/formats/src/mesh_import/usd/tests.rs index 6cfd0a07..e5da5cb8 100644 --- a/crates/formats/src/mesh_import/usd/tests.rs +++ b/crates/formats/src/mesh_import/usd/tests.rs @@ -347,16 +347,16 @@ fn usda_usdc_and_usdz_round_trip_with_textures() { round_trip(&m, UsdFormat::Usdc, "usdc", &textures); let usdz = round_trip(&m, UsdFormat::Usdz, "usdz", &textures); let mut zip = zip::ZipArchive::new(std::io::Cursor::new(&usdz)).unwrap(); - let names: Vec = zip.file_names().map(str::to_string).collect(); + let names: Vec = zip.file_names().map(|n| n.unwrap().into_owned()).collect(); assert_eq!(names.first().map(String::as_str), Some("Test_scene.usdc")); assert_eq!(names.len(), 1 + 7, "the layer and every non-black texture"); for i in 0..zip.len() { let mut f = zip.by_index(i).unwrap(); assert_eq!(f.compression(), zip::CompressionMethod::Stored); - assert_eq!(f.data_start() % 64, 0, "usdz entries are 64-byte aligned"); + assert_eq!(f.data_start().unwrap() % 64, 0, "usdz entries are 64-byte aligned"); let mut data = Vec::new(); f.read_to_end(&mut data).unwrap(); - if f.name().ends_with(".png") { + if f.name().unwrap().ends_with(".png") { assert!(image::load_from_memory(&data).is_ok()); } } diff --git a/crates/formats/src/project_file/mod.rs b/crates/formats/src/project_file/mod.rs index bd8bd228..a0d6cb3b 100644 --- a/crates/formats/src/project_file/mod.rs +++ b/crates/formats/src/project_file/mod.rs @@ -333,7 +333,7 @@ fn load(reader: R) -> Result { }; for i in 0..zip.len() { let mut f = zip.by_index(i).map_err(zip_err)?; - let name = f.name().to_string(); + let name = f.name().map_err(zip_err)?.into_owned(); let size_of = |id: LayerId| texture_set_of(&pf.project, id).and_then(|ts| pf.project.texture_sets.get(ts)).map(|t| t.size()); if name == "thumbnail.png" { pf.thumbnail = Some(read_all(&mut f, MAX_THUMBNAIL, &mut budget, &name)?);