From baddf38dbc2c72ab095deaf9b3e251ea2faeb699 Mon Sep 17 00:00:00 2001 From: Petr Ledvina Date: Tue, 17 Jul 2018 17:31:40 +0200 Subject: [PATCH] Make card filename `const` Fixes warning in filename_wldsd --- Firmware/Marlin_main.cpp | 2 +- Firmware/cardreader.cpp | 10 +++++----- Firmware/cardreader.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 5e9a7f9c..22a8b8a9 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8082,7 +8082,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ int ix = 0; int iy = 0; - char* filename_wldsd = "wldsd.txt"; + const char* filename_wldsd = "wldsd.txt"; char data_wldsd[70]; char numb_wldsd[10]; diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index 06a47a74..493113d6 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -258,7 +258,7 @@ void CardReader::pauseSDPrint() } -void CardReader::openLogFile(char* name) +void CardReader::openLogFile(const char* name) { logging = true; openFile(name, false); @@ -289,7 +289,7 @@ void CardReader::getAbsFilename(char *t) t[0]=0; } -void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/) +void CardReader::openFile(const char* name,bool read, bool replace_current/*=true*/) { if(!cardOK) return; @@ -341,7 +341,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/) SdFile myDir; curDir=&root; - char *fname=name; + const char *fname=name; char *dirname_start,*dirname_end; if(name[0]=='/') @@ -429,7 +429,7 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/) } -void CardReader::removeFile(char* name) +void CardReader::removeFile(const char* name) { if(!cardOK) return; @@ -439,7 +439,7 @@ void CardReader::removeFile(char* name) SdFile myDir; curDir=&root; - char *fname=name; + const char *fname=name; char *dirname_start,*dirname_end; if(name[0]=='/') diff --git a/Firmware/cardreader.h b/Firmware/cardreader.h index 073325e3..4acc9376 100644 --- a/Firmware/cardreader.h +++ b/Firmware/cardreader.h @@ -19,9 +19,9 @@ public: //this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset void checkautostart(bool x); - void openFile(char* name,bool read,bool replace_current=true); - void openLogFile(char* name); - void removeFile(char* name); + void openFile(const char* name,bool read,bool replace_current=true); + void openLogFile(const char* name); + void removeFile(const char* name); void closefile(bool store_location=false); void release(); void startFileprint();