Commit 20c01390 by Jamie Madill

Fix FastVector::resize when count < size.

Also update a test to trigger the bug. Bug: angleproject:2763 Change-Id: I8e6735320a34dcc4cc8beee1b7a22b768912f24f Reviewed-on: https://chromium-review.googlesource.com/1234338Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent dbce1f89
...@@ -366,8 +366,8 @@ void FastVector<T, N, Storage>::resize(size_type count, const value_type &value) ...@@ -366,8 +366,8 @@ void FastVector<T, N, Storage>::resize(size_type count, const value_type &value)
if (count > mSize) if (count > mSize)
{ {
ensure_capacity(count); ensure_capacity(count);
std::fill(mData + mSize, mData + count, value);
} }
std::fill(mData + mSize, mData + count, value);
mSize = count; mSize = count;
} }
......
...@@ -181,7 +181,7 @@ TEST(FastVector, Resize) ...@@ -181,7 +181,7 @@ TEST(FastVector, Resize)
} }
// Resize back to smaller // Resize back to smaller
vec.resize(2u); vec.resize(2u, 2);
EXPECT_EQ(2u, vec.size()); EXPECT_EQ(2u, vec.size());
} }
......
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