Skip to content

Conversation

@RangelReale
Copy link

If you read directly from the source after using bitreader, some bytes may have been "lost"

…you read directly from the source after using bitreader, some bytes may have been "lost"
@32bitkid
Copy link
Owner

I'll have to think about this a little bit more. The BitReader can be greedy, which can be good for a bunch of small incremental reads. However, yea, accessing the underlying reader may not put you in the spot you think you are.

The intended work-around was that BitReader itself implements io.Reader, which will the read buffer into account when reading larger chunks of data, rather than accessing the underlying data source directly.

My hesitation here is the specific usage of make() inside this method, which can potentially be called a lot.

@RangelReale
Copy link
Author

This is the code that had trouble for me, I was reading an .swf file header, and there is a "Rect" structure that uses variable number of bits, but there is more data to be read after this.

https://github.com/RangelReale/swfinfo/blob/master/types.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants