Skip to content

Commit

Permalink
coding guidelines: comply with MISRA Rule 21.15
Browse files Browse the repository at this point in the history
- made explicit the copied data type

Signed-off-by: Hess Nathan <nhess@baumer.com>
  • Loading branch information
DeHess authored and nashif committed Jun 14, 2024
1 parent 1db7caa commit 7fb4a74
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/os/cbprintf_packaged.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags,
return -ENOSPC;
}
if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) {
memcpy(buf, &v, size);
memcpy(buf, (uint8_t *)&v, size);
} else if (fmt[-1] == 'L') {
*(long double *)buf = v.ld;
} else {
Expand Down Expand Up @@ -583,7 +583,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags,
return -ENOSPC;
}
if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) {
memcpy(buf, &v, size);
memcpy(buf, (uint8_t *)&v, size);
} else if (fmt[-1] == 'L') {
*(long double *)buf = v.ld;
} else {
Expand Down Expand Up @@ -699,7 +699,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags,

if (buf0 != NULL) {
if (Z_CBPRINTF_VA_STACK_LL_DBL_MEMCPY) {
memcpy(buf, &v, sizeof(long long));
memcpy(buf, (uint8_t *)&v, sizeof(long long));
} else {
*(long long *)buf = v;
}
Expand Down Expand Up @@ -796,7 +796,7 @@ int cbvprintf_package(void *packaged, size_t len, uint32_t flags,
/* store the pointer position prefix */
*buf++ = str_ptr_pos[i];
/* copy the string with its terminating '\0' */
memcpy(buf, s, size);
memcpy(buf, (uint8_t *)s, size);
buf += size;
}

Expand Down

0 comments on commit 7fb4a74

Please sign in to comment.