Skip to content

Commit

Permalink
Merge pull request #108 from skal65535/api_fix
Browse files Browse the repository at this point in the history
small API fix:
  • Loading branch information
skal65535 committed Mar 24, 2021
2 parents b6e44de + dea9a07 commit f19916a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bit_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ template<class T> class Sink : public ByteSink {
return true;
}
virtual bool Finalize() { ptr_->resize(pos_); return true; }
virtual void Reset() { ptr_->clear(); }
virtual void Reset() {
ptr_->clear();
pos_ = 0;
}

protected:
T* const ptr_;
Expand Down
1 change: 1 addition & 0 deletions src/enc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Encoder::Encoder(SjpegYUVMode yuv_mode, int W, int H, ByteSink* const sink)
InitializeStaticPointers();
memset(dc_codes_, 0, sizeof(dc_codes_)); // safety
memset(ac_codes_, 0, sizeof(ac_codes_));
sink->Reset();
}

Encoder::~Encoder() {
Expand Down

0 comments on commit f19916a

Please sign in to comment.