Skip to content

Commit 4754f43

Browse files
martinayotteigrr
authored andcommitted
SD: change 'char *' parameters to 'const char *' to fix bad recursion (#2398)
1 parent 497d19d commit 4754f43

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

libraries/SD/src/SD.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#define MAX_COMPONENT_LEN 12 // What is max length?
5757
#define PATH_COMPONENT_BUFFER_LEN MAX_COMPONENT_LEN+1
5858

59-
bool getNextPathComponent(char *path, unsigned int *p_offset,
59+
bool getNextPathComponent(const char *path, unsigned int *p_offset,
6060
char *buffer) {
6161
/*
6262
@@ -115,7 +115,7 @@ bool getNextPathComponent(char *path, unsigned int *p_offset,
115115

116116

117117

118-
boolean walkPath(char *filepath, SdFile& parentDir,
118+
boolean walkPath(const char *filepath, SdFile& parentDir,
119119
boolean (*callback)(SdFile& parentDir,
120120
char *filePathComponent,
121121
boolean isLastComponent,
@@ -513,7 +513,7 @@ File SDClass::open(char *filepath, uint8_t mode) {
513513
//}
514514

515515

516-
boolean SDClass::exists(char *filepath) {
516+
boolean SDClass::exists(const char *filepath) {
517517
/*
518518
519519
Returns true if the supplied file path exists.
@@ -534,7 +534,7 @@ boolean SDClass::exists(char *filepath) {
534534
//}
535535

536536

537-
boolean SDClass::mkdir(char *filepath) {
537+
boolean SDClass::mkdir(const char *filepath) {
538538
/*
539539
540540
Makes a single directory or a heirarchy of directories.
@@ -545,7 +545,7 @@ boolean SDClass::mkdir(char *filepath) {
545545
return walkPath(filepath, root, callback_makeDirPath);
546546
}
547547

548-
boolean SDClass::rmdir(char *filepath) {
548+
boolean SDClass::rmdir(const char *filepath) {
549549
/*
550550
551551
Remove a single directory or a heirarchy of directories.
@@ -556,7 +556,7 @@ boolean SDClass::rmdir(char *filepath) {
556556
return walkPath(filepath, root, callback_rmdir);
557557
}
558558

559-
boolean SDClass::remove(char *filepath) {
559+
boolean SDClass::remove(const char *filepath) {
560560
return walkPath(filepath, root, callback_remove);
561561
}
562562

libraries/SD/src/SD.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ class SDClass {
9696
File open(const String &filename, uint8_t mode = FILE_READ) { return open( filename.c_str(), mode ); }
9797

9898
// Methods to determine if the requested file path exists.
99-
boolean exists(char *filepath);
99+
boolean exists(const char *filepath);
100100
boolean exists(const String &filepath) { return exists(filepath.c_str()); }
101101

102102
// Create the requested directory heirarchy--if intermediate directories
103103
// do not exist they will be created.
104-
boolean mkdir(char *filepath);
104+
boolean mkdir(const char *filepath);
105105
boolean mkdir(const String &filepath) { return mkdir(filepath.c_str()); }
106106

107107
// Delete the file.
108-
boolean remove(char *filepath);
108+
boolean remove(const char *filepath);
109109
boolean remove(const String &filepath) { return remove(filepath.c_str()); }
110110

111-
boolean rmdir(char *filepath);
111+
boolean rmdir(const char *filepath);
112112
boolean rmdir(const String &filepath) { return rmdir(filepath.c_str()); }
113113

114114
uint8_t type(){ return card.type(); }

0 commit comments

Comments
 (0)