summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt36
-rw-r--r--test/array_encoders_test.c14
-rw-r--r--test/array_test.c50
-rw-r--r--test/bad_inputs_test.c20
-rw-r--r--test/bytestring_encoders_test.c6
-rw-r--r--test/bytestring_test.c46
-rw-r--r--test/callbacks_test.c26
-rw-r--r--test/cbor_serialize_test.c272
-rw-r--r--test/cbor_stream_decode_test.c110
-rw-r--r--test/copy_test.c67
-rw-r--r--test/float_ctrl_encoders_test.c34
-rw-r--r--test/float_ctrl_test.c20
-rw-r--r--test/fuzz_test.c12
-rw-r--r--test/map_encoders_test.c6
-rw-r--r--test/map_test.c60
-rw-r--r--test/memory_utils_test.c10
-rw-r--r--test/negint_encoders_test.c12
-rw-r--r--test/negint_test.c14
-rw-r--r--test/pretty_printer_test.c64
-rw-r--r--test/stack_over_limit_test.c8
-rw-r--r--test/stream_expectations.c50
-rw-r--r--test/stream_expectations.h50
-rw-r--r--test/string_encoders_test.c6
-rw-r--r--test/string_test.c62
-rw-r--r--test/tag_encoders_test.c4
-rw-r--r--test/tag_test.c36
-rw-r--r--test/test_allocator.c16
-rw-r--r--test/test_allocator.h8
-rw-r--r--test/uint_encoders_test.c12
-rw-r--r--test/uint_test.c22
-rw-r--r--test/unicode_test.c4
31 files changed, 572 insertions, 585 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 9721fd03a166..626266aeba90 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -6,26 +6,22 @@ message(STATUS "CMocka vars: ${CMOCKA_LIBRARIES} ${CMOCKA_INCLUDE_DIR}")
find_library(MATH_LIBRARY m)
-CHECK_INCLUDE_FILE("execinfo.h" HAS_EXECINFO)
+check_include_file("execinfo.h" HAS_EXECINFO)
-foreach (TEST ${TESTS})
- string(REGEX REPLACE ".*/([^/]+).c" "\\1" NAME ${TEST})
- message("Adding test ${NAME}")
- add_executable(${NAME} "${NAME}.c" assertions.c stream_expectations.c test_allocator.c)
- target_link_libraries(${NAME} ${CMOCKA_LIBRARIES})
- target_link_libraries(${NAME} cbor)
- if(MATH_LIBRARY)
- target_link_libraries(${NAME} ${MATH_LIBRARY})
- endif()
- target_include_directories(${NAME} PUBLIC ${CMOCKA_INCLUDE_DIR})
- # See https://stackoverflow.com/a/10824578/499521
- ADD_TEST(ctest_build_test_${NAME}
- "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${NAME})
- ADD_TEST(ctest_run_${NAME} ${NAME})
- SET_TESTS_PROPERTIES(ctest_run_${NAME}
- PROPERTIES DEPENDS ctest_build_test_${NAME})
- add_dependencies(coverage ${NAME})
-endforeach (TEST)
+foreach(test_file ${TESTS})
+ string(REGEX REPLACE ".*/([^/]+).c" "\\1" NAME ${test_file})
+ message("Adding test ${NAME}")
+ add_executable(${NAME} "${NAME}.c" assertions.c stream_expectations.c
+ test_allocator.c)
+ target_link_libraries(${NAME} ${CMOCKA_LIBRARIES})
+ target_link_libraries(${NAME} cbor)
+ if(MATH_LIBRARY)
+ target_link_libraries(${NAME} ${MATH_LIBRARY})
+ endif()
+ target_include_directories(${NAME} PUBLIC ${CMOCKA_INCLUDE_DIR})
+ add_test(NAME ${NAME} COMMAND ${NAME})
+ add_dependencies(coverage ${NAME})
+endforeach()
add_executable(cpp_linkage_test cpp_linkage_test.cpp)
-target_link_libraries(cpp_linkage_test cbor) \ No newline at end of file
+target_link_libraries(cpp_linkage_test cbor)
diff --git a/test/array_encoders_test.c b/test/array_encoders_test.c
index 54a28bd94c6b..baab0d54ff57 100644
--- a/test/array_encoders_test.c
+++ b/test/array_encoders_test.c
@@ -10,27 +10,27 @@
unsigned char buffer[512];
-static void test_embedded_array_start(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_array_start(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_array_start(1, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x81}), 1);
}
-static void test_array_start(void **_CBOR_UNUSED(_state)) {
+static void test_array_start(void** _state _CBOR_UNUSED) {
assert_size_equal(5, cbor_encode_array_start(1000000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x9A, 0x00, 0x0F, 0x42, 0x40}),
5);
}
-static void test_indef_array_start(void **_CBOR_UNUSED(_state)) {
+static void test_indef_array_start(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_indef_array_start(buffer, 512));
assert_size_equal(0, cbor_encode_indef_array_start(buffer, 0));
assert_memory_equal(buffer, ((unsigned char[]){0x9F}), 1);
}
-static void test_indef_array_encoding(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *array = cbor_new_indefinite_array();
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *two = cbor_build_uint8(2);
+static void test_indef_array_encoding(void** _state _CBOR_UNUSED) {
+ cbor_item_t* array = cbor_new_indefinite_array();
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* two = cbor_build_uint8(2);
assert_true(cbor_array_push(array, one));
assert_true(cbor_array_push(array, two));
diff --git a/test/array_test.c b/test/array_test.c
index 1a241c051f2c..20e51eea6d79 100644
--- a/test/array_test.c
+++ b/test/array_test.c
@@ -9,12 +9,12 @@
#include "cbor.h"
#include "test_allocator.h"
-cbor_item_t *arr;
+cbor_item_t* arr;
struct cbor_load_result res;
unsigned char data1[] = {0x80, 0xFF};
-static void test_empty_array(void **_CBOR_UNUSED(_state)) {
+static void test_empty_array(void** _state _CBOR_UNUSED) {
arr = cbor_load(data1, 2, &res);
assert_non_null(arr);
assert_true(cbor_typeof(arr) == CBOR_TYPE_ARRAY);
@@ -27,7 +27,7 @@ static void test_empty_array(void **_CBOR_UNUSED(_state)) {
unsigned char data2[] = {0x81, 0x01, 0xFF};
-static void test_simple_array(void **_CBOR_UNUSED(_state)) {
+static void test_simple_array(void** _state _CBOR_UNUSED) {
arr = cbor_load(data2, 3, &res);
assert_non_null(arr);
assert_true(cbor_typeof(arr) == CBOR_TYPE_ARRAY);
@@ -37,10 +37,10 @@ static void test_simple_array(void **_CBOR_UNUSED(_state)) {
assert_size_equal(cbor_array_allocated(arr), 1);
/* Check the values */
assert_uint8(cbor_array_handle(arr)[0], 1);
- cbor_item_t *intermediate = cbor_array_get(arr, 0);
+ cbor_item_t* intermediate = cbor_array_get(arr, 0);
assert_uint8(intermediate, 1);
- cbor_item_t *new_val = cbor_build_uint8(10);
+ cbor_item_t* new_val = cbor_build_uint8(10);
assert_false(cbor_array_set(arr, 1, new_val));
assert_false(cbor_array_set(arr, 3, new_val));
cbor_decref(&new_val);
@@ -53,7 +53,7 @@ static void test_simple_array(void **_CBOR_UNUSED(_state)) {
unsigned char data3[] = {0x82, 0x01, 0x81, 0x01, 0xFF};
-static void test_nested_arrays(void **_CBOR_UNUSED(_state)) {
+static void test_nested_arrays(void** _state _CBOR_UNUSED) {
arr = cbor_load(data3, 5, &res);
assert_non_null(arr);
assert_true(cbor_typeof(arr) == CBOR_TYPE_ARRAY);
@@ -63,7 +63,7 @@ static void test_nested_arrays(void **_CBOR_UNUSED(_state)) {
/* Check the values */
assert_uint8(cbor_array_handle(arr)[0], 1);
- cbor_item_t *nested = cbor_array_handle(arr)[1];
+ cbor_item_t* nested = cbor_array_handle(arr)[1];
assert_true(cbor_isa_array(nested));
assert_true(cbor_array_size(nested) == 1);
assert_uint8(cbor_array_handle(nested)[0], 1);
@@ -74,7 +74,7 @@ static void test_nested_arrays(void **_CBOR_UNUSED(_state)) {
unsigned char test_indef_arrays_data[] = {0x9f, 0x01, 0x02, 0xFF};
-static void test_indef_arrays(void **_CBOR_UNUSED(_state)) {
+static void test_indef_arrays(void** _state _CBOR_UNUSED) {
arr = cbor_load(test_indef_arrays_data, 4, &res);
assert_non_null(arr);
assert_true(cbor_typeof(arr) == CBOR_TYPE_ARRAY);
@@ -94,7 +94,7 @@ static void test_indef_arrays(void **_CBOR_UNUSED(_state)) {
unsigned char test_nested_indef_arrays_data[] = {0x9f, 0x01, 0x9f, 0x02,
0xFF, 0x03, 0xFF};
-static void test_nested_indef_arrays(void **_CBOR_UNUSED(_state)) {
+static void test_nested_indef_arrays(void** _state _CBOR_UNUSED) {
arr = cbor_load(test_nested_indef_arrays_data, 7, &res);
assert_non_null(arr);
assert_true(cbor_typeof(arr) == CBOR_TYPE_ARRAY);
@@ -104,7 +104,7 @@ static void test_nested_indef_arrays(void **_CBOR_UNUSED(_state)) {
/* Check the values */
assert_uint8(cbor_array_handle(arr)[0], 1);
- cbor_item_t *nested = cbor_array_handle(arr)[1];
+ cbor_item_t* nested = cbor_array_handle(arr)[1];
assert_true(cbor_isa_array(nested));
assert_true(cbor_array_size(nested) == 1);
assert_uint8(cbor_array_handle(nested)[0], 2);
@@ -113,11 +113,11 @@ static void test_nested_indef_arrays(void **_CBOR_UNUSED(_state)) {
assert_null(arr);
}
-static void test_array_replace(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *array = cbor_new_definite_array(2);
+static void test_array_replace(void** _state _CBOR_UNUSED) {
+ cbor_item_t* array = cbor_new_definite_array(2);
assert_size_equal(cbor_array_size(array), 0);
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *three = cbor_build_uint8(3);
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* three = cbor_build_uint8(3);
assert_size_equal(cbor_refcount(one), 1);
assert_size_equal(cbor_refcount(three), 1);
@@ -147,11 +147,11 @@ static void test_array_replace(void **_CBOR_UNUSED(_state)) {
cbor_decref(&array);
}
-static void test_array_push_overflow(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *array = cbor_new_indefinite_array();
- cbor_item_t *one = cbor_build_uint8(1);
- struct _cbor_array_metadata *metadata =
- (struct _cbor_array_metadata *)&array->metadata;
+static void test_array_push_overflow(void** _state _CBOR_UNUSED) {
+ cbor_item_t* array = cbor_new_indefinite_array();
+ cbor_item_t* one = cbor_build_uint8(1);
+ struct _cbor_array_metadata* metadata =
+ (struct _cbor_array_metadata*)&array->metadata;
// Pretend we already have a huge block allocated
metadata->allocated = SIZE_MAX;
metadata->end_ptr = SIZE_MAX;
@@ -165,7 +165,7 @@ static void test_array_push_overflow(void **_CBOR_UNUSED(_state)) {
cbor_decref(&array);
}
-static void test_array_creation(void **_CBOR_UNUSED(_state)) {
+static void test_array_creation(void** _state _CBOR_UNUSED) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_definite_array(42)); });
WITH_MOCK_MALLOC({ assert_null(cbor_new_definite_array(42)); }, 2, MALLOC,
MALLOC_FAIL);
@@ -173,11 +173,11 @@ static void test_array_creation(void **_CBOR_UNUSED(_state)) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_indefinite_array()); });
}
-static void test_array_push(void **_CBOR_UNUSED(_state)) {
+static void test_array_push(void** _state _CBOR_UNUSED) {
WITH_MOCK_MALLOC(
{
- cbor_item_t *array = cbor_new_indefinite_array();
- cbor_item_t *string = cbor_build_string("Hello!");
+ cbor_item_t* array = cbor_new_indefinite_array();
+ cbor_item_t* string = cbor_build_string("Hello!");
assert_false(cbor_array_push(array, string));
assert_size_equal(cbor_array_allocated(array), 0);
@@ -191,10 +191,10 @@ static void test_array_push(void **_CBOR_UNUSED(_state)) {
}
static unsigned char simple_indef_array[] = {0x9F, 0x01, 0x02, 0xFF};
-static void test_indef_array_decode(void **_CBOR_UNUSED(_state)) {
+static void test_indef_array_decode(void** _state _CBOR_UNUSED) {
WITH_MOCK_MALLOC(
{
- cbor_item_t *array;
+ cbor_item_t* array;
struct cbor_load_result res;
array = cbor_load(simple_indef_array, 4, &res);
diff --git a/test/bad_inputs_test.c b/test/bad_inputs_test.c
index de7bdab95231..e3cf02f01680 100644
--- a/test/bad_inputs_test.c
+++ b/test/bad_inputs_test.c
@@ -11,12 +11,12 @@
/* These tests verify behavior on interesting randomly generated inputs from the
* fuzzer */
-cbor_item_t *item;
+cbor_item_t* item;
struct cbor_load_result res;
/* Map start + array with embedded length */
unsigned char data1[] = {0xA9, 0x85};
-static void test_1(void **_CBOR_UNUSED(_state)) {
+static void test_1(void** _state _CBOR_UNUSED) {
item = cbor_load(data1, 2, &res);
assert_null(item);
assert_true(res.error.code == CBOR_ERR_NOTENOUGHDATA);
@@ -24,7 +24,7 @@ static void test_1(void **_CBOR_UNUSED(_state)) {
}
unsigned char data2[] = {0x9D};
-static void test_2(void **_CBOR_UNUSED(_state)) {
+static void test_2(void** _state _CBOR_UNUSED) {
item = cbor_load(data2, 1, &res);
assert_null(item);
assert_true(res.error.code == CBOR_ERR_MALFORMATED);
@@ -32,7 +32,7 @@ static void test_2(void **_CBOR_UNUSED(_state)) {
}
unsigned char data3[] = {0xD6};
-static void test_3(void **_CBOR_UNUSED(_state)) {
+static void test_3(void** _state _CBOR_UNUSED) {
item = cbor_load(data3, 1, &res);
assert_null(item);
assert_true(res.error.code == CBOR_ERR_NOTENOUGHDATA);
@@ -41,7 +41,7 @@ static void test_3(void **_CBOR_UNUSED(_state)) {
#ifdef SANE_MALLOC
unsigned char data4[] = {0xBA, 0xC1, 0xE8, 0x3E, 0xE7, 0x20, 0xA8};
-static void test_4(void **_CBOR_UNUSED(_state)) {
+static void test_4(void** _state _CBOR_UNUSED) {
item = cbor_load(data4, 7, &res);
assert_null(item);
assert_true(res.error.code == CBOR_ERR_MEMERROR);
@@ -49,7 +49,7 @@ static void test_4(void **_CBOR_UNUSED(_state)) {
}
unsigned char data5[] = {0x9A, 0xDA, 0x3A, 0xB2, 0x7F, 0x29};
-static void test_5(void **_CBOR_UNUSED(_state)) {
+static void test_5(void** _state _CBOR_UNUSED) {
assert_true(res.error.code == CBOR_ERR_MEMERROR);
item = cbor_load(data5, 6, &res);
assert_null(item);
@@ -59,7 +59,7 @@ static void test_5(void **_CBOR_UNUSED(_state)) {
#endif
unsigned char data6[] = {0x7F, 0x21, 0x4C, 0x02, 0x40};
-static void test_6(void **_CBOR_UNUSED(_state)) {
+static void test_6(void** _state _CBOR_UNUSED) {
item = cbor_load(data6, 5, &res);
assert_null(item);
assert_true(res.error.code == CBOR_ERR_SYNTAXERROR);
@@ -71,7 +71,7 @@ static void test_6(void **_CBOR_UNUSED(_state)) {
* works with 64b sizes */
unsigned char data7[] = {0xA2, 0x9B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-static void test_7(void **_CBOR_UNUSED(_state)) {
+static void test_7(void** _state _CBOR_UNUSED) {
item = cbor_load(data7, 16, &res);
assert_null(item);
assert_true(res.error.code == CBOR_ERR_MEMERROR);
@@ -84,7 +84,7 @@ unsigned char data8[] = {0xA3, 0x64, 0x68, 0x61, 0x6C, 0x66, 0xFF, 0x00,
0xFA, 0x7F, 0x7F, 0xFF, 0xFF, 0x6D, 0x73, 0x69,
0x6D, 0x70, 0x6C, 0x65, 0x20, 0x76, 0x61, 0x6C,
0x75, 0x65, 0x73, 0x83, 0xF5, 0xF4, 0xF6};
-static void test_8(void **_CBOR_UNUSED(_state)) {
+static void test_8(void** _state _CBOR_UNUSED) {
item = cbor_load(data8, 39, &res);
assert_null(item);
assert_true(res.error.code == CBOR_ERR_SYNTAXERROR);
@@ -92,7 +92,7 @@ static void test_8(void **_CBOR_UNUSED(_state)) {
}
unsigned char data9[] = {0xBF, 0x05, 0xFF, 0x00, 0x00, 0x00, 0x10, 0x04};
-static void test_9(void **_CBOR_UNUSED(_state)) {
+static void test_9(void** _state _CBOR_UNUSED) {
item = cbor_load(data9, 8, &res);
assert_null(item);
assert_true(res.error.code == CBOR_ERR_SYNTAXERROR);
diff --git a/test/bytestring_encoders_test.c b/test/bytestring_encoders_test.c
index 8e2fbe694055..850f84645bcf 100644
--- a/test/bytestring_encoders_test.c
+++ b/test/bytestring_encoders_test.c
@@ -11,18 +11,18 @@
unsigned char buffer[512];
-static void test_embedded_bytestring_start(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_bytestring_start(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_bytestring_start(1, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x41}), 1);
}
-static void test_bytestring_start(void **_CBOR_UNUSED(_state)) {
+static void test_bytestring_start(void** _state _CBOR_UNUSED) {
assert_size_equal(5, cbor_encode_bytestring_start(1000000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x5A, 0x00, 0x0F, 0x42, 0x40}),
5);
}
-static void test_indef_bytestring_start(void **_CBOR_UNUSED(_state)) {
+static void test_indef_bytestring_start(void** _state _CBOR_UNUSED) {
assert_size_equal(0, cbor_encode_indef_bytestring_start(buffer, 0));
assert_size_equal(1, cbor_encode_indef_bytestring_start(buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x5F}), 1);
diff --git a/test/bytestring_test.c b/test/bytestring_test.c
index 08968a13e98e..5410aabdcdbc 100644
--- a/test/bytestring_test.c
+++ b/test/bytestring_test.c
@@ -9,7 +9,7 @@
#include "cbor.h"
#include "test_allocator.h"
-cbor_item_t *bs;
+cbor_item_t* bs;
struct cbor_load_result res;
unsigned char data1[] = {0x40, 0xFF};
@@ -133,7 +133,7 @@ unsigned char data8[] = {
0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD,
0xFE, 0xFF};
-static void test_empty_bs(void **_CBOR_UNUSED(_state)) {
+static void test_empty_bs(void** _state _CBOR_UNUSED) {
bs = cbor_load(data1, 2, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -144,7 +144,7 @@ static void test_empty_bs(void **_CBOR_UNUSED(_state)) {
assert_null(bs);
}
-static void test_embedded_bs(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_bs(void** _state _CBOR_UNUSED) {
bs = cbor_load(data2, 2, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -157,13 +157,13 @@ static void test_embedded_bs(void **_CBOR_UNUSED(_state)) {
assert_null(bs);
}
-static void test_notenough_data(void **_CBOR_UNUSED(_state)) {
+static void test_notenough_data(void** _state _CBOR_UNUSED) {
bs = cbor_load(data3, 2, &res);
assert_null(bs);
assert_true(res.error.code == CBOR_ERR_NOTENOUGHDATA);
}
-static void test_short_bs1(void **_CBOR_UNUSED(_state)) {
+static void test_short_bs1(void** _state _CBOR_UNUSED) {
bs = cbor_load(data3, 4, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -176,7 +176,7 @@ static void test_short_bs1(void **_CBOR_UNUSED(_state)) {
assert_null(bs);
}
-static void test_short_bs2(void **_CBOR_UNUSED(_state)) {
+static void test_short_bs2(void** _state _CBOR_UNUSED) {
bs = cbor_load(data4, 259, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -188,7 +188,7 @@ static void test_short_bs2(void **_CBOR_UNUSED(_state)) {
assert_null(bs);
}
-static void test_half_bs(void **_CBOR_UNUSED(_state)) {
+static void test_half_bs(void** _state _CBOR_UNUSED) {
bs = cbor_load(data5, 259, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -200,7 +200,7 @@ static void test_half_bs(void **_CBOR_UNUSED(_state)) {
assert_null(bs);
}
-static void test_int_bs(void **_CBOR_UNUSED(_state)) {
+static void test_int_bs(void** _state _CBOR_UNUSED) {
bs = cbor_load(data6, 261, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -212,7 +212,7 @@ static void test_int_bs(void **_CBOR_UNUSED(_state)) {
assert_null(bs);
}
-static void test_long_bs(void **_CBOR_UNUSED(_state)) {
+static void test_long_bs(void** _state _CBOR_UNUSED) {
bs = cbor_load(data7, 265, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -226,7 +226,7 @@ static void test_long_bs(void **_CBOR_UNUSED(_state)) {
unsigned char data9[] = {0x5F, 0xFF};
-static void test_zero_indef(void **_CBOR_UNUSED(_state)) {
+static void test_zero_indef(void** _state _CBOR_UNUSED) {
bs = cbor_load(data9, 2, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -242,7 +242,7 @@ unsigned char data10[] = {0x5F, 0x58, 0x01, 0xA1, 0xFF, 0xFF};
/* start | bstring | break| extra */
-static void test_short_indef(void **_CBOR_UNUSED(_state)) {
+static void test_short_indef(void** _state _CBOR_UNUSED) {
bs = cbor_load(data10, 6, &res);
assert_non_null(bs);
assert_true(cbor_typeof(bs) == CBOR_TYPE_BYTESTRING);
@@ -265,7 +265,7 @@ unsigned char data11[] = {0x5F, 0x58, 0x01, 0xA1, 0x58, 0x01, 0xA2, 0xFF, 0xFF};
/* start | bstring | bstring | break|
* extra */
-static void test_two_indef(void **_CBOR_UNUSED(_state)) {
+static void test_two_indef(void** _state _CBOR_UNUSED) {
bs = cbor_load(data11, 9, &res);
assert_non_null(bs);
assert_size_equal(1, cbor_refcount(bs));
@@ -293,23 +293,23 @@ unsigned char data12[] = {0x5F, 0x58, 0x01};
/* start | bstring - too short */
-static void test_missing_indef(void **_CBOR_UNUSED(_state)) {
+static void test_missing_indef(void** _state _CBOR_UNUSED) {
bs = cbor_load(data12, 3, &res);
assert_true(res.error.code == CBOR_ERR_NOTENOUGHDATA);
assert_null(bs);
}
-static void test_inline_creation(void **_CBOR_UNUSED(_state)) {
+static void test_inline_creation(void** _state _CBOR_UNUSED) {
bs = cbor_build_bytestring((cbor_data) "Hello!", 6);
assert_memory_equal(cbor_bytestring_handle(bs), "Hello!", 6);
cbor_decref(&bs);
}
-static void test_add_chunk_reallocation_overflow(void **_CBOR_UNUSED(_state)) {
+static void test_add_chunk_reallocation_overflow(void** _state _CBOR_UNUSED) {
bs = cbor_new_indefinite_bytestring();
- cbor_item_t *chunk = cbor_build_bytestring((cbor_data) "Hello!", 6);
- struct cbor_indefinite_string_data *metadata =
- (struct cbor_indefinite_string_data *)bs->data;
+ cbor_item_t* chunk = cbor_build_bytestring((cbor_data) "Hello!", 6);
+ struct cbor_indefinite_string_data* metadata =
+ (struct cbor_indefinite_string_data*)bs->data;
// Pretend we already have many chunks allocated
metadata->chunk_count = SIZE_MAX;
metadata->chunk_capacity = SIZE_MAX;
@@ -323,7 +323,7 @@ static void test_add_chunk_reallocation_overflow(void **_CBOR_UNUSED(_state)) {
cbor_decref(&bs);
}
-static void test_bytestring_creation(void **_CBOR_UNUSED(_state)) {
+static void test_bytestring_creation(void** _state _CBOR_UNUSED) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_definite_bytestring()); });
WITH_FAILING_MALLOC({ assert_null(cbor_new_indefinite_bytestring()); });
@@ -337,18 +337,18 @@ static void test_bytestring_creation(void **_CBOR_UNUSED(_state)) {
MALLOC_FAIL);
}
-static void test_bytestring_add_chunk(void **_CBOR_UNUSED(_state)) {
+static void test_bytestring_add_chunk(void** _state _CBOR_UNUSED) {
unsigned char bytes[] = {0, 0, 0xFF, 0xAB};
WITH_MOCK_MALLOC(
{
- cbor_item_t *bytestring = cbor_new_indefinite_bytestring();
- cbor_item_t *chunk = cbor_build_bytestring(bytes, 4);
+ cbor_item_t* bytestring = cbor_new_indefinite_bytestring();
+ cbor_item_t* chunk = cbor_build_bytestring(bytes, 4);
assert_false(cbor_bytestring_add_chunk(bytestring, chunk));
assert_size_equal(cbor_bytestring_chunk_count(bytestring), 0);
assert_size_equal(
- ((struct cbor_indefinite_string_data *)bytestring->data)
+ ((struct cbor_indefinite_string_data*)bytestring->data)
->chunk_capacity,
0);
diff --git a/test/callbacks_test.c b/test/callbacks_test.c
index 65c5d37f4399..c2b5ecfe8fe0 100644
--- a/test/callbacks_test.c
+++ b/test/callbacks_test.c
@@ -20,7 +20,7 @@ unsigned char data[] = {
0x88, 0x00, 0x75, 0x9C, 0xF6, 0xF7, 0xF5};
/* Exercise the default callbacks */
-static void test_default_callbacks(void** _CBOR_UNUSED(_state)) {
+static void test_default_callbacks(void** _state _CBOR_UNUSED) {
size_t read = 0;
while (read < 79) {
struct cbor_decoder_result result =
@@ -31,7 +31,7 @@ static void test_default_callbacks(void** _CBOR_UNUSED(_state)) {
unsigned char bytestring_data[] = {0x01, 0x02, 0x03};
static void test_builder_byte_string_callback_append(
- void** _CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(
_cbor_stack_push(&stack, cbor_new_indefinite_bytestring(), 0));
@@ -71,7 +71,7 @@ static void test_builder_byte_string_callback_append(
}
static void test_builder_byte_string_callback_append_alloc_failure(
- void** _CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(
_cbor_stack_push(&stack, cbor_new_indefinite_bytestring(), 0));
@@ -103,7 +103,7 @@ static void test_builder_byte_string_callback_append_alloc_failure(
}
static void test_builder_byte_string_callback_append_item_alloc_failure(
- void** _CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(
_cbor_stack_push(&stack, cbor_new_indefinite_bytestring(), 0));
@@ -137,7 +137,7 @@ static void test_builder_byte_string_callback_append_item_alloc_failure(
}
static void test_builder_byte_string_callback_append_parent_alloc_failure(
- void** _CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(
_cbor_stack_push(&stack, cbor_new_indefinite_bytestring(), 0));
@@ -171,7 +171,7 @@ static void test_builder_byte_string_callback_append_parent_alloc_failure(
}
unsigned char string_data[] = {0x61, 0x62, 0x63};
-static void test_builder_string_callback_append(void** _CBOR_UNUSED(_state)) {
+static void test_builder_string_callback_append(void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(_cbor_stack_push(&stack, cbor_new_indefinite_string(), 0));
struct _cbor_decoder_context context = {
@@ -208,7 +208,7 @@ static void test_builder_string_callback_append(void** _CBOR_UNUSED(_state)) {
}
static void test_builder_string_callback_append_alloc_failure(
- void** _CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(_cbor_stack_push(&stack, cbor_new_indefinite_string(), 0));
struct _cbor_decoder_context context = {
@@ -239,7 +239,7 @@ static void test_builder_string_callback_append_alloc_failure(
}
static void test_builder_string_callback_append_item_alloc_failure(
- void** _CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(_cbor_stack_push(&stack, cbor_new_indefinite_string(), 0));
struct _cbor_decoder_context context = {
@@ -271,7 +271,7 @@ static void test_builder_string_callback_append_item_alloc_failure(
}
static void test_builder_string_callback_append_parent_alloc_failure(
- void** _CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(_cbor_stack_push(&stack, cbor_new_indefinite_string(), 0));
struct _cbor_decoder_context context = {
@@ -302,7 +302,7 @@ static void test_builder_string_callback_append_parent_alloc_failure(
_cbor_stack_pop(&stack);
}
-static void test_append_array_failure(void** _CBOR_UNUSED(_state)) {
+static void test_append_array_failure(void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(_cbor_stack_push(&stack, cbor_new_definite_array(0), 0));
stack.top->subitems = 1;
@@ -331,7 +331,7 @@ static void test_append_array_failure(void** _CBOR_UNUSED(_state)) {
_cbor_stack_pop(&stack);
}
-static void test_append_map_failure(void** _CBOR_UNUSED(_state)) {
+static void test_append_map_failure(void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(
_cbor_stack_push(&stack, cbor_new_indefinite_map(), /*subitems=*/0));
@@ -362,7 +362,7 @@ static void test_append_map_failure(void** _CBOR_UNUSED(_state)) {
// Size 1 array start, but we get an indef break
unsigned char invalid_indef_break_data[] = {0x81, 0xFF};
-static void test_invalid_indef_break(void** _CBOR_UNUSED(_state)) {
+static void test_invalid_indef_break(void** _state _CBOR_UNUSED) {
struct cbor_load_result res;
cbor_item_t* item = cbor_load(invalid_indef_break_data, 2, &res);
@@ -371,7 +371,7 @@ static void test_invalid_indef_break(void** _CBOR_UNUSED(_state)) {
assert_true(res.error.code == CBOR_ERR_SYNTAXERROR);
}
-static void test_invalid_state_indef_break(void** _CBOR_UNUSED(_state)) {
+static void test_invalid_state_indef_break(void** _state _CBOR_UNUSED) {
struct _cbor_stack stack = _cbor_stack_init();
assert_non_null(_cbor_stack_push(&stack, cbor_new_int8(), /*subitems=*/0));
struct _cbor_decoder_context context = {
diff --git a/test/cbor_serialize_test.c b/test/cbor_serialize_test.c
index a2907b149345..5f8cf9f611da 100644
--- a/test/cbor_serialize_test.c
+++ b/test/cbor_serialize_test.c
@@ -6,7 +6,6 @@
*/
// cbor_serialize_alloc
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <math.h>
@@ -24,8 +23,8 @@
unsigned char buffer[512];
-static void test_serialize_uint8_embed(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int8();
+static void test_serialize_uint8_embed(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int8();
cbor_set_uint8(item, 0);
assert_size_equal(1, cbor_serialize(item, buffer, 512));
assert_memory_equal(buffer, (unsigned char[]){0x00}, 1);
@@ -33,8 +32,8 @@ static void test_serialize_uint8_embed(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_uint8(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int8();
+static void test_serialize_uint8(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int8();
cbor_set_uint8(item, 42);
assert_size_equal(2, cbor_serialize(item, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x18, 0x2a}), 2);
@@ -42,8 +41,8 @@ static void test_serialize_uint8(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_uint16(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int16();
+static void test_serialize_uint16(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int16();
cbor_set_uint16(item, 1000);
assert_size_equal(3, cbor_serialize(item, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x19, 0x03, 0xE8}), 3);
@@ -51,8 +50,8 @@ static void test_serialize_uint16(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_uint32(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int32();
+static void test_serialize_uint32(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int32();
cbor_set_uint32(item, 1000000);
assert_size_equal(5, cbor_serialize(item, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x1A, 0x00, 0x0F, 0x42, 0x40}),
@@ -61,8 +60,8 @@ static void test_serialize_uint32(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_uint64(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int64();
+static void test_serialize_uint64(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int64();
cbor_set_uint64(item, 1000000000000);
assert_size_equal(9, cbor_serialize(item, buffer, 512));
assert_memory_equal(
@@ -73,8 +72,8 @@ static void test_serialize_uint64(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_negint8_embed(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int8();
+static void test_serialize_negint8_embed(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int8();
cbor_set_uint8(item, 0);
cbor_mark_negint(item);
assert_size_equal(1, cbor_serialize(item, buffer, 512));
@@ -83,8 +82,8 @@ static void test_serialize_negint8_embed(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_negint8(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int8();
+static void test_serialize_negint8(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int8();
cbor_set_uint8(item, 42);
cbor_mark_negint(item);
assert_size_equal(2, cbor_serialize(item, buffer, 512));
@@ -93,8 +92,8 @@ static void test_serialize_negint8(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_negint16(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int16();
+static void test_serialize_negint16(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int16();
cbor_set_uint16(item, 1000);
cbor_mark_negint(item);
assert_size_equal(3, cbor_serialize(item, buffer, 512));
@@ -103,8 +102,8 @@ static void test_serialize_negint16(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_negint32(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int32();
+static void test_serialize_negint32(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int32();
cbor_set_uint32(item, 1000000);
cbor_mark_negint(item);
assert_size_equal(5, cbor_serialize(item, buffer, 512));
@@ -114,8 +113,8 @@ static void test_serialize_negint32(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_negint64(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_int64();
+static void test_serialize_negint64(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_int64();
cbor_set_uint64(item, 1000000000000);
cbor_mark_negint(item);
assert_size_equal(9, cbor_serialize(item, buffer, 512));
@@ -127,9 +126,9 @@ static void test_serialize_negint64(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_definite_bytestring(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_bytestring();
- unsigned char *data = malloc(256);
+static void test_serialize_definite_bytestring(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_bytestring();
+ unsigned char* data = malloc(256);
cbor_bytestring_set_handle(item, data, 256);
memset(data, 0, 256); /* Prevent undefined behavior in comparison */
assert_size_equal(256 + 3, cbor_serialize(item, buffer, 512));
@@ -139,11 +138,11 @@ static void test_serialize_definite_bytestring(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_indefinite_bytestring(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_bytestring();
+static void test_serialize_indefinite_bytestring(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_bytestring();
- cbor_item_t *chunk = cbor_new_definite_bytestring();
- unsigned char *data = malloc(256);
+ cbor_item_t* chunk = cbor_new_definite_bytestring();
+ unsigned char* data = malloc(256);
memset(data, 0, 256); /* Prevent undefined behavior in comparison */
cbor_bytestring_set_handle(chunk, data, 256);
@@ -159,11 +158,11 @@ static void test_serialize_indefinite_bytestring(void **_CBOR_UNUSED(_state)) {
}
static void test_serialize_bytestring_size_overflow(
- void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_bytestring();
+ void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_bytestring();
// Fake having a huge chunk of data
- unsigned char *data = malloc(1);
+ unsigned char* data = malloc(1);
cbor_bytestring_set_handle(item, data, SIZE_MAX);
// Would require 1 + 8 + SIZE_MAX bytes, which overflows size_t
@@ -172,9 +171,9 @@ static void test_serialize_bytestring_size_overflow(
cbor_decref(&item);
}
-static void test_serialize_bytestring_no_space(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_bytestring();
- unsigned char *data = malloc(12);
+static void test_serialize_bytestring_no_space(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_bytestring();
+ unsigned char* data = malloc(12);
cbor_bytestring_set_handle(item, data, 12);
assert_size_equal(cbor_serialize(item, buffer, 1), 0);
@@ -183,10 +182,10 @@ static void test_serialize_bytestring_no_space(void **_CBOR_UNUSED(_state)) {
}
static void test_serialize_indefinite_bytestring_no_space(
- void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_bytestring();
- cbor_item_t *chunk = cbor_new_definite_bytestring();
- unsigned char *data = malloc(256);
+ void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_bytestring();
+ cbor_item_t* chunk = cbor_new_definite_bytestring();
+ unsigned char* data = malloc(256);
cbor_bytestring_set_handle(chunk, data, 256);
assert_true(cbor_bytestring_add_chunk(item, cbor_move(chunk)));
@@ -203,10 +202,10 @@ static void test_serialize_indefinite_bytestring_no_space(
cbor_decref(&item);
}
-static void test_serialize_definite_string(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_string();
- unsigned char *data = malloc(12);
- strncpy((char *)data, "Hello world!", 12);
+static void test_serialize_definite_string(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_string();
+ unsigned char* data = malloc(12);
+ strncpy((char*)data, "Hello world!", 12);
cbor_string_set_handle(item, data, 12);
assert_size_equal(1 + 12, cbor_serialize(item, buffer, 512));
assert_memory_equal(
@@ -219,11 +218,11 @@ static void test_serialize_definite_string(void **_CBOR_UNUSED(_state)) {
}
static void test_serialize_definite_string_4b_header(
- void **_CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
#if SIZE_MAX > UINT16_MAX
- cbor_item_t *item = cbor_new_definite_string();
+ cbor_item_t* item = cbor_new_definite_string();
const size_t size = (size_t)UINT16_MAX + 1;
- unsigned char *data = malloc(size);
+ unsigned char* data = malloc(size);
memset(data, 0, size);
cbor_string_set_handle(item, data, size);
assert_size_equal(cbor_serialized_size(item), 1 + 4 + size);
@@ -232,11 +231,11 @@ static void test_serialize_definite_string_4b_header(
}
static void test_serialize_definite_string_8b_header(
- void **_CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
#if SIZE_MAX > UINT32_MAX
- cbor_item_t *item = cbor_new_definite_string();
+ cbor_item_t* item = cbor_new_definite_string();
const size_t size = (size_t)UINT32_MAX + 1;
- unsigned char *data = malloc(1);
+ unsigned char* data = malloc(1);
data[0] = '\0';
cbor_string_set_handle(item, data, 1);
// Pretend that we have a big item to avoid the huge malloc
@@ -246,12 +245,12 @@ static void test_serialize_definite_string_8b_header(
#endif
}
-static void test_serialize_indefinite_string(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_string();
- cbor_item_t *chunk = cbor_new_definite_string();
+static void test_serialize_indefinite_string(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_string();
+ cbor_item_t* chunk = cbor_new_definite_string();
- unsigned char *data = malloc(12);
- strncpy((char *)data, "Hello world!", 12);
+ unsigned char* data = malloc(12);
+ strncpy((char*)data, "Hello world!", 12);
cbor_string_set_handle(chunk, data, 12);
assert_true(cbor_string_add_chunk(item, cbor_move(chunk)));
@@ -267,9 +266,9 @@ static void test_serialize_indefinite_string(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_string_no_space(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_string();
- unsigned char *data = malloc(12);
+static void test_serialize_string_no_space(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_string();
+ unsigned char* data = malloc(12);
memset(data, 0, 12);
cbor_string_set_handle(item, data, 12);
@@ -279,10 +278,10 @@ static void test_serialize_string_no_space(void **_CBOR_UNUSED(_state)) {
}
static void test_serialize_indefinite_string_no_space(
- void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_string();
- cbor_item_t *chunk = cbor_new_definite_string();
- unsigned char *data = malloc(256);
+ void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_string();
+ cbor_item_t* chunk = cbor_new_definite_string();
+ unsigned char* data = malloc(256);
memset(data, 0, 256);
cbor_string_set_handle(chunk, data, 256);
assert_true(cbor_string_add_chunk(item, cbor_move(chunk)));
@@ -300,10 +299,10 @@ static void test_serialize_indefinite_string_no_space(
cbor_decref(&item);
}
-static void test_serialize_definite_array(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_array(2);
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *two = cbor_build_uint8(2);
+static void test_serialize_definite_array(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_array(2);
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* two = cbor_build_uint8(2);
assert_true(cbor_array_push(item, one));
assert_true(cbor_array_set(item, 1, two));
@@ -317,9 +316,9 @@ static void test_serialize_definite_array(void **_CBOR_UNUSED(_state)) {
cbor_decref(&two);
}
-static void test_serialize_array_no_space(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_array();
- cbor_item_t *one = cbor_build_uint8(1);
+static void test_serialize_array_no_space(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_array();
+ cbor_item_t* one = cbor_build_uint8(1);
assert_true(cbor_array_push(item, one));
assert_size_equal(cbor_serialized_size(item), 3);
@@ -336,10 +335,10 @@ static void test_serialize_array_no_space(void **_CBOR_UNUSED(_state)) {
cbor_decref(&one);
}
-static void test_serialize_indefinite_array(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_array();
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *two = cbor_build_uint8(2);
+static void test_serialize_indefinite_array(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_array();
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* two = cbor_build_uint8(2);
assert_true(cbor_array_push(item, one));
assert_true(cbor_array_push(item, two));
@@ -352,10 +351,10 @@ static void test_serialize_indefinite_array(void **_CBOR_UNUSED(_state)) {
cbor_decref(&two);
}
-static void test_serialize_definite_map(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_map(2);
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *two = cbor_build_uint8(2);
+static void test_serialize_definite_map(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_map(2);
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* two = cbor_build_uint8(2);
assert_true(cbor_map_add(item, (struct cbor_pair){.key = one, .value = two}));
assert_true(cbor_map_add(item, (struct cbor_pair){.key = two, .value = one}));
@@ -369,10 +368,10 @@ static void test_serialize_definite_map(void **_CBOR_UNUSED(_state)) {
cbor_decref(&two);
}
-static void test_serialize_indefinite_map(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_map();
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *two = cbor_build_uint8(2);
+static void test_serialize_indefinite_map(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_map();
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* two = cbor_build_uint8(2);
assert_true(cbor_map_add(item, (struct cbor_pair){.key = one, .value = two}));
assert_true(cbor_map_add(item, (struct cbor_pair){.key = two, .value = one}));
@@ -386,10 +385,10 @@ static void test_serialize_indefinite_map(void **_CBOR_UNUSED(_state)) {
cbor_decref(&two);
}
-static void test_serialize_map_no_space(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_map();
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *two = cbor_build_uint8(2);
+static void test_serialize_map_no_space(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_map();
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* two = cbor_build_uint8(2);
assert_true(cbor_map_add(item, (struct cbor_pair){.key = one, .value = two}));
assert_size_equal(cbor_serialized_size(item), 4);
@@ -410,9 +409,9 @@ static void test_serialize_map_no_space(void **_CBOR_UNUSED(_state)) {
cbor_decref(&two);
}
-static void test_serialize_tags(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_tag(21);
- cbor_item_t *one = cbor_build_uint8(1);
+static void test_serialize_tags(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_tag(21);
+ cbor_item_t* one = cbor_build_uint8(1);
cbor_tag_set_item(item, one);
assert_size_equal(2, cbor_serialize(item, buffer, 512));
@@ -422,9 +421,9 @@ static void test_serialize_tags(void **_CBOR_UNUSED(_state)) {
cbor_decref(&one);
}
-static void test_serialize_tags_no_space(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_tag(21);
- cbor_item_t *one = cbor_build_uint8(1);
+static void test_serialize_tags_no_space(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_tag(21);
+ cbor_item_t* one = cbor_build_uint8(1);
cbor_tag_set_item(item, one);
assert_size_equal(cbor_serialized_size(item), 2);
@@ -438,8 +437,8 @@ static void test_serialize_tags_no_space(void **_CBOR_UNUSED(_state)) {
cbor_decref(&one);
}
-static void test_serialize_half(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_float2();
+static void test_serialize_half(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_float2();
cbor_set_float2(item, NAN);
assert_size_equal(3, cbor_serialize(item, buffer, 512));
@@ -448,8 +447,8 @@ static void test_serialize_half(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_single(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_float4();
+static void test_serialize_single(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_float4();
cbor_set_float4(item, 100000.0f);
assert_size_equal(5, cbor_serialize(item, buffer, 512));
@@ -459,8 +458,8 @@ static void test_serialize_single(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_double(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_float8();
+static void test_serialize_double(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_float8();
cbor_set_float8(item, -4.1);
assert_size_equal(9, cbor_serialize(item, buffer, 512));
@@ -472,8 +471,8 @@ static void test_serialize_double(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_ctrl(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_undef();
+static void test_serialize_ctrl(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_undef();
assert_size_equal(1, cbor_serialize(item, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF7}), 1);
@@ -481,8 +480,8 @@ static void test_serialize_ctrl(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_serialize_long_ctrl(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_ctrl();
+static void test_serialize_long_ctrl(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_ctrl();
cbor_set_ctrl(item, 254);
assert_size_equal(2, cbor_serialize(item, buffer, 512));
@@ -491,13 +490,13 @@ static void test_serialize_long_ctrl(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_auto_serialize(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_array(4);
+static void test_auto_serialize(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_array(4);
for (size_t i = 0; i < 4; i++) {
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint64(0))));
}
- unsigned char *output;
+ unsigned char* output;
size_t output_size;
assert_size_equal(cbor_serialize_alloc(item, &output, &output_size), 37);
assert_size_equal(output_size, 37);
@@ -507,10 +506,10 @@ static void test_auto_serialize(void **_CBOR_UNUSED(_state)) {
_cbor_free(output);
}
-static void test_auto_serialize_no_size(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_build_uint8(1);
+static void test_auto_serialize_no_size(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_build_uint8(1);
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 1);
assert_memory_equal(output, ((unsigned char[]){0x01}), 1);
assert_size_equal(cbor_serialized_size(item), 1);
@@ -518,16 +517,16 @@ static void test_auto_serialize_no_size(void **_CBOR_UNUSED(_state)) {
_cbor_free(output);
}
-static void test_auto_serialize_too_large(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_string();
- cbor_item_t *chunk = cbor_new_definite_string();
+static void test_auto_serialize_too_large(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_string();
+ cbor_item_t* chunk = cbor_new_definite_string();
assert_true(cbor_string_add_chunk(item, chunk));
// Pretend the chunk is huge
chunk->metadata.string_metadata.length = SIZE_MAX;
assert_true(SIZE_MAX + 2 == 1);
assert_size_equal(cbor_serialized_size(item), 0);
- unsigned char *output;
+ unsigned char* output;
size_t output_size;
assert_size_equal(cbor_serialize_alloc(item, &output, &output_size), 0);
assert_size_equal(output_size, 0);
@@ -538,11 +537,11 @@ static void test_auto_serialize_too_large(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_auto_serialize_alloc_fail(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_build_uint8(42);
+static void test_auto_serialize_alloc_fail(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_build_uint8(42);
WITH_FAILING_MALLOC({
- unsigned char *output;
+ unsigned char* output;
size_t output_size;
assert_size_equal(cbor_serialize_alloc(item, &output, &output_size), 0);
assert_size_equal(output_size, 0);
@@ -553,10 +552,10 @@ static void test_auto_serialize_alloc_fail(void **_CBOR_UNUSED(_state)) {
}
static void test_auto_serialize_zero_len_bytestring(
- void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_build_bytestring((cbor_data) "", 0);
+ void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_build_bytestring((cbor_data) "", 0);
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 1);
assert_memory_equal(output, ((unsigned char[]){0x40}), 1);
assert_size_equal(cbor_serialized_size(item), 1);
@@ -564,10 +563,10 @@ static void test_auto_serialize_zero_len_bytestring(
_cbor_free(output);
}
-static void test_auto_serialize_zero_len_string(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_build_string("");
+static void test_auto_serialize_zero_len_string(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_build_string("");
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 1);
assert_memory_equal(output, ((unsigned char[]){0x60}), 1);
assert_size_equal(cbor_serialized_size(item), 1);
@@ -576,13 +575,13 @@ static void test_auto_serialize_zero_len_string(void **_CBOR_UNUSED(_state)) {
}
static void test_auto_serialize_zero_len_bytestring_chunk(
- void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_bytestring();
+ void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_bytestring();
assert_true(cbor_bytestring_add_chunk(
item, cbor_move(cbor_build_bytestring((cbor_data) "", 0))));
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 3);
assert_memory_equal(output, ((unsigned char[]){0x5f, 0x40, 0xff}), 3);
assert_size_equal(cbor_serialized_size(item), 3);
@@ -591,12 +590,12 @@ static void test_auto_serialize_zero_len_bytestring_chunk(
}
static void test_auto_serialize_zero_len_string_chunk(
- void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_string();
+ void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_string();
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string(""))));
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 3);
assert_memory_equal(output, ((unsigned char[]){0x7f, 0x60, 0xff}), 3);
assert_size_equal(cbor_serialized_size(item), 3);
@@ -604,10 +603,10 @@ static void test_auto_serialize_zero_len_string_chunk(
_cbor_free(output);
}
-static void test_auto_serialize_zero_len_array(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_array(0);
+static void test_auto_serialize_zero_len_array(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_array(0);
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 1);
assert_memory_equal(output, ((unsigned char[]){0x80}), 1);
assert_size_equal(cbor_serialized_size(item), 1);
@@ -616,10 +615,10 @@ static void test_auto_serialize_zero_len_array(void **_CBOR_UNUSED(_state)) {
}
static void test_auto_serialize_zero_len_indef_array(
- void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_array();
+ void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_array();
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 2);
assert_memory_equal(output, ((unsigned char[]){0x9f, 0xff}), 2);
assert_size_equal(cbor_serialized_size(item), 2);
@@ -627,10 +626,10 @@ static void test_auto_serialize_zero_len_indef_array(
_cbor_free(output);
}
-static void test_auto_serialize_zero_len_map(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_map(0);
+static void test_auto_serialize_zero_len_map(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_map(0);
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 1);
assert_memory_equal(output, ((unsigned char[]){0xa0}), 1);
assert_size_equal(cbor_serialized_size(item), 1);
@@ -638,11 +637,10 @@ static void test_auto_serialize_zero_len_map(void **_CBOR_UNUSED(_state)) {
_cbor_free(output);
}
-static void test_auto_serialize_zero_len_indef_map(
- void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_map();
+static void test_auto_serialize_zero_len_indef_map(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_map();
- unsigned char *output;
+ unsigned char* output;
assert_size_equal(cbor_serialize_alloc(item, &output, NULL), 2);
assert_memory_equal(output, ((unsigned char[]){0xbf, 0xff}), 2);
assert_size_equal(cbor_serialized_size(item), 2);
diff --git a/test/cbor_stream_decode_test.c b/test/cbor_stream_decode_test.c
index 5288016c2fc6..d1befd09b131 100644
--- a/test/cbor_stream_decode_test.c
+++ b/test/cbor_stream_decode_test.c
@@ -9,12 +9,12 @@
#include "cbor.h"
#include "stream_expectations.h"
-static void test_no_data(void **_CBOR_UNUSED(_state)) {
+static void test_no_data(void** _state _CBOR_UNUSED) {
assert_decoder_result_nedata(1, decode(NULL, 0));
}
unsigned char embedded_uint8_data[] = {0x00, 0x01, 0x05, 0x17};
-static void test_uint8_embedded_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_uint8_embedded_decoding(void** _state _CBOR_UNUSED) {
assert_uint8_eq(0);
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(embedded_uint8_data, 1));
@@ -33,7 +33,7 @@ static void test_uint8_embedded_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char uint8_data[] = {0x18, 0x83, 0x18, 0xFF};
-static void test_uint8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_uint8_decoding(void** _state _CBOR_UNUSED) {
assert_uint8_eq(0x83);
assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(uint8_data, 2));
@@ -44,7 +44,7 @@ static void test_uint8_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char uint16_data[] = {0x19, 0x01, 0xf4};
-static void test_uint16_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_uint16_decoding(void** _state _CBOR_UNUSED) {
assert_uint16_eq(500);
assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(uint16_data, 3));
@@ -52,7 +52,7 @@ static void test_uint16_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char uint32_data[] = {0x1a, 0xa5, 0xf7, 0x02, 0xb3};
-static void test_uint32_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_uint32_decoding(void** _state _CBOR_UNUSED) {
assert_uint32_eq((uint32_t)2784428723UL);
assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(uint32_data, 5));
@@ -61,7 +61,7 @@ static void test_uint32_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char uint64_data[] = {0x1b, 0xa5, 0xf7, 0x02, 0xb3,
0xa5, 0xf7, 0x02, 0xb3};
-static void test_uint64_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_uint64_decoding(void** _state _CBOR_UNUSED) {
assert_uint64_eq(11959030306112471731ULL);
assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(uint64_data, 9));
@@ -69,7 +69,7 @@ static void test_uint64_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char embedded_negint8_data[] = {0x20, 0x21, 0x25, 0x37};
-static void test_negint8_embedded_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_negint8_embedded_decoding(void** _state _CBOR_UNUSED) {
assert_negint8_eq(0);
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(embedded_negint8_data, 1));
@@ -88,7 +88,7 @@ static void test_negint8_embedded_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char negint8_data[] = {0x38, 0x83, 0x38, 0xFF};
-static void test_negint8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_negint8_decoding(void** _state _CBOR_UNUSED) {
assert_negint8_eq(0x83);
assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(negint8_data, 2));
@@ -99,7 +99,7 @@ static void test_negint8_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char negint16_data[] = {0x39, 0x01, 0xf4};
-static void test_negint16_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_negint16_decoding(void** _state _CBOR_UNUSED) {
assert_negint16_eq(500);
assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(negint16_data, 3));
@@ -107,7 +107,7 @@ static void test_negint16_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char negint32_data[] = {0x3a, 0xa5, 0xf7, 0x02, 0xb3};
-static void test_negint32_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_negint32_decoding(void** _state _CBOR_UNUSED) {
assert_negint32_eq((uint32_t)2784428723UL);
assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(negint32_data, 5));
@@ -116,7 +116,7 @@ static void test_negint32_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char negint64_data[] = {0x3b, 0xa5, 0xf7, 0x02, 0xb3,
0xa5, 0xf7, 0x02, 0xb3};
-static void test_negint64_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_negint64_decoding(void** _state _CBOR_UNUSED) {
assert_negint64_eq(11959030306112471731ULL);
assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(negint64_data, 9));
@@ -124,7 +124,7 @@ static void test_negint64_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char bstring_embedded_int8_data[] = {0x41, 0xFF};
-static void test_bstring_embedded_int8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_embedded_int8_decoding(void** _state _CBOR_UNUSED) {
assert_bstring_mem_eq(bstring_embedded_int8_data + 1, 1);
assert_decoder_result(2, CBOR_DECODER_FINISHED,
decode(bstring_embedded_int8_data, 2));
@@ -136,7 +136,7 @@ static void test_bstring_embedded_int8_decoding(void **_CBOR_UNUSED(_state)) {
// the second byte of input); the data is never read, so we never run into
// memory issues despite not allocating and initializing all the data.
unsigned char bstring_int8_data[] = {0x58, 0x02 /*, [2 bytes] */};
-static void test_bstring_int8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_int8_decoding(void** _state _CBOR_UNUSED) {
assert_bstring_mem_eq(bstring_int8_data + 2, 2);
assert_decoder_result(4, CBOR_DECODER_FINISHED, decode(bstring_int8_data, 4));
@@ -146,7 +146,7 @@ static void test_bstring_int8_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char bstring_int8_empty_data[] = {0x58, 0x00};
-static void test_bstring_int8_empty_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_int8_empty_decoding(void** _state _CBOR_UNUSED) {
assert_bstring_mem_eq(bstring_int8_empty_data + 2, 0);
assert_decoder_result(2, CBOR_DECODER_FINISHED,
decode(bstring_int8_empty_data, 2));
@@ -155,7 +155,7 @@ static void test_bstring_int8_empty_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char bstring_int16_data[] = {0x59, 0x01, 0x5C /*, [348 bytes] */};
-static void test_bstring_int16_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_int16_decoding(void** _state _CBOR_UNUSED) {
assert_bstring_mem_eq(bstring_int16_data + 3, 348);
assert_decoder_result(3 + 348, CBOR_DECODER_FINISHED,
decode(bstring_int16_data, 3 + 348));
@@ -167,7 +167,7 @@ static void test_bstring_int16_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char bstring_int32_data[] = {0x5A, 0x00, 0x10, 0x10,
0x10 /*, [1052688 bytes] */};
-static void test_bstring_int32_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_int32_decoding(void** _state _CBOR_UNUSED) {
assert_bstring_mem_eq(bstring_int32_data + 5, 1052688);
assert_decoder_result(5 + 1052688, CBOR_DECODER_FINISHED,
decode(bstring_int32_data, 5 + 1052688));
@@ -181,7 +181,7 @@ static void test_bstring_int32_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char bstring_int64_data[] = {
0x5B, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00 /*, [4294967296 bytes] */};
-static void test_bstring_int64_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_int64_decoding(void** _state _CBOR_UNUSED) {
assert_bstring_mem_eq(bstring_int64_data + 9, 4294967296);
assert_decoder_result(9 + 4294967296, CBOR_DECODER_FINISHED,
decode(bstring_int64_data, 9 + 4294967296));
@@ -194,7 +194,7 @@ static void test_bstring_int64_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char bstring_indef_1_data[] = {0x5F, 0x40 /* Empty byte string */,
0xFF};
-static void test_bstring_indef_decoding_1(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_indef_decoding_1(void** _state _CBOR_UNUSED) {
assert_bstring_indef_start();
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(bstring_indef_1_data, 3));
@@ -209,7 +209,7 @@ static void test_bstring_indef_decoding_1(void **_CBOR_UNUSED(_state)) {
}
unsigned char bstring_indef_2_data[] = {0x5F, 0xFF};
-static void test_bstring_indef_decoding_2(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_indef_decoding_2(void** _state _CBOR_UNUSED) {
assert_bstring_indef_start();
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(bstring_indef_2_data, 2));
@@ -226,7 +226,7 @@ unsigned char bstring_indef_3_data[] = {0x5F,
0x58, 0x01, 0x00,
// Break
0xFF};
-static void test_bstring_indef_decoding_3(void **_CBOR_UNUSED(_state)) {
+static void test_bstring_indef_decoding_3(void** _state _CBOR_UNUSED) {
assert_bstring_indef_start();
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(bstring_indef_3_data, 6));
@@ -245,7 +245,7 @@ static void test_bstring_indef_decoding_3(void **_CBOR_UNUSED(_state)) {
}
unsigned char string_embedded_int8_data[] = {0x61, 0xFF};
-static void test_string_embedded_int8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_string_embedded_int8_decoding(void** _state _CBOR_UNUSED) {
assert_string_mem_eq(string_embedded_int8_data + 1, 1);
assert_decoder_result(2, CBOR_DECODER_FINISHED,
decode(string_embedded_int8_data, 2));
@@ -257,7 +257,7 @@ static void test_string_embedded_int8_decoding(void **_CBOR_UNUSED(_state)) {
// the second byte of input); the data is never read, so we never run into
// memory issues despite not allocating and initializing all the data.
unsigned char string_int8_data[] = {0x78, 0x02 /*, [2 bytes] */};
-static void test_string_int8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_string_int8_decoding(void** _state _CBOR_UNUSED) {
assert_string_mem_eq(string_int8_data + 2, 2);
assert_decoder_result(4, CBOR_DECODER_FINISHED, decode(string_int8_data, 4));
@@ -267,7 +267,7 @@ static void test_string_int8_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char string_int8_empty_data[] = {0x78, 0x00};
-static void test_string_int8_empty_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_string_int8_empty_decoding(void** _state _CBOR_UNUSED) {
assert_string_mem_eq(string_int8_empty_data + 2, 0);
assert_decoder_result(2, CBOR_DECODER_FINISHED,
decode(string_int8_empty_data, 2));
@@ -276,7 +276,7 @@ static void test_string_int8_empty_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char string_int16_data[] = {0x79, 0x01, 0x5C /*, [348 bytes] */};
-static void test_string_int16_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_string_int16_decoding(void** _state _CBOR_UNUSED) {
assert_string_mem_eq(string_int16_data + 3, 348);
assert_decoder_result(3 + 348, CBOR_DECODER_FINISHED,
decode(string_int16_data, 3 + 348));
@@ -288,7 +288,7 @@ static void test_string_int16_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char string_int32_data[] = {0x7A, 0x00, 0x10, 0x10,
0x10 /*, [1052688 bytes] */};
-static void test_string_int32_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_string_int32_decoding(void** _state _CBOR_UNUSED) {
assert_string_mem_eq(string_int32_data + 5, 1052688);
assert_decoder_result(5 + 1052688, CBOR_DECODER_FINISHED,
decode(string_int32_data, 5 + 1052688));
@@ -302,7 +302,7 @@ static void test_string_int32_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char string_int64_data[] = {
0x7B, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00 /*, [4294967296 bytes] */};
-static void test_string_int64_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_string_int64_decoding(void** _state _CBOR_UNUSED) {
assert_string_mem_eq(string_int64_data + 9, 4294967296);
assert_decoder_result(9 + 4294967296, CBOR_DECODER_FINISHED,
decode(string_int64_data, 9 + 4294967296));
@@ -314,7 +314,7 @@ static void test_string_int64_decoding(void **_CBOR_UNUSED(_state)) {
#endif
unsigned char string_indef_1_data[] = {0x7F, 0x60 /* Empty string */, 0xFF};
-static void test_string_indef_decoding_1(void **_CBOR_UNUSED(_state)) {
+static void test_string_indef_decoding_1(void** _state _CBOR_UNUSED) {
assert_string_indef_start();
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(string_indef_1_data, 3));
@@ -329,7 +329,7 @@ static void test_string_indef_decoding_1(void **_CBOR_UNUSED(_state)) {
}
unsigned char string_indef_2_data[] = {0x7F, 0xFF};
-static void test_string_indef_decoding_2(void **_CBOR_UNUSED(_state)) {
+static void test_string_indef_decoding_2(void** _state _CBOR_UNUSED) {
assert_string_indef_start();
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(string_indef_2_data, 2));
@@ -346,7 +346,7 @@ unsigned char string_indef_3_data[] = {0x7F,
0x78, 0x01, 0x00,
// Break
0xFF};
-static void test_string_indef_decoding_3(void **_CBOR_UNUSED(_state)) {
+static void test_string_indef_decoding_3(void** _state _CBOR_UNUSED) {
assert_string_indef_start();
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(string_indef_3_data, 6));
@@ -365,14 +365,14 @@ static void test_string_indef_decoding_3(void **_CBOR_UNUSED(_state)) {
}
unsigned char array_embedded_int8_data[] = {0x80};
-static void test_array_embedded_int8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_array_embedded_int8_decoding(void** _state _CBOR_UNUSED) {
assert_array_start(0);
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(array_embedded_int8_data, 1));
}
unsigned char array_int8_data[] = {0x98, 0x02, 0x00, 0x01};
-static void test_array_int8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_array_int8_decoding(void** _state _CBOR_UNUSED) {
assert_array_start(2);
assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(array_int8_data, 4));
@@ -388,7 +388,7 @@ static void test_array_int8_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char array_int16_data[] = {0x99, 0x00, 0x02, 0x00, 0x01};
-static void test_array_int16_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_array_int16_decoding(void** _state _CBOR_UNUSED) {
assert_array_start(2);
assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(array_int16_data, 5));
@@ -404,7 +404,7 @@ static void test_array_int16_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char array_int32_data[] = {0x9A, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01};
-static void test_array_int32_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_array_int32_decoding(void** _state _CBOR_UNUSED) {
assert_array_start(2);
assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(array_int32_data, 7));
@@ -421,7 +421,7 @@ static void test_array_int32_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char array_int64_data[] = {0x9B, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x02, 0x00, 0x01};
-static void test_array_int64_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_array_int64_decoding(void** _state _CBOR_UNUSED) {
assert_array_start(2);
assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(array_int64_data, 11));
@@ -437,7 +437,7 @@ static void test_array_int64_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char array_of_arrays_data[] = {0x82, 0x80, 0x80};
-static void test_array_of_arrays_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_array_of_arrays_decoding(void** _state _CBOR_UNUSED) {
assert_array_start(2);
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(array_of_arrays_data, 3));
@@ -452,7 +452,7 @@ static void test_array_of_arrays_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char indef_array_data_1[] = {0x9F, 0x00, 0x18, 0xFF, 0x9F, 0xFF, 0xFF};
-static void test_indef_array_decoding_1(void **_CBOR_UNUSED(_state)) {
+static void test_indef_array_decoding_1(void** _state _CBOR_UNUSED) {
assert_indef_array_start();
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(indef_array_data_1, 7));
@@ -479,7 +479,7 @@ static void test_indef_array_decoding_1(void **_CBOR_UNUSED(_state)) {
}
unsigned char map_embedded_int8_data[] = {0xa1, 0x01, 0x00};
-static void test_map_embedded_int8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_map_embedded_int8_decoding(void** _state _CBOR_UNUSED) {
assert_map_start(1);
assert_decoder_result(1, CBOR_DECODER_FINISHED,
decode(map_embedded_int8_data, 3));
@@ -494,7 +494,7 @@ static void test_map_embedded_int8_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char map_int8_data[] = {0xB8, 0x01, 0x00, 0x01};
-static void test_map_int8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_map_int8_decoding(void** _state _CBOR_UNUSED) {
assert_map_start(1);
assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(map_int8_data, 4));
@@ -508,7 +508,7 @@ static void test_map_int8_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char map_int16_data[] = {0xB9, 0x00, 0x01, 0x00, 0x01};
-static void test_map_int16_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_map_int16_decoding(void** _state _CBOR_UNUSED) {
assert_map_start(1);
assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(map_int16_data, 5));
@@ -524,7 +524,7 @@ static void test_map_int16_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char map_int32_data[] = {0xBA, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01};
-static void test_map_int32_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_map_int32_decoding(void** _state _CBOR_UNUSED) {
assert_map_start(1);
assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(map_int32_data, 7));
@@ -541,7 +541,7 @@ static void test_map_int32_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char map_int64_data[] = {0xBB, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x01};
-static void test_map_int64_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_map_int64_decoding(void** _state _CBOR_UNUSED) {
assert_map_start(1);
assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(map_int64_data, 11));
@@ -557,7 +557,7 @@ static void test_map_int64_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char indef_map_data_1[] = {0xBF, 0x00, 0x18, 0xFF, 0xFF};
-static void test_indef_map_decoding_1(void **_CBOR_UNUSED(_state)) {
+static void test_indef_map_decoding_1(void** _state _CBOR_UNUSED) {
assert_indef_map_start();
assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(indef_map_data_1, 5));
@@ -575,13 +575,13 @@ static void test_indef_map_decoding_1(void **_CBOR_UNUSED(_state)) {
}
unsigned char embedded_tag_data[] = {0xC1};
-static void test_embedded_tag_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_tag_decoding(void** _state _CBOR_UNUSED) {
assert_tag_eq(1);
assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(embedded_tag_data, 1));
}
unsigned char int8_tag_data[] = {0xD8, 0xFE};
-static void test_int8_tag_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_int8_tag_decoding(void** _state _CBOR_UNUSED) {
assert_tag_eq(254);
assert_decoder_result(2, CBOR_DECODER_FINISHED, decode(int8_tag_data, 2));
@@ -589,7 +589,7 @@ static void test_int8_tag_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char int16_tag_data[] = {0xD9, 0xFE, 0xFD};
-static void test_int16_tag_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_int16_tag_decoding(void** _state _CBOR_UNUSED) {
assert_tag_eq(65277);
assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(int16_tag_data, 3));
@@ -597,7 +597,7 @@ static void test_int16_tag_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char int32_tag_data[] = {0xDA, 0xFE, 0xFD, 0xFC, 0xFB};
-static void test_int32_tag_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_int32_tag_decoding(void** _state _CBOR_UNUSED) {
assert_tag_eq(4278058235ULL);
assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(int32_tag_data, 5));
@@ -606,7 +606,7 @@ static void test_int32_tag_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char int64_tag_data[] = {0xDB, 0xFE, 0xFD, 0xFC, 0xFB,
0xFA, 0xF9, 0xF8, 0xF7};
-static void test_int64_tag_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_int64_tag_decoding(void** _state _CBOR_UNUSED) {
assert_tag_eq(18374120213919168759ULL);
assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(int64_tag_data, 9));
@@ -614,12 +614,12 @@ static void test_int64_tag_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char reserved_byte_data[] = {0xDC};
-static void test_reserved_byte_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_reserved_byte_decoding(void** _state _CBOR_UNUSED) {
assert_decoder_result(0, CBOR_DECODER_ERROR, decode(reserved_byte_data, 1));
}
unsigned char float2_data[] = {0xF9, 0x7B, 0xFF};
-static void test_float2_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_float2_decoding(void** _state _CBOR_UNUSED) {
assert_half(65504.0f);
assert_decoder_result(3, CBOR_DECODER_FINISHED, decode(float2_data, 3));
@@ -627,7 +627,7 @@ static void test_float2_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char float4_data[] = {0xFA, 0x47, 0xC3, 0x50, 0x00};
-static void test_float4_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_float4_decoding(void** _state _CBOR_UNUSED) {
assert_float(100000.0f);
assert_decoder_result(5, CBOR_DECODER_FINISHED, decode(float4_data, 5));
@@ -636,7 +636,7 @@ static void test_float4_decoding(void **_CBOR_UNUSED(_state)) {
unsigned char float8_data[] = {0xFB, 0xC0, 0x10, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66};
-static void test_float8_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_float8_decoding(void** _state _CBOR_UNUSED) {
assert_double(-4.1);
assert_decoder_result(9, CBOR_DECODER_FINISHED, decode(float8_data, 9));
@@ -644,25 +644,25 @@ static void test_float8_decoding(void **_CBOR_UNUSED(_state)) {
}
unsigned char false_data[] = {0xF4};
-static void test_false_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_false_decoding(void** _state _CBOR_UNUSED) {
assert_bool(false);
assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(false_data, 1));
}
unsigned char true_data[] = {0xF5};
-static void test_true_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_true_decoding(void** _state _CBOR_UNUSED) {
assert_bool(true);
assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(true_data, 1));
}
unsigned char null_data[] = {0xF6};
-static void test_null_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_null_decoding(void** _state _CBOR_UNUSED) {
assert_nil();
assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(null_data, 1));
}
unsigned char undef_data[] = {0xF7};
-static void test_undef_decoding(void **_CBOR_UNUSED(_state)) {
+static void test_undef_decoding(void** _state _CBOR_UNUSED) {
assert_undef();
assert_decoder_result(1, CBOR_DECODER_FINISHED, decode(undef_data, 1));
}
diff --git a/test/copy_test.c b/test/copy_test.c
index 92e210a6a600..ef58fecd5a9f 100644
--- a/test/copy_test.c
+++ b/test/copy_test.c
@@ -11,7 +11,7 @@
cbor_item_t *item, *copy, *tmp;
-static void test_uints(void **_CBOR_UNUSED(_state)) {
+static void test_uints(void** _state _CBOR_UNUSED) {
item = cbor_build_uint8(10);
assert_uint8(copy = cbor_copy(item), 10);
cbor_decref(&item);
@@ -33,7 +33,7 @@ static void test_uints(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_negints(void **_CBOR_UNUSED(_state)) {
+static void test_negints(void** _state _CBOR_UNUSED) {
item = cbor_build_negint8(10);
assert_true(cbor_get_uint8(copy = cbor_copy(item)) == 10);
cbor_decref(&item);
@@ -55,7 +55,7 @@ static void test_negints(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_def_bytestring(void **_CBOR_UNUSED(_state)) {
+static void test_def_bytestring(void** _state _CBOR_UNUSED) {
item = cbor_build_bytestring((cbor_data) "abc", 3);
assert_memory_equal(cbor_bytestring_handle(copy = cbor_copy(item)),
cbor_bytestring_handle(item), 3);
@@ -63,7 +63,7 @@ static void test_def_bytestring(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_indef_bytestring(void **_CBOR_UNUSED(_state)) {
+static void test_indef_bytestring(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_bytestring();
assert_true(cbor_bytestring_add_chunk(
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
@@ -78,7 +78,7 @@ static void test_indef_bytestring(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_def_string(void **_CBOR_UNUSED(_state)) {
+static void test_def_string(void** _state _CBOR_UNUSED) {
item = cbor_build_string("abc");
assert_memory_equal(cbor_string_handle(copy = cbor_copy(item)),
cbor_string_handle(item), 3);
@@ -86,7 +86,7 @@ static void test_def_string(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_indef_string(void **_CBOR_UNUSED(_state)) {
+static void test_indef_string(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_string();
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
copy = cbor_copy(item);
@@ -100,7 +100,7 @@ static void test_indef_string(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_def_array(void **_CBOR_UNUSED(_state)) {
+static void test_def_array(void** _state _CBOR_UNUSED) {
item = cbor_new_definite_array(1);
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
@@ -110,7 +110,7 @@ static void test_def_array(void **_CBOR_UNUSED(_state)) {
cbor_decref(&tmp);
}
-static void test_indef_array(void **_CBOR_UNUSED(_state)) {
+static void test_indef_array(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_array();
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
@@ -120,7 +120,7 @@ static void test_indef_array(void **_CBOR_UNUSED(_state)) {
cbor_decref(&tmp);
}
-static void test_def_map(void **_CBOR_UNUSED(_state)) {
+static void test_def_map(void** _state _CBOR_UNUSED) {
item = cbor_new_definite_map(1);
assert_true(cbor_map_add(item, (struct cbor_pair){
.key = cbor_move(cbor_build_uint8(42)),
@@ -133,7 +133,7 @@ static void test_def_map(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_indef_map(void **_CBOR_UNUSED(_state)) {
+static void test_indef_map(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_map();
assert_true(cbor_map_add(item, (struct cbor_pair){
.key = cbor_move(cbor_build_uint8(42)),
@@ -146,7 +146,7 @@ static void test_indef_map(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_tag(void **_CBOR_UNUSED(_state)) {
+static void test_tag(void** _state _CBOR_UNUSED) {
item = cbor_build_tag(10, cbor_move(cbor_build_uint8(42)));
assert_uint8(cbor_move(cbor_tag_item(copy = cbor_copy(item))), 42);
@@ -155,14 +155,14 @@ static void test_tag(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_ctrls(void **_CBOR_UNUSED(_state)) {
+static void test_ctrls(void** _state _CBOR_UNUSED) {
item = cbor_new_null();
assert_true(cbor_is_null(copy = cbor_copy(item)));
cbor_decref(&item);
cbor_decref(&copy);
}
-static void test_floats(void **_CBOR_UNUSED(_state)) {
+static void test_floats(void** _state _CBOR_UNUSED) {
item = cbor_build_float2(3.14f);
assert_true(cbor_float_get_float2(copy = cbor_copy(item)) ==
cbor_float_get_float2(item));
@@ -182,7 +182,7 @@ static void test_floats(void **_CBOR_UNUSED(_state)) {
cbor_decref(&copy);
}
-static void test_alloc_failure_simple(void **_CBOR_UNUSED(_state)) {
+static void test_alloc_failure_simple(void** _state _CBOR_UNUSED) {
item = cbor_build_uint8(10);
WITH_FAILING_MALLOC({ assert_null(cbor_copy(item)); });
@@ -191,7 +191,7 @@ static void test_alloc_failure_simple(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_bytestring_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_bytestring_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_bytestring();
assert_true(cbor_bytestring_add_chunk(
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
@@ -202,7 +202,7 @@ static void test_bytestring_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_bytestring_chunk_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_bytestring_chunk_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_bytestring();
assert_true(cbor_bytestring_add_chunk(
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
@@ -213,7 +213,7 @@ static void test_bytestring_chunk_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_bytestring_chunk_append_failure(void **_CBOR_UNUSED(_state)) {
+static void test_bytestring_chunk_append_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_bytestring();
assert_true(cbor_bytestring_add_chunk(
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
@@ -228,7 +228,7 @@ static void test_bytestring_chunk_append_failure(void **_CBOR_UNUSED(_state)) {
}
static void test_bytestring_second_chunk_alloc_failure(
- void **_CBOR_UNUSED(_state)) {
+ void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_bytestring();
assert_true(cbor_bytestring_add_chunk(
item, cbor_move(cbor_build_bytestring((cbor_data) "abc", 3))));
@@ -245,7 +245,7 @@ static void test_bytestring_second_chunk_alloc_failure(
cbor_decref(&item);
}
-static void test_string_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_string_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_string();
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
@@ -255,7 +255,7 @@ static void test_string_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_string_chunk_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_string_chunk_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_string();
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
@@ -265,7 +265,7 @@ static void test_string_chunk_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_string_chunk_append_failure(void **_CBOR_UNUSED(_state)) {
+static void test_string_chunk_append_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_string();
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
@@ -278,8 +278,7 @@ static void test_string_chunk_append_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_string_second_chunk_alloc_failure(
- void **_CBOR_UNUSED(_state)) {
+static void test_string_second_chunk_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_string();
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("abc"))));
assert_true(cbor_string_add_chunk(item, cbor_move(cbor_build_string("def"))));
@@ -294,7 +293,7 @@ static void test_string_second_chunk_alloc_failure(
cbor_decref(&item);
}
-static void test_array_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_array_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_array();
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
@@ -304,7 +303,7 @@ static void test_array_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_array_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_array_item_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_array();
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
@@ -317,7 +316,7 @@ static void test_array_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_array_push_failure(void **_CBOR_UNUSED(_state)) {
+static void test_array_push_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_array();
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
@@ -330,7 +329,7 @@ static void test_array_push_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_array_second_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_array_second_item_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_array();
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(42))));
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(43))));
@@ -344,7 +343,7 @@ static void test_array_second_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_map_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_map_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_map();
assert_true(
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
@@ -356,7 +355,7 @@ static void test_map_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_map_key_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_map_key_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_map();
assert_true(
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
@@ -370,7 +369,7 @@ static void test_map_key_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_map_value_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_map_value_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_map();
assert_true(
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
@@ -384,7 +383,7 @@ static void test_map_value_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_map_add_failure(void **_CBOR_UNUSED(_state)) {
+static void test_map_add_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_map();
assert_true(
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
@@ -398,7 +397,7 @@ static void test_map_add_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_map_second_key_failure(void **_CBOR_UNUSED(_state)) {
+static void test_map_second_key_failure(void** _state _CBOR_UNUSED) {
item = cbor_new_indefinite_map();
assert_true(
cbor_map_add(item, (struct cbor_pair){cbor_move(cbor_build_uint8(42)),
@@ -415,7 +414,7 @@ static void test_map_second_key_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_tag_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_tag_item_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_build_tag(1, cbor_move(cbor_build_uint8(42)));
WITH_FAILING_MALLOC({ assert_null(cbor_copy(item)); });
@@ -424,7 +423,7 @@ static void test_tag_item_alloc_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_tag_alloc_failure(void **_CBOR_UNUSED(_state)) {
+static void test_tag_alloc_failure(void** _state _CBOR_UNUSED) {
item = cbor_build_tag(1, cbor_move(cbor_build_uint8(42)));
WITH_MOCK_MALLOC({ assert_null(cbor_copy(item)); }, 2,
diff --git a/test/float_ctrl_encoders_test.c b/test/float_ctrl_encoders_test.c
index 8940106d91d3..f7d302472666 100644
--- a/test/float_ctrl_encoders_test.c
+++ b/test/float_ctrl_encoders_test.c
@@ -11,24 +11,24 @@
unsigned char buffer[512];
-static void test_bools(void **_CBOR_UNUSED(_state)) {
+static void test_bools(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_bool(false, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF4}), 1);
assert_size_equal(1, cbor_encode_bool(true, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF5}), 1);
}
-static void test_null(void **_CBOR_UNUSED(_state)) {
+static void test_null(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_null(buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF6}), 1);
}
-static void test_undef(void **_CBOR_UNUSED(_state)) {
+static void test_undef(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_undef(buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF7}), 1);
}
-static void test_break(void **_CBOR_UNUSED(_state)) {
+static void test_break(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_break(buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xFF}), 1);
}
@@ -39,7 +39,7 @@ static void assert_half_float_codec_identity(void) {
unsigned char secondary_buffer[3];
struct cbor_load_result res;
// Load and check data in buffer
- cbor_item_t *half_float = cbor_load(buffer, 3, &res);
+ cbor_item_t* half_float = cbor_load(buffer, 3, &res);
assert_size_equal(res.error.code, CBOR_ERR_NONE);
assert_true(cbor_isa_float_ctrl(half_float));
assert_true(cbor_is_float(half_float));
@@ -51,7 +51,7 @@ static void assert_half_float_codec_identity(void) {
cbor_decref(&half_float);
}
-static void test_half(void **_CBOR_UNUSED(_state)) {
+static void test_half(void** _state _CBOR_UNUSED) {
assert_size_equal(3, cbor_encode_half(1.5f, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF9, 0x3E, 0x00}), 3);
assert_half_float_codec_identity();
@@ -117,21 +117,17 @@ static void test_half(void **_CBOR_UNUSED(_state)) {
assert_half_float_codec_identity();
}
-static void test_half_special(void **_CBOR_UNUSED(_state)) {
+static void test_half_special(void** _state _CBOR_UNUSED) {
assert_size_equal(3, cbor_encode_half(NAN, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF9, 0x7E, 0x00}), 3);
assert_half_float_codec_identity();
- // We discard all information bits in half-float NaNs. This is
- // not required for the core CBOR protocol (it is only a suggestion in
- // Section 3.9).
- // See https://github.com/PJK/libcbor/issues/215
assert_size_equal(3, cbor_encode_half(nanf("2"), buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF9, 0x7E, 0x00}), 3);
assert_half_float_codec_identity();
}
-static void test_half_infinity(void **_CBOR_UNUSED(_state)) {
+static void test_half_infinity(void** _state _CBOR_UNUSED) {
assert_size_equal(3, cbor_encode_half(INFINITY, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xF9, 0x7C, 0x00}), 3);
assert_half_float_codec_identity();
@@ -141,7 +137,7 @@ static void test_half_infinity(void **_CBOR_UNUSED(_state)) {
assert_half_float_codec_identity();
}
-static void test_float(void **_CBOR_UNUSED(_state)) {
+static void test_float(void** _state _CBOR_UNUSED) {
assert_size_equal(5, cbor_encode_single(3.4028234663852886e+38, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xFA, 0x7F, 0x7F, 0xFF, 0xFF}),
5);
@@ -150,12 +146,9 @@ static void test_float(void **_CBOR_UNUSED(_state)) {
assert_memory_equal(buffer, ((unsigned char[]){0xFA, 0x7F, 0xC0, 0x00, 0x00}),
5);
-#ifndef _WIN32
- // TODO: https://github.com/PJK/libcbor/issues/271
assert_size_equal(5, cbor_encode_single(nanf("3"), buffer, 512));
- assert_memory_equal(buffer, ((unsigned char[]){0xFA, 0x7F, 0xC0, 0x00, 0x03}),
+ assert_memory_equal(buffer, ((unsigned char[]){0xFA, 0x7F, 0xC0, 0x00, 0x00}),
5);
-#endif
assert_size_equal(5, cbor_encode_single(strtof("Inf", NULL), buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xFA, 0x7F, 0x80, 0x00, 0x00}),
@@ -166,7 +159,7 @@ static void test_float(void **_CBOR_UNUSED(_state)) {
5);
}
-static void test_double(void **_CBOR_UNUSED(_state)) {
+static void test_double(void** _state _CBOR_UNUSED) {
assert_size_equal(9, cbor_encode_double(1.0e+300, buffer, 512));
assert_memory_equal(
buffer,
@@ -179,14 +172,11 @@ static void test_double(void **_CBOR_UNUSED(_state)) {
((unsigned char[]){0xFB, 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}),
9);
-#ifndef _WIN32
- // TODO: https://github.com/PJK/libcbor/issues/271
assert_size_equal(9, cbor_encode_double(nan("3"), buffer, 512));
assert_memory_equal(
buffer,
- ((unsigned char[]){0xFB, 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}),
+ ((unsigned char[]){0xFB, 0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}),
9);
-#endif
assert_size_equal(9, cbor_encode_double(strtod("Inf", NULL), buffer, 512));
assert_memory_equal(
diff --git a/test/float_ctrl_test.c b/test/float_ctrl_test.c
index c939486877e7..927bf567bdc3 100644
--- a/test/float_ctrl_test.c
+++ b/test/float_ctrl_test.c
@@ -17,14 +17,14 @@
#include "cbor.h"
#include "test_allocator.h"
-cbor_item_t *float_ctrl;
+cbor_item_t* float_ctrl;
struct cbor_load_result res;
static const float eps = 0.00001f;
unsigned char float2_data[] = {0xF9, 0x7B, 0xFF};
-static void test_float2(void **_CBOR_UNUSED(_state)) {
+static void test_float2(void** _state _CBOR_UNUSED) {
float_ctrl = cbor_load(float2_data, 3, &res);
assert_true(cbor_isa_float_ctrl(float_ctrl));
assert_true(cbor_is_float(float_ctrl));
@@ -37,7 +37,7 @@ static void test_float2(void **_CBOR_UNUSED(_state)) {
unsigned char float4_data[] = {0xFA, 0x47, 0xC3, 0x50, 0x00};
-static void test_float4(void **_CBOR_UNUSED(_state)) {
+static void test_float4(void** _state _CBOR_UNUSED) {
float_ctrl = cbor_load(float4_data, 5, &res);
assert_true(cbor_isa_float_ctrl(float_ctrl));
assert_true(cbor_is_float(float_ctrl));
@@ -51,7 +51,7 @@ static void test_float4(void **_CBOR_UNUSED(_state)) {
unsigned char float8_data[] = {0xFB, 0x7E, 0x37, 0xE4, 0x3C,
0x88, 0x00, 0x75, 0x9C};
-static void test_float8(void **_CBOR_UNUSED(_state)) {
+static void test_float8(void** _state _CBOR_UNUSED) {
float_ctrl = cbor_load(float8_data, 9, &res);
assert_true(cbor_isa_float_ctrl(float_ctrl));
assert_true(cbor_is_float(float_ctrl));
@@ -66,7 +66,7 @@ static void test_float8(void **_CBOR_UNUSED(_state)) {
unsigned char null_data[] = {0xF6};
-static void test_null(void **_CBOR_UNUSED(_state)) {
+static void test_null(void** _state _CBOR_UNUSED) {
float_ctrl = cbor_load(null_data, 1, &res);
assert_true(cbor_isa_float_ctrl(float_ctrl));
assert_true(cbor_is_null(float_ctrl));
@@ -76,7 +76,7 @@ static void test_null(void **_CBOR_UNUSED(_state)) {
unsigned char undef_data[] = {0xF7};
-static void test_undef(void **_CBOR_UNUSED(_state)) {
+static void test_undef(void** _state _CBOR_UNUSED) {
float_ctrl = cbor_load(undef_data, 1, &res);
assert_true(cbor_isa_float_ctrl(float_ctrl));
assert_true(cbor_is_undef(float_ctrl));
@@ -86,7 +86,7 @@ static void test_undef(void **_CBOR_UNUSED(_state)) {
unsigned char bool_data[] = {0xF4, 0xF5};
-static void test_bool(void **_CBOR_UNUSED(_state)) {
+static void test_bool(void** _state _CBOR_UNUSED) {
_CBOR_TEST_DISABLE_ASSERT({
float_ctrl = cbor_load(bool_data, 1, &res);
assert_true(cbor_isa_float_ctrl(float_ctrl));
@@ -110,7 +110,7 @@ static void test_bool(void **_CBOR_UNUSED(_state)) {
});
}
-static void test_float_ctrl_creation(void **_CBOR_UNUSED(_state)) {
+static void test_float_ctrl_creation(void** _state _CBOR_UNUSED) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_ctrl()); });
WITH_FAILING_MALLOC({ assert_null(cbor_new_float2()); });
WITH_FAILING_MALLOC({ assert_null(cbor_new_float4()); });
@@ -119,8 +119,8 @@ static void test_float_ctrl_creation(void **_CBOR_UNUSED(_state)) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_undef()); });
WITH_FAILING_MALLOC({ assert_null(cbor_build_bool(false)); });
- WITH_FAILING_MALLOC({ assert_null(cbor_build_float2(3.14)); });
- WITH_FAILING_MALLOC({ assert_null(cbor_build_float4(3.14)); });
+ WITH_FAILING_MALLOC({ assert_null(cbor_build_float2(3.14f)); });
+ WITH_FAILING_MALLOC({ assert_null(cbor_build_float4(3.14f)); });
WITH_FAILING_MALLOC({ assert_null(cbor_build_float8(3.14)); });
WITH_FAILING_MALLOC({ assert_null(cbor_build_ctrl(0xAF)); });
}
diff --git a/test/fuzz_test.c b/test/fuzz_test.c
index a02ed7ea9287..5effadd64774 100644
--- a/test/fuzz_test.c
+++ b/test/fuzz_test.c
@@ -18,7 +18,7 @@
#endif
#ifdef PRINT_FUZZ
-static void printmem(const unsigned char *ptr, size_t length) {
+static void printmem(const unsigned char* ptr, size_t length) {
for (size_t i = 0; i < length; i++) printf("%02X", ptr[i]);
printf("\n");
}
@@ -26,7 +26,7 @@ static void printmem(const unsigned char *ptr, size_t length) {
unsigned seed;
-void *mock_malloc(size_t size) {
+void* mock_malloc(size_t size) {
if (size > (1 << 19))
return NULL;
else
@@ -34,11 +34,11 @@ void *mock_malloc(size_t size) {
}
static void run_round(void) {
- cbor_item_t *item;
+ cbor_item_t* item;
struct cbor_load_result res;
size_t length = rand() % MAXLEN + 1;
- unsigned char *data = malloc(length);
+ unsigned char* data = malloc(length);
for (size_t i = 0; i < length; i++) {
data[i] = rand() % 0xFF;
}
@@ -55,7 +55,7 @@ static void run_round(void) {
free(data);
}
-static void fuzz(void **_CBOR_UNUSED(_state)) {
+static void fuzz(void** _state _CBOR_UNUSED) {
cbor_set_allocs(mock_malloc, realloc, free);
printf("Fuzzing %llu rounds of up to %llu bytes with seed %u\n", ROUNDS,
MAXLEN, seed);
@@ -67,7 +67,7 @@ static void fuzz(void **_CBOR_UNUSED(_state)) {
(ROUNDS * MAXLEN) / 1024);
}
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
if (argc > 1)
seed = (unsigned)strtoul(argv[1], NULL, 10);
else
diff --git a/test/map_encoders_test.c b/test/map_encoders_test.c
index bbb5fdc1ad91..40cfe33631ed 100644
--- a/test/map_encoders_test.c
+++ b/test/map_encoders_test.c
@@ -10,18 +10,18 @@
unsigned char buffer[512];
-static void test_embedded_map_start(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_map_start(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_map_start(1, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xA1}), 1);
}
-static void test_map_start(void **_CBOR_UNUSED(_state)) {
+static void test_map_start(void** _state _CBOR_UNUSED) {
assert_size_equal(5, cbor_encode_map_start(1000000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xBA, 0x00, 0x0F, 0x42, 0x40}),
5);
}
-static void test_indef_map_start(void **_CBOR_UNUSED(_state)) {
+static void test_indef_map_start(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_indef_map_start(buffer, 512));
assert_size_equal(0, cbor_encode_indef_map_start(buffer, 0));
assert_memory_equal(buffer, ((unsigned char[]){0xBF}), 1);
diff --git a/test/map_test.c b/test/map_test.c
index 11bd7a8d7242..3c41456079a0 100644
--- a/test/map_test.c
+++ b/test/map_test.c
@@ -17,12 +17,12 @@
#include "cbor.h"
#include "test_allocator.h"
-cbor_item_t *map;
+cbor_item_t* map;
struct cbor_load_result res;
unsigned char empty_map[] = {0xA0};
-static void test_empty_map(void **_CBOR_UNUSED(_state)) {
+static void test_empty_map(void** _state _CBOR_UNUSED) {
map = cbor_load(empty_map, 1, &res);
assert_non_null(map);
assert_true(cbor_typeof(map) == CBOR_TYPE_MAP);
@@ -37,7 +37,7 @@ static void test_empty_map(void **_CBOR_UNUSED(_state)) {
unsigned char simple_map[] = {0xA2, 0x01, 0x02, 0x03, 0x04};
/* {1: 2, 3: 4} */
-static void test_simple_map(void **_CBOR_UNUSED(_state)) {
+static void test_simple_map(void** _state _CBOR_UNUSED) {
map = cbor_load(simple_map, 5, &res);
assert_non_null(map);
assert_true(cbor_typeof(map) == CBOR_TYPE_MAP);
@@ -45,7 +45,7 @@ static void test_simple_map(void **_CBOR_UNUSED(_state)) {
assert_true(cbor_map_is_definite(map));
assert_true(cbor_map_size(map) == 2);
assert_true(res.read == 5);
- struct cbor_pair *handle = cbor_map_handle(map);
+ struct cbor_pair* handle = cbor_map_handle(map);
assert_uint8(handle[0].key, 1);
assert_uint8(handle[0].value, 2);
assert_uint8(handle[1].key, 3);
@@ -57,7 +57,7 @@ static void test_simple_map(void **_CBOR_UNUSED(_state)) {
unsigned char simple_indef_map[] = {0xBF, 0x01, 0x02, 0x03, 0x04, 0xFF};
/* {_ 1: 2, 3: 4} */
-static void test_indef_simple_map(void **_CBOR_UNUSED(_state)) {
+static void test_indef_simple_map(void** _state _CBOR_UNUSED) {
map = cbor_load(simple_indef_map, 6, &res);
assert_non_null(map);
assert_true(cbor_typeof(map) == CBOR_TYPE_MAP);
@@ -65,7 +65,7 @@ static void test_indef_simple_map(void **_CBOR_UNUSED(_state)) {
assert_true(cbor_map_is_indefinite(map));
assert_true(cbor_map_size(map) == 2);
assert_true(res.read == 6);
- struct cbor_pair *handle = cbor_map_handle(map);
+ struct cbor_pair* handle = cbor_map_handle(map);
assert_uint8(handle[0].key, 1);
assert_uint8(handle[0].value, 2);
assert_uint8(handle[1].key, 3);
@@ -84,7 +84,7 @@ unsigned char def_nested_map[] = {
0x74, 0x69, 0x74, 0x6C, 0x65, 0x70, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C,
0x65, 0x20, 0x67, 0x6C, 0x6F, 0x73, 0x73, 0x61, 0x72, 0x79};
-static void test_def_nested_map(void **_CBOR_UNUSED(_state)) {
+static void test_def_nested_map(void** _state _CBOR_UNUSED) {
map = cbor_load(def_nested_map, 34, &res);
assert_non_null(map);
assert_true(cbor_typeof(map) == CBOR_TYPE_MAP);
@@ -92,10 +92,10 @@ static void test_def_nested_map(void **_CBOR_UNUSED(_state)) {
assert_true(cbor_map_is_definite(map));
assert_true(cbor_map_size(map) == 1);
assert_true(res.read == 34);
- struct cbor_pair *handle = cbor_map_handle(map);
+ struct cbor_pair* handle = cbor_map_handle(map);
assert_true(cbor_typeof(handle[0].key) == CBOR_TYPE_STRING);
assert_true(cbor_typeof(handle[0].value) == CBOR_TYPE_MAP);
- struct cbor_pair *inner_handle = cbor_map_handle(handle[0].value);
+ struct cbor_pair* inner_handle = cbor_map_handle(handle[0].value);
assert_true(cbor_typeof(inner_handle[0].key) == CBOR_TYPE_STRING);
assert_true(cbor_typeof(inner_handle[0].value) == CBOR_TYPE_STRING);
assert_memory_equal(cbor_string_handle(inner_handle[0].value),
@@ -108,7 +108,7 @@ unsigned char streamed_key_map[] = {0xA1, 0x7F, 0x61, 0x61,
0x61, 0x62, 0xFF, 0xA0};
/* '{ (_"a" "b"): {}}' */
-static void test_streamed_key_map(void **_CBOR_UNUSED(_state)) {
+static void test_streamed_key_map(void** _state _CBOR_UNUSED) {
map = cbor_load(streamed_key_map, 8, &res);
assert_non_null(map);
assert_true(cbor_typeof(map) == CBOR_TYPE_MAP);
@@ -116,7 +116,7 @@ static void test_streamed_key_map(void **_CBOR_UNUSED(_state)) {
assert_true(cbor_map_is_definite(map));
assert_true(cbor_map_size(map) == 1);
assert_true(res.read == 8);
- struct cbor_pair *handle = cbor_map_handle(map);
+ struct cbor_pair* handle = cbor_map_handle(map);
assert_true(cbor_typeof(handle[0].key) == CBOR_TYPE_STRING);
assert_true(cbor_string_is_indefinite(handle[0].key));
assert_size_equal(cbor_string_chunk_count(handle[0].key), 2);
@@ -130,7 +130,7 @@ unsigned char streamed_kv_map[] = {0xA1, 0x7F, 0x61, 0x61, 0x61, 0x62, 0xFF,
0x7F, 0x61, 0x63, 0x61, 0x64, 0xFF};
/* '{ (_"a" "b"): (_"c", "d")}' */
-static void test_streamed_kv_map(void **_CBOR_UNUSED(_state)) {
+static void test_streamed_kv_map(void** _state _CBOR_UNUSED) {
map = cbor_load(streamed_kv_map, 13, &res);
assert_non_null(map);
assert_true(cbor_typeof(map) == CBOR_TYPE_MAP);
@@ -138,7 +138,7 @@ static void test_streamed_kv_map(void **_CBOR_UNUSED(_state)) {
assert_true(cbor_map_is_definite(map));
assert_size_equal(cbor_map_size(map), 1);
assert_size_equal(res.read, 13);
- struct cbor_pair *handle = cbor_map_handle(map);
+ struct cbor_pair* handle = cbor_map_handle(map);
assert_true(cbor_typeof(handle[0].key) == CBOR_TYPE_STRING);
assert_true(cbor_string_is_indefinite(handle[0].key));
assert_size_equal(cbor_string_chunk_count(handle[0].key), 2);
@@ -157,7 +157,7 @@ unsigned char streamed_streamed_kv_map[] = {0xBF, 0x7F, 0x61, 0x61, 0x61,
0x61, 0x64, 0xFF, 0xFF};
/* '{_ (_"a" "b"): (_"c", "d")}' */
-static void test_streamed_streamed_kv_map(void **_CBOR_UNUSED(_state)) {
+static void test_streamed_streamed_kv_map(void** _state _CBOR_UNUSED) {
map = cbor_load(streamed_streamed_kv_map, 14, &res);
assert_non_null(map);
assert_true(cbor_typeof(map) == CBOR_TYPE_MAP);
@@ -165,7 +165,7 @@ static void test_streamed_streamed_kv_map(void **_CBOR_UNUSED(_state)) {
assert_true(cbor_map_is_indefinite(map));
assert_size_equal(cbor_map_size(map), 1);
assert_size_equal(res.read, 14);
- struct cbor_pair *handle = cbor_map_handle(map);
+ struct cbor_pair* handle = cbor_map_handle(map);
assert_true(cbor_typeof(handle[0].key) == CBOR_TYPE_STRING);
assert_true(cbor_string_is_indefinite(handle[0].key));
assert_size_equal(cbor_string_chunk_count(handle[0].key), 2);
@@ -179,10 +179,10 @@ static void test_streamed_streamed_kv_map(void **_CBOR_UNUSED(_state)) {
assert_null(map);
}
-static void test_map_add_full(void **_CBOR_UNUSED(_state)) {
+static void test_map_add_full(void** _state _CBOR_UNUSED) {
map = cbor_new_definite_map(0);
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *two = cbor_build_uint8(2);
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* two = cbor_build_uint8(2);
assert_false(cbor_map_add(map, (struct cbor_pair){.key = one, .value = two}));
@@ -191,15 +191,15 @@ static void test_map_add_full(void **_CBOR_UNUSED(_state)) {
cbor_decref(&two);
}
-static void test_map_add_too_big_to_realloc(void **_CBOR_UNUSED(_state)) {
+static void test_map_add_too_big_to_realloc(void** _state _CBOR_UNUSED) {
map = cbor_new_indefinite_map();
- struct _cbor_map_metadata *metadata =
- (struct _cbor_map_metadata *)&map->metadata;
+ struct _cbor_map_metadata* metadata =
+ (struct _cbor_map_metadata*)&map->metadata;
// Pretend we already have a huge memory block
metadata->allocated = SIZE_MAX;
metadata->end_ptr = SIZE_MAX;
- cbor_item_t *one = cbor_build_uint8(1);
- cbor_item_t *two = cbor_build_uint8(2);
+ cbor_item_t* one = cbor_build_uint8(1);
+ cbor_item_t* two = cbor_build_uint8(2);
assert_false(cbor_map_add(map, (struct cbor_pair){.key = one, .value = two}));
@@ -210,7 +210,7 @@ static void test_map_add_too_big_to_realloc(void **_CBOR_UNUSED(_state)) {
cbor_decref(&two);
}
-static void test_map_creation(void **_CBOR_UNUSED(_state)) {
+static void test_map_creation(void** _state _CBOR_UNUSED) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_definite_map(42)); });
WITH_MOCK_MALLOC({ assert_null(cbor_new_definite_map(42)); }, 2, MALLOC,
MALLOC_FAIL);
@@ -218,12 +218,12 @@ static void test_map_creation(void **_CBOR_UNUSED(_state)) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_indefinite_map()); });
}
-static void test_map_add(void **_CBOR_UNUSED(_state)) {
+static void test_map_add(void** _state _CBOR_UNUSED) {
WITH_MOCK_MALLOC(
{
- cbor_item_t *map = cbor_new_indefinite_map();
- cbor_item_t *key = cbor_build_uint8(0);
- cbor_item_t *value = cbor_build_bool(true);
+ cbor_item_t* map = cbor_new_indefinite_map();
+ cbor_item_t* key = cbor_build_uint8(0);
+ cbor_item_t* value = cbor_build_bool(true);
assert_false(
cbor_map_add(map, (struct cbor_pair){.key = key, .value = value}));
@@ -238,10 +238,10 @@ static void test_map_add(void **_CBOR_UNUSED(_state)) {
}
static unsigned char test_indef_map[] = {0xBF, 0x01, 0x02, 0x03, 0x04, 0xFF};
-static void test_indef_map_decode(void **_CBOR_UNUSED(_state)) {
+static void test_indef_map_decode(void** _state _CBOR_UNUSED) {
WITH_MOCK_MALLOC(
{
- cbor_item_t *map;
+ cbor_item_t* map;
struct cbor_load_result res;
map = cbor_load(test_indef_map, 6, &res);
diff --git a/test/memory_utils_test.c b/test/memory_utils_test.c
index 6cf07c7da934..e10551c7b502 100644
--- a/test/memory_utils_test.c
+++ b/test/memory_utils_test.c
@@ -9,7 +9,7 @@
#include <string.h>
#include "assertions.h"
-static void test_safe_multiply(void **_CBOR_UNUSED(_state)) {
+static void test_safe_multiply(void** _state _CBOR_UNUSED) {
assert_true(_cbor_safe_to_multiply(1, 1));
assert_true(_cbor_safe_to_multiply(SIZE_MAX, 0));
assert_true(_cbor_safe_to_multiply(SIZE_MAX, 1));
@@ -17,7 +17,7 @@ static void test_safe_multiply(void **_CBOR_UNUSED(_state)) {
assert_false(_cbor_safe_to_multiply(SIZE_MAX, SIZE_MAX));
}
-static void test_safe_add(void **_CBOR_UNUSED(_state)) {
+static void test_safe_add(void** _state _CBOR_UNUSED) {
assert_true(_cbor_safe_to_add(1, 1));
assert_true(_cbor_safe_to_add(SIZE_MAX - 1, 1));
assert_true(_cbor_safe_to_add(SIZE_MAX, 0));
@@ -28,7 +28,7 @@ static void test_safe_add(void **_CBOR_UNUSED(_state)) {
assert_false(_cbor_safe_to_add(SIZE_MAX - 1, SIZE_MAX - 1));
}
-static void test_safe_signalling_add(void **_CBOR_UNUSED(_state)) {
+static void test_safe_signalling_add(void** _state _CBOR_UNUSED) {
assert_size_equal(_cbor_safe_signaling_add(1, 2), 3);
assert_size_equal(_cbor_safe_signaling_add(0, 1), 0);
assert_size_equal(_cbor_safe_signaling_add(0, SIZE_MAX), 0);
@@ -36,8 +36,8 @@ static void test_safe_signalling_add(void **_CBOR_UNUSED(_state)) {
assert_size_equal(_cbor_safe_signaling_add(1, SIZE_MAX - 1), SIZE_MAX);
}
-static void test_realloc_multiple(void **_CBOR_UNUSED(_state)) {
- unsigned char *data = malloc(1);
+static void test_realloc_multiple(void** _state _CBOR_UNUSED) {
+ unsigned char* data = malloc(1);
data[0] = 0x2a;
data = _cbor_realloc_multiple(data, /*item_size=*/1, /*item_count=*/10);
diff --git a/test/negint_encoders_test.c b/test/negint_encoders_test.c
index e9230fbe42ae..f4e52c8c37d0 100644
--- a/test/negint_encoders_test.c
+++ b/test/negint_encoders_test.c
@@ -10,31 +10,31 @@
unsigned char buffer[512];
-static void test_embedded_negint8(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_negint8(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_negint8(14, buffer, 512));
assert_memory_equal(buffer, (unsigned char[]){0x2E}, 1);
}
-static void test_negint8(void **_CBOR_UNUSED(_state)) {
+static void test_negint8(void** _state _CBOR_UNUSED) {
assert_size_equal(0, cbor_encode_negint8(180, buffer, 1));
assert_size_equal(2, cbor_encode_negint8(255, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x38, 0xFF}), 2);
}
-static void test_negint16(void **_CBOR_UNUSED(_state)) {
+static void test_negint16(void** _state _CBOR_UNUSED) {
assert_size_equal(0, cbor_encode_negint16(1000, buffer, 2));
assert_size_equal(3, cbor_encode_negint16(1000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x39, 0x03, 0xE8}), 3);
}
-static void test_negint32(void **_CBOR_UNUSED(_state)) {
+static void test_negint32(void** _state _CBOR_UNUSED) {
assert_size_equal(0, cbor_encode_negint32(1000000, buffer, 4));
assert_size_equal(5, cbor_encode_negint32(1000000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x3A, 0x00, 0x0F, 0x42, 0x40}),
5);
}
-static void test_negint64(void **_CBOR_UNUSED(_state)) {
+static void test_negint64(void** _state _CBOR_UNUSED) {
assert_size_equal(0,
cbor_encode_negint64(18446744073709551615ULL, buffer, 8));
assert_size_equal(9,
@@ -45,7 +45,7 @@ static void test_negint64(void **_CBOR_UNUSED(_state)) {
9);
}
-static void test_unspecified(void **_CBOR_UNUSED(_state)) {
+static void test_unspecified(void** _state _CBOR_UNUSED) {
assert_size_equal(9,
cbor_encode_negint(18446744073709551615ULL, buffer, 512));
assert_memory_equal(
diff --git a/test/negint_test.c b/test/negint_test.c
index 66e7445b7f23..1df7d53fd526 100644
--- a/test/negint_test.c
+++ b/test/negint_test.c
@@ -9,7 +9,7 @@
#include "cbor.h"
#include "test_allocator.h"
-cbor_item_t *number;
+cbor_item_t* number;
struct cbor_load_result res;
unsigned char data1[] = {0x22, 0xFF};
@@ -19,7 +19,7 @@ unsigned char data4[] = {0x3a, 0xa5, 0xf7, 0x02, 0xb3, 0xFF};
unsigned char data5[] = {0x3b, 0xa5, 0xf7, 0x02, 0xb3,
0xa5, 0xf7, 0x02, 0xb3, 0xFF};
-static void test_very_short_int(void **_CBOR_UNUSED(_state)) {
+static void test_very_short_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data1, 2, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_NEGINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_8);
@@ -33,7 +33,7 @@ static void test_very_short_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_short_int(void **_CBOR_UNUSED(_state)) {
+static void test_short_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data2, 3, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_NEGINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_8);
@@ -47,7 +47,7 @@ static void test_short_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_half_int(void **_CBOR_UNUSED(_state)) {
+static void test_half_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data3, 5, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_NEGINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_16);
@@ -61,7 +61,7 @@ static void test_half_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_int(void **_CBOR_UNUSED(_state)) {
+static void test_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data4, 6, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_NEGINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_32);
@@ -75,7 +75,7 @@ static void test_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_long_int(void **_CBOR_UNUSED(_state)) {
+static void test_long_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data5, 10, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_NEGINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_64);
@@ -89,7 +89,7 @@ static void test_long_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_int_creation(void **_CBOR_UNUSED(_state)) {
+static void test_int_creation(void** _state _CBOR_UNUSED) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_int8()); });
WITH_FAILING_MALLOC({ assert_null(cbor_new_int16()); });
WITH_FAILING_MALLOC({ assert_null(cbor_new_int32()); });
diff --git a/test/pretty_printer_test.c b/test/pretty_printer_test.c
index 6ea40c0e7ce2..3652ef304787 100644
--- a/test/pretty_printer_test.c
+++ b/test/pretty_printer_test.c
@@ -11,17 +11,17 @@
#include "assertions.h"
#include "cbor.h"
-void assert_describe_result(cbor_item_t *item, char *expected_result) {
+void assert_describe_result(cbor_item_t* item, char* expected_result) {
#if CBOR_PRETTY_PRINTER
// We know the expected size based on `expected_result`, but read everything
// in order to get the full actual output in a useful error message.
const size_t buffer_size = 512;
- FILE *outfile = tmpfile();
+ FILE* outfile = tmpfile();
cbor_describe(item, outfile);
rewind(outfile);
// Treat string as null-terminated since cmocka doesn't have asserts
// for explicit length strings.
- char *output = malloc(buffer_size);
+ char* output = malloc(buffer_size);
assert_non_null(output);
size_t output_size = fread(output, sizeof(char), buffer_size, outfile);
output[output_size] = '\0';
@@ -32,31 +32,31 @@ void assert_describe_result(cbor_item_t *item, char *expected_result) {
#endif
}
-static void test_uint(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_build_uint8(42);
+static void test_uint(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_build_uint8(42);
assert_describe_result(item, "[CBOR_TYPE_UINT] Width: 1B, Value: 42\n");
cbor_decref(&item);
}
-static void test_negint(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_build_negint16(40);
+static void test_negint(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_build_negint16(40);
assert_describe_result(item,
"[CBOR_TYPE_NEGINT] Width: 2B, Value: -40 - 1\n");
cbor_decref(&item);
}
-static void test_definite_bytestring(void **_CBOR_UNUSED(_state)) {
+static void test_definite_bytestring(void** _state _CBOR_UNUSED) {
unsigned char data[] = {0x01, 0x02, 0x03};
- cbor_item_t *item = cbor_build_bytestring(data, 3);
+ cbor_item_t* item = cbor_build_bytestring(data, 3);
assert_describe_result(item,
"[CBOR_TYPE_BYTESTRING] Definite, Length: 3B, Data:\n"
" 010203\n");
cbor_decref(&item);
}
-static void test_indefinite_bytestring(void **_CBOR_UNUSED(_state)) {
+static void test_indefinite_bytestring(void** _state _CBOR_UNUSED) {
unsigned char data[] = {0x01, 0x02, 0x03};
- cbor_item_t *item = cbor_new_indefinite_bytestring();
+ cbor_item_t* item = cbor_new_indefinite_bytestring();
assert_true(cbor_bytestring_add_chunk(
item, cbor_move(cbor_build_bytestring(data, 3))));
assert_true(cbor_bytestring_add_chunk(
@@ -71,9 +71,9 @@ static void test_indefinite_bytestring(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_definite_string(void **_CBOR_UNUSED(_state)) {
- char *string = "Hello!";
- cbor_item_t *item = cbor_build_string(string);
+static void test_definite_string(void** _state _CBOR_UNUSED) {
+ char* string = "Hello!";
+ cbor_item_t* item = cbor_build_string(string);
assert_describe_result(
item,
"[CBOR_TYPE_STRING] Definite, Length: 6B, Codepoints: 6, Data:\n"
@@ -81,9 +81,9 @@ static void test_definite_string(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_indefinite_string(void **_CBOR_UNUSED(_state)) {
- char *string = "Hello!";
- cbor_item_t *item = cbor_new_indefinite_string();
+static void test_indefinite_string(void** _state _CBOR_UNUSED) {
+ char* string = "Hello!";
+ cbor_item_t* item = cbor_new_indefinite_string();
assert_true(
cbor_string_add_chunk(item, cbor_move(cbor_build_string(string))));
assert_true(
@@ -98,10 +98,10 @@ static void test_indefinite_string(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_multibyte_string(void **_CBOR_UNUSED(_state)) {
+static void test_multibyte_string(void** _state _CBOR_UNUSED) {
// "Štěstíčko" in UTF-8
- char *string = "\xc5\xa0t\xc4\x9bst\xc3\xad\xc4\x8dko";
- cbor_item_t *item = cbor_build_string(string);
+ char* string = "\xc5\xa0t\xc4\x9bst\xc3\xad\xc4\x8dko";
+ cbor_item_t* item = cbor_build_string(string);
assert_describe_result(
item,
"[CBOR_TYPE_STRING] Definite, Length: 13B, Codepoints: 9, Data:\n"
@@ -109,8 +109,8 @@ static void test_multibyte_string(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_definite_array(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_array(2);
+static void test_definite_array(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_array(2);
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(1))));
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(2))));
assert_describe_result(item,
@@ -120,8 +120,8 @@ static void test_definite_array(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_indefinite_array(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_array();
+static void test_indefinite_array(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_array();
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(1))));
assert_true(cbor_array_push(item, cbor_move(cbor_build_uint8(2))));
assert_describe_result(item,
@@ -131,8 +131,8 @@ static void test_indefinite_array(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_definite_map(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_definite_map(1);
+static void test_definite_map(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_definite_map(1);
assert_true(cbor_map_add(
item, (struct cbor_pair){.key = cbor_move(cbor_build_uint8(1)),
.value = cbor_move(cbor_build_uint8(2))}));
@@ -144,8 +144,8 @@ static void test_definite_map(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_indefinite_map(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_map();
+static void test_indefinite_map(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_map();
assert_true(cbor_map_add(
item, (struct cbor_pair){.key = cbor_move(cbor_build_uint8(1)),
.value = cbor_move(cbor_build_uint8(2))}));
@@ -157,16 +157,16 @@ static void test_indefinite_map(void **_CBOR_UNUSED(_state)) {
cbor_decref(&item);
}
-static void test_tag(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_build_tag(42, cbor_move(cbor_build_uint8(1)));
+static void test_tag(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_build_tag(42, cbor_move(cbor_build_uint8(1)));
assert_describe_result(item,
"[CBOR_TYPE_TAG] Value: 42\n"
" [CBOR_TYPE_UINT] Width: 1B, Value: 1\n");
cbor_decref(&item);
}
-static void test_floats(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *item = cbor_new_indefinite_array();
+static void test_floats(void** _state _CBOR_UNUSED) {
+ cbor_item_t* item = cbor_new_indefinite_array();
assert_true(cbor_array_push(item, cbor_move(cbor_build_bool(true))));
assert_true(
cbor_array_push(item, cbor_move(cbor_build_ctrl(CBOR_CTRL_UNDEF))));
diff --git a/test/stack_over_limit_test.c b/test/stack_over_limit_test.c
index 73b6bdc2567b..fef2c6dd018e 100644
--- a/test/stack_over_limit_test.c
+++ b/test/stack_over_limit_test.c
@@ -1,9 +1,9 @@
#include "assertions.h"
#include "cbor.h"
-static size_t generate_overflow_data(unsigned char **overflow_data) {
+static size_t generate_overflow_data(unsigned char** overflow_data) {
int i;
- *overflow_data = (unsigned char *)malloc(CBOR_MAX_STACK_SIZE + 3);
+ *overflow_data = (unsigned char*)malloc(CBOR_MAX_STACK_SIZE + 3);
for (i = 0; i < CBOR_MAX_STACK_SIZE + 1; i++) {
(*overflow_data)[i] = 0xC2; // tag of positive bignum
}
@@ -12,8 +12,8 @@ static size_t generate_overflow_data(unsigned char **overflow_data) {
return CBOR_MAX_STACK_SIZE + 3;
}
-static void test_stack_over_limit(void **_CBOR_UNUSED(_state)) {
- unsigned char *overflow_data;
+static void test_stack_over_limit(void** _state _CBOR_UNUSED) {
+ unsigned char* overflow_data;
size_t overflow_data_len;
struct cbor_load_result res;
overflow_data_len = generate_overflow_data(&overflow_data);
diff --git a/test/stream_expectations.c b/test/stream_expectations.c
index 3592c9625da5..2a1b512f36c6 100644
--- a/test/stream_expectations.c
+++ b/test/stream_expectations.c
@@ -4,7 +4,7 @@ struct test_assertion assertions_queue[MAX_QUEUE_ITEMS];
int queue_size = 0;
int current_expectation = 0;
-int clean_up_stream_assertions(void **state) {
+int clean_up_stream_assertions(void** state) {
if (queue_size != current_expectation) {
return 1; // We have not matched all expectations correctly
}
@@ -25,7 +25,7 @@ void assert_uint8_eq(uint8_t actual) {
UINT8_EQ, (union test_expectation_data){.int8 = actual}};
}
-void uint8_callback(void *_CBOR_UNUSED(_context), uint8_t actual) {
+void uint8_callback(void* _context _CBOR_UNUSED, uint8_t actual) {
assert_true(current().expectation == UINT8_EQ);
assert_true(current().data.int8 == actual);
current_expectation++;
@@ -36,7 +36,7 @@ void assert_uint16_eq(uint16_t actual) {
UINT16_EQ, (union test_expectation_data){.int16 = actual}};
}
-void uint16_callback(void *_CBOR_UNUSED(_context), uint16_t actual) {
+void uint16_callback(void* _context _CBOR_UNUSED, uint16_t actual) {
assert_true(current().expectation == UINT16_EQ);
assert_true(current().data.int16 == actual);
current_expectation++;
@@ -47,7 +47,7 @@ void assert_uint32_eq(uint32_t actual) {
UINT32_EQ, (union test_expectation_data){.int32 = actual}};
}
-void uint32_callback(void *_CBOR_UNUSED(_context), uint32_t actual) {
+void uint32_callback(void* _context _CBOR_UNUSED, uint32_t actual) {
assert_true(current().expectation == UINT32_EQ);
assert_true(current().data.int32 == actual);
current_expectation++;
@@ -58,7 +58,7 @@ void assert_uint64_eq(uint64_t actual) {
UINT64_EQ, (union test_expectation_data){.int64 = actual}};
}
-void uint64_callback(void *_CBOR_UNUSED(_context), uint64_t actual) {
+void uint64_callback(void* _context _CBOR_UNUSED, uint64_t actual) {
assert_true(current().expectation == UINT64_EQ);
assert_true(current().data.int64 == actual);
current_expectation++;
@@ -69,7 +69,7 @@ void assert_negint8_eq(uint8_t actual) {
NEGINT8_EQ, (union test_expectation_data){.int8 = actual}};
}
-void negint8_callback(void *_CBOR_UNUSED(_context), uint8_t actual) {
+void negint8_callback(void* _context _CBOR_UNUSED, uint8_t actual) {
assert_true(current().expectation == NEGINT8_EQ);
assert_true(current().data.int8 == actual);
current_expectation++;
@@ -80,7 +80,7 @@ void assert_negint16_eq(uint16_t actual) {
NEGINT16_EQ, (union test_expectation_data){.int16 = actual}};
}
-void negint16_callback(void *_CBOR_UNUSED(_context), uint16_t actual) {
+void negint16_callback(void* _context _CBOR_UNUSED, uint16_t actual) {
assert_true(current().expectation == NEGINT16_EQ);
assert_true(current().data.int16 == actual);
current_expectation++;
@@ -91,7 +91,7 @@ void assert_negint32_eq(uint32_t actual) {
NEGINT32_EQ, (union test_expectation_data){.int32 = actual}};
}
-void negint32_callback(void *_CBOR_UNUSED(_context), uint32_t actual) {
+void negint32_callback(void* _context _CBOR_UNUSED, uint32_t actual) {
assert_true(current().expectation == NEGINT32_EQ);
assert_true(current().data.int32 == actual);
current_expectation++;
@@ -102,7 +102,7 @@ void assert_negint64_eq(uint64_t actual) {
NEGINT64_EQ, (union test_expectation_data){.int64 = actual}};
}
-void negint64_callback(void *_CBOR_UNUSED(_context), uint64_t actual) {
+void negint64_callback(void* _context _CBOR_UNUSED, uint64_t actual) {
assert_true(current().expectation == NEGINT64_EQ);
assert_true(current().data.int64 == actual);
current_expectation++;
@@ -114,7 +114,7 @@ void assert_bstring_mem_eq(cbor_data address, size_t length) {
(union test_expectation_data){.string = {address, length}}};
}
-void byte_string_callback(void *_CBOR_UNUSED(_context), cbor_data address,
+void byte_string_callback(void* _context _CBOR_UNUSED, cbor_data address,
uint64_t length) {
assert_true(current().expectation == BSTRING_MEM_EQ);
assert_true(current().data.string.address == address);
@@ -127,7 +127,7 @@ void assert_bstring_indef_start(void) {
(struct test_assertion){.expectation = BSTRING_INDEF_START};
}
-void byte_string_start_callback(void *_CBOR_UNUSED(_context)) {
+void byte_string_start_callback(void* _context _CBOR_UNUSED) {
assert_true(current().expectation == BSTRING_INDEF_START);
current_expectation++;
}
@@ -138,7 +138,7 @@ void assert_string_mem_eq(cbor_data address, size_t length) {
(union test_expectation_data){.string = {address, length}}};
}
-void string_callback(void *_CBOR_UNUSED(_context), cbor_data address,
+void string_callback(void* _context _CBOR_UNUSED, cbor_data address,
uint64_t length) {
assert_true(current().expectation == STRING_MEM_EQ);
assert_true(current().data.string.address == address);
@@ -151,7 +151,7 @@ void assert_string_indef_start(void) {
(struct test_assertion){.expectation = STRING_INDEF_START};
}
-void string_start_callback(void *_CBOR_UNUSED(_context)) {
+void string_start_callback(void* _context _CBOR_UNUSED) {
assert_true(current().expectation == STRING_INDEF_START);
current_expectation++;
}
@@ -161,7 +161,7 @@ void assert_indef_break(void) {
(struct test_assertion){.expectation = INDEF_BREAK};
}
-void indef_break_callback(void *_CBOR_UNUSED(_context)) {
+void indef_break_callback(void* _context _CBOR_UNUSED) {
assert_true(current().expectation == INDEF_BREAK);
current_expectation++;
}
@@ -171,7 +171,7 @@ void assert_array_start(size_t length) {
(struct test_assertion){ARRAY_START, {.length = length}};
}
-void array_start_callback(void *_CBOR_UNUSED(_context), uint64_t length) {
+void array_start_callback(void* _context _CBOR_UNUSED, uint64_t length) {
assert_true(current().expectation == ARRAY_START);
assert_true(current().data.length == length);
current_expectation++;
@@ -182,7 +182,7 @@ void assert_indef_array_start(void) {
(struct test_assertion){.expectation = ARRAY_INDEF_START};
}
-void indef_array_start_callback(void *_CBOR_UNUSED(_context)) {
+void indef_array_start_callback(void* _context _CBOR_UNUSED) {
assert_true(current().expectation == ARRAY_INDEF_START);
current_expectation++;
}
@@ -192,7 +192,7 @@ void assert_map_start(size_t length) {
(struct test_assertion){MAP_START, {.length = length}};
}
-void map_start_callback(void *_CBOR_UNUSED(_context), uint64_t length) {
+void map_start_callback(void* _context _CBOR_UNUSED, uint64_t length) {
assert_true(current().expectation == MAP_START);
assert_true(current().data.length == length);
current_expectation++;
@@ -203,7 +203,7 @@ void assert_indef_map_start(void) {
(struct test_assertion){.expectation = MAP_INDEF_START};
}
-void indef_map_start_callback(void *_CBOR_UNUSED(_context)) {
+void indef_map_start_callback(void* _context _CBOR_UNUSED) {
assert_true(current().expectation == MAP_INDEF_START);
current_expectation++;
}
@@ -213,7 +213,7 @@ void assert_tag_eq(uint64_t value) {
(struct test_assertion){TAG_EQ, {.int64 = value}};
}
-void tag_callback(void *_CBOR_UNUSED(_context), uint64_t value) {
+void tag_callback(void* _context _CBOR_UNUSED, uint64_t value) {
assert_true(current().expectation == TAG_EQ);
assert_true(current().data.int64 == value);
current_expectation++;
@@ -224,7 +224,7 @@ void assert_half(float value) {
(struct test_assertion){HALF_EQ, {.float2 = value}};
}
-void half_callback(void *_CBOR_UNUSED(_context), float actual) {
+void half_callback(void* _context _CBOR_UNUSED, float actual) {
assert_true(current().expectation == HALF_EQ);
assert_true(current().data.float2 == actual);
current_expectation++;
@@ -235,7 +235,7 @@ void assert_float(float value) {
(struct test_assertion){FLOAT_EQ, {.float4 = value}};
}
-void float_callback(void *_CBOR_UNUSED(_context), float actual) {
+void float_callback(void* _context _CBOR_UNUSED, float actual) {
assert_true(current().expectation == FLOAT_EQ);
assert_true(current().data.float4 == actual);
current_expectation++;
@@ -246,7 +246,7 @@ void assert_double(double value) {
(struct test_assertion){DOUBLE_EQ, {.float8 = value}};
}
-void double_callback(void *_CBOR_UNUSED(_context), double actual) {
+void double_callback(void* _context _CBOR_UNUSED, double actual) {
assert_true(current().expectation == DOUBLE_EQ);
assert_true(current().data.float8 == actual);
current_expectation++;
@@ -266,18 +266,18 @@ void assert_undef(void) {
(struct test_assertion){.expectation = UNDEF};
}
-void bool_callback(void *_CBOR_UNUSED(_context), bool actual) {
+void bool_callback(void* _context _CBOR_UNUSED, bool actual) {
assert_true(current().expectation == BOOL_EQ);
assert_true(current().data.boolean == actual);
current_expectation++;
}
-void null_callback(void *_CBOR_UNUSED(_context)) {
+void null_callback(void* _context _CBOR_UNUSED) {
assert_true(current().expectation == NIL);
current_expectation++;
}
-void undef_callback(void *_CBOR_UNUSED(_context)) {
+void undef_callback(void* _context _CBOR_UNUSED) {
assert_true(current().expectation == UNDEF);
current_expectation++;
}
diff --git a/test/stream_expectations.h b/test/stream_expectations.h
index bfc58e97cd9f..f67d025f9eaa 100644
--- a/test/stream_expectations.h
+++ b/test/stream_expectations.h
@@ -78,7 +78,7 @@ struct test_assertion {
struct cbor_decoder_result decode(cbor_data, size_t);
/* Verify all assertions were applied and clean up */
-int clean_up_stream_assertions(void **);
+int clean_up_stream_assertions(void**);
/* Assertions builders */
void assert_uint8_eq(uint8_t);
@@ -116,37 +116,37 @@ void assert_undef(void);
void assert_indef_break(void);
/* Assertions verifying callbacks */
-void uint8_callback(void *, uint8_t);
-void uint16_callback(void *, uint16_t);
-void uint32_callback(void *, uint32_t);
-void uint64_callback(void *, uint64_t);
+void uint8_callback(void*, uint8_t);
+void uint16_callback(void*, uint16_t);
+void uint32_callback(void*, uint32_t);
+void uint64_callback(void*, uint64_t);
-void negint8_callback(void *, uint8_t);
-void negint16_callback(void *, uint16_t);
-void negint32_callback(void *, uint32_t);
-void negint64_callback(void *, uint64_t);
+void negint8_callback(void*, uint8_t);
+void negint16_callback(void*, uint16_t);
+void negint32_callback(void*, uint32_t);
+void negint64_callback(void*, uint64_t);
-void byte_string_callback(void *, cbor_data, uint64_t);
-void byte_string_start_callback(void *);
+void byte_string_callback(void*, cbor_data, uint64_t);
+void byte_string_start_callback(void*);
-void string_callback(void *, cbor_data, uint64_t);
-void string_start_callback(void *);
+void string_callback(void*, cbor_data, uint64_t);
+void string_start_callback(void*);
-void array_start_callback(void *, uint64_t);
-void indef_array_start_callback(void *);
+void array_start_callback(void*, uint64_t);
+void indef_array_start_callback(void*);
-void map_start_callback(void *, uint64_t);
-void indef_map_start_callback(void *);
+void map_start_callback(void*, uint64_t);
+void indef_map_start_callback(void*);
-void tag_callback(void *, uint64_t);
+void tag_callback(void*, uint64_t);
-void half_callback(void *, float);
-void float_callback(void *, float);
-void double_callback(void *, double);
-void indef_break_callback(void *);
+void half_callback(void*, float);
+void float_callback(void*, float);
+void double_callback(void*, double);
+void indef_break_callback(void*);
-void bool_callback(void *, bool);
-void null_callback(void *);
-void undef_callback(void *);
+void bool_callback(void*, bool);
+void null_callback(void*);
+void undef_callback(void*);
#endif
diff --git a/test/string_encoders_test.c b/test/string_encoders_test.c
index 6de1cfb27eb3..2c00ff991090 100644
--- a/test/string_encoders_test.c
+++ b/test/string_encoders_test.c
@@ -10,18 +10,18 @@
unsigned char buffer[512];
-static void test_embedded_string_start(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_string_start(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_string_start(1, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x61}), 1);
}
-static void test_string_start(void **_CBOR_UNUSED(_state)) {
+static void test_string_start(void** _state _CBOR_UNUSED) {
assert_size_equal(5, cbor_encode_string_start(1000000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x7A, 0x00, 0x0F, 0x42, 0x40}),
5);
}
-static void test_indef_string_start(void **_CBOR_UNUSED(_state)) {
+static void test_indef_string_start(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_indef_string_start(buffer, 512));
assert_size_equal(0, cbor_encode_indef_string_start(buffer, 0));
assert_memory_equal(buffer, ((unsigned char[]){0x7F}), 1);
diff --git a/test/string_test.c b/test/string_test.c
index c3079b449838..9ce3bdfb7d17 100644
--- a/test/string_test.c
+++ b/test/string_test.c
@@ -10,12 +10,12 @@
#include "cbor.h"
#include "test_allocator.h"
-cbor_item_t *string;
+cbor_item_t* string;
struct cbor_load_result res;
unsigned char empty_string_data[] = {0x60};
-static void test_empty_string(void **_CBOR_UNUSED(_state)) {
+static void test_empty_string(void** _state _CBOR_UNUSED) {
string = cbor_load(empty_string_data, 1, &res);
assert_non_null(string);
assert_true(cbor_typeof(string) == CBOR_TYPE_STRING);
@@ -31,7 +31,7 @@ unsigned char short_string_data[] = {0x6C, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20,
0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21};
/* 0x60 + 12 | Hello world! */
-static void test_short_string(void **_CBOR_UNUSED(_state)) {
+static void test_short_string(void** _state _CBOR_UNUSED) {
string = cbor_load(short_string_data, 13, &res);
assert_non_null(string);
assert_true(cbor_typeof(string) == CBOR_TYPE_STRING);
@@ -49,7 +49,7 @@ unsigned char short_multibyte_string_data[] = {
0xC3, 0x9F, 0x76, 0xC4, 0x9B, 0x74, 0x65, 0x21};
/* 0x60 + 15 | Čaues ßvěte! */
-static void test_short_multibyte_string(void **_CBOR_UNUSED(_state)) {
+static void test_short_multibyte_string(void** _state _CBOR_UNUSED) {
string = cbor_load(short_multibyte_string_data, 16, &res);
assert_non_null(string);
assert_true(cbor_typeof(string) == CBOR_TYPE_STRING);
@@ -78,7 +78,7 @@ unsigned char int8_string_data[] = {
0x70, 0x6F, 0x73, 0x75, 0x65, 0x72, 0x65, 0x2E};
/* 150 | Lorem ....*/
-static void test_int8_string(void **_CBOR_UNUSED(_state)) {
+static void test_int8_string(void** _state _CBOR_UNUSED) {
string = cbor_load(int8_string_data, 152, &res);
assert_non_null(string);
assert_true(cbor_typeof(string) == CBOR_TYPE_STRING);
@@ -112,7 +112,7 @@ unsigned char int16_string_data[] = {
/* 150 | Lorem ....*/
/* This valid but not realistic - length 150 could be encoded in a single
* uint8_t (but we need to keep the test files reasonably compact) */
-static void test_int16_string(void **_CBOR_UNUSED(_state)) {
+static void test_int16_string(void** _state _CBOR_UNUSED) {
string = cbor_load(int16_string_data, 153, &res);
assert_non_null(string);
assert_true(cbor_typeof(string) == CBOR_TYPE_STRING);
@@ -145,7 +145,7 @@ unsigned char int32_string_data[] = {
0x74, 0x6F, 0x20, 0x70, 0x6F, 0x73, 0x75, 0x65, 0x72, 0x65, 0x2E};
/* 150 | Lorem ....*/
-static void test_int32_string(void **_CBOR_UNUSED(_state)) {
+static void test_int32_string(void** _state _CBOR_UNUSED) {
string = cbor_load(int32_string_data, 155, &res);
assert_non_null(string);
assert_true(cbor_typeof(string) == CBOR_TYPE_STRING);
@@ -179,7 +179,7 @@ unsigned char int64_string_data[] = {
0x72, 0x65, 0x2E};
/* 150 | Lorem ....*/
-static void test_int64_string(void **_CBOR_UNUSED(_state)) {
+static void test_int64_string(void** _state _CBOR_UNUSED) {
string = cbor_load(int64_string_data, 159, &res);
assert_non_null(string);
assert_true(cbor_typeof(string) == CBOR_TYPE_STRING);
@@ -201,7 +201,7 @@ unsigned char short_indef_string_data[] = {0x7F, 0x78, 0x01, 0x65, 0xFF, 0xFF};
/* start | string | break| extra
*/
-static void test_short_indef_string(void **_CBOR_UNUSED(_state)) {
+static void test_short_indef_string(void** _state _CBOR_UNUSED) {
string = cbor_load(short_indef_string_data, 6, &res);
assert_non_null(string);
assert_true(cbor_typeof(string) == CBOR_TYPE_STRING);
@@ -217,7 +217,7 @@ static void test_short_indef_string(void **_CBOR_UNUSED(_state)) {
assert_null(string);
}
-static void test_invalid_utf(void **_CBOR_UNUSED(_state)) {
+static void test_invalid_utf(void** _state _CBOR_UNUSED) {
/* 0x60 + 1 | 0xC5 (invalid unfinished 2B codepoint) */
unsigned char string_data[] = {0x61, 0xC5};
string = cbor_load(string_data, 2, &res);
@@ -233,13 +233,13 @@ static void test_invalid_utf(void **_CBOR_UNUSED(_state)) {
cbor_decref(&string);
}
-static void test_inline_creation(void **_CBOR_UNUSED(_state)) {
+static void test_inline_creation(void** _state _CBOR_UNUSED) {
string = cbor_build_string("Hello!");
assert_memory_equal(cbor_string_handle(string), "Hello!", strlen("Hello!"));
cbor_decref(&string);
}
-static void test_string_creation(void **_CBOR_UNUSED(_state)) {
+static void test_string_creation(void** _state _CBOR_UNUSED) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_definite_string()); });
WITH_FAILING_MALLOC({ assert_null(cbor_new_indefinite_string()); });
@@ -255,17 +255,17 @@ static void test_string_creation(void **_CBOR_UNUSED(_state)) {
MALLOC_FAIL);
}
-static void test_string_add_chunk(void **_CBOR_UNUSED(_state)) {
+static void test_string_add_chunk(void** _state _CBOR_UNUSED) {
WITH_MOCK_MALLOC(
{
- cbor_item_t *string = cbor_new_indefinite_string();
- cbor_item_t *chunk = cbor_build_string("Hello!");
+ cbor_item_t* string = cbor_new_indefinite_string();
+ cbor_item_t* chunk = cbor_build_string("Hello!");
assert_false(cbor_string_add_chunk(string, chunk));
assert_size_equal(cbor_string_chunk_count(string), 0);
- assert_size_equal(((struct cbor_indefinite_string_data *)string->data)
- ->chunk_capacity,
- 0);
+ assert_size_equal(
+ ((struct cbor_indefinite_string_data*)string->data)->chunk_capacity,
+ 0);
cbor_decref(&chunk);
cbor_decref(&string);
@@ -273,11 +273,11 @@ static void test_string_add_chunk(void **_CBOR_UNUSED(_state)) {
5, MALLOC, MALLOC, MALLOC, MALLOC, REALLOC_FAIL);
}
-static void test_add_chunk_reallocation_overflow(void **_CBOR_UNUSED(_state)) {
+static void test_add_chunk_reallocation_overflow(void** _state _CBOR_UNUSED) {
string = cbor_new_indefinite_string();
- cbor_item_t *chunk = cbor_build_string("Hello!");
- struct cbor_indefinite_string_data *metadata =
- (struct cbor_indefinite_string_data *)string->data;
+ cbor_item_t* chunk = cbor_build_string("Hello!");
+ struct cbor_indefinite_string_data* metadata =
+ (struct cbor_indefinite_string_data*)string->data;
// Pretend we already have many chunks allocated
metadata->chunk_count = SIZE_MAX;
metadata->chunk_capacity = SIZE_MAX;
@@ -291,10 +291,10 @@ static void test_add_chunk_reallocation_overflow(void **_CBOR_UNUSED(_state)) {
cbor_decref(&string);
}
-static void test_set_handle(void **_CBOR_UNUSED(_state)) {
+static void test_set_handle(void** _state _CBOR_UNUSED) {
string = cbor_new_definite_string();
- char *test_string = "Hello";
- unsigned char *string_data = malloc(strlen(test_string));
+ char* test_string = "Hello";
+ unsigned char* string_data = malloc(strlen(test_string));
memcpy(string_data, test_string, strlen(test_string));
assert_ptr_not_equal(string_data, NULL);
cbor_string_set_handle(string, string_data, strlen(test_string));
@@ -306,11 +306,11 @@ static void test_set_handle(void **_CBOR_UNUSED(_state)) {
cbor_decref(&string);
}
-static void test_set_handle_multibyte_codepoint(void **_CBOR_UNUSED(_state)) {
+static void test_set_handle_multibyte_codepoint(void** _state _CBOR_UNUSED) {
string = cbor_new_definite_string();
// "Štěstíčko" in UTF-8
- char *test_string = "\xc5\xa0t\xc4\x9bst\xc3\xad\xc4\x8dko";
- unsigned char *string_data = malloc(strlen(test_string));
+ char* test_string = "\xc5\xa0t\xc4\x9bst\xc3\xad\xc4\x8dko";
+ unsigned char* string_data = malloc(strlen(test_string));
memcpy(string_data, test_string, strlen(test_string));
assert_ptr_not_equal(string_data, NULL);
cbor_string_set_handle(string, string_data, strlen(test_string));
@@ -322,11 +322,11 @@ static void test_set_handle_multibyte_codepoint(void **_CBOR_UNUSED(_state)) {
cbor_decref(&string);
}
-static void test_set_handle_invalid_utf(void **_CBOR_UNUSED(_state)) {
+static void test_set_handle_invalid_utf(void** _state _CBOR_UNUSED) {
string = cbor_new_definite_string();
// Invalid multi-byte character (missing the second byte).
- char *test_string = "Test: \xc5";
- unsigned char *string_data = malloc(strlen(test_string));
+ char* test_string = "Test: \xc5";
+ unsigned char* string_data = malloc(strlen(test_string));
memcpy(string_data, test_string, strlen(test_string));
assert_ptr_not_equal(string_data, NULL);
cbor_string_set_handle(string, string_data, strlen(test_string));
diff --git a/test/tag_encoders_test.c b/test/tag_encoders_test.c
index 5962dd9d8938..06f87475392d 100644
--- a/test/tag_encoders_test.c
+++ b/test/tag_encoders_test.c
@@ -10,12 +10,12 @@
unsigned char buffer[512];
-static void test_embedded_tag(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_tag(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_tag(1, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xC1}), 1);
}
-static void test_tag(void **_CBOR_UNUSED(_state)) {
+static void test_tag(void** _state _CBOR_UNUSED) {
assert_size_equal(5, cbor_encode_tag(1000000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0xDA, 0x00, 0x0F, 0x42, 0x40}),
5);
diff --git a/test/tag_test.c b/test/tag_test.c
index 4bce10589803..293953cb4d9b 100644
--- a/test/tag_test.c
+++ b/test/tag_test.c
@@ -9,15 +9,15 @@
#include "cbor.h"
#include "test_allocator.h"
-cbor_item_t *tag;
+cbor_item_t* tag;
struct cbor_load_result res;
unsigned char embedded_tag_data[] = {0xC0, 0x00};
-static void test_refcounting(void **_CBOR_UNUSED(_state)) {
+static void test_refcounting(void** _state _CBOR_UNUSED) {
tag = cbor_load(embedded_tag_data, 2, &res);
assert_true(cbor_refcount(tag) == 1);
- cbor_item_t *item = cbor_tag_item(tag);
+ cbor_item_t* item = cbor_tag_item(tag);
assert_true(cbor_refcount(item) == 2);
cbor_decref(&tag);
assert_null(tag);
@@ -27,7 +27,7 @@ static void test_refcounting(void **_CBOR_UNUSED(_state)) {
}
/* Tag 0 + uint 0 */
-static void test_embedded_tag(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_tag(void** _state _CBOR_UNUSED) {
tag = cbor_load(embedded_tag_data, 2, &res);
assert_true(cbor_typeof(tag) == CBOR_TYPE_TAG);
assert_true(cbor_tag_value(tag) == 0);
@@ -39,7 +39,7 @@ static void test_embedded_tag(void **_CBOR_UNUSED(_state)) {
unsigned char int8_tag_data[] = {0xD8, 0xFF, 0x01};
/* Tag 255 + uint 1 */
-static void test_int8_tag(void **_CBOR_UNUSED(_state)) {
+static void test_int8_tag(void** _state _CBOR_UNUSED) {
tag = cbor_load(int8_tag_data, 3, &res);
assert_true(cbor_typeof(tag) == CBOR_TYPE_TAG);
assert_true(cbor_tag_value(tag) == 255);
@@ -51,7 +51,7 @@ static void test_int8_tag(void **_CBOR_UNUSED(_state)) {
unsigned char int16_tag_data[] = {0xD9, 0xFF, 0x00, 0x02};
/* Tag 255 << 8 + uint 2 */
-static void test_int16_tag(void **_CBOR_UNUSED(_state)) {
+static void test_int16_tag(void** _state _CBOR_UNUSED) {
tag = cbor_load(int16_tag_data, 4, &res);
assert_true(cbor_typeof(tag) == CBOR_TYPE_TAG);
assert_true(cbor_tag_value(tag) == 255 << 8);
@@ -63,7 +63,7 @@ static void test_int16_tag(void **_CBOR_UNUSED(_state)) {
unsigned char int32_tag_data[] = {0xDA, 0xFF, 0x00, 0x00, 0x00, 0x03};
/* uint 3 */
-static void test_int32_tag(void **_CBOR_UNUSED(_state)) {
+static void test_int32_tag(void** _state _CBOR_UNUSED) {
tag = cbor_load(int32_tag_data, 6, &res);
assert_true(cbor_typeof(tag) == CBOR_TYPE_TAG);
assert_true(cbor_tag_value(tag) == 4278190080ULL);
@@ -76,7 +76,7 @@ unsigned char int64_tag_data[] = {0xDB, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04};
/* uint 4 */
-static void test_int64_tag(void **_CBOR_UNUSED(_state)) {
+static void test_int64_tag(void** _state _CBOR_UNUSED) {
tag = cbor_load(int64_tag_data, 10, &res);
assert_true(cbor_typeof(tag) == CBOR_TYPE_TAG);
assert_true(cbor_tag_value(tag) == 18374686479671623680ULL);
@@ -88,11 +88,11 @@ static void test_int64_tag(void **_CBOR_UNUSED(_state)) {
unsigned char nested_tag_data[] = {0xC0, 0xC1, 0x18, 0x2A};
/* Tag 0, tag 1 + uint 0 */
-static void test_nested_tag(void **_CBOR_UNUSED(_state)) {
+static void test_nested_tag(void** _state _CBOR_UNUSED) {
tag = cbor_load(nested_tag_data, 4, &res);
assert_true(cbor_typeof(tag) == CBOR_TYPE_TAG);
assert_true(cbor_tag_value(tag) == 0);
- cbor_item_t *nested_tag = cbor_tag_item(tag);
+ cbor_item_t* nested_tag = cbor_tag_item(tag);
assert_true(cbor_typeof(nested_tag) == CBOR_TYPE_TAG);
assert_true(cbor_tag_value(nested_tag) == 1);
assert_uint8(cbor_move(cbor_tag_item(nested_tag)), 42);
@@ -102,13 +102,13 @@ static void test_nested_tag(void **_CBOR_UNUSED(_state)) {
assert_null(nested_tag);
}
-static void test_all_tag_values_supported(void **_CBOR_UNUSED(_state)) {
+static void test_all_tag_values_supported(void** _state _CBOR_UNUSED) {
/* Test all items in the protected range of
* https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml */
- for (int64_t tag_value = 0; tag_value <= 32767; tag_value++) {
- cbor_item_t *tag_item =
+ for (uint64_t tag_value = 0; tag_value <= 32767; tag_value++) {
+ cbor_item_t* tag_item =
cbor_build_tag(tag_value, cbor_move(cbor_build_uint8(42)));
- unsigned char *serialized_tag;
+ unsigned char* serialized_tag;
size_t serialized_tag_size =
cbor_serialize_alloc(tag_item, &serialized_tag, NULL);
assert_true(serialized_tag_size > 0);
@@ -124,7 +124,7 @@ static void test_all_tag_values_supported(void **_CBOR_UNUSED(_state)) {
}
}
-static void test_build_tag(void **_CBOR_UNUSED(_state)) {
+static void test_build_tag(void** _state _CBOR_UNUSED) {
tag = cbor_build_tag(1, cbor_move(cbor_build_uint8(42)));
assert_true(cbor_typeof(tag) == CBOR_TYPE_TAG);
@@ -134,8 +134,8 @@ static void test_build_tag(void **_CBOR_UNUSED(_state)) {
cbor_decref(&tag);
}
-static void test_build_tag_failure(void **_CBOR_UNUSED(_state)) {
- cbor_item_t *tagged_item = cbor_build_uint8(42);
+static void test_build_tag_failure(void** _state _CBOR_UNUSED) {
+ cbor_item_t* tagged_item = cbor_build_uint8(42);
WITH_FAILING_MALLOC({ assert_null(cbor_build_tag(1, tagged_item)); });
assert_size_equal(cbor_refcount(tagged_item), 1);
@@ -143,7 +143,7 @@ static void test_build_tag_failure(void **_CBOR_UNUSED(_state)) {
cbor_decref(&tagged_item);
}
-static void test_tag_creation(void **_CBOR_UNUSED(_state)) {
+static void test_tag_creation(void** _state _CBOR_UNUSED) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_tag(42)); });
}
diff --git a/test/test_allocator.c b/test/test_allocator.c
index a2f98efa22f7..b941c79a4181 100644
--- a/test/test_allocator.c
+++ b/test/test_allocator.c
@@ -8,8 +8,8 @@
int alloc_calls_expected;
// How many alloc calls we got
int alloc_calls;
-// Array of booleans indicating whether to return a block or fail with NULL
-call_expectation *expectations;
+// Array of expected call and their behavior (success or failure)
+call_expectation* expectations;
void set_mock_malloc(int calls, ...) {
va_list args;
@@ -31,9 +31,9 @@ void finalize_mock_malloc(void) {
void print_backtrace(void) {
#if HAS_EXECINFO
- void *buffer[128];
+ void* buffer[128];
int frames = backtrace(buffer, 128);
- char **symbols = backtrace_symbols(buffer, frames);
+ char** symbols = backtrace_symbols(buffer, frames);
// Skip this function and the caller
for (int i = 2; i < frames; ++i) {
printf("%s\n", symbols[i]);
@@ -42,7 +42,7 @@ void print_backtrace(void) {
#endif
}
-void *instrumented_malloc(size_t size) {
+void* instrumented_malloc(size_t size) {
if (alloc_calls >= alloc_calls_expected) {
goto error;
}
@@ -59,13 +59,13 @@ error:
print_error(
"Unexpected call to malloc(%zu) at position %d of %d; expected %d\n",
size, alloc_calls, alloc_calls_expected,
- alloc_calls < alloc_calls_expected ? expectations[alloc_calls] : -1);
+ alloc_calls < alloc_calls_expected ? (int)expectations[alloc_calls] : -1);
print_backtrace();
fail();
return NULL;
}
-void *instrumented_realloc(void *ptr, size_t size) {
+void* instrumented_realloc(void* ptr, size_t size) {
if (alloc_calls >= alloc_calls_expected) {
goto error;
}
@@ -82,7 +82,7 @@ error:
print_error(
"Unexpected call to realloc(%zu) at position %d of %d; expected %d\n",
size, alloc_calls, alloc_calls_expected,
- alloc_calls < alloc_calls_expected ? expectations[alloc_calls] : -1);
+ alloc_calls < alloc_calls_expected ? (int)expectations[alloc_calls] : -1);
print_backtrace();
fail();
return NULL;
diff --git a/test/test_allocator.h b/test/test_allocator.h
index 0e58454edbd6..09e5791b81d9 100644
--- a/test/test_allocator.h
+++ b/test/test_allocator.h
@@ -7,9 +7,13 @@
// Harness for mocking `malloc` and `realloc`
typedef enum call_expectation {
+ // Call malloc and return a pointer
MALLOC,
+ // Pretend call malloc, but return NULL (fail)
MALLOC_FAIL,
+ // Call realloc and return a pointer
REALLOC,
+ // Pretend call realloc, but return NULL (fail)
REALLOC_FAIL
} call_expectation;
@@ -17,9 +21,9 @@ void set_mock_malloc(int calls, ...);
void finalize_mock_malloc(void);
-void *instrumented_malloc(size_t size);
+void* instrumented_malloc(size_t size);
-void *instrumented_realloc(void *ptr, size_t size);
+void* instrumented_realloc(void* ptr, size_t size);
#define WITH_MOCK_MALLOC(block, malloc_calls, ...) \
do { \
diff --git a/test/uint_encoders_test.c b/test/uint_encoders_test.c
index 59b95a33026e..886086469819 100644
--- a/test/uint_encoders_test.c
+++ b/test/uint_encoders_test.c
@@ -10,31 +10,31 @@
unsigned char buffer[512];
-static void test_embedded_uint8(void **_CBOR_UNUSED(_state)) {
+static void test_embedded_uint8(void** _state _CBOR_UNUSED) {
assert_size_equal(1, cbor_encode_uint8(14, buffer, 512));
assert_memory_equal(buffer, (unsigned char[]){0x0E}, 1);
}
-static void test_uint8(void **_CBOR_UNUSED(_state)) {
+static void test_uint8(void** _state _CBOR_UNUSED) {
assert_size_equal(0, cbor_encode_uint8(180, buffer, 1));
assert_size_equal(2, cbor_encode_uint8(255, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x18, 0xFF}), 2);
}
-static void test_uint16(void **_CBOR_UNUSED(_state)) {
+static void test_uint16(void** _state _CBOR_UNUSED) {
assert_size_equal(0, cbor_encode_uint16(1000, buffer, 2));
assert_size_equal(3, cbor_encode_uint16(1000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x19, 0x03, 0xE8}), 3);
}
-static void test_uint32(void **_CBOR_UNUSED(_state)) {
+static void test_uint32(void** _state _CBOR_UNUSED) {
assert_size_equal(0, cbor_encode_uint32(1000000, buffer, 4));
assert_size_equal(5, cbor_encode_uint32(1000000, buffer, 512));
assert_memory_equal(buffer, ((unsigned char[]){0x1A, 0x00, 0x0F, 0x42, 0x40}),
5);
}
-static void test_uint64(void **_CBOR_UNUSED(_state)) {
+static void test_uint64(void** _state _CBOR_UNUSED) {
assert_size_equal(0, cbor_encode_uint64(18446744073709551615ULL, buffer, 8));
assert_size_equal(9,
cbor_encode_uint64(18446744073709551615ULL, buffer, 512));
@@ -44,7 +44,7 @@ static void test_uint64(void **_CBOR_UNUSED(_state)) {
9);
}
-static void test_unspecified(void **_CBOR_UNUSED(_state)) {
+static void test_unspecified(void** _state _CBOR_UNUSED) {
assert_size_equal(9, cbor_encode_uint(18446744073709551615ULL, buffer, 512));
assert_memory_equal(
buffer,
diff --git a/test/uint_test.c b/test/uint_test.c
index 89eb2b91833e..3c269daef238 100644
--- a/test/uint_test.c
+++ b/test/uint_test.c
@@ -10,7 +10,7 @@
#include "cbor.h"
-cbor_item_t *number;
+cbor_item_t* number;
struct cbor_load_result res;
unsigned char data1[] = {0x02, 0xFF};
@@ -20,7 +20,7 @@ unsigned char data4[] = {0x1a, 0xa5, 0xf7, 0x02, 0xb3, 0xFF};
unsigned char data5[] = {0x1b, 0xa5, 0xf7, 0x02, 0xb3,
0xa5, 0xf7, 0x02, 0xb3, 0xFF};
-static void test_very_short_int(void **_CBOR_UNUSED(_state)) {
+static void test_very_short_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data1, 2, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_UINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_8);
@@ -34,13 +34,13 @@ static void test_very_short_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_incomplete_data(void **_CBOR_UNUSED(_state)) {
+static void test_incomplete_data(void** _state _CBOR_UNUSED) {
number = cbor_load(data2, 1, &res);
assert_null(number);
assert_true(res.error.code == CBOR_ERR_NOTENOUGHDATA);
}
-static void test_short_int(void **_CBOR_UNUSED(_state)) {
+static void test_short_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data2, 3, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_UINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_8);
@@ -54,7 +54,7 @@ static void test_short_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_half_int(void **_CBOR_UNUSED(_state)) {
+static void test_half_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data3, 5, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_UINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_16);
@@ -68,7 +68,7 @@ static void test_half_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_int(void **_CBOR_UNUSED(_state)) {
+static void test_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data4, 6, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_UINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_32);
@@ -82,7 +82,7 @@ static void test_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_long_int(void **_CBOR_UNUSED(_state)) {
+static void test_long_int(void** _state _CBOR_UNUSED) {
number = cbor_load(data5, 10, &res);
assert_true(cbor_typeof(number) == CBOR_TYPE_UINT);
assert_true(cbor_int_get_width(number) == CBOR_INT_64);
@@ -96,7 +96,7 @@ static void test_long_int(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_refcounting(void **_CBOR_UNUSED(_state)) {
+static void test_refcounting(void** _state _CBOR_UNUSED) {
number = cbor_load(data5, 10, &res);
cbor_incref(number);
assert_true(number->refcount == 2);
@@ -106,13 +106,13 @@ static void test_refcounting(void **_CBOR_UNUSED(_state)) {
assert_null(number);
}
-static void test_empty_input(void **_CBOR_UNUSED(_state)) {
+static void test_empty_input(void** _state _CBOR_UNUSED) {
number = cbor_load(data5, 0, &res);
assert_null(number);
assert_true(res.error.code == CBOR_ERR_NODATA);
}
-static void test_inline_creation(void **_CBOR_UNUSED(_state)) {
+static void test_inline_creation(void** _state _CBOR_UNUSED) {
number = cbor_build_uint8(10);
assert_true(cbor_get_int(number) == 10);
cbor_decref(&number);
@@ -130,7 +130,7 @@ static void test_inline_creation(void **_CBOR_UNUSED(_state)) {
cbor_decref(&number);
}
-static void test_int_creation(void **_CBOR_UNUSED(_state)) {
+static void test_int_creation(void** _state _CBOR_UNUSED) {
WITH_FAILING_MALLOC({ assert_null(cbor_new_int8()); });
WITH_FAILING_MALLOC({ assert_null(cbor_new_int16()); });
WITH_FAILING_MALLOC({ assert_null(cbor_new_int32()); });
diff --git a/test/unicode_test.c b/test/unicode_test.c
index 4b3613e77f78..62245bc1fe4a 100644
--- a/test/unicode_test.c
+++ b/test/unicode_test.c
@@ -13,7 +13,7 @@ struct _cbor_unicode_status status;
unsigned char missing_bytes_data[] = {0xC4, 0x8C};
/* Capital accented C */
-static void test_missing_bytes(void **_CBOR_UNUSED(_state)) {
+static void test_missing_bytes(void** _state _CBOR_UNUSED) {
assert_true(_cbor_unicode_codepoint_count(missing_bytes_data, 1, &status) ==
0);
assert_true(status.status == _CBOR_UNICODE_BADCP);
@@ -28,7 +28,7 @@ static void test_missing_bytes(void **_CBOR_UNUSED(_state)) {
unsigned char invalid_sequence_data[] = {0x65, 0xC4, 0x00};
/* e, invalid seq */
-static void test_invalid_sequence(void **_CBOR_UNUSED(_state)) {
+static void test_invalid_sequence(void** _state _CBOR_UNUSED) {
assert_true(
_cbor_unicode_codepoint_count(invalid_sequence_data, 3, &status) == 0);
assert_true(status.status == _CBOR_UNICODE_BADCP);