Merge pull request #104 from theotherjimmy/buffered-serial-printf

removed warning about unsigned to signed cast
Sam Grove 2016-05-18 02:02:59 -05:00
commit 7d541a9cbd
1 changed files with 4 additions and 2 deletions

View File

@ -89,13 +89,15 @@ int BufferedSerial::printf(const char* format, ...)
va_start(arg, format);
r = vsprintf(buffer, format, arg);
// this may not hit the heap but should alert the user anyways
if(r > this->_buf_size) {
if(r > (int32_t) this->_buf_size) {
error("%s %d buffer overwrite (max_buf_size: %d exceeded: %d)!\r\n", __FILE__, __LINE__,this->_buf_size,r);
va_end(arg);
return 0;
}
va_end(arg);
r = BufferedSerial::write(buffer, r);
if ( r > 0 ) {
r = BufferedSerial::write(buffer, r);
}
return r;
}