X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fcrcsync%2Ftest%2Frun-crash.c;h=b187bac401be4f7ce4676aaa6c68c72704bd1d3f;hp=7fb1df4554ffd5754ff3d5214defbcbf9ad9828f;hb=a7f635002edf6af05ecf8b6b5cc121eaaa588c46;hpb=c934a7a21d9ea8aa421d62a65a93f46c95adb535 diff --git a/ccan/crcsync/test/run-crash.c b/ccan/crcsync/test/run-crash.c index 7fb1df45..b187bac4 100644 --- a/ccan/crcsync/test/run-crash.c +++ b/ccan/crcsync/test/run-crash.c @@ -1,8 +1,8 @@ /* This used to crash us on 64-bit; submitted by Alex Wulms */ -#include "crcsync/crcsync.h" -#include "crcsync/crcsync.c" -#include "tap/tap.h" +#include +#include +#include #include #include @@ -11,14 +11,14 @@ typedef struct { int block_count; - unsigned int *crcs; + uint64_t *crcs; } crc_info_t; static void crcblocks(crc_info_t *crc_info, char *data, int datalen, int blocksize) { crc_info->block_count = (datalen+blocksize-1)/blocksize; - crc_info->crcs = malloc(sizeof(unsigned int)*(crc_info->block_count + 1)); - crc_of_blocks(data, datalen, blocksize, 30, crc_info->crcs); + crc_info->crcs = malloc(sizeof(uint64_t)*(crc_info->block_count + 1)); + crc_of_blocks(data, datalen, blocksize, 60, crc_info->crcs); } #define BLOCKSIZE 5 @@ -55,14 +55,14 @@ int main(int argc, char *argv[]) size_t ndigested; size_t offset = 0; size_t len2 = strlen(data2); - size_t finalsize = strlen(data1) % BLOCKSIZE ?: BLOCKSIZE; + size_t tailsize = strlen(data1) % BLOCKSIZE; int expected_i = 0; plan_tests(ARRAY_SIZE(expected) + 2); crcblocks(&crc_info1, data1, strlen(data1), BLOCKSIZE); - crcctx = crc_context_new(BLOCKSIZE, 30, crc_info1.crcs, crc_info1.block_count, - finalsize); + crcctx = crc_context_new(BLOCKSIZE, 60, crc_info1.crcs, crc_info1.block_count, + tailsize); while ( offset < len2) { ndigested = crc_read_block(crcctx, &result, data2+offset, len2 - offset);