Skip to content

Commit 3b80181

Browse files
committed
fix(modem): Fix remaining print format warnings
Partially addresses #79
1 parent a363bee commit 3b80181

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

components/esp_modem/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,3 @@ set_target_properties(${COMPONENT_LIB} PROPERTIES
4545
if(CONFIG_ESP_MODEM_ADD_CUSTOM_MODULE)
4646
idf_component_optional_requires(PUBLIC main)
4747
endif()
48-
49-
if(${target} STREQUAL "linux")
50-
# This is needed for ESP_LOGx() macros, as integer formats differ on ESP32(..) and x64
51-
set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_FLAGS -Wno-format)
52-
endif()

components/esp_modem/src/esp_modem_cmux.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -13,6 +13,12 @@
1313

1414
using namespace esp_modem;
1515

16+
#ifdef CONFIG_IDF_TARGET_LINUX
17+
#define PRIsize_t "lu"
18+
#else
19+
#define PRIsize_t "u"
20+
#endif
21+
1622
#ifdef CONFIG_ESP_MODEM_CMUX_DEFRAGMENT_PAYLOAD
1723
/**
1824
* @brief Define this to defragment partially received data of CMUX payload
@@ -245,7 +251,7 @@ bool CMux::on_header(CMuxFrame &frame)
245251

246252
bool CMux::on_payload(CMuxFrame &frame)
247253
{
248-
ESP_LOGD("CMUX", "Payload frame: dlci:%02x type:%02x payload:%d available:%d", dlci, type, payload_len, frame.len);
254+
ESP_LOGD("CMUX", "Payload frame: dlci:%02x type:%02x payload:%" PRIsize_t " available:%" PRIsize_t, dlci, type, payload_len, frame.len);
249255
if (frame.len < payload_len) { // payload
250256
state = cmux_state::PAYLOAD;
251257
if (!data_available(frame.ptr, frame.len)) { // partial read
@@ -312,7 +318,7 @@ bool CMux::on_cmux_data(uint8_t *data, size_t actual_len)
312318
auto data_end = buffer.get() + buffer.size;
313319
data_to_read = payload_len + 2; // 2 -- CMUX protocol footer
314320
if (data + data_to_read >= data_end) {
315-
ESP_LOGW("CUMX", "Failed to defragment longer payload (payload=%d)", payload_len);
321+
ESP_LOGW("CUMX", "Failed to defragment longer payload (payload=%" PRIsize_t ")", payload_len);
316322
// If you experience this error, your device uses longer payloads while
317323
// the configured buffer is too small to defragment the payload properly.
318324
// To resolve this issue you can:

0 commit comments

Comments
 (0)