mirror of https://github.com/ArduPilot/ardupilot
AP_HAL: resolved -Woverloaded-virtual warning
the function: virtual size_t AP_HAL::Print::write(const uint8_t *buffer, size_t size); was hidden in all derived classes by their virtual size_t write(uint8_t) = 0; implementations. To solve this, a non-virtual write(const uint8_t *, size_t) that calls a virtual write_implementation was added. This isn't necessary atm, because the derived classes don't call write(const uint8_t *, size_t), BUT this decreases the apm2-quad Program size by 40 bytes :D and removes warnings.
This commit is contained in:
parent
1bf135b36f
commit
d3ea88e8c7
|
@ -30,7 +30,7 @@
|
|||
using namespace AP_HAL;
|
||||
|
||||
/* default implementation: may be overridden */
|
||||
size_t Print::write(const uint8_t *buffer, size_t size)
|
||||
size_t Print::write_implementation(const uint8_t *buffer, size_t size)
|
||||
{
|
||||
size_t n = 0;
|
||||
while (size--) {
|
||||
|
|
|
@ -47,8 +47,9 @@ class AP_HAL::Print {
|
|||
virtual size_t write(uint8_t) = 0;
|
||||
|
||||
size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
|
||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||
|
||||
size_t write(const uint8_t *buffer, size_t size) {return write_implementation(buffer, size);}
|
||||
virtual size_t write_implementation(const uint8_t *buffer, size_t size);
|
||||
public:
|
||||
size_t print(const char[]);
|
||||
size_t print(char);
|
||||
size_t print(unsigned char, int = DEC);
|
||||
|
|
Loading…
Reference in New Issue