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

Add explicit Print::write(char) (#6101)

W/o this change, file::write('a'); tries to use the template and fails
since char is a basic type.

The reason it is needed is due to pre 2.5.x behavior, File::write(char)
silently was cast to File::write(uint8_t).  With the template write,
though, this is not performed.

* Add Print::write tests and add'l overrides

Ensure that print::write does something sane and doesn't cause a compile
time error about templates when used for Files.

Test using SPIFFS file since Print is an abstract type.
This commit is contained in:
Earle F. Philhower, III
2019-05-18 14:07:13 -07:00
committed by GitHub
parent 48fc8aff20
commit 82adc95d64
4 changed files with 91 additions and 11 deletions

View File

@ -80,10 +80,6 @@ class TwoWire : public Stream
void onReceive( void (*)(size_t) ); // legacy esp8266 backward compatibility
void onRequest( void (*)(void) );
inline size_t write(unsigned long n) { return write((uint8_t)n); }
inline size_t write(long n) { return write((uint8_t)n); }
inline size_t write(unsigned int n) { return write((uint8_t)n); }
inline size_t write(int n) { return write((uint8_t)n); }
using Print::write;
};