This commit is contained in:
Scott Lahteine 2018-11-20 05:36:19 -06:00
parent 8ea4eeb785
commit 643e0066a0
4 changed files with 17 additions and 17 deletions

View File

@ -68,7 +68,7 @@ typedef struct {
char command_queue[BUFSIZE][MAX_CMD_SIZE];
// SD Filename and position
char sd_filename[MAXPATHNAMELENGTH + 1];
char sd_filename[MAXPATHNAMELENGTH];
uint32_t sdpos;
// Job elapsed time

View File

@ -106,7 +106,7 @@
* Defines for 8.3 and long (vfat) filenames
*/
#define FILENAME_LENGTH 12 // Number of UTF-16 characters per entry
#define FILENAME_LENGTH 13 // Number of UTF-16 characters per entry
// Total bytes needed to store a single long filename
#define LONG_FILENAME_LENGTH ((FILENAME_LENGTH) * (MAX_VFAT_ENTRIES))
#define LONG_FILENAME_LENGTH (FILENAME_LENGTH * MAX_VFAT_ENTRIES + 1)

View File

@ -48,7 +48,7 @@
// public:
card_flags_t CardReader::flag;
char CardReader::filename[FILENAME_LENGTH + 1], CardReader::longFilename[LONG_FILENAME_LENGTH + 1];
char CardReader::filename[FILENAME_LENGTH], CardReader::longFilename[LONG_FILENAME_LENGTH];
int8_t CardReader::autostart_index;
#if ENABLED(FAST_FILE_TRANSFER)
@ -82,11 +82,11 @@ uint8_t CardReader::workDirDepth;
#if ENABLED(SDSORT_DYNAMIC_RAM)
char **CardReader::sortshort, **CardReader::sortnames;
#else
char CardReader::sortshort[SDSORT_LIMIT][FILENAME_LENGTH + 1];
char CardReader::sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN + 1];
char CardReader::sortshort[SDSORT_LIMIT][FILENAME_LENGTH];
char CardReader::sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN];
#endif
#elif DISABLED(SDSORT_USES_STACK)
char CardReader::sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN + 1];
char CardReader::sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN];
#endif
#if HAS_FOLDER_SORTING
@ -107,7 +107,7 @@ SdFile CardReader::file;
uint8_t CardReader::file_subcall_ctr;
uint32_t CardReader::filespos[SD_PROCEDURE_DEPTH];
char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH + 1];
char CardReader::proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
uint32_t CardReader::filesize, CardReader::sdpos;
@ -183,7 +183,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
if (DIR_IS_SUBDIR(&p) && lsAction != LS_Count && lsAction != LS_GetFilename) {
// Get the short name for the item, which we know is a folder
char dosFilename[FILENAME_LENGTH + 1];
char dosFilename[FILENAME_LENGTH];
createFilename(dosFilename, p);
// Allocate enough stack space for the full path to a folder, trailing slash, and nul
@ -350,7 +350,7 @@ void CardReader::printFilename(
#endif
) {
if (file.isOpen()) {
char dosFilename[FILENAME_LENGTH + 1];
char dosFilename[FILENAME_LENGTH];
file.getFilename(dosFilename);
SERIAL_ECHO_P(port, dosFilename);
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
@ -856,7 +856,7 @@ void CardReader::setroot() {
sortnames = new char*[fileCnt];
#endif
#elif ENABLED(SDSORT_USES_STACK)
char sortnames[fileCnt][SORTED_LONGNAME_MAXLEN + 1];
char sortnames[fileCnt][SORTED_LONGNAME_MAXLEN];
#endif
// Folder sorting needs 1 bit per entry for flags.
@ -873,7 +873,7 @@ void CardReader::setroot() {
// By default re-read the names from SD for every compare
// retaining only two filenames at a time. This is very
// slow but is safest and uses minimal RAM.
char name1[LONG_FILENAME_LENGTH + 1];
char name1[LONG_FILENAME_LENGTH];
#endif

View File

@ -159,7 +159,7 @@ public:
public:
static card_flags_t flag;
static char filename[FILENAME_LENGTH + 1], longFilename[LONG_FILENAME_LENGTH + 1];
static char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH];
static int8_t autostart_index;
#if ENABLED(FAST_FILE_TRANSFER)
@ -204,11 +204,11 @@ private:
#if ENABLED(SDSORT_DYNAMIC_RAM)
static char **sortshort, **sortnames;
#else
static char sortshort[SDSORT_LIMIT][FILENAME_LENGTH + 1];
static char sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN + 1];
static char sortshort[SDSORT_LIMIT][FILENAME_LENGTH];
static char sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN];
#endif
#elif DISABLED(SDSORT_USES_STACK)
static char sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN + 1];
static char sortnames[SDSORT_LIMIT][SORTED_LONGNAME_MAXLEN];
#endif
// Folder sorting uses an isDir array when caching items.
@ -234,7 +234,7 @@ private:
static uint8_t file_subcall_ctr;
static uint32_t filespos[SD_PROCEDURE_DEPTH];
static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH + 1];
static char proc_filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
static uint32_t filesize, sdpos;