| 195 | |
| 196 | |
| 197 | bool Unpack::AddFilter(UnpackFilter &Filter) |
| 198 | { |
| 199 | if (Filters.Size()>=MAX_UNPACK_FILTERS) |
| 200 | { |
| 201 | UnpWriteBuf(); // Write data, apply and flush filters. |
| 202 | if (Filters.Size()>=MAX_UNPACK_FILTERS) |
| 203 | InitFilters(); // Still too many filters, prevent excessive memory use. |
| 204 | } |
| 205 | |
| 206 | // If distance to filter start is that large that due to circular dictionary |
| 207 | // mode now it points to old not written yet data, then we set 'NextWindow' |
| 208 | // flag and process this filter only after processing that older data. |
| 209 | Filter.NextWindow=WrPtr!=UnpPtr && ((WrPtr-UnpPtr)&MaxWinMask)<=Filter.BlockStart; |
| 210 | |
| 211 | Filter.BlockStart=uint((Filter.BlockStart+UnpPtr)&MaxWinMask); |
| 212 | Filters.Push(Filter); |
| 213 | return true; |
| 214 | } |
| 215 | |
| 216 | |
| 217 | bool Unpack::UnpReadBuf() |