File: replace-rle-decode-fast.patch

package info (click to toggle)
rust-libflate-lz77 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 132 kB
  • sloc: makefile: 4
file content (30 lines) | stat: -rw-r--r-- 834 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
Description: Replace rle-decode-fast with std provided function
 as suggested by that crate itself.
Last-Update: 2024-10-13
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,3 +12,2 @@
 use core2::io;
-use rle_decode_fast::rle_decode;
 
@@ -188,7 +187,8 @@
                 }
-                rle_decode(
-                    &mut self.buffer,
-                    usize::from(backward_distance),
-                    usize::from(length),
-                );
+				let old_len = self.buffer.len();
+				let target_len = old_len + length as usize;
+				while self.buffer.len() < target_len {
+					self.buffer.extend_from_within(old_len - backward_distance as usize..old_len);
+				}
+				self.buffer.truncate(target_len);
             }
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,4 +32,2 @@
 
-[dependencies.rle-decode-fast]
-version = "1.0.0"