зеркало из https://github.com/mozilla/sccache.git
chore(src/compiler/msvc): replace rust-encoding with encoding-rs ...
... since former is unmaintained
This commit is contained in:
Родитель
b260af4802
Коммит
556303635a
|
@ -657,70 +657,6 @@ version = "1.9.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "encoding"
|
||||
version = "0.2.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
|
||||
dependencies = [
|
||||
"encoding-index-japanese",
|
||||
"encoding-index-korean",
|
||||
"encoding-index-simpchinese",
|
||||
"encoding-index-singlebyte",
|
||||
"encoding-index-tradchinese",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-japanese"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-korean"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-simpchinese"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-singlebyte"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-tradchinese"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_index_tests"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.33"
|
||||
|
@ -2404,7 +2340,7 @@ dependencies = [
|
|||
"clap",
|
||||
"daemonize",
|
||||
"directories",
|
||||
"encoding",
|
||||
"encoding_rs",
|
||||
"env_logger",
|
||||
"filetime",
|
||||
"flate2",
|
||||
|
|
|
@ -35,7 +35,7 @@ bytes = "1"
|
|||
chrono = "0.4"
|
||||
clap = { version = "4.3.24", features = ["derive", "env", "wrap_help"] }
|
||||
directories = "5.0.1"
|
||||
encoding = "0.2"
|
||||
encoding_rs = "0.8"
|
||||
env_logger = "0.10"
|
||||
filetime = "0.2"
|
||||
flate2 = { version = "1.0", optional = true, default-features = false, features = [
|
||||
|
|
|
@ -1213,13 +1213,16 @@ where
|
|||
let mut buf = Vec::new();
|
||||
reader.read_to_end(&mut buf)?;
|
||||
|
||||
let (result, _) = encoding::decode(
|
||||
&buf,
|
||||
encoding::DecoderTrap::Strict,
|
||||
encoding::all::ISO_8859_1,
|
||||
);
|
||||
let (result, _, has_error) = encoding_rs::WINDOWS_1252.decode(&buf);
|
||||
|
||||
result.map_err(|err| io::Error::new(io::ErrorKind::Other, err.into_owned()))
|
||||
if has_error {
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::InvalidData,
|
||||
"failed to decode text",
|
||||
))
|
||||
} else {
|
||||
Ok(result.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// An iterator over the arguments in a Windows command line.
|
||||
|
@ -2289,9 +2292,12 @@ mod test {
|
|||
.unwrap();
|
||||
let cmd_file_path = td.path().join("foo");
|
||||
{
|
||||
use encoding::{all::UTF_16LE, EncoderTrap::Strict, Encoding};
|
||||
use encoding_rs::UTF_16LE;
|
||||
let mut file = File::create(&cmd_file_path).unwrap();
|
||||
let content = UTF_16LE.encode("-c foo€.c -o foo.o", Strict).unwrap();
|
||||
let (content, _, has_error) = UTF_16LE.encode("-c foo€.c -o foo.o");
|
||||
if has_error {
|
||||
panic!("Failed to encode as UTF-16LE");
|
||||
}
|
||||
file.write_all(&[0xFF, 0xFE]).unwrap(); // little endian BOM
|
||||
file.write_all(&content).unwrap();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче