Commit 8431fb19 authored by strobe@google.com's avatar strobe@google.com

Make peeking before the head of OffsetByteQueue a hard error.

BUG=
TEST=OffsetByteQueueTest


Review URL: https://chromiumcodereview.appspot.com/10823069

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149293 0039d316-1c4b-4281-b951-d872f2087c98
parent ec78a559
......@@ -37,6 +37,7 @@ void OffsetByteQueue::Pop(int count) {
}
void OffsetByteQueue::PeekAt(int64 offset, const uint8** buf, int* size) {
DCHECK(offset >= head());
if (offset < head() || offset >= tail()) {
*buf = NULL;
*size = 0;
......
......@@ -48,10 +48,6 @@ TEST_F(OffsetByteQueueTest, TestPeekAt) {
const uint8* buf;
int size;
queue_->PeekAt(128, &buf, &size);
EXPECT_EQ(NULL, buf);
EXPECT_EQ(0, size);
queue_->PeekAt(400, &buf, &size);
EXPECT_EQ(queue_->tail() - 400, size);
EXPECT_EQ(400 - 256, buf[0]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment