From cbf90163cbe9051052f960ef3f2493bd61b2e6a8 Mon Sep 17 00:00:00 2001 From: LouisDISPA Date: Mon, 26 Feb 2024 17:59:17 +0100 Subject: [PATCH 1/8] Update dependencies --- Cargo.lock | 265 +++++++++++++++++++++++++++++----------------- Cargo.toml | 10 +- src/dll.rs | 4 +- src/lib.rs | 30 +++--- src/properties.rs | 32 +++--- src/winstream.rs | 10 +- tests/wic.rs | 2 +- 7 files changed, 209 insertions(+), 144 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index efbc47b..4e55a89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "cfg-if" version = "1.0.0" @@ -16,76 +10,72 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.16" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "jxl-bitstream" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ae9d8f3dfbef298b8357a283fad85da9c59027229e28beafcfc9d2a810a398" +checksum = "23ace52f4e7df7cf39e3132da74184a9f2dcd375c01008c28bb5e0af668d3254" dependencies = [ "tracing", ] [[package]] name = "jxl-coding" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "851149f14415943e525e6259ddff212a1f507e0b12ee6f9fc0fa5266bea88891" +checksum = "44c62097f56996c1bbb67cd52f102f56e768609dc26ac8c5f811c0618e100ce0" dependencies = [ "jxl-bitstream", + "tracing", ] [[package]] name = "jxl-color" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320b54db472711efc56c8b257207b91772277e926b21e686cb23d10daf2c7f8f" +checksum = "f68d72fed76c73dc1738654c147bd6e634dc74800e2788d3f03e8d3a581af7a1" dependencies = [ "jxl-bitstream", "jxl-coding", "jxl-grid", + "jxl-threadpool", + "tracing", ] [[package]] name = "jxl-frame" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "694f9d1d3f6addabf74ad9ca664ef0e760e85a66558dc348d03137a7adda620c" +checksum = "a761bd05174c93a3e41901f55ee1eb6b81f4320fd3d38f3b209785229069f127" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -99,15 +89,18 @@ dependencies = [ [[package]] name = "jxl-grid" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93164539f6339d98341835684b5c8458dafd9a5dfb2fdbd3c821ea00f58a86d" +checksum = "986d963bc7a1a7cb6a09d0a3ec3b56ff798f13192688c669cc7283ee51c836ec" +dependencies = [ + "tracing", +] [[package]] name = "jxl-image" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c33911f1240386e4d0f874b313a4d27b68c5f67d4a7a418990b6605543c08a39" +checksum = "47fd8d376f06ecf5540b324e4bc67b181771dacf1c8850cf80cf4c7e0b2ea150" dependencies = [ "jxl-bitstream", "jxl-color", @@ -117,9 +110,9 @@ dependencies = [ [[package]] name = "jxl-modular" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3aa0fd75ed9e7101c1dcf7172ccac722705f6e75cc0b44721154765846a2d70" +checksum = "08bd3f027534838b7eec34a42acb5da9c1fca41efd6adacd6e7761f6b36c2247" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -130,9 +123,9 @@ dependencies = [ [[package]] name = "jxl-oxide" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e986fe957d42be34043ed5b089c34c35a182524509e6cfee87d86527f61f9623" +checksum = "1d5d4e58348b5eaea8496af76cf6323e364d571646e3709750b1bd7fa181871e" dependencies = [ "jxl-bitstream", "jxl-color", @@ -146,9 +139,9 @@ dependencies = [ [[package]] name = "jxl-render" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b862f98f83049febe65feb40d75493638386721ff5dff4c6a5ad267035881bf" +checksum = "36dd2307202d09e8608003ba977a065c266093819c8ae90b73107e42dfcc1e67" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -164,9 +157,9 @@ dependencies = [ [[package]] name = "jxl-threadpool" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcd3e9cf51745c0f4e86cd728c2725d62f0d1c8611a10307e96c2af6226db291" +checksum = "9d2860c68899a3c6266044fc26c6a0041e9f27145f58cc69b6eedc1b77f5ee13" dependencies = [ "rayon", "rayon-core", @@ -175,9 +168,9 @@ dependencies = [ [[package]] name = "jxl-vardct" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "027bacaccf80849dfa4513354c8c41e8e4e1a112efeb682f6b3e9aeb4b4db481" +checksum = "c7cf239729edf838e2385b9025d472753176af2e34f46ad3c31ae19e585f5b53" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -206,9 +199,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "log" @@ -216,15 +209,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -239,27 +223,27 @@ checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -267,9 +251,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -294,9 +278,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.109" +version = "2.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" dependencies = [ "proc-macro2", "quote", @@ -363,20 +347,31 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.44.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" +checksum = "efc5cf48f83140dcaab716eeaea345f9e93d0018fb81162753a3f76c3397b538" dependencies = [ + "windows-core", "windows-implement", "windows-interface", - "windows-targets", + "windows-targets 0.52.3", +] + +[[package]] +name = "windows-core" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dcc5b895a6377f1ab9fa55acedab1fd5ac0db66ad1e6c7f47e28a22e446a5dd" +dependencies = [ + "windows-result", + "windows-targets 0.52.3", ] [[package]] name = "windows-implement" -version = "0.44.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce87ca8e3417b02dc2a8a22769306658670ec92d78f1bd420d6310a67c245c6" +checksum = "942ac266be9249c84ca862f0a164a39533dc2f6f33dc98ec89c8da99b82ea0bd" dependencies = [ "proc-macro2", "quote", @@ -385,77 +380,153 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.44.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "853f69a591ecd4f810d29f17e902d40e349fb05b0b11fff63b08b826bfe39c7f" +checksum = "da33557140a288fae4e1d5f8873aaf9eb6613a9cf82c3e070223ff177f598b60" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "windows-result" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" +dependencies = [ + "windows-targets 0.52.3", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.3", + "windows_aarch64_msvc 0.52.3", + "windows_i686_gnu 0.52.3", + "windows_i686_msvc 0.52.3", + "windows_x86_64_gnu 0.52.3", + "windows_x86_64_gnullvm 0.52.3", + "windows_x86_64_msvc 0.52.3", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.2" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.42.2" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" [[package]] name = "winreg" -version = "0.10.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ - "winapi", + "cfg-if", + "windows-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 431b207..df0dab9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,13 +10,13 @@ crate-type = ["rlib", "cdylib"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simple-logging = "2.0.2" -log = "0.4.17" -winreg = "0.10.1" -jxl-oxide = "0.5.1" +simple-logging = "2.0" +log = "0.4" +winreg = "0.52.0" +jxl-oxide = "0.7" [dependencies.windows] -version = "0.44.0" +version = "0.53.0" features = [ "implement", "Win32_Graphics_Imaging", diff --git a/src/dll.rs b/src/dll.rs index 445c9d3..334a4d5 100644 --- a/src/dll.rs +++ b/src/dll.rs @@ -26,7 +26,7 @@ struct ClassFactory {} impl IClassFactory_Impl for ClassFactory { fn CreateInstance( &self, - outer: &Option, + outer: Option<&windows::core::IUnknown>, iid: *const GUID, object: *mut *mut core::ffi::c_void, ) -> windows::core::Result<()> { @@ -113,7 +113,7 @@ pub extern "stdcall" fn DllMain( pub unsafe extern "system" fn DllGetClassObject( rclsid: *const GUID, riid: *const GUID, - pout: *mut *const core::ffi::c_void, + pout: *mut *mut core::ffi::c_void, ) -> HRESULT { // Sets up logging to the Cargo.toml directory for debug purposes. #[cfg(debug_assertions)] diff --git a/src/lib.rs b/src/lib.rs index a79c359..f7e5b36 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,7 @@ impl JXLWICBitmapDecoder { } impl IWICBitmapDecoder_Impl for JXLWICBitmapDecoder { - fn QueryCapability(&self, _pistream: &Option) -> windows::core::Result { + fn QueryCapability(&self, _pistream: Option<&IStream>) -> windows::core::Result { log::trace!("QueryCapability"); Ok((WICBitmapDecoderCapabilityCanDecodeSomeImages.0 | WICBitmapDecoderCapabilityCanDecodeAllImages.0) as u32) @@ -54,16 +54,16 @@ impl IWICBitmapDecoder_Impl for JXLWICBitmapDecoder { fn Initialize( &self, - pistream: &Option, + pistream: Option<&IStream>, _cacheoptions: WICDecodeOptions, ) -> windows::core::Result<()> { log::trace!("JXLWICBitmapDecoder::Initialize"); - let stream = WinStream::from(pistream.to_owned().unwrap()); + let stream = WinStream::from(pistream.unwrap()); let reader = BufReader::new(stream); - let image = JxlImage::from_reader(reader).map_err(|err| { - windows::core::Error::new(WINCODEC_ERR_BADIMAGE, format!("{:?}", err).as_str().into()) + let image = JxlImage::builder().read(reader).map_err(|err| { + windows::core::Error::new(WINCODEC_ERR_BADIMAGE, format!("{:?}", err).as_str()) })?; let (width, height, _left, _top) = image.image_header().metadata.apply_orientation( @@ -102,7 +102,7 @@ impl IWICBitmapDecoder_Impl for JXLWICBitmapDecoder { } } - fn CopyPalette(&self, _pipalette: &Option) -> windows::core::Result<()> { + fn CopyPalette(&self, _pipalette: Option<&IWICPalette>) -> windows::core::Result<()> { log::trace!("JXLWICBitmapDecoder::CopyPalette"); // TODO WINCODEC_ERR_PALETTEUNAVAILABLE.ok() @@ -183,10 +183,7 @@ impl IWICBitmapDecoder_Impl for JXLWICBitmapDecoder { } let render = decoded.image.render_frame(index as usize).map_err(|err| { - windows::core::Error::new( - WINCODEC_ERR_FRAMEMISSING, - format!("{:?}", err).as_str().into(), - ) + windows::core::Error::new(WINCODEC_ERR_FRAMEMISSING, format!("{:?}", err).as_str()) })?; let frame_decode = JXLWICBitmapFrameDecode::new( @@ -250,16 +247,13 @@ impl IWICBitmapSource_Impl for JXLWICBitmapFrameDecode { PixelFormat::Gray => Ok(GUID_WICPixelFormat32bppGrayFloat), PixelFormat::Graya => Err(windows::core::Error::new( WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT, - "Gray alpha image is currently not supported".into(), + "Gray alpha image is currently not supported", )), PixelFormat::Rgb => Ok(GUID_WICPixelFormat96bppRGBFloat), PixelFormat::Rgba => Ok(GUID_WICPixelFormat128bppRGBAFloat), - jxl_oxide::PixelFormat::Cmyk | jxl_oxide::PixelFormat::Cmyka => { - Err(windows::core::Error::new( - WINCODEC_ERR_BADIMAGE, - "Cmyk is currently not supported".into(), - )) - } + jxl_oxide::PixelFormat::Cmyk | jxl_oxide::PixelFormat::Cmyka => Err( + windows::core::Error::new(WINCODEC_ERR_BADIMAGE, "Cmyk is currently not supported"), + ), } } @@ -273,7 +267,7 @@ impl IWICBitmapSource_Impl for JXLWICBitmapFrameDecode { Ok(()) } - fn CopyPalette(&self, _pipalette: &Option) -> windows::core::Result<()> { + fn CopyPalette(&self, _pipalette: Option<&IWICPalette>) -> windows::core::Result<()> { log::trace!("JXLWICBitmapFrameDecode::CopyPalette"); WINCODEC_ERR_PALETTEUNAVAILABLE.ok() } diff --git a/src/properties.rs b/src/properties.rs index e6623f4..3f6cda2 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -1,21 +1,21 @@ use std::io::BufReader; +use crate::winstream::WinStream; +use jxl_oxide::JxlImage; use windows as Windows; -use windows::core::{implement, Interface, GUID, HSTRING, PCWSTR}; +use windows::core::{implement, Interface, GUID, HSTRING, PCWSTR, PROPVARIANT}; use windows::Win32::{ Foundation::*, - System::Com::IStream, - System::Com::StructuredStorage::PROPVARIANT, + System::Com::{ + IStream, + StructuredStorage::{InitPropVariantFromStringVector, InitPropVariantFromUInt32Vector}, + }, UI::Shell::PropertiesSystem::{ IInitializeWithStream_Impl, IPropertyStoreCache, IPropertyStoreCapabilities_Impl, - IPropertyStore_Impl, InitPropVariantFromStringVector, InitPropVariantFromUInt32Vector, - PSCreateMemoryPropertyStore, PROPERTYKEY, PSC_READONLY, + IPropertyStore_Impl, PSCreateMemoryPropertyStore, PROPERTYKEY, PSC_READONLY, }, }; -use crate::winstream::WinStream; -use jxl_oxide::JxlImage; - #[implement( Windows::Win32::UI::Shell::PropertiesSystem::IInitializeWithStream, Windows::Win32::UI::Shell::PropertiesSystem::IPropertyStore, @@ -33,7 +33,7 @@ impl JXLPropertyStore { if self.props.is_none() { return Err(windows::core::Error::new( WINCODEC_ERR_NOTINITIALIZED, - "Property store not initialized".into(), + "Property store not initialized", )); } @@ -42,12 +42,12 @@ impl JXLPropertyStore { } impl IInitializeWithStream_Impl for JXLPropertyStore { - fn Initialize(&self, pstream: &Option, _grfmode: u32) -> windows::core::Result<()> { - let stream = WinStream::from(pstream.to_owned().unwrap()); + fn Initialize(&self, pstream: Option<&IStream>, _grfmode: u32) -> windows::core::Result<()> { + let stream = WinStream::from(pstream.unwrap()); let reader = BufReader::new(stream); - let image = JxlImage::from_reader(reader).map_err(|err| { - windows::core::Error::new(WINCODEC_ERR_BADIMAGE, format!("{:?}", err).as_str().into()) + let image = JxlImage::builder().read(reader).map_err(|err| { + windows::core::Error::new(WINCODEC_ERR_BADIMAGE, format!("{:?}", err).as_str()) })?; let (width, height, _left, _top) = image.image_header().metadata.apply_orientation( @@ -125,14 +125,14 @@ impl IPropertyStore_Impl for JXLPropertyStore { ) -> windows::core::Result<()> { Err(windows::core::Error::new( WINCODEC_ERR_UNSUPPORTEDOPERATION, - "Setter not supported".into(), + "Setter not supported", )) } fn Commit(&self) -> windows::core::Result<()> { Err(windows::core::Error::new( WINCODEC_ERR_UNSUPPORTEDOPERATION, - "Setter not supported".into(), + "Setter not supported", )) } } @@ -141,7 +141,7 @@ impl IPropertyStoreCapabilities_Impl for JXLPropertyStore { fn IsPropertyWritable(&self, _key: *const PROPERTYKEY) -> windows::core::Result<()> { Err(windows::core::Error::new( WINCODEC_ERR_UNSUPPORTEDOPERATION, - "Setter not supported".into(), + "Setter not supported", )) } } diff --git a/src/winstream.rs b/src/winstream.rs index 5373171..fe6f84a 100644 --- a/src/winstream.rs +++ b/src/winstream.rs @@ -2,17 +2,17 @@ use std::io::{ErrorKind, Read}; use windows::Win32::System::Com::IStream; -pub struct WinStream { - stream: IStream, +pub struct WinStream<'a> { + stream: &'a IStream, } -impl From for WinStream { - fn from(stream: IStream) -> Self { +impl<'a> From<&'a IStream> for WinStream<'a> { + fn from(stream: &'a IStream) -> Self { Self { stream } } } -impl Read for WinStream { +impl<'a> Read for WinStream<'a> { fn read(&mut self, buf: &mut [u8]) -> Result { let mut bytes_read = 0u32; unsafe { diff --git a/tests/wic.rs b/tests/wic.rs index 7c5f61b..82cda07 100644 --- a/tests/wic.rs +++ b/tests/wic.rs @@ -5,7 +5,7 @@ use windows::Win32::UI::Shell::SHCreateMemStream; #[test] fn basic() { - unsafe { CoInitialize(None) }.expect("CoInitialize"); + unsafe { CoInitialize(None) }.unwrap(); let mem = std::fs::read("tests/alien.jxl").expect("Read the test file"); let stream = unsafe { SHCreateMemStream(Some(&mem[..])) }.expect("Create an IStream"); From e7e5c7a562e9412b99854e59d8818e237e3665b5 Mon Sep 17 00:00:00 2001 From: LouisDISPA Date: Mon, 26 Feb 2024 18:02:34 +0100 Subject: [PATCH 2/8] Update readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 94a837d..bbddb74 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,11 @@ A JPEG XL (*.jxl) WIC decoder to render thumbnails on Windows File Explorer or v 1. Move to your download directory 1. `regsvr32 jxl_winthumb.dll`, or to uninstall, `regsvr32 /u jxl_winthumb.dll`. +You might need to restart windows for the extention to work. + ## Build environment -Use the stable Rust toolchain. Current toolchain as of 23th July 2023 is 1.71.0. +Use the stable Rust toolchain. Current toolchain as of 26th February 2024 is 1.75.0. ## Helpful resources From 1c8db884f248873f3de72486d0f11516d3d65aea Mon Sep 17 00:00:00 2001 From: LouisDISPA Date: Wed, 28 Feb 2024 11:10:58 +0100 Subject: [PATCH 3/8] Reviews --- README.md | 3 ++- tests/wic.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bbddb74..0450524 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ A JPEG XL (*.jxl) WIC decoder to render thumbnails on Windows File Explorer or v 1. Move to your download directory 1. `regsvr32 jxl_winthumb.dll`, or to uninstall, `regsvr32 /u jxl_winthumb.dll`. -You might need to restart windows for the extention to work. +You might need to restart `explorer.exe` for the component to work. +You can use this command: `taskkill /f /im explorer.exe & start explorer.exe` ## Build environment diff --git a/tests/wic.rs b/tests/wic.rs index 82cda07..78707e6 100644 --- a/tests/wic.rs +++ b/tests/wic.rs @@ -5,7 +5,7 @@ use windows::Win32::UI::Shell::SHCreateMemStream; #[test] fn basic() { - unsafe { CoInitialize(None) }.unwrap(); + unsafe { CoInitialize(None) }.ok().expect("CoInitialize"); let mem = std::fs::read("tests/alien.jxl").expect("Read the test file"); let stream = unsafe { SHCreateMemStream(Some(&mem[..])) }.expect("Create an IStream"); From b61879a9eda3a2e5d3862af8e8339388b0d9762b Mon Sep 17 00:00:00 2001 From: LouisDISPA Date: Thu, 29 Feb 2024 17:05:59 +0100 Subject: [PATCH 4/8] Update dependencies --- Cargo.lock | 108 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e55a89..84b5562 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,9 +50,9 @@ dependencies = [ [[package]] name = "jxl-coding" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c62097f56996c1bbb67cd52f102f56e768609dc26ac8c5f811c0618e100ce0" +checksum = "720c19e732100891ced54ef3a565dda867cdcbb355fe388e218ff09fda738368" dependencies = [ "jxl-bitstream", "tracing", @@ -60,9 +60,9 @@ dependencies = [ [[package]] name = "jxl-color" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f68d72fed76c73dc1738654c147bd6e634dc74800e2788d3f03e8d3a581af7a1" +checksum = "9ef54a5228a8f193c8d7aeb341aceffad7d8ddd2469ae8a483029a262d7b45f8" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -73,9 +73,9 @@ dependencies = [ [[package]] name = "jxl-frame" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a761bd05174c93a3e41901f55ee1eb6b81f4320fd3d38f3b209785229069f127" +checksum = "fd5c39977033aaa7484dfb14a273c2bd5f4ebf38ba4f344d8d4d5ab33a723956" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -89,18 +89,18 @@ dependencies = [ [[package]] name = "jxl-grid" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "986d963bc7a1a7cb6a09d0a3ec3b56ff798f13192688c669cc7283ee51c836ec" +checksum = "5b25b54442448752e9ccbd5e177da76e84b464054eddef792c44ceb11fc68aba" dependencies = [ "tracing", ] [[package]] name = "jxl-image" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47fd8d376f06ecf5540b324e4bc67b181771dacf1c8850cf80cf4c7e0b2ea150" +checksum = "e286d078e21230db8c3c62769bab7f8696168d3718222d1c59b7fea9a87bc7c1" dependencies = [ "jxl-bitstream", "jxl-color", @@ -110,9 +110,9 @@ dependencies = [ [[package]] name = "jxl-modular" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bd3f027534838b7eec34a42acb5da9c1fca41efd6adacd6e7761f6b36c2247" +checksum = "4274c241d7bf25216f87406d6d7c0f4826ba961eefaaf9a6a3982a235df64837" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "jxl-oxide" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5d4e58348b5eaea8496af76cf6323e364d571646e3709750b1bd7fa181871e" +checksum = "31e0ad6f1defe2126f33bb24b4dfab84b7ea3dd6720af0399abb75ab4d20a7fb" dependencies = [ "jxl-bitstream", "jxl-color", @@ -139,9 +139,9 @@ dependencies = [ [[package]] name = "jxl-render" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36dd2307202d09e8608003ba977a065c266093819c8ae90b73107e42dfcc1e67" +checksum = "90809573df2958b1598601a93e76afc10009419e21948afbd78c74989eb7946d" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -168,9 +168,9 @@ dependencies = [ [[package]] name = "jxl-vardct" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cf239729edf838e2385b9025d472753176af2e34f46ad3c31ae19e585f5b53" +checksum = "4853dae1aaec0e5a5acb0ff1b5e47263dcfcbd40aecf89bc71c34a50f158dfb9" dependencies = [ "jxl-bitstream", "jxl-coding", @@ -205,9 +205,9 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "once_cell" @@ -241,9 +241,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" dependencies = [ "either", "rayon-core", @@ -278,9 +278,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.51" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -347,24 +347,24 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.53.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efc5cf48f83140dcaab716eeaea345f9e93d0018fb81162753a3f76c3397b538" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" dependencies = [ "windows-core", "windows-implement", "windows-interface", - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] name = "windows-core" -version = "0.53.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dcc5b895a6377f1ab9fa55acedab1fd5ac0db66ad1e6c7f47e28a22e446a5dd" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" dependencies = [ "windows-result", - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -395,7 +395,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -424,17 +424,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.3", - "windows_aarch64_msvc 0.52.3", - "windows_i686_gnu 0.52.3", - "windows_i686_msvc 0.52.3", - "windows_x86_64_gnu 0.52.3", - "windows_x86_64_gnullvm 0.52.3", - "windows_x86_64_msvc 0.52.3", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -445,9 +445,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -457,9 +457,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -469,9 +469,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -481,9 +481,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -493,9 +493,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -505,9 +505,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -517,9 +517,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winreg" diff --git a/Cargo.toml b/Cargo.toml index df0dab9..384df2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ winreg = "0.52.0" jxl-oxide = "0.7" [dependencies.windows] -version = "0.53.0" +version = "0.54.0" features = [ "implement", "Win32_Graphics_Imaging", From ff761f165b256415d54335f2b0a58901cd0b5543 Mon Sep 17 00:00:00 2001 From: Louis Dispa Date: Thu, 29 Feb 2024 23:58:29 +0100 Subject: [PATCH 5/8] Update README.md Co-authored-by: Kagami Sascha Rosylight --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0450524..6cc5f19 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A JPEG XL (*.jxl) WIC decoder to render thumbnails on Windows File Explorer or v 1. `regsvr32 jxl_winthumb.dll`, or to uninstall, `regsvr32 /u jxl_winthumb.dll`. You might need to restart `explorer.exe` for the component to work. -You can use this command: `taskkill /f /im explorer.exe & start explorer.exe` +You can use this command: `taskkill /f /im explorer.exe && start explorer.exe` ## Build environment From a8346a758a66902cdb73780aad12a5e7aae23677 Mon Sep 17 00:00:00 2001 From: LouisDISPA Date: Fri, 1 Mar 2024 00:15:16 +0100 Subject: [PATCH 6/8] Review --- Cargo.toml | 6 +++--- src/dll.rs | 6 +++--- src/properties.rs | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 384df2e..f35575b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,10 +10,10 @@ crate-type = ["rlib", "cdylib"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -simple-logging = "2.0" -log = "0.4" +simple-logging = "2.0.2" +log = "0.4.21" winreg = "0.52.0" -jxl-oxide = "0.7" +jxl-oxide = "0.7.1" [dependencies.windows] version = "0.54.0" diff --git a/src/dll.rs b/src/dll.rs index 334a4d5..f8b072c 100644 --- a/src/dll.rs +++ b/src/dll.rs @@ -37,11 +37,11 @@ impl IClassFactory_Impl for ClassFactory { match *iid { windows::Win32::Graphics::Imaging::IWICBitmapDecoder::IID => { let unknown: IUnknown = JXLWICBitmapDecoder::default().into(); - unknown.query(&*iid, object as _).ok() + unknown.query(iid, object).ok() } windows::Win32::UI::Shell::PropertiesSystem::IPropertyStore::IID => { let unknown: IUnknown = JXLPropertyStore::default().into(); - unknown.query(&*iid, object as _).ok() + unknown.query(iid, object).ok() } _ => { log::trace!("Unknown IID: {:?}", *iid); @@ -134,7 +134,7 @@ pub unsafe extern "system" fn DllGetClassObject( let unknown: IUnknown = factory.into(); match *rclsid { - JXLWICBitmapDecoder::CLSID | JXLPropertyStore::CLSID => unknown.query(&*riid, pout), + JXLWICBitmapDecoder::CLSID | JXLPropertyStore::CLSID => unknown.query(riid, pout), _ => CLASS_E_CLASSNOTAVAILABLE, } } diff --git a/src/properties.rs b/src/properties.rs index 3f6cda2..0f35353 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -1,7 +1,5 @@ use std::io::BufReader; -use crate::winstream::WinStream; -use jxl_oxide::JxlImage; use windows as Windows; use windows::core::{implement, Interface, GUID, HSTRING, PCWSTR, PROPVARIANT}; use windows::Win32::{ @@ -16,6 +14,9 @@ use windows::Win32::{ }, }; +use crate::winstream::WinStream; +use jxl_oxide::JxlImage; + #[implement( Windows::Win32::UI::Shell::PropertiesSystem::IInitializeWithStream, Windows::Win32::UI::Shell::PropertiesSystem::IPropertyStore, From ce7473e88f92c471c6e89cbdc0163bcc23c52290 Mon Sep 17 00:00:00 2001 From: LouisDISPA Date: Fri, 1 Mar 2024 00:20:41 +0100 Subject: [PATCH 7/8] Remove as_str() --- src/lib.rs | 4 ++-- src/properties.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f7e5b36..dc88fc0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,7 +63,7 @@ impl IWICBitmapDecoder_Impl for JXLWICBitmapDecoder { let reader = BufReader::new(stream); let image = JxlImage::builder().read(reader).map_err(|err| { - windows::core::Error::new(WINCODEC_ERR_BADIMAGE, format!("{:?}", err).as_str()) + windows::core::Error::new(WINCODEC_ERR_BADIMAGE, format!("{:?}", err)) })?; let (width, height, _left, _top) = image.image_header().metadata.apply_orientation( @@ -183,7 +183,7 @@ impl IWICBitmapDecoder_Impl for JXLWICBitmapDecoder { } let render = decoded.image.render_frame(index as usize).map_err(|err| { - windows::core::Error::new(WINCODEC_ERR_FRAMEMISSING, format!("{:?}", err).as_str()) + windows::core::Error::new(WINCODEC_ERR_FRAMEMISSING, format!("{:?}", err)) })?; let frame_decode = JXLWICBitmapFrameDecode::new( diff --git a/src/properties.rs b/src/properties.rs index 0f35353..d98f4c7 100644 --- a/src/properties.rs +++ b/src/properties.rs @@ -48,7 +48,7 @@ impl IInitializeWithStream_Impl for JXLPropertyStore { let reader = BufReader::new(stream); let image = JxlImage::builder().read(reader).map_err(|err| { - windows::core::Error::new(WINCODEC_ERR_BADIMAGE, format!("{:?}", err).as_str()) + windows::core::Error::new(WINCODEC_ERR_BADIMAGE, format!("{:?}", err)) })?; let (width, height, _left, _top) = image.image_header().metadata.apply_orientation( From 66987d6c8a06ca89c873b76325fffb5a3c4be2bb Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 1 Mar 2024 01:02:59 +0100 Subject: [PATCH 8/8] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6cc5f19..4585b66 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,7 @@ A JPEG XL (*.jxl) WIC decoder to render thumbnails on Windows File Explorer or v 1. Move to your download directory 1. `regsvr32 jxl_winthumb.dll`, or to uninstall, `regsvr32 /u jxl_winthumb.dll`. -You might need to restart `explorer.exe` for the component to work. -You can use this command: `taskkill /f /im explorer.exe && start explorer.exe` +You might need to restart `explorer.exe` or any programs that use the dll before updating it. Get the list of such programs using `tasklist /m jxl_winthumb.dll` and kill them e.g. with `taskkill /f /im explorer.exe && start explorer.exe`. ## Build environment