Skip to content

Commit

Permalink
Fix String build warning with DEBUG_ESP_PORT but without DEBUG_ESP_CO…
Browse files Browse the repository at this point in the history
…RE (#8849)
  • Loading branch information
d-a-v committed Feb 5, 2023
1 parent badb407 commit 9a3d55c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cores/esp8266/WString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ bool String::reserve(unsigned int size) {
#ifdef DEBUG_ESP_PORT
static void identifyString (const String& badOne)
{
DEBUGV("[String] '%." STR(OOM_STRING_BORDER_DISPLAY) "s ... %." STR(OOM_STRING_BORDER_DISPLAY) "s': ",
DEBUG_ESP_PORT.printf("[String] '%." STR(OOM_STRING_BORDER_DISPLAY) "s ... %." STR(OOM_STRING_BORDER_DISPLAY) "s': ",
badOne.c_str(),
badOne.length() > OOM_STRING_BORDER_DISPLAY? badOne.c_str() + std::max((int)badOne.length() - OOM_STRING_BORDER_DISPLAY, OOM_STRING_BORDER_DISPLAY): "");
}
Expand Down Expand Up @@ -231,14 +231,14 @@ bool String::changeBuffer(unsigned int maxStrLen) {
if (!isSSO() && capacity() >= OOM_STRING_THRESHOLD_REALLOC_WARN && maxStrLen > capacity()) {
// warn when badly re-allocating
identifyString(*this);
DEBUGV("Reallocating large String(%d -> %d bytes)\n", len(), maxStrLen);
DEBUG_ESP_PORT.printf("Reallocating large String(%d -> %d bytes)\n", len(), maxStrLen);
}
#endif
// Make sure we can fit newsize in the buffer
if (newSize > CAPACITY_MAX) {
#ifdef DEBUG_ESP_PORT
identifyString(*this);
DEBUGV("Maximum capacity reached (" STR(CAPACITY_MAX) ")\n");
DEBUG_ESP_PORT.printf("Maximum capacity reached (" STR(CAPACITY_MAX) ")\n");
#endif
return false;
}
Expand All @@ -261,7 +261,7 @@ bool String::changeBuffer(unsigned int maxStrLen) {
}
#ifdef DEBUG_ESP_PORT
identifyString(*this);
DEBUGV("OOM: %d -> %d bytes\n", isSSO() ? 0: capacity(), newSize);
DEBUG_ESP_PORT.printf("OOM: %d -> %zu bytes\n", isSSO() ? 0: capacity(), newSize);
#endif
return false;
}
Expand Down

0 comments on commit 9a3d55c

Please sign in to comment.