Merge pull request #834 from david-cermak/fix/modem_build_new_gcc

[modem]: Fix to use compatible iterator types for std::search in new gcc
This commit is contained in:
david-cermak
2025-07-11 09:29:00 +02:00
committed by GitHub
3 changed files with 17 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -130,12 +130,15 @@ Responder::ret Responder::recv(uint8_t *data, size_t len)
auto *recv_data = (char *)data; auto *recv_data = (char *)data;
if (data_to_recv == 0) { if (data_to_recv == 0) {
const std::string_view head = "+QIRD: "; const std::string_view head = "+QIRD: ";
auto head_pos = std::search(recv_data, recv_data + len, head.begin(), head.end()); const std::string_view recv_data_view = std::string_view(recv_data, len);
if (head_pos == recv_data + len) { auto head_pos_found = recv_data_view.find(head);
if (head_pos_found == std::string_view::npos) {
return ret::FAIL; return ret::FAIL;
} }
auto *head_pos = recv_data + head_pos_found;
auto next_nl = (char *)memchr(head_pos + head.size(), '\n', MIN_MESSAGE); auto next_nl = (char *)memchr(head_pos + head.size(), '\n', MIN_MESSAGE);
if (next_nl == nullptr) { if (next_nl == nullptr) {
return ret::FAIL; return ret::FAIL;
} }

View File

@ -185,7 +185,7 @@ menu "Example Configuration"
config EXAMPLE_MQTT_BROKER_URI config EXAMPLE_MQTT_BROKER_URI
string "MQTT Broker URL" string "MQTT Broker URL"
default "mqtt://mqtt.eclipseprojects.io" default "mqtt://test.mosquitto.org"
help help
URL of the mqtt broker which this example connects to. URL of the mqtt broker which this example connects to.

View File

@ -16,4 +16,4 @@ CONFIG_COMPILER_CXX_EXCEPTIONS=y
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
CONFIG_EXAMPLE_CLOSE_CMUX_AT_END=y CONFIG_EXAMPLE_CLOSE_CMUX_AT_END=y
CONFIG_EXAMPLE_MQTT_TEST_TOPIC="/ci/esp-modem/pppos-client" CONFIG_EXAMPLE_MQTT_TEST_TOPIC="/ci/esp-modem/pppos-client"
CONFIG_BROKER_URI="mqtt://mqtt.eclipseprojects.io" CONFIG_BROKER_URI="mqtt://test.mosquitto.org"