diff options
author | David Robillard <d@drobilla.net> | 2020-07-17 19:35:53 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-07-17 20:44:52 +0200 |
commit | b50a5872fca8a4086502d7c19e80bc9992782079 (patch) | |
tree | 07a4df6bd59076c7ecf543c0928fdf08a3deb104 /test | |
parent | 0887b4035da053931bee16fafc7800a05f2ce775 (diff) | |
download | raul-b50a5872fca8a4086502d7c19e80bc9992782079.tar.gz raul-b50a5872fca8a4086502d7c19e80bc9992782079.tar.bz2 raul-b50a5872fca8a4086502d7c19e80bc9992782079.zip |
Fix conversion warnings
Diffstat (limited to 'test')
-rw-r--r-- | test/ringbuffer_test.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/ringbuffer_test.cpp b/test/ringbuffer_test.cpp index 519b0c3..709af9e 100644 --- a/test/ringbuffer_test.cpp +++ b/test/ringbuffer_test.cpp @@ -27,7 +27,7 @@ #include <string> #include <thread> -#define MSG_SIZE 20 +#define MSG_SIZE 20u namespace { @@ -41,7 +41,7 @@ struct Context { int gen_msg(int* msg, int start) { - for (int i = 0; i < MSG_SIZE; ++i) { + for (unsigned i = 0u; i < MSG_SIZE; ++i) { msg[i] = start; start = (start + 1) % INT_MAX; } @@ -51,7 +51,7 @@ gen_msg(int* msg, int start) void check_msg(int* msg1, int* msg2) { - for (int i = 0; i < MSG_SIZE; ++i) { + for (unsigned i = 0u; i < MSG_SIZE; ++i) { assert(msg1[i] == msg2[i]); } } @@ -108,20 +108,20 @@ main(int argc, char** argv) Context ctx; - size_t size = 512; + uint32_t size = 512u; if (argc > 1) { - size = std::stoul(argv[1]); + size = static_cast<uint32_t>(std::stoi(argv[1])); } - ctx.n_writes = size * 1024; + ctx.n_writes = size * 1024u; if (argc > 2) { ctx.n_writes = std::stoul(argv[2]); } - printf("Testing %zu writes of %u ints to a %zu int ring...\n", + printf("Testing %zu writes of %u ints to a %u int ring...\n", ctx.n_writes, MSG_SIZE, size); - ctx.ring = std::unique_ptr<RingBuffer>(new RingBuffer(uint32_t(size))); + ctx.ring = std::unique_ptr<RingBuffer>(new RingBuffer(size)); auto& ring = ctx.ring; assert(ring->capacity() >= size - 1); |