rvdbreemen / OTGW-firmware

A ESP8266 devkit firmware for the Nodoshop version of the Opentherm Gateway (OTGW)
MIT License
145 stars 34 forks source link

Fix some compiler warnings. #105

Closed DaveDavenport closed 2 years ago

DaveDavenport commented 2 years ago

Making constant strings const. Right signedness (need some more). time_t -> unsigned long (for use with millis). Fix some data types for printf. Removed unused variables

Untested, not all warnings fixed, some signedness/unsigned conversion remaining.

rlagerweij commented 2 years ago

there is a change in here that leads to the result of String.IndexOf() to be set to an unsigned int, but this function returns -1 if the substring is not found

DaveDavenport commented 2 years ago

there is a change in here that leads to the result of String.IndexOf() to be set to an unsigned int, but this function returns -1 if the substring is not found

aah yes thanks, i intended to look that one up (Because it compared against 0 or eos I was not sure).. does that mean that there is a bug in the code anyway given it does not check for this?

(p.s. you can add comments inline in the diff view)

DaveDavenport commented 2 years ago

changed it to:


-  if ((pos == 0) || (pos == (sIn.length() - 1))) return false; // no key or no value
+  if ((pos <= 0) || (((unsigned int)pos) == (sIn.length() - 1))) return false; // no key or no value