diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-01-21 14:32:27 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-01-21 14:32:27 +0100 |
| commit | 507a3936aa2f7a32f7f45c13734ffbe0ed4a2078 (patch) | |
| tree | 40b83de62173e3112a0a6fe35ba66a517cef4894 /sax/src/sax_processor.cc | |
| parent | 7dd49c6293172b494c78918507242cdb55d35137 (diff) | |
Diffstat (limited to 'sax/src/sax_processor.cc')
| -rw-r--r-- | sax/src/sax_processor.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sax/src/sax_processor.cc b/sax/src/sax_processor.cc index afc9d3b..2b627e0 100644 --- a/sax/src/sax_processor.cc +++ b/sax/src/sax_processor.cc @@ -1,7 +1,5 @@ #include "sax_processor.hh" -#include <iostream> - #include "buffer.hh" #include "guessing_decoder.hh" #include "processor.hh" @@ -304,7 +302,6 @@ class ProcessorImpl : public Processor { while (true) { if (cmds_.empty()) { if (!buffer_->empty()) { - std::cerr << make_string_view(buffer_->rspan()) << std::endl; delegate_->error("Extra data at end"); } return consumed; @@ -430,7 +427,8 @@ class ProcessorImpl : public Processor { std::size_t tmp = offset; auto wspan = buffer_->wspan(4); - switch (decoder_->decode(data, tmp, wspan, consumed)) { + std::size_t wrote = 0; + switch (decoder_->decode(data, tmp, wspan, wrote)) { case Decoder::State::GOOD: break; case Decoder::State::NEED_MORE: @@ -439,7 +437,8 @@ class ProcessorImpl : public Processor { delegate_->error("Invalid data"); return Process::ERROR; } - buffer_->commit(consumed); + buffer_->commit(wrote); + consumed = tmp - offset; return Process::CONTINUE; } |
