GrumpyOldPizza / arduino-STM32L4

69 stars 60 forks source link

conflicting return type specified for virtual int Client::read(uint8_t *buf, size_t size) #38

Open dberenguer opened 5 years ago

dberenguer commented 5 years ago

Client inherits from Stream but read is declared in Client.h as:

virtual int read(uint8_t *buf, size_t size) = 0;

whilst the parent declaration in Stream.h is:

virtual size_t read(uint8_t *buffer, size_t size);

Using the Adafruit_MQTT library generates the above error. Changing from int to size_t as the return type in Client.h fixes the problem.

GrumpyOldPizza commented 5 years ago

I'll take a peek. Seems that other libraries (like Wire.h) do use "size_t". The code in "Stream.h" is an extension from the standard Arduino code.

Looking at "write()" the return type is "size_t".

On Mon, Aug 27, 2018 at 4:34 AM Daniel Berenguer notifications@github.com wrote:

Client inherits from Stream but read is declared in Client.h as:

virtual int read(uint8_t *buf, size_t size) = 0;

whilst the parent declaration in Stream.h is:

virtual size_t read(uint8_t *buffer, size_t size);

Using the Adafruit_MQTT library generates the above error. Changing from int to size_t as the return type in Client.h fixes the problem.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/38, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfJ1VhDLOoK4LBZye2Y15saJR_BP7ks5uU8sugaJpZM4WNjsO .

dberenguer commented 5 years ago

Perfect. I created a pull request, in case you want to merge.