Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix buffer size to ensure
  • Loading branch information
xerial committed Apr 8, 2015
commit b15e18fd761869227926031d46de15f2ecf2a1d2
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ public String unpackString() throws IOException {
decodeBuffer.clear();
StringBuilder sb = new StringBuilder();
while(cursor < strLen) {
if (!ensure(strLen))
if (!ensure(strLen-cursor))
throw new EOFException();

int readLen = Math.min(buffer.size() - position, strLen-cursor);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure(int byteSizeToRead) looks to guarantee to prepare a buffer requested as byteSizeToRead. So readLen should be simply strLen - cursor? If so, maybe we can remove the outer loop.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like so. i'll remove it

Expand Down