Skip to content

Commit ee69c92

Browse files
committed
fix SDWebServer sample
1 parent 9be51eb commit ee69c92

File tree

1 file changed

+8
-10
lines changed
  • hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/SDWebServer

1 file changed

+8
-10
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/SDWebServer/SDWebServer.ino

+8-10
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ void returnOK(){
5555
message += "Access-Control-Allow-Origin: *\r\n";
5656
message += "\r\n";
5757
client.print(message);
58-
message = 0;
5958
client.stop();
6059
}
6160

@@ -69,7 +68,6 @@ void returnFail(String msg){
6968
message += msg;
7069
message += "\r\n";
7170
client.print(message);
72-
message = 0;
7371
client.stop();
7472
}
7573

@@ -108,8 +106,8 @@ bool loadFromSdCard(String path){
108106
head += "\r\nAccess-Control-Allow-Origin: *";
109107
head += "\r\n\r\n";
110108
client.print(head);
111-
dataType = 0;
112-
path = 0;
109+
dataType = String();
110+
path = String();
113111

114112
uint8_t obuf[WWW_BUF_SIZE];
115113

@@ -172,11 +170,11 @@ void deleteRecursive(String path){
172170
entry.close();
173171
SD.remove((char *)entryPath.c_str());
174172
}
175-
entryPath = 0;
173+
entryPath = String();
176174
yield();
177175
}
178176
SD.rmdir((char *)path.c_str());
179-
path = 0;
177+
path = String();
180178
file.close();
181179
}
182180

@@ -186,7 +184,7 @@ void handleDelete(){
186184
if(path == "/" || !SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
187185
deleteRecursive(path);
188186
returnOK();
189-
path = 0;
187+
path = String();
190188
}
191189

192190
void handleCreate(){
@@ -203,15 +201,15 @@ void handleCreate(){
203201
SD.mkdir((char *)path.c_str());
204202
}
205203
returnOK();
206-
path = 0;
204+
path = String();
207205
}
208206

209207
void printDirectory() {
210208
if(!server.hasArg("dir")) return returnFail("BAD ARGS");
211209
String path = server.arg("dir");
212210
if(path != "/" && !SD.exists((char *)path.c_str())) return returnFail("BAD PATH");
213211
File dir = SD.open((char *)path.c_str());
214-
path = 0;
212+
path = String();
215213
if(!dir.isDirectory()){
216214
dir.close();
217215
return returnFail("NOT DIR");
@@ -242,7 +240,7 @@ void printDirectory() {
242240
output += "]";
243241
client.write(output.c_str(), output.length());
244242
client.stop();
245-
output = 0;
243+
output = String();
246244
}
247245

248246
void handleNotFound(){

0 commit comments

Comments
 (0)