From 4754f4317c0b12c5d2fee55e23678b1ce8495f42 Mon Sep 17 00:00:00 2001 From: martinayotte Date: Mon, 22 Aug 2016 09:11:34 -0400 Subject: [PATCH] SD: change 'char *' parameters to 'const char *' to fix bad recursion (#2398) --- libraries/SD/src/SD.cpp | 12 ++++++------ libraries/SD/src/SD.h | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/SD/src/SD.cpp b/libraries/SD/src/SD.cpp index fcbece832..974813037 100644 --- a/libraries/SD/src/SD.cpp +++ b/libraries/SD/src/SD.cpp @@ -56,7 +56,7 @@ #define MAX_COMPONENT_LEN 12 // What is max length? #define PATH_COMPONENT_BUFFER_LEN MAX_COMPONENT_LEN+1 -bool getNextPathComponent(char *path, unsigned int *p_offset, +bool getNextPathComponent(const char *path, unsigned int *p_offset, char *buffer) { /* @@ -115,7 +115,7 @@ bool getNextPathComponent(char *path, unsigned int *p_offset, -boolean walkPath(char *filepath, SdFile& parentDir, +boolean walkPath(const char *filepath, SdFile& parentDir, boolean (*callback)(SdFile& parentDir, char *filePathComponent, boolean isLastComponent, @@ -513,7 +513,7 @@ File SDClass::open(char *filepath, uint8_t mode) { //} -boolean SDClass::exists(char *filepath) { +boolean SDClass::exists(const char *filepath) { /* Returns true if the supplied file path exists. @@ -534,7 +534,7 @@ boolean SDClass::exists(char *filepath) { //} -boolean SDClass::mkdir(char *filepath) { +boolean SDClass::mkdir(const char *filepath) { /* Makes a single directory or a heirarchy of directories. @@ -545,7 +545,7 @@ boolean SDClass::mkdir(char *filepath) { return walkPath(filepath, root, callback_makeDirPath); } -boolean SDClass::rmdir(char *filepath) { +boolean SDClass::rmdir(const char *filepath) { /* Remove a single directory or a heirarchy of directories. @@ -556,7 +556,7 @@ boolean SDClass::rmdir(char *filepath) { return walkPath(filepath, root, callback_rmdir); } -boolean SDClass::remove(char *filepath) { +boolean SDClass::remove(const char *filepath) { return walkPath(filepath, root, callback_remove); } diff --git a/libraries/SD/src/SD.h b/libraries/SD/src/SD.h index a164411ba..38ad79359 100644 --- a/libraries/SD/src/SD.h +++ b/libraries/SD/src/SD.h @@ -96,19 +96,19 @@ public: File open(const String &filename, uint8_t mode = FILE_READ) { return open( filename.c_str(), mode ); } // Methods to determine if the requested file path exists. - boolean exists(char *filepath); + boolean exists(const char *filepath); boolean exists(const String &filepath) { return exists(filepath.c_str()); } // Create the requested directory heirarchy--if intermediate directories // do not exist they will be created. - boolean mkdir(char *filepath); + boolean mkdir(const char *filepath); boolean mkdir(const String &filepath) { return mkdir(filepath.c_str()); } // Delete the file. - boolean remove(char *filepath); + boolean remove(const char *filepath); boolean remove(const String &filepath) { return remove(filepath.c_str()); } - boolean rmdir(char *filepath); + boolean rmdir(const char *filepath); boolean rmdir(const String &filepath) { return rmdir(filepath.c_str()); } uint8_t type(){ return card.type(); }