From: Bastian Dehn Date: Sun, 29 Dec 2024 21:57:15 +0000 (+0100) Subject: fix bw read test allocation one byte to much X-Git-Tag: v1.0.19^2~9 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=1fab9dfc8d70518609c039d9b53870e2061986fe;p=sane-kds-s2000w-net.git fix bw read test allocation one byte to much --- diff --git a/tests/kds_s2000w_net_read_tests.c b/tests/kds_s2000w_net_read_tests.c index 6d04000..58feec8 100644 --- a/tests/kds_s2000w_net_read_tests.c +++ b/tests/kds_s2000w_net_read_tests.c @@ -127,15 +127,15 @@ void sane_kds_s2000w_net_read_test() void sane_kds_s2000w_net_read_bw_test() { handler* h = init_handler(); - h->image->size = 65541; - h->image->data = malloc(sizeof(char) * 65541); + h->image->size = 65540; + h->image->data = malloc(sizeof(char) * 65540); char* imagedata = (char*) h->image->data; imagedata[0] = 'P'; imagedata[1] = '4'; for (int i = 2; i < 4; i++) { imagedata[i] = 0x0a; } - for (int i = 4; i < 65541; i++) { + for (int i = 4; i < 65540; i++) { imagedata[i] = 0xff; } @@ -146,7 +146,7 @@ void sane_kds_s2000w_net_read_bw_test() _sane_kds_s2000w_net_read(h, (void*) dataptr, maxlen, length); assert_int_equal(*length, 65536); - assert_memory_equal(dataptr, h->image->data + 5, 65536); + assert_memory_equal(dataptr, h->image->data + 4, 65536); assert_int_equal(h->read_info->read_size, 65540); free(dataptr);