#include <filter.h>
Definition at line 98 of file filter.h.
◆ ZLibInflateFilter()
dart::bin::ZLibInflateFilter::ZLibInflateFilter |
( |
int32_t |
window_bits, |
|
|
uint8_t * |
dictionary, |
|
|
intptr_t |
dictionary_length, |
|
|
bool |
raw |
|
) |
| |
|
inline |
Definition at line 100 of file filter.h.
104 : window_bits_(window_bits),
105 dictionary_(dictionary),
106 dictionary_length_(dictionary_length),
107 raw_(raw),
108 current_buffer_(nullptr) {}
◆ ~ZLibInflateFilter()
dart::bin::ZLibInflateFilter::~ZLibInflateFilter |
( |
| ) |
|
|
virtual |
Definition at line 371 of file filter.cc.
371 {
372 delete[] dictionary_;
373 delete[] current_buffer_;
375 inflateEnd(&stream_);
376 }
377}
◆ Init()
bool dart::bin::ZLibInflateFilter::Init |
( |
| ) |
|
|
virtual |
Implements dart::bin::Filter.
Definition at line 379 of file filter.cc.
379 {
380 int window_bits =
382
383 stream_.next_in = Z_NULL;
384 stream_.avail_in = 0;
385 stream_.zalloc = Z_NULL;
386 stream_.zfree = Z_NULL;
387 stream_.opaque = Z_NULL;
388 int result = inflateInit2(&stream_, window_bits);
390 return false;
391 }
393 return true;
394}
void set_initialized(bool value)
const int kZLibFlagAcceptAnyHeader
◆ Process()
bool dart::bin::ZLibInflateFilter::Process |
( |
uint8_t * |
data, |
|
|
intptr_t |
length |
|
) |
| |
|
virtual |
On a successful call to Process, Process will take ownership of data. On successive calls to either Processed or ~Filter, data will be freed with a delete[] call.
Implements dart::bin::Filter.
Definition at line 396 of file filter.cc.
396 {
397 if (current_buffer_ != nullptr) {
398 return false;
399 }
400 stream_.avail_in =
length;
401 stream_.next_in = current_buffer_ =
data;
402 return true;
403}
static int8_t data[kExtLength]
◆ Processed()
intptr_t dart::bin::ZLibInflateFilter::Processed |
( |
uint8_t * |
buffer, |
|
|
intptr_t |
length, |
|
|
bool |
finish, |
|
|
bool |
end |
|
) |
| |
|
virtual |
Implements dart::bin::Filter.
Definition at line 405 of file filter.cc.
408 {
409 stream_.avail_out =
length;
410 stream_.next_out =
buffer;
412 int v;
413 switch (v = inflate(&stream_,
end ? Z_FINISH
414 : flush ? Z_SYNC_FLUSH
415 : Z_NO_FLUSH)) {
416 case Z_STREAM_END:
417 case Z_BUF_ERROR:
418 case Z_OK: {
419 intptr_t processed =
length - stream_.avail_out;
420 if (processed == 0) {
421 break;
422 }
423 return processed;
424 }
425
426 case Z_NEED_DICT:
427 if (dictionary_ == nullptr) {
429 } else {
431 inflateSetDictionary(&stream_, dictionary_, dictionary_length_);
432 delete[] dictionary_;
433 dictionary_ = nullptr;
435 }
437 break;
438 } else {
440 }
441
442 default:
443 case Z_MEM_ERROR:
444 case Z_DATA_ERROR:
445 case Z_STREAM_ERROR:
447 }
448
449 delete[] current_buffer_;
450 current_buffer_ = nullptr;
451
452 return error ? -1 : 0;
453}
virtual intptr_t Processed(uint8_t *buffer, intptr_t length, bool finish, bool end)
static const uint8_t buffer[]
const uint8_t uint32_t uint32_t GError ** error
The documentation for this class was generated from the following files:
- third_party/dart-lang/sdk/runtime/bin/filter.h
- third_party/dart-lang/sdk/runtime/bin/filter.cc