Sun, 01 May 2022 11:46:54 +0200
#170 no bug never existed
src/buffer.c | file | annotate | diff | comparison | revisions | |
test/test_buffer.cpp | file | annotate | diff | comparison | revisions |
--- a/src/buffer.c Sun May 01 11:44:23 2022 +0200 +++ b/src/buffer.c Sun May 01 11:46:54 2022 +0200 @@ -167,7 +167,6 @@ // truncate data to be written, if we can neither extend nor flush len = buffer->capacity - buffer->pos; if (size > 1) { - // TODO: this is bugged - it would only discard one element and not as many as required len -= len % size; } nitems = len / size;
--- a/test/test_buffer.cpp Sun May 01 11:44:23 2022 +0200 +++ b/test/test_buffer.cpp Sun May 01 11:46:54 2022 +0200 @@ -362,11 +362,11 @@ } TEST_F(BufferWrite, MultibyteDiscard) { - const char *data = "tester"; + const char *data = "testing"; ASSERT_EQ(buf.capacity, 8); ASSERT_EQ(buf.size, 4); buf.pos = 3; - size_t written = cxBufferWrite(data, 2, 3, &buf); + size_t written = cxBufferWrite(data, 2, 4, &buf); // remember: whole elements are discarded if they do not fit EXPECT_EQ(written, 2); EXPECT_EQ(buf.size, 7);