Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Warnings #503

Merged
merged 6 commits into from
Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Homie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ HomieClass::HomieClass()
Interface::get().bootMode = HomieBootMode::UNDEFINED;
Interface::get().configurationAp.secured = false;
Interface::get().led.enabled = true;
Interface::get().led.pin = BUILTIN_LED;
Interface::get().led.pin = LED_BUILTIN;
Interface::get().led.on = LOW;
Interface::get().reset.idle = true;
Interface::get().reset.enabled = true;
Expand Down
15 changes: 5 additions & 10 deletions src/Homie/Boot/BootConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void BootConfig::_proxyHttpRequest(AsyncWebServerRequest *request) {
_httpClient.setUserAgent(F("ESP8266-Homie"));
_httpClient.begin(url);
// copy headers
for (int i = 0; i < request->headers(); i++) {
for (size_t i = 0; i < request->headers(); i++) {
_httpClient.addHeader(request->headerName(i), request->header(i));
}

Expand Down Expand Up @@ -335,7 +335,7 @@ void BootConfig::_onDeviceInfoRequest(AsyncWebServerRequest *request) {
for (IHomieSetting* iSetting : IHomieSetting::settings) {
JsonObject& jsonSetting = jsonBuffer.createObject();

if (iSetting->getType() != "unknown") {
if (String(iSetting->getType()) != "unknown") {
jsonSetting["name"] = iSetting->getName();
jsonSetting["description"] = iSetting->getDescription();
jsonSetting["type"] = iSetting->getType();
Expand Down Expand Up @@ -421,19 +421,14 @@ void BootConfig::__parsePost(AsyncWebServerRequest *request, uint8_t *data, size
if (index == 0) {
request->_tempObject = new char[total + 1];
}
void* buff = request->_tempObject + index;
char* buff = reinterpret_cast<char*>(request->_tempObject) + index;
memcpy(buff, data, len);
if (index + len == total) {
void* buff = request->_tempObject + total;
*reinterpret_cast<char*>(buff) = 0;
char* buff = reinterpret_cast<char*>(request->_tempObject) + total;
*buff = '\0';
}
}
}
static const String ConfigJSONError(const String error) {
const String BEGINNING = String(FPSTR(PROGMEM_CONFIG_JSON_FAILURE_BEGINNING));
const String END = String(FPSTR(PROGMEM_CONFIG_JSON_FAILURE_END));
return BEGINNING + error + END;
}

void HomieInternals::BootConfig::__SendJSONError(AsyncWebServerRequest * request, String msg, int16_t code) {
Interface::get().getLogger() << msg << endl;
Expand Down
6 changes: 4 additions & 2 deletions src/Homie/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ void Logger::setPrinter(Print* printer) {
}

size_t Logger::write(uint8_t character) {
if (_loggingEnabled) _printer->write(character);
if (_loggingEnabled) return _printer->write(character);
return 0;
}

size_t Logger::write(const uint8_t* buffer, size_t size) {
if (_loggingEnabled) _printer->write(buffer, size);
if (_loggingEnabled) return _printer->write(buffer, size);
return 0;
}
2 changes: 1 addition & 1 deletion src/Homie/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void Timer::setInterval(uint32_t interval, bool tickAtBeginning) {
}

uint32_t HomieInternals::Timer::getInterval() {
_interval;
return _interval;
}

bool Timer::check() const {
Expand Down