Unverified Commit 1160d7cd authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Replace ancient "boolean" with "bool" (#1908)

parent 2aa85e32
......@@ -46,7 +46,7 @@ IPAddress netMsk(255, 255, 255, 0);
/** Should I connect to WLAN asap? */
boolean connect;
bool connect;
/** Last time I tried to connect to WLAN */
unsigned long lastConnectTry = 0;
......
......@@ -24,7 +24,7 @@ void handleRoot() {
}
/** Redirect to captive portal if we got a request for another domain. Return true in that case so the page handler do not try to handle the request again. */
boolean captivePortal() {
bool captivePortal() {
if (!isIp(server.hostHeader()) && server.hostHeader() != (String(myHostname) + ".local")) {
Serial.println("Request redirected to captive portal");
server.sendHeader("Location", String("http://") + toStringIp(server.client().localIP()), true);
......
/** Is this an IP? */
boolean isIp(String str) {
bool isIp(String str) {
for (size_t i = 0; i < str.length(); i++) {
int c = str.charAt(i);
if (c != '.' && (c < '0' || c > '9')) {
......
......@@ -31,13 +31,13 @@
class SDClass {
public:
boolean begin(uint8_t csPin, HardwareSPI &spi) {
bool begin(uint8_t csPin, HardwareSPI &spi) {
SDFS.setConfig(SDFSConfig(csPin, SPI_HALF_SPEED, spi));
return (boolean)SDFS.begin();
return SDFS.begin();
}
boolean begin(uint8_t csPin, uint32_t cfg = SPI_HALF_SPEED, HardwareSPI &spi = SPI) {
bool begin(uint8_t csPin, uint32_t cfg = SPI_HALF_SPEED, HardwareSPI &spi = SPI) {
SDFS.setConfig(SDFSConfig(csPin, cfg, spi));
return (boolean)SDFS.begin();
return SDFS.begin();
}
void end(bool endSPI = true) {
......@@ -63,43 +63,43 @@ public:
return open(filename.c_str(), mode);
}
boolean exists(const char *filepath) {
return (boolean)SDFS.exists(filepath);
bool exists(const char *filepath) {
return SDFS.exists(filepath);
}
boolean exists(const String &filepath) {
return (boolean)SDFS.exists(filepath.c_str());
bool exists(const String &filepath) {
return SDFS.exists(filepath.c_str());
}
boolean rename(const char* filepathfrom, const char* filepathto) {
return (boolean)SDFS.rename(filepathfrom, filepathto);
bool rename(const char* filepathfrom, const char* filepathto) {
return SDFS.rename(filepathfrom, filepathto);
}
boolean rename(const String &filepathfrom, const String &filepathto) {
return (boolean)rename(filepathfrom.c_str(), filepathto.c_str());
bool rename(const String &filepathfrom, const String &filepathto) {
return rename(filepathfrom.c_str(), filepathto.c_str());
}
boolean mkdir(const char *filepath) {
return (boolean)SDFS.mkdir(filepath);
bool mkdir(const char *filepath) {
return SDFS.mkdir(filepath);
}
boolean mkdir(const String &filepath) {
return (boolean)SDFS.mkdir(filepath.c_str());
bool mkdir(const String &filepath) {
return SDFS.mkdir(filepath.c_str());
}
boolean remove(const char *filepath) {
return (boolean)SDFS.remove(filepath);
bool remove(const char *filepath) {
return SDFS.remove(filepath);
}
boolean remove(const String &filepath) {
bool remove(const String &filepath) {
return remove(filepath.c_str());
}
boolean rmdir(const char *filepath) {
return (boolean)SDFS.rmdir(filepath);
bool rmdir(const char *filepath) {
return SDFS.rmdir(filepath);
}
boolean rmdir(const String &filepath) {
bool rmdir(const String &filepath) {
return rmdir(filepath.c_str());
}
......
......@@ -262,15 +262,15 @@ void HTTPServer::setContentLength(const size_t contentLength) {
_contentLength = contentLength;
}
void HTTPServer::enableDelay(boolean value) {
void HTTPServer::enableDelay(bool value) {
_nullDelay = value;
}
void HTTPServer::enableCORS(boolean value) {
void HTTPServer::enableCORS(bool value) {
_corsEnabled = value;
}
void HTTPServer::enableCrossOrigin(boolean value) {
void HTTPServer::enableCrossOrigin(bool value) {
enableCORS(value);
}
......
......@@ -146,9 +146,9 @@ public:
send(code, content_type, (const char *)content, contentLength);
}
void enableDelay(boolean value);
void enableCORS(boolean value = true);
void enableCrossOrigin(boolean value = true);
void enableDelay(bool value);
void enableCORS(bool value = true);
void enableCrossOrigin(bool value = true);
void setContentLength(const size_t contentLength);
void sendHeader(const String& name, const String& value, bool first = false);
......@@ -235,7 +235,7 @@ protected:
String value;
};
boolean _corsEnabled;
bool _corsEnabled;
WiFiClient *_currentClient;
HTTPMethod _currentMethod;
......@@ -243,7 +243,7 @@ protected:
uint8_t _currentVersion;
HTTPClientStatus _currentStatus;
unsigned long _statusChange;
boolean _nullDelay;
bool _nullDelay;
RequestHandler* _currentHandler;
RequestHandler* _firstHandler;
......
......@@ -339,7 +339,7 @@ int HTTPServer::_uploadReadByte(WiFiClient* client) {
// keep trying until you either read a valid byte or timeout
unsigned long startMillis = millis();
unsigned long timeoutIntervalMillis = client->getTimeout();
boolean timedOut = false;
bool timedOut = false;
for (;;) {
if (!client->connected()) {
return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment