Skip to content

Commit

Permalink
fixup! Fix issues reported by clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 committed Jun 24, 2023
1 parent 73b0216 commit 346cc02
Show file tree
Hide file tree
Showing 13 changed files with 400 additions and 370 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cmake-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
- args: "-DOC_IPV4_ENABLED=ON -DOC_TCP_ENABLED=ON -DOC_PKI_ENABLED=OFF"
# cloud on (ipv4+tcp on), collections create on
- args: "-DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON"
# cloud on (ipv4+tcp on), collections create on, custom message buffer size
- args: "-DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_INOUT_BUFFER_SIZE=1024"
# cloud on (ipv4+tcp on), collections create on, custom message buffer size, custom message buffer pool size, custom app data buffer size, custom app data buffer pool size
- args: "-DOC_CLOUD_ENABLED=ON -DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_INOUT_BUFFER_SIZE=2048 -DOC_INOUT_BUFFER_POOL=4 -DOC_APP_DATA_BUFFER_SIZE=2048 -DOC_APP_DATA_BUFFER_POOL=4"
# debug on
- args: "-DOC_DEBUG_ENABLED=ON"
# debug on, cloud on (ipv4+tcp on)
Expand Down
4 changes: 2 additions & 2 deletions api/oc_blockwise.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ oc_blockwise_find_response_buffer(const char *href, size_t href_len,
endpoint, method, query, query_len, role);
}

const void *
void *
oc_blockwise_dispatch_block(oc_blockwise_state_t *buffer, uint32_t block_offset,
uint32_t requested_block_size,
uint32_t *payload_size)
Expand All @@ -404,7 +404,7 @@ oc_blockwise_dispatch_block(oc_blockwise_state_t *buffer, uint32_t block_offset,
(uint32_t)(buffer->payload_size - block_offset));
}
buffer->next_block_offset = block_offset + *payload_size;
return (const void *)&buffer->buffer[block_offset];
return (void *)&buffer->buffer[block_offset];
}
return NULL;
}
Expand Down
7 changes: 4 additions & 3 deletions api/oc_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dispatch_coap_request(void)
#else /* OC_TCP */
if ((long)payload_size > OC_BLOCK_SIZE) {
#endif /* !OC_TCP */
const void *payload = oc_blockwise_dispatch_block(
void *payload = oc_blockwise_dispatch_block(
g_request_buffer, 0, (uint32_t)OC_BLOCK_SIZE, &block_size);
if (payload) {
coap_set_payload(g_request, payload, block_size);
Expand Down Expand Up @@ -219,7 +219,8 @@ prepare_coap_request(oc_client_cb_t *cb)
}

if (oc_string_len(cb->query) > 0) {
coap_set_header_uri_query(g_request, oc_string(cb->query));
coap_set_header_uri_query(g_request, oc_string(cb->query),
oc_string_len(cb->query));
}

g_dispatch.client_cb = cb;
Expand Down Expand Up @@ -314,7 +315,7 @@ oc_init_multicast_update(const char *uri, const char *query)
coap_set_header_uri_path(g_request, uri, strlen(uri));

if (query) {
coap_set_header_uri_query(g_request, query);
coap_set_header_uri_query(g_request, query, strlen(query));
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion api/oc_server_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ handle_separate_response_request(coap_separate_t *request,
response_state->payload_size = (uint32_t)response_buffer->response_length;

uint32_t payload_size = 0;
const void *payload = oc_blockwise_dispatch_block(
void *payload = oc_blockwise_dispatch_block(
response_state, 0, request->block2_size, &payload_size);
if (payload != NULL) {
coap_set_payload(&response, payload, payload_size);
Expand Down
2 changes: 1 addition & 1 deletion apps/client_block_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ stop_observe(void *data)

if (oc_init_post(array_1, array_server, NULL, &post_array, LOW_QOS, NULL)) {
for (int i = 0; i < 100; i++) {
large_array[i] = oc_random_value();
large_array[i] = (int)oc_random_value();
OC_PRINTF("(%d %d) ", i, large_array[i]);
}
OC_PRINTF("\n");
Expand Down
3 changes: 2 additions & 1 deletion apps/cloud_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,8 @@ simulate_tpm_mbedtls_pk_parse_key(size_t device, mbedtls_pk_context *pk,
return MBEDTLS_ERR_PK_KEY_INVALID_FORMAT;
}
uint8_t identity_private_key[4096];
int ret = fread(identity_private_key, 1, sizeof(identity_private_key), f);
size_t ret =
fread(identity_private_key, 1, sizeof(identity_private_key), f);
fclose(f);
return mbedtls_pk_parse_key(pk, identity_private_key, ret, NULL, 0, f_rng,
p_rng);
Expand Down
10 changes: 5 additions & 5 deletions include/oc_blockwise.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ void oc_blockwise_free_response_buffer(oc_blockwise_state_t *buffer);
* @param block_offset the block offset
* @param requested_block_size blocksize to be send
* @param payload_size the send payload size
* @return const void*
* @return void*
*/
const void *oc_blockwise_dispatch_block(oc_blockwise_state_t *buffer,
uint32_t block_offset,
uint32_t requested_block_size,
uint32_t *payload_size);
void *oc_blockwise_dispatch_block(oc_blockwise_state_t *buffer,
uint32_t block_offset,
uint32_t requested_block_size,
uint32_t *payload_size);

/**
* @brief handle the incomming block (partial message)
Expand Down
Loading

0 comments on commit 346cc02

Please sign in to comment.