mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Fixed and un-ignored the 'stringop-truncation' warning.
This commit is contained in:
parent
23c458e85f
commit
fd87829aed
3 changed files with 11 additions and 12 deletions
3
Makefile
3
Makefile
|
@ -239,8 +239,7 @@ CC_NO_OPTIMISATION :=
|
||||||
#
|
#
|
||||||
# Added after GCC version update, remove once the warnings have been fixed
|
# Added after GCC version update, remove once the warnings have been fixed
|
||||||
#
|
#
|
||||||
TEMPORARY_FLAGS := -Wno-stringop-truncation \
|
TEMPORARY_FLAGS := -Wno-attributes \
|
||||||
-Wno-attributes \
|
|
||||||
-Wno-cast-function-type
|
-Wno-cast-function-type
|
||||||
|
|
||||||
CFLAGS += $(ARCH_FLAGS) \
|
CFLAGS += $(ARCH_FLAGS) \
|
||||||
|
|
|
@ -38,8 +38,8 @@ void initBoardInformation(void)
|
||||||
{
|
{
|
||||||
boardInformationSet = boardConfig()->boardInformationSet;
|
boardInformationSet = boardConfig()->boardInformationSet;
|
||||||
if (boardInformationSet) {
|
if (boardInformationSet) {
|
||||||
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
strncpy(manufacturerId, boardConfig()->manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
|
||||||
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH);
|
strncpy(boardName, boardConfig()->boardName, MAX_BOARD_NAME_LENGTH + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
signatureSet = boardConfig()->signatureSet;
|
signatureSet = boardConfig()->signatureSet;
|
||||||
|
@ -66,7 +66,7 @@ bool boardInformationIsSet(void)
|
||||||
bool setManufacturerId(const char *newManufacturerId)
|
bool setManufacturerId(const char *newManufacturerId)
|
||||||
{
|
{
|
||||||
if (!boardInformationSet || strlen(manufacturerId) == 0) {
|
if (!boardInformationSet || strlen(manufacturerId) == 0) {
|
||||||
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
|
||||||
|
|
||||||
boardInformationWasUpdated = true;
|
boardInformationWasUpdated = true;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ bool setManufacturerId(const char *newManufacturerId)
|
||||||
bool setBoardName(const char *newBoardName)
|
bool setBoardName(const char *newBoardName)
|
||||||
{
|
{
|
||||||
if (!boardInformationSet || strlen(boardName) == 0) {
|
if (!boardInformationSet || strlen(boardName) == 0) {
|
||||||
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH);
|
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH + 1);
|
||||||
|
|
||||||
boardInformationWasUpdated = true;
|
boardInformationWasUpdated = true;
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ bool setBoardName(const char *newBoardName)
|
||||||
bool persistBoardInformation(void)
|
bool persistBoardInformation(void)
|
||||||
{
|
{
|
||||||
if (boardInformationWasUpdated) {
|
if (boardInformationWasUpdated) {
|
||||||
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
strncpy(boardConfigMutable()->manufacturerId, manufacturerId, MAX_MANUFACTURER_ID_LENGTH + 1);
|
||||||
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH);
|
strncpy(boardConfigMutable()->boardName, boardName, MAX_BOARD_NAME_LENGTH + 1);
|
||||||
boardConfigMutable()->boardInformationSet = true;
|
boardConfigMutable()->boardInformationSet = true;
|
||||||
|
|
||||||
initBoardInformation();
|
initBoardInformation();
|
||||||
|
|
|
@ -38,15 +38,15 @@ PG_REGISTER_WITH_RESET_FN(boardConfig_t, boardConfig, PG_BOARD_CONFIG, 0);
|
||||||
void pgResetFn_boardConfig(boardConfig_t *boardConfig)
|
void pgResetFn_boardConfig(boardConfig_t *boardConfig)
|
||||||
{
|
{
|
||||||
if (boardInformationIsSet()) {
|
if (boardInformationIsSet()) {
|
||||||
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH);
|
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1);
|
||||||
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH);
|
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1);
|
||||||
boardConfig->boardInformationSet = true;
|
boardConfig->boardInformationSet = true;
|
||||||
} else {
|
} else {
|
||||||
#if !defined(USE_UNIFIED_TARGET)
|
#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)
|
#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
|
#endif
|
||||||
boardConfig->boardInformationSet = true;
|
boardConfig->boardInformationSet = true;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue