remove br->error_ field

it's somewhat redundant with br->eos_

also make the status-check coherent.

Change-Id: I98e755e037d45acb0760baf2344bf11fb5fb5cda
This commit is contained in:
skal
2014-09-23 00:04:58 -07:00
parent 38128cb9df
commit 248f3aed22
3 changed files with 13 additions and 20 deletions

View File

@ -136,7 +136,6 @@ void VP8LInitBitReader(VP8LBitReader* const br, const uint8_t* const start,
br->val_ = 0;
br->bit_pos_ = 0;
br->eos_ = 0;
br->error_ = 0;
if (length > sizeof(br->val_)) {
length = sizeof(br->val_);
@ -157,8 +156,7 @@ void VP8LBitReaderSetBuffer(VP8LBitReader* const br,
br->buf_ = buf;
br->len_ = len;
// pos_ > len_ should be considered a param error.
br->error_ = (br->pos_ > br->len_);
br->eos_ = br->error_ || VP8LIsEndOfStream(br);
br->eos_ = (br->pos_ > br->len_) || VP8LIsEndOfStream(br);
}
// If not at EOS, reload up to VP8L_LBITS byte-by-byte
@ -202,7 +200,7 @@ uint32_t VP8LReadBits(VP8LBitReader* const br, int n_bits) {
ShiftBytes(br);
return val;
} else {
br->error_ = 1;
br->eos_ = 1;
return 0;
}
}

View File

@ -118,8 +118,7 @@ typedef struct {
size_t len_; // buffer length
size_t pos_; // byte position in buf_
int bit_pos_; // current bit-reading position in val_
int eos_; // bitstream is finished
int error_; // an error occurred (buffer overflow attempt...)
int eos_; // true if a bit was read past the end of buffer
} VP8LBitReader;
void VP8LInitBitReader(VP8LBitReader* const br,