]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
fix bw read test allocation one byte to much
authorBastian Dehn <hhaalo@arcor.de>
Sun, 29 Dec 2024 21:57:15 +0000 (22:57 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 29 Dec 2024 21:57:15 +0000 (22:57 +0100)
tests/kds_s2000w_net_read_tests.c

index 6d040007073ef18b05c79a9a851672254cff57d6..58feec875312a498a6453b6caba4337d022b2b97 100644 (file)
@@ -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);