mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Moving write errors out of return value into separate API methods.
write(), print(), println() now return size_t (and don't use negative values to signal errors). Print adds writeError() for checking for write errors, clearWriteError() to reset the flag to false, and a protected setWriteError() for signalling errors. http://code.google.com/p/arduino/issues/detail?id=598
This commit is contained in:
@ -42,15 +42,15 @@ bool IPAddress::operator==(const uint8_t* addr)
|
||||
return memcmp(addr, _address, sizeof(_address)) == 0;
|
||||
}
|
||||
|
||||
ssize_t IPAddress::printTo(Print& p) const
|
||||
size_t IPAddress::printTo(Print& p) const
|
||||
{
|
||||
ssize_t n = 0, t;
|
||||
size_t n = 0;
|
||||
for (int i =0; i < 3; i++)
|
||||
{
|
||||
if ((t = p.print(_address[i], DEC)) > 0) n += t;
|
||||
if ((t = p.print('.')) > 0) n+= t;
|
||||
n += p.print(_address[i], DEC);
|
||||
n += p.print('.');
|
||||
}
|
||||
if ((t = p.print(_address[3], DEC)) > 0) n += t;
|
||||
n += p.print(_address[3], DEC);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user