@@ -126,18 +126,21 @@ impl File {
126
126
let offset: usize = data_offset. try_into ( ) . expect ( "offset representable by machine" ) ;
127
127
assert ! ( offset < self . data. len( ) , "entry offset out of bounds" ) ;
128
128
129
- use std:: cell:: RefCell ;
130
- thread_local ! {
131
- pub static INFLATE : RefCell <zlib:: Inflate > = RefCell :: new( zlib:: Inflate :: default ( ) ) ;
132
- }
133
- INFLATE . with ( |inflate| {
134
- let mut inflate = inflate. borrow_mut ( ) ;
135
- let res = inflate
136
- . once ( & self . data [ offset..] , out)
137
- . map ( |( _status, consumed_in, _consumed_out) | consumed_in) ;
138
- inflate. reset ( ) ;
139
- res
140
- } )
129
+ // use std::cell::RefCell;
130
+ // thread_local! {
131
+ // pub static INFLATE: RefCell<zlib::Inflate> = RefCell::new(zlib::Inflate::default());
132
+ // }
133
+ // INFLATE.with(|inflate| {
134
+ // let mut inflate = inflate.borrow_mut();
135
+ // let res = inflate
136
+ // .once(&self.data[offset..], out)
137
+ // .map(|(_status, consumed_in, _consumed_out)| consumed_in);
138
+ // inflate.reset();
139
+ // res
140
+ // })
141
+ zlib:: Inflate :: default ( )
142
+ . once ( & self . data [ offset..] , out)
143
+ . map ( |( _status, consumed_in, _consumed_out) | consumed_in)
141
144
}
142
145
143
146
/// Like `decompress_entry_from_data_offset`, but returns consumed input and output.
@@ -149,19 +152,23 @@ impl File {
149
152
let offset: usize = data_offset. try_into ( ) . expect ( "offset representable by machine" ) ;
150
153
assert ! ( offset < self . data. len( ) , "entry offset out of bounds" ) ;
151
154
152
- use std:: cell:: RefCell ;
153
- thread_local ! {
154
- pub static INFLATE : RefCell <zlib:: Inflate > = RefCell :: new( zlib:: Inflate :: default ( ) ) ;
155
- }
156
-
157
- INFLATE . with ( |inflate| {
158
- let mut inflate = inflate. borrow_mut ( ) ;
159
- let res = inflate
160
- . once ( & self . data [ offset..] , out)
161
- . map ( |( _status, consumed_in, consumed_out) | ( consumed_in, consumed_out) ) ;
162
- inflate. reset ( ) ;
163
- res
164
- } )
155
+ // TODO: put this back in once we know that zlib-ng doesn't fail once in a million times (see tree-traversal)
156
+ // use std::cell::RefCell;
157
+ // thread_local! {
158
+ // pub static INFLATE: RefCell<zlib::Inflate> = RefCell::new(zlib::Inflate::default());
159
+ // }
160
+ //
161
+ // INFLATE.with(|inflate| {
162
+ // let mut inflate = inflate.borrow_mut();
163
+ // let res = inflate
164
+ // .once(&self.data[offset..], out)
165
+ // .map(|(_status, consumed_in, consumed_out)| (consumed_in, consumed_out));
166
+ // inflate.reset();
167
+ // res
168
+ // })
169
+ zlib:: Inflate :: default ( )
170
+ . once ( & self . data [ offset..] , out)
171
+ . map ( |( _status, consumed_in, consumed_out) | ( consumed_in, consumed_out) )
165
172
}
166
173
167
174
/// Decode an entry, resolving delta's as needed, while growing the `out` vector if there is not enough
0 commit comments