Skip to content

Commit e883e6e

Browse files
Copilotdoudar
andcommitted
Fix code review issues in NimBLEStream implementation
Co-authored-by: doudar <[email protected]>
1 parent cb589db commit e883e6e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/NimBLEStream.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ static const char* LOG_TAG = "NimBLEStream";
2626

2727
// Stub Print/Stream implementations when Arduino not available
2828
# if !NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
29+
# include <cstring>
30+
2931
size_t Print::print(const char* s) {
3032
if (!s) return 0;
3133
return write(reinterpret_cast<const uint8_t*>(s), strlen(s));
@@ -245,7 +247,7 @@ size_t NimBLEStream::pushRx(const uint8_t* data, size_t len) {
245247
m_hasPeek = false;
246248

247249
if (xRingbufferSend(m_rxBuf, data, len, 0) != pdTRUE) {
248-
NIMBLE_UART_LOGE(LOG_TAG, "RX buffer full, dropping %u bytes", len);
250+
NIMBLE_UART_LOGE(LOG_TAG, "RX buffer full, dropping %zu bytes", len);
249251
return 0;
250252
}
251253
return len;
@@ -481,7 +483,7 @@ int uart_log_printfv(const char* format, va_list arg) {
481483
free(temp);
482484
}
483485

484-
return len;
486+
return wlen;
485487
}
486488

487489
int uart_log_printf(const char* format, ...) {

src/NimBLEStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class NimBLEStreamClient : public NimBLEStream {
187187

188188
# endif // CONFIG_BT_NIMBLE_ENABLED && (MYNEWT_VAL(BLE_ROLE_PERIPHERAL) || MYNEWT_VAL(BLE_ROLE_CENTRAL))
189189

190-
// These logging macros exist to provide log output over UART so that it stream classes can
190+
// These logging macros exist to provide log output over UART so that the stream classes can
191191
// be used to redirect logs without causing recursion issues.
192192
static int uart_log_printfv(const char* format, va_list arg);
193193
static int uart_log_printf(const char* format, ...);

0 commit comments

Comments
 (0)