Skip to content

Commit

Permalink
SaferStringFormatConcat
Browse files Browse the repository at this point in the history
  • Loading branch information
kisslorand committed Jan 6, 2021
1 parent 4da84f8 commit 2a62a8d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions TFT/src/User/API/parseACK.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,18 +815,18 @@ void parseACK(void)
{
char tmpMsg[100];
strcpy (tmpMsg, "Mean: ");
sprintf (tmpMsg, "%s%0.5f", tmpMsg, ack_value());
sprintf (&tmpMsg[strlen(tmpMsg)], "%0.5f", ack_value());
if (ack_seen("Min: "))
{
sprintf (tmpMsg, "%s\nMin: %0.5f", tmpMsg, ack_value());
sprintf (&tmpMsg[strlen(tmpMsg)], "\nMin: %0.5f", ack_value());
}
if (ack_seen("Max: "))
{
sprintf (tmpMsg, "%s\nMax: %0.5f", tmpMsg, ack_value());
sprintf (&tmpMsg[strlen(tmpMsg)], "\nMax: %0.5f", ack_value());
}
if (ack_seen("Range: "))
{
sprintf (tmpMsg, "%s\nRange: %0.5f", tmpMsg, ack_value());
sprintf (&tmpMsg[strlen(tmpMsg)], "\nRange: %0.5f", ack_value());
}
setDialogText( (u8* )"Repeatability Test", (uint8_t *)tmpMsg, LABEL_CONFIRM, LABEL_BACKGROUND);
showDialog(DIALOG_TYPE_INFO, NULL, NULL, NULL);
Expand Down
4 changes: 2 additions & 2 deletions TFT/src/User/Menu/ABL.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void ablUpdateStatus(bool succeeded)
savingEnabled = false;
tempTitle.index = LABEL_ABL_SETTINGS_UBL;

sprintf(tempMsg, "%s\n %s", tempMsg, textSelect(LABEL_BL_SMART_FILL));
sprintf(&tempMsg[strlen(tempMsg)], "\n %s", textSelect(LABEL_BL_SMART_FILL));
break;
}
default:
Expand All @@ -39,7 +39,7 @@ void ablUpdateStatus(bool succeeded)

if (savingEnabled && infoMachineSettings.EEPROM == 1)
{
sprintf(tempMsg, "%s\n %s", tempMsg, textSelect(LABEL_EEPROM_SAVE_INFO));
sprintf(&tempMsg[strlen(tempMsg)], "\n %s", textSelect(LABEL_EEPROM_SAVE_INFO));
setDialogText(tempTitle.index, (u8 *) tempMsg, LABEL_CONFIRM, LABEL_CANCEL);
showDialog(DIALOG_TYPE_SUCCESS, saveEepromSettings, NULL, NULL);
}
Expand Down
4 changes: 2 additions & 2 deletions TFT/src/User/Menu/MBL.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void mblUpdateStatus(bool succeeded)

if (infoMachineSettings.EEPROM == 1)
{
sprintf(tempMsg, "%s\n %s", tempMsg, textSelect(LABEL_EEPROM_SAVE_INFO));
sprintf(&tempMsg[strlen(tempMsg)], "\n %s", textSelect(LABEL_EEPROM_SAVE_INFO));

setDialogText(LABEL_MBL_SETTINGS, (u8 *) tempMsg, LABEL_CONFIRM, LABEL_CANCEL);
showDialog(DIALOG_TYPE_SUCCESS, saveEepromSettings, NULL, NULL);
Expand All @@ -48,7 +48,7 @@ void mblNotifyError(void)
{
LABELCHAR(tempMsg, LABEL_MBL);

sprintf(tempMsg, "%s %s", tempMsg, textSelect(LABEL_OFF));
sprintf(&tempMsg[strlen(tempMsg)], " %s", textSelect(LABEL_OFF));

addToast(DIALOG_TYPE_ERROR, tempMsg);
}
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/MeshEditor.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ void meshUpdateData(char *dataRow)

LABELCHAR(tempMsg, LABEL_PROCESS_ABORTED);

sprintf(tempMsg, "%s\n %s", tempMsg, dataRow);
sprintf(&tempMsg[strlen(tempMsg)], "\n %s", dataRow);

popupReminder(DIALOG_TYPE_ERROR, LABEL_MESH_EDITOR, (u8 *) tempMsg);

Expand Down
8 changes: 4 additions & 4 deletions TFT/src/User/Menu/Pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ void pidUpdateStatus(bool succeeded)

if (succeeded)
{
sprintf(tempMsg, "%s %s", tempMsg, textSelect(LABEL_PROCESS_COMPLETED));
sprintf(&tempMsg[strlen(tempMsg)], " %s", textSelect(LABEL_PROCESS_COMPLETED));

BUZZER_PLAY(sound_notify);

addToast(DIALOG_TYPE_INFO, tempMsg);
}
else
{
sprintf(tempMsg, "%s %s", tempMsg, textSelect(LABEL_PROCESS_ABORTED));
sprintf(&tempMsg[strlen(tempMsg)], " %s", textSelect(LABEL_PROCESS_ABORTED));

BUZZER_PLAY(sound_error);

Expand All @@ -72,7 +72,7 @@ void pidUpdateStatus(bool succeeded)

if (infoMachineSettings.EEPROM == 1)
{
sprintf(tempMsg, "%s\n %s", tempMsg, textSelect(LABEL_EEPROM_SAVE_INFO));
sprintf(&tempMsg[strlen(tempMsg)], "\n %s", textSelect(LABEL_EEPROM_SAVE_INFO));

setDialogText(LABEL_PID_TITLE, (u8 *) tempMsg, LABEL_CONFIRM, LABEL_CANCEL);
showDialog(DIALOG_TYPE_SUCCESS, saveEepromSettings, NULL, NULL);
Expand Down Expand Up @@ -104,7 +104,7 @@ static inline void pidCheckTimeout(void)

LABELCHAR(tempMsg, LABEL_TIMEOUT_REACHED);

sprintf(tempMsg, "%s\n %s", tempMsg, textSelect(LABEL_PROCESS_ABORTED));
sprintf(&tempMsg[strlen(tempMsg)], "\n %s", textSelect(LABEL_PROCESS_ABORTED));

BUZZER_PLAY(sound_error);

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/ProbeOffset.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void probeNotifyError(void)
{
LABELCHAR(tempMsg, LABEL_Z_OFFSET);

sprintf(tempMsg, "%s %s", tempMsg, textSelect(LABEL_OFF));
sprintf(&tempMsg[strlen(tempMsg)], " %s", textSelect(LABEL_OFF));

addToast(DIALOG_TYPE_ERROR, tempMsg);
}
Expand Down

0 comments on commit 2a62a8d

Please sign in to comment.