Skip to content

Commit 2033bbc

Browse files
committed
samples: net sockets coap_upload: Be explicit about offsetting pointer
Let's be explicit about offsetting the pointer into the string, to avoid a warning by the compiler in code it considers may be a programming bug: error: adding 'size_t' (aka 'unsigned int') to a string does not append to the string Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
1 parent 9885b00 commit 2033bbc

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • samples/net/sockets/coap_upload/src

samples/net/sockets/coap_upload/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ static int block_payload_cb(size_t offset, const uint8_t **payload, size_t *len,
8585
return -EINVAL;
8686
}
8787

88-
*payload = LOREM_IPSUM_SHORT + offset;
88+
*payload = LOREM_IPSUM_SHORT;
89+
*payload += (intptr_t)offset;
8990

9091
data_left = LOREM_IPSUM_SHORT_STRLEN - offset;
9192
if (data_left <= *len) {

0 commit comments

Comments
 (0)