Skip to content

Commit 59ed1be

Browse files
committed
removed warning about unsigned to signed cast
1 parent cde78ec commit 59ed1be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/ESP8266Interface/ESP8266/ATParser/BufferedSerial/BufferedSerial.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,15 @@ int BufferedSerial::printf(const char* format, ...)
8989
va_start(arg, format);
9090
r = vsprintf(buffer, format, arg);
9191
// this may not hit the heap but should alert the user anyways
92-
if(r > this->_buf_size) {
92+
if(r > (int32_t) this->_buf_size) {
9393
error("%s %d buffer overwrite (max_buf_size: %d exceeded: %d)!\r\n", __FILE__, __LINE__,this->_buf_size,r);
9494
va_end(arg);
9595
return 0;
9696
}
9797
va_end(arg);
98-
r = BufferedSerial::write(buffer, r);
98+
if ( r > 0 ) {
99+
r = BufferedSerial::write(buffer, r);
100+
}
99101

100102
return r;
101103
}

0 commit comments

Comments
 (0)