Fix sign conversion warnings

This commit is contained in:
vitaut
2016-03-02 07:53:14 -08:00
parent d929fdeb9b
commit 3ecad55910
10 changed files with 44 additions and 28 deletions

View File

@@ -332,8 +332,9 @@ TEST(MemoryBufferTest, Grow) {
void grow(std::size_t size) { Base::grow(size); }
} buffer((Allocator(&alloc)));
buffer.resize(7);
using fmt::internal::to_unsigned;
for (int i = 0; i < 7; ++i)
buffer[i] = i * i;
buffer[to_unsigned(i)] = i * i;
EXPECT_EQ(10u, buffer.capacity());
int mem[20];
mem[7] = 0xdead;
@@ -342,7 +343,7 @@ TEST(MemoryBufferTest, Grow) {
EXPECT_EQ(20u, buffer.capacity());
// Check if size elements have been copied
for (int i = 0; i < 7; ++i)
EXPECT_EQ(i * i, buffer[i]);
EXPECT_EQ(i * i, buffer[to_unsigned(i)]);
// and no more than that.
EXPECT_EQ(0xdead, buffer[7]);
EXPECT_CALL(alloc, deallocate(mem, 20));