… | |
… | |
97 | |
97 | |
98 | New (0, state, 1, LZF_STATE); |
98 | New (0, state, 1, LZF_STATE); |
99 | if (!state) |
99 | if (!state) |
100 | croak ("Compress::LZF unable to allocate memory for compression state"); |
100 | croak ("Compress::LZF unable to allocate memory for compression state"); |
101 | |
101 | |
102 | if (usize > 1000) perlinterp_release (); |
102 | if (usize > 2000) perlinterp_release (); |
103 | /* 11 bytes is the smallest compressible string */ |
103 | /* 11 bytes is the smallest compressible string */ |
104 | csize = usize < 11 ? 0 : |
104 | csize = usize < 11 ? 0 : |
105 | (best ? lzf_compress_best (src, usize, dst + skip, usize - skip) |
105 | (best ? lzf_compress_best (src, usize, dst + skip, usize - skip) |
106 | : lzf_compress (src, usize, dst + skip, usize - skip, *state)); |
106 | : lzf_compress (src, usize, dst + skip, usize - skip, *state)); |
107 | if (usize > 1000) perlinterp_acquire (); |
107 | if (usize > 2000) perlinterp_acquire (); |
108 | |
108 | |
109 | Safefree (state); |
109 | Safefree (state); |
110 | |
110 | |
111 | if (csize) |
111 | if (csize) |
112 | { |
112 | { |
… | |
… | |
201 | |
201 | |
202 | ret = NEWSV (0, usize); |
202 | ret = NEWSV (0, usize); |
203 | SvPOK_only (ret); |
203 | SvPOK_only (ret); |
204 | dst = SvPVX (ret); |
204 | dst = SvPVX (ret); |
205 | |
205 | |
206 | if (usize > 2000) perlinterp_release (); |
206 | if (usize > 4000) perlinterp_release (); |
207 | res = lzf_decompress (src, csize, dst, usize) != usize; |
207 | res = lzf_decompress (src, csize, dst, usize) != usize; |
208 | if (usize > 2000) perlinterp_acquire (); |
208 | if (usize > 4000) perlinterp_acquire (); |
209 | |
209 | |
210 | if (res) |
210 | if (res) |
211 | { |
211 | { |
212 | SvREFCNT_dec (ret); |
212 | SvREFCNT_dec (ret); |
213 | croak ("compressed data corrupted (size mismatch)", csize, skip, usize); |
213 | croak ("compressed data corrupted (size mismatch)", csize, skip, usize); |