diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2022-04-21 20:47:04 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2022-04-21 20:47:04 +0300 |
| commit | 369e1efeab53ea050ac9bbfa3b623f84c6be14a7 (patch) | |
| tree | 914dccd88c5c5ccdbcc349910f1f11b5f96ae412 | |
| parent | f6337e1268374f4cb1e1f72cd7df8bbedc4d4302 (diff) | |
Fix compilation warnings.
| -rw-r--r-- | src/libecbor/ecbor.c | 12 | ||||
| -rw-r--r-- | src/libecbor/ecbor_internal.h | 4 | ||||
| -rw-r--r-- | src/unittest/test_encoder.cpp | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/libecbor/ecbor.c b/src/libecbor/ecbor.c index c604fc7..1c89a1d 100644 --- a/src/libecbor/ecbor.c +++ b/src/libecbor/ecbor.c @@ -123,8 +123,8 @@ ecbor_fp64_to_big_endian (double value) ecbor_type_t ecbor_get_type (ecbor_item_t *item) { - ECBOR_INTERNAL_CHECK_ITEM_PTR (item); - if (item->type < ECBOR_TYPE_FIRST + if (item == NULL + || item->type < ECBOR_TYPE_FIRST || item->type > ECBOR_TYPE_LAST) { return ECBOR_TYPE_NONE; } @@ -593,13 +593,13 @@ ecbor_memcpy (void *dest, void *src, size_t num) while (num > 4) { *((uint32_t *) dest) = *((uint32_t *) src); num -= 4; - dest += 4; - src += 4; + dest = ((uint32_t *)dest) + 1; + src = ((uint32_t *)src) + 1; } while (num) { *((uint8_t *) dest) = *((uint8_t *) src); num --; - dest ++; - src ++; + dest = ((uint8_t *)dest) + 1; + src = ((uint8_t *)src) + 1; } } diff --git a/src/libecbor/ecbor_internal.h b/src/libecbor/ecbor_internal.h index 9612c1a..c237f91 100644 --- a/src/libecbor/ecbor_internal.h +++ b/src/libecbor/ecbor_internal.h @@ -41,7 +41,7 @@ enum { }; /* Static item, for various initializations */ -static ecbor_item_t null_item = { +static const ecbor_item_t null_item = { .type = ECBOR_TYPE_NONE, .value = { .tag = { @@ -135,4 +135,4 @@ ecbor_fp64_to_big_endian (double value); extern void ecbor_memcpy (void *dest, void *src, size_t num); -#endif
\ No newline at end of file +#endif diff --git a/src/unittest/test_encoder.cpp b/src/unittest/test_encoder.cpp index 380d45c..dfa9926 100644 --- a/src/unittest/test_encoder.cpp +++ b/src/unittest/test_encoder.cpp @@ -50,7 +50,7 @@ void run_encoder_test_normal(std::function<void(ecbor_encode_context_t*)> callba TEST(encoder, noop) { - run_encoder_test_normal([](ecbor_encode_context_t* ctx) -> void { + run_encoder_test_normal([](ecbor_encode_context_t*) -> void { }, {}); } |
