mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
upm: musl and gcc8 fixes
gcc8 detects that strncpy is overwiritng the null terminating character the source strings are already initialized to 0 so memcpy would do the same job Fixes rn2903.c:153:5: error: 'strncpy' output may be truncated copying 16 bytes from a string of length 511 [-Werror=stringop-truncation] strncpy(dev->hardware_eui, dev->resp_data, RN2903_MAX_HEX_EUI64); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include sys/types.h for uint definition uint is defined in sys/types.h, therefore this header needs to be included, it gets exposed with musl where this header is not getting included indirectly as it is happening when building on glibc Fixes build errors on musl e.g. upm/src/kx122/kx122.hpp:456:31: error: 'uint' has not been declared | void setBufferThreshold(uint samples); | ^~~~ Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
a16d279b6f
commit
8a617aa904
@ -488,7 +488,7 @@ int ecezo_send_command(const ecezo_context dev, char *cmd, char *buffer,
|
||||
// our write buffer
|
||||
char writeBuffer[ECEZO_MAX_BUFFER_LEN];
|
||||
|
||||
strncpy(writeBuffer, cmd, ECEZO_MAX_BUFFER_LEN);
|
||||
memcpy(writeBuffer, cmd, ECEZO_MAX_BUFFER_LEN - 1);
|
||||
writeBuffer[ECEZO_MAX_BUFFER_LEN - 1] = 0;
|
||||
|
||||
int writelen = strlen(writeBuffer);
|
||||
|
Reference in New Issue
Block a user