From 510a7471348788fccba6b7c4b9f7b7cc9aee6ba9 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 21 Apr 2025 14:33:01 +0200 Subject: Always use unsigned char * for data buffers Before this commit I was inconsistently using one of void *, char * and uint8_t *. --- test/090_tables_readwrite/tables_readwrite_tests.c | 6 +++--- test/100_gendata_cocsep/gendata_cocsep_tests.c | 6 +++--- test/101_cocsep_transform_invariant/cocsep_transform_invariant.c | 4 ++-- test/102_cocsep_selfsim/cocsep_selfsim_tests.c | 6 +++--- .../cocsep_selfsim_distribution_tests.c | 4 ++-- test/104_cocsep_ttrep/cocsep_ttrep_tests.c | 4 ++-- test/105_gendata_eoesep/gendata_eoesep_tests.c | 6 +++--- test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c | 6 +++--- test/112_gendata_h48short/gendata_h48short_tests.c | 4 ++-- test/120_gendata_eo/gendata_eo_tests.c | 6 +++--- test/121_coorddata_dr/coorddata_dr.c | 8 ++++---- test/122_coorddata_dreo/coorddata_dreo.c | 8 ++++---- 12 files changed, 34 insertions(+), 34 deletions(-) (limited to 'test') diff --git a/test/090_tables_readwrite/tables_readwrite_tests.c b/test/090_tables_readwrite/tables_readwrite_tests.c index 01c1172..3306dd6 100644 --- a/test/090_tables_readwrite/tables_readwrite_tests.c +++ b/test/090_tables_readwrite/tables_readwrite_tests.c @@ -1,7 +1,7 @@ #include "../test.h" -bool readtableinfo(uint64_t, const char *, tableinfo_t *); -bool writetableinfo(const tableinfo_t *, uint64_t, char *); +bool readtableinfo(uint64_t, const unsigned char *, tableinfo_t *); +bool writetableinfo(const tableinfo_t *, uint64_t, unsigned char *); uint64_t readn(void) { char str[STRLENMAX]; @@ -66,7 +66,7 @@ void test_writeinfo(tableinfo_t info) { } void run(void) { - char buf[INFOSIZE]; + unsigned char buf[INFOSIZE]; tableinfo_t expected, actual; expected = test_readinfo(); diff --git a/test/100_gendata_cocsep/gendata_cocsep_tests.c b/test/100_gendata_cocsep/gendata_cocsep_tests.c index 91ebb52..46b9443 100644 --- a/test/100_gendata_cocsep/gendata_cocsep_tests.c +++ b/test/100_gendata_cocsep/gendata_cocsep_tests.c @@ -2,11 +2,11 @@ #define BUF_SIZE 2000000 -size_t gendata_cocsep(void *, uint64_t *, cube_t *); -bool readtableinfo(uint64_t, const char *, tableinfo_t *); +size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); +bool readtableinfo(uint64_t, const unsigned char *, tableinfo_t *); void run(void) { - char buf[BUF_SIZE]; + unsigned char buf[BUF_SIZE]; uint32_t i; uint64_t selfsim[COCSEP_CLASSES]; cube_t rep[COCSEP_CLASSES]; diff --git a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c index 853586a..b5a74b0 100644 --- a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c +++ b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c @@ -1,12 +1,12 @@ #include "../test.h" -size_t gendata_cocsep(void *, uint64_t *, cube_t *); +size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); cube_t transform(cube_t, uint8_t); int64_t coord_cocsep(cube_t); void run(void) { uint8_t t; - char buf[2000000]; + unsigned char buf[2000000]; uint32_t *cocsepdata; uint64_t selfsim[COCSEP_CLASSES]; int64_t coord, tcoord; diff --git a/test/102_cocsep_selfsim/cocsep_selfsim_tests.c b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c index dd778aa..0ead3b4 100644 --- a/test/102_cocsep_selfsim/cocsep_selfsim_tests.c +++ b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c @@ -7,19 +7,19 @@ */ #include "../test.h" -size_t gendata_cocsep(void *, uint64_t *, cube_t *); +size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); int64_t coord_cocsep(cube_t); void run(void) { char str[STRLENMAX]; - char buf[2000000]; + unsigned char buf[2000000]; uint32_t *cocsepdata, data; int64_t coord, coclass; uint64_t selfsim[COCSEP_CLASSES], sim, t; cube_t cube, rep[COCSEP_CLASSES]; gendata_cocsep(buf, selfsim, rep); - cocsepdata = (uint32_t *)((char *)buf + INFOSIZE); + cocsepdata = (uint32_t *)(buf + INFOSIZE); /* All cases in the same test so we do not generate data many times */ diff --git a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c index a907317..90208eb 100644 --- a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c +++ b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c @@ -1,6 +1,6 @@ #include "../test.h" -size_t gendata_cocsep(void *, uint64_t *, cube_t *); +size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); int64_t coord_cocsep(cube_t); int bcount(uint64_t x) { @@ -15,7 +15,7 @@ int bcount(uint64_t x) { } void run(void) { - char buf[2000000]; + unsigned char buf[2000000]; int size[65], tot, j; uint64_t i, selfsim[COCSEP_CLASSES], sim; cube_t rep[COCSEP_CLASSES]; diff --git a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c index 0b853c3..87975a4 100644 --- a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c +++ b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c @@ -3,11 +3,11 @@ uint8_t inverse_trans(uint8_t); cube_t transform_corners(cube_t, uint8_t); int64_t coord_cocsep(cube_t); -size_t gendata_cocsep(void *, uint64_t *, cube_t *); +size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); void run(void) { uint8_t t; - char buf[2000000]; + unsigned char buf[2000000]; uint32_t *cocsepdata, tt; uint64_t i, selfsim[COCSEP_CLASSES]; int64_t j, k, l; diff --git a/test/105_gendata_eoesep/gendata_eoesep_tests.c b/test/105_gendata_eoesep/gendata_eoesep_tests.c index 62c36bc..0c22d7f 100644 --- a/test/105_gendata_eoesep/gendata_eoesep_tests.c +++ b/test/105_gendata_eoesep/gendata_eoesep_tests.c @@ -23,10 +23,10 @@ The test does not generate the full table. For reference, these are the values: #define ISIZE 512 #define FULLSIZE (ISIZE + (CL*1024) + (4*EMAX)) -char buf[FULLSIZE]; +unsigned char buf[FULLSIZE]; -size_t gendata_eoesep(char [static FULLSIZE], uint8_t); -bool readtableinfo(uint64_t, const char *, tableinfo_t *); +size_t gendata_eoesep(unsigned char [static FULLSIZE], uint8_t); +bool readtableinfo(uint64_t, const unsigned char *, tableinfo_t *); void run(void) { uint32_t i; diff --git a/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c index 025ff2b..fdc4619 100644 --- a/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c +++ b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c @@ -1,6 +1,6 @@ #include "../test.h" -size_t gendata_cocsep(void *, uint64_t *, cube_t *); +size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); int64_t coord_h48(cube_t, const uint32_t *, uint8_t); cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); cube_t transform(cube_t, uint8_t); @@ -10,14 +10,14 @@ void run(void) { int i; bool found; uint8_t h, t; - char buf[2000000]; + unsigned char buf[2000000]; uint32_t *cocsepdata; uint64_t selfsim[COCSEP_CLASSES]; int64_t c, cc; cube_t cube, invc, rep[COCSEP_CLASSES]; gendata_cocsep(buf, selfsim, rep); - cocsepdata = (uint32_t *)((char *)buf + INFOSIZE); + cocsepdata = (uint32_t *)(buf + INFOSIZE); i = 1; h = 11; diff --git a/test/112_gendata_h48short/gendata_h48short_tests.c b/test/112_gendata_h48short/gendata_h48short_tests.c index 2ed42c1..0de9408 100644 --- a/test/112_gendata_h48short/gendata_h48short_tests.c +++ b/test/112_gendata_h48short/gendata_h48short_tests.c @@ -5,7 +5,7 @@ void h48map_create(h48map_t [static 1], uint64_t, uint64_t); void h48map_destroy(h48map_t [static 1]); kvpair_t h48map_nextkvpair(h48map_t [static 1], uint64_t [static 1]); -size_t gendata_cocsep(void *, uint64_t *, cube_t *); +size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); uint64_t gendata_h48short(gendata_h48short_arg_t [static 1]); char str[STRLENMAX]; @@ -25,7 +25,7 @@ uint64_t readl(void) { } void run(void) { - char buf[2000000]; + unsigned char buf[2000000]; h48map_t map; uint64_t i, j, capacity, randomizer, selfsim[COCSEP_CLASSES]; kvpair_t kv, b[MAXPOS]; diff --git a/test/120_gendata_eo/gendata_eo_tests.c b/test/120_gendata_eo/gendata_eo_tests.c index 46a0606..08c495e 100644 --- a/test/120_gendata_eo/gendata_eo_tests.c +++ b/test/120_gendata_eo/gendata_eo_tests.c @@ -15,10 +15,10 @@ Pruning table values (from nissy): #define ISIZE 512 #define FULLSIZE (ISIZE + 1024) -char buf[FULLSIZE]; +unsigned char buf[FULLSIZE]; -size_t gendata_coord_dispatch(const char *, void *); -bool readtableinfo(uint64_t, const char *, tableinfo_t *); +size_t gendata_coord_dispatch(const char *, unsigned char *); +bool readtableinfo(uint64_t, const unsigned char *, tableinfo_t *); void run(void) { uint32_t i; diff --git a/test/121_coorddata_dr/coorddata_dr.c b/test/121_coorddata_dr/coorddata_dr.c index 707d605..9432b4c 100644 --- a/test/121_coorddata_dr/coorddata_dr.c +++ b/test/121_coorddata_dr/coorddata_dr.c @@ -5,15 +5,15 @@ #define TGROUP UINT64_C(4278190335) cube_t transform(cube_t, uint8_t); -uint64_t coordinate_dr_coord(cube_t, const void *); -cube_t coordinate_dr_cube(uint64_t, const void *); -uint64_t coordinate_dr_gendata(void *); +uint64_t coordinate_dr_coord(cube_t, const unsigned char *); +cube_t coordinate_dr_cube(uint64_t, const unsigned char *); +uint64_t coordinate_dr_gendata(unsigned char *); void run(void) { bool found; uint64_t t; char str[STRLENMAX]; - void *data; + unsigned char *data; size_t size; cube_t cube; uint64_t coord, coord2; diff --git a/test/122_coorddata_dreo/coorddata_dreo.c b/test/122_coorddata_dreo/coorddata_dreo.c index 0c75c5e..5c1e796 100644 --- a/test/122_coorddata_dreo/coorddata_dreo.c +++ b/test/122_coorddata_dreo/coorddata_dreo.c @@ -5,15 +5,15 @@ #define TGROUP UINT64_C(4278190335) cube_t transform(cube_t, uint8_t); -uint64_t coordinate_dreo_coord(cube_t, const void *); -cube_t coordinate_dreo_cube(uint64_t, const void *); -uint64_t coordinate_dreo_gendata(void *); +uint64_t coordinate_dreo_coord(cube_t, const unsigned char *); +cube_t coordinate_dreo_cube(uint64_t, const unsigned char *); +uint64_t coordinate_dreo_gendata(unsigned char *); void run(void) { bool found; uint64_t t; char str[STRLENMAX]; - void *data; + unsigned char *data; size_t size; cube_t cube; uint64_t coord, coord2; -- cgit v1.3