variables: Remove size changing warnings when using Visual Studio

Change some of the types of variables, and cast change sizes where known to
be safe.

There still are some C4116 warning and a couple of C4090 warning which are OK,
so disabled by a #pragma.
This commit is contained in:
Jon Shallow committed 2021-03-03 12:23:25 +00:00
1 parent 0044c61fab
commit 640bb4e667
17 files changed
+65 -54

No files matched your search

+2 -2
View File
@@ -105,7 +105,7 @@ struct coap_lg_crcv_t {
uint8_t last_type; /**< Last request type (CON/NON) */
uint8_t initial; /**< If set, has not been used yet */
uint8_t szx; /**< size of individual blocks */
uint32_t total_len; /**< Length as indicated by SIZE2 option */
size_t total_len; /**< Length as indicated by SIZE2 option */
coap_binary_t *body_data; /**< Used for re-assembling entire body */
coap_binary_t *app_token; /**< app requesting PDU token */
uint8_t base_token[8]; /**< established base PDU token */
@@ -132,7 +132,7 @@ struct coap_lg_srcv_t {
uint16_t content_format; /**< Content format for the set of blocks */
uint8_t last_type; /**< Last request type (CON/NON) */
uint8_t szx; /**< size of individual blocks */
uint32_t total_len; /**< Length as indicated by SIZE1 option */
size_t total_len; /**< Length as indicated by SIZE1 option */
coap_binary_t *body_data; /**< Used for re-assembling entire body */
size_t amount_so_far; /**< Amount of data seen so far */
coap_resource_t *resource; /**< associated resource */
+1 -1
View File
@@ -89,7 +89,7 @@ void coap_set_prng(coap_rand_func_t rng);
*
* @param seed The seed for the pseudo random number generator.
*/
void coap_prng_init(unsigned long seed);
void coap_prng_init(unsigned int seed);
/**
* Fills @p buf with @p len random bytes using the default pseudo
+2 -2
View File
@@ -62,8 +62,8 @@ typedef struct coap_session_t {
coap_session_type_t type; /**< client or server side socket */
coap_session_state_t state; /**< current state of relationaship with peer */
unsigned ref; /**< reference count from queues */
unsigned tls_overhead; /**< overhead of TLS layer */
uint64_t mtu; /**< path or CSM mtu */
size_t tls_overhead; /**< overhead of TLS layer */
size_t mtu; /**< path or CSM mtu */
coap_address_t local_if; /**< optional local interface address */
UT_hash_handle hh;
coap_addr_tuple_t addr_info; /**< key: remote/local address info */
+2 -2
View File
@@ -47,7 +47,7 @@ extern int coap_flsll(long long i);
*
* @return The decoded value
*/
unsigned int coap_decode_var_bytes(const uint8_t *buf, unsigned int length);
unsigned int coap_decode_var_bytes(const uint8_t *buf, size_t length);
/**
* Decodes multiple-length byte sequences. @p buf points to an input byte
@@ -58,7 +58,7 @@ unsigned int coap_decode_var_bytes(const uint8_t *buf, unsigned int length);
*
* @return The decoded value
*/
uint64_t coap_decode_var_bytes8(const uint8_t *buf, unsigned int length);
uint64_t coap_decode_var_bytes8(const uint8_t *buf, size_t length);
/**
* Encodes multiple-length byte sequences. @p buf points to an output buffer of
+1 -1
View File
@@ -618,7 +618,7 @@ size_t coap_insert_option(coap_pdu_t *pdu, uint16_t type,
*
* Internal use only.
*/
int coap_update_option(coap_pdu_t *pdu,
size_t coap_update_option(coap_pdu_t *pdu,
uint16_t type,
size_t len,
const uint8_t *data);