bug in socket.cpp

I may have found a bug in socket.cpp

uint8_t recv(SOCKET s, uint8_t *buf, uint16_t len)

I believe this should be a int instead of uint8_t.
Same for uint_8 ret.

reason: if the connection is still up but there is no data to be read, ret is set to -1. for a uint_8_t, this will result in a positive number.
Later in the same routine, if ( ret > 0 ) yield true in this case, though it is not what you would want.

Anyone please confirm if I got this right. My knowledge of C++ is still fairly limited.

lampmaker
What you are describing is a logical bug. I mean from code reading point of view it is wrong.
I'm however not sure whether the compiler will generate bad code. If not you save a byte of memory by sticking to 8 bit.

I've tried to look at the code but I can not find any socket.cpp delivered with arduino. Where did you get the code from?

Best regards
Jantje

socket.cpp is in libraries\Ethernet\utility

lampmaker
I've double checked and indeed this is a bug.
you have perfectly understood the code.
The code will however not fail but the desired optimization will not happen.
Best regards
Jantje

LampMaker, which version of Arduino IDE are you using?

You can post (serious) bugreports here, - Google Code Archive - Long-term storage for Google Code Project Hosting. -
think this is serious enough
(If you don't wanna post I can do it, just PM me with a link to this thread)