Fixed and un-ignored the 'stringop-truncation' warning.

This commit is contained in:
mikeller 2019-11-26 07:45:33 +13:00
parent 23c458e85f
commit fd87829aed
3 changed files with 11 additions and 12 deletions

View File

@ -239,8 +239,7 @@ CC_NO_OPTIMISATION :=
#
# Added after GCC version update, remove once the warnings have been fixed
#
TEMPORARY_FLAGS := -Wno-stringop-truncation \
-Wno-attributes \
TEMPORARY_FLAGS := -Wno-attributes \
-Wno-cast-function-type
CFLAGS += $(ARCH_FLAGS) \

View File

@ -38,8 +38,8 @@ void initBoardInformation(void)
{
boardInformationSet = boardConfig()->boardInformationSet;
if (boardInformationSet) {
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH);
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH + 1);
}
signatureSet = boardConfig()->signatureSet;
@ -66,7 +66,7 @@ bool boardInformationIsSet(void)
bool setManufacturerId(const char *newManufacturerId)
{
if (!boardInformationSet || strlen(manufacturerId) == 0) {
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH);
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
boardInformationWasUpdated = true;
@ -79,7 +79,7 @@ bool setManufacturerId(const char *newManufacturerId)
bool setBoardName(const char *newBoardName)
{
if (!boardInformationSet || strlen(boardName) == 0) {
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH);
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH + 1);
boardInformationWasUpdated = true;
@ -92,8 +92,8 @@ bool setBoardName(const char *newBoardName)
bool persistBoardInformation(void)
{
if (boardInformationWasUpdated) {
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH);
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH + 1);
boardConfigMutable()->boardInformationSet = true;
initBoardInformation();

View File

@ -38,15 +38,15 @@ PG_REGISTER_WITH_RESET_FN(boardConfig_t, boardConfig, PG_BOARD_CONFIG, 0);
void pgResetFn_boardConfig(boardConfig_t *boardConfig)
{
if (boardInformationIsSet()) {
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH);
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH);
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1);
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1);
boardConfig->boardInformationSet = true;
} else {
#if !defined(USE_UNIFIED_TARGET)
strncpy(boardConfig->boardName, targetName, MAX_BOARD_NAME_LENGTH);
strncpy(boardConfig->boardName, targetName, MAX_BOARD_NAME_LENGTH + 1);
#if defined(TARGET_MANUFACTURER_IDENTIFIER)
strncpy(boardConfig->manufacturerId, TARGET_MANUFACTURER_IDENTIFIER, MAX_MANUFACTURER_ID_LENGTH);
strncpy(boardConfig->manufacturerId, TARGET_MANUFACTURER_IDENTIFIER, MAX_MANUFACTURER_ID_LENGTH + 1);
#endif
boardConfig->boardInformationSet = true;
#else