partially revert static outputString in RenderCurrentFolder

The optimization only applies to targets with DGUS2_TFT set. On other
targets the fixed-size array may be of insufficient size.

However, remove the potentially problematic initialization with a single
nullpointer (empty string), as this will be overwritten in the very next
line anyway.

Fixes: a9c018f18c
This commit is contained in:
Stefan Kalscheuer
2023-06-25 15:42:12 +02:00
parent e169b0e627
commit f10f396cc1

View File

@@ -885,10 +885,12 @@ void AnycubicTouchscreenClass::RenderCurrentFolder(uint16_t selectedNumber) {
fileNameWasCut = true;
fileNameLen = MAX_PRINTABLE_FILENAME_LEN;
}
static char outputString[MAX_PRINTABLE_FILENAME_LEN];
#else
char outputString[fileNameLen];
#endif
// Bugfix for non-printable special characters which are now replaced by underscores.
static char outputString[MAX_PRINTABLE_FILENAME_LEN] = {'\0'};
for (unsigned int i = 0; i <= fileNameLen; i++) {
if (isPrintable(fileName[i])) {
outputString[i] = fileName[i];