diff options
| author | rimio <vasi.vilvoiu@gmail.com> | 2018-03-06 00:23:59 +0200 |
|---|---|---|
| committer | rimio <vasi.vilvoiu@gmail.com> | 2018-03-06 00:23:59 +0200 |
| commit | 5c43023ce4c837ed70ac0c231e5b79f5fefb1157 (patch) | |
| tree | cc3009cba8848aa54d8acf483c9f5c966b5f210f | |
| parent | e3f3c0d12eb83af50f984332a8ddae6f27197b12 (diff) | |
Const correctness fixes
| -rw-r--r-- | include/ecbor.h.in | 4 | ||||
| -rw-r--r-- | src/ecbor-describe/ecbor_describe.c | 4 | ||||
| -rw-r--r-- | src/libecbor/ecbor.c | 9 |
3 files changed, 9 insertions, 8 deletions
diff --git a/include/ecbor.h.in b/include/ecbor.h.in index 0379b93..ef33ce2 100644 --- a/include/ecbor.h.in +++ b/include/ecbor.h.in @@ -363,7 +363,7 @@ ecbor_get_int64 (ecbor_item_t *item, int64_t *value); /* Strings */ extern ecbor_error_t -ecbor_get_str (ecbor_item_t *str, char **value); +ecbor_get_str (ecbor_item_t *str, const char **value); extern ecbor_error_t ecbor_get_str_chunk_count (ecbor_item_t *str, size_t *count); @@ -373,7 +373,7 @@ ecbor_get_str_chunk (ecbor_item_t *str, size_t index, ecbor_item_t *chunk); extern ecbor_error_t -ecbor_get_bstr (ecbor_item_t *str, uint8_t **value); +ecbor_get_bstr (ecbor_item_t *str, const uint8_t **value); extern ecbor_error_t ecbor_get_bstr_chunk_count (ecbor_item_t *str, size_t *count); diff --git a/src/ecbor-describe/ecbor_describe.c b/src/ecbor-describe/ecbor_describe.c index 52b2eed..670b681 100644 --- a/src/ecbor-describe/ecbor_describe.c +++ b/src/ecbor-describe/ecbor_describe.c @@ -124,7 +124,7 @@ print_ecbor_item (ecbor_item_t *item, unsigned int level, char *prefix) } } } else { - char *val; + const char *val; rc = ecbor_get_str (item, &val); if (rc != ECBOR_OK) { @@ -170,7 +170,7 @@ print_ecbor_item (ecbor_item_t *item, unsigned int level, char *prefix) } } } else { - uint8_t *val; + const uint8_t *val; rc = ecbor_get_bstr (item, &val); if (rc != ECBOR_OK) { diff --git a/src/libecbor/ecbor.c b/src/libecbor/ecbor.c index 30d2ac5..92a50f5 100644 --- a/src/libecbor/ecbor.c +++ b/src/libecbor/ecbor.c @@ -423,7 +423,7 @@ ECBOR_GET_INTEGER_INTERNAL (item, value, ECBOR_TYPE_NINT, int64_t) static __attribute__((noinline)) ecbor_error_t -ecbor_get_string_internal (ecbor_item_t *str, uint8_t **value, +ecbor_get_string_internal (ecbor_item_t *str, const uint8_t **value, ecbor_type_t type) { ECBOR_INTERNAL_CHECK_ITEM_PTR (str); @@ -502,9 +502,10 @@ ecbor_get_string_chunk_internal (ecbor_item_t *str, size_t index, } ecbor_error_t -ecbor_get_str (ecbor_item_t *str, char **value) +ecbor_get_str (ecbor_item_t *str, const char **value) { - return ecbor_get_string_internal (str, (uint8_t **)value, ECBOR_TYPE_STR); + return ecbor_get_string_internal (str, (const uint8_t **)value, + ECBOR_TYPE_STR); } ecbor_error_t @@ -520,7 +521,7 @@ ecbor_get_str_chunk (ecbor_item_t *str, size_t index, ecbor_item_t *chunk) } ecbor_error_t -ecbor_get_bstr (ecbor_item_t *str, uint8_t **value) +ecbor_get_bstr (ecbor_item_t *str, const uint8_t **value) { return ecbor_get_string_internal (str, value, ECBOR_TYPE_BSTR); } |
