1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-26 07:02:15 +03:00

BREAKING: Add Print::availableForWrite method (#7658)

* Add Print::availableForWrite method

Adds an availableForWrite() method to the Print class, matching current
ArduinoCore-API commit 398e70f188e2b861c10d9ffe5e2bfcb6a4a4f489 .

Hook availableForWrite into the SDFS filesystem (other FSes don't have
this capability built-in).

Fixes #7650

* WiFiClient::availableForWrite proto matching Print

* Fix Netdump signedness warning

* Clean up Serial availableForWrite

This is evidently a breaking change due to the type difference.
Arduino's `availableForWrite` returns an `int`, while the
(multiply-implemented, non-virtual) core `availableForWrite` returned
`size_t`.
This commit is contained in:
Earle F. Philhower, III
2020-10-27 03:55:42 -07:00
committed by GitHub
parent 95de525af9
commit 7f38e141c7
10 changed files with 28 additions and 9 deletions

View File

@ -176,7 +176,7 @@ void Netdump::tcpDumpProcess(const Packet& np)
bufferIndex += incl_len;
}
if (bufferIndex && tcpDumpClient && tcpDumpClient.availableForWrite() >= bufferIndex)
if (bufferIndex && tcpDumpClient && tcpDumpClient.availableForWrite() >= (int)bufferIndex)
{
tcpDumpClient.write(packetBuffer, bufferIndex);
bufferIndex = 0;
@ -202,7 +202,7 @@ void Netdump::tcpDumpLoop(WiFiServer &tcpDumpServer, const Filter nf)
{
setCallback(nullptr);
}
if (bufferIndex && tcpDumpClient && tcpDumpClient.availableForWrite() >= bufferIndex)
if (bufferIndex && tcpDumpClient && tcpDumpClient.availableForWrite() >= (int)bufferIndex)
{
tcpDumpClient.write(packetBuffer, bufferIndex);
bufferIndex = 0;