Merge branch 'bugfix/protocol_components_no_format_cflag' into 'master'

Remove "-Wno-format" from protocol example specific components

See merge request espressif/esp-idf!21734
This commit is contained in:
Harshit Malpani
2022-12-22 18:54:48 +08:00
15 changed files with 39 additions and 39 deletions

View File

@@ -7,5 +7,3 @@ idf_component_register(SRCS "esp_http_client.c"
# lwip is a public requirement because esp_http_client.h includes sys/socket.h
REQUIRES lwip
PRIV_REQUIRES tcp_transport http_parser)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@@ -6,6 +6,7 @@
#include <string.h>
#include <inttypes.h>
#include "esp_system.h"
#include "esp_log.h"
@@ -253,7 +254,7 @@ static int http_on_headers_complete(http_parser *parser)
client->response->data_offset = parser->nread;
client->response->content_length = parser->content_length;
client->response->data_process = 0;
ESP_LOGD(TAG, "http_on_headers_complete, status=%d, offset=%d, nread=%d", parser->status_code, client->response->data_offset, parser->nread);
ESP_LOGD(TAG, "http_on_headers_complete, status=%d, offset=%d, nread=%" PRId32, parser->status_code, client->response->data_offset, parser->nread);
client->state = HTTP_STATE_RES_COMPLETE_HEADER;
if (client->connection_info.method == HTTP_METHOD_HEAD) {
/* In a HTTP_RESPONSE parser returning '1' from on_headers_complete will tell the

View File

@@ -9,5 +9,3 @@ idf_component_register(SRCS "src/httpd_main.c"
PRIV_INCLUDE_DIRS "src/port/esp32" "src/util"
REQUIRES esp_event http_parser # for http_parser.h
PRIV_REQUIRES lwip mbedtls esp_timer)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@@ -10,6 +10,7 @@
#include <esp_log.h>
#include <esp_err.h>
#include <http_parser.h>
#include <inttypes.h>
#include <esp_http_server.h>
#include "esp_httpd_priv.h"
@@ -364,7 +365,7 @@ static esp_err_t cb_headers_complete(http_parser *parser)
r->content_len = ((int)parser->content_length != -1 ?
parser->content_length : 0);
ESP_LOGD(TAG, LOG_FMT("bytes read = %d"), parser->nread);
ESP_LOGD(TAG, LOG_FMT("bytes read = %" PRId32 ""), parser->nread);
ESP_LOGD(TAG, LOG_FMT("content length = %zu"), r->content_len);
/* Handle upgrade requests - only WebSocket is supported for now */

View File

@@ -2,5 +2,3 @@ idf_component_register(SRCS "src/esp_https_ota.c"
INCLUDE_DIRS "include"
REQUIRES esp_http_client bootloader_support esp_app_format esp_event
PRIV_REQUIRES log app_update)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@@ -12,6 +12,7 @@
#include <esp_ota_ops.h>
#include <errno.h>
#include <sys/param.h>
#include <inttypes.h>
ESP_EVENT_DEFINE_BASE(ESP_HTTPS_OTA_EVENT);
@@ -342,7 +343,7 @@ esp_err_t esp_https_ota_begin(const esp_https_ota_config_t *ota_config, esp_http
err = ESP_FAIL;
goto http_cleanup;
}
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%x",
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%" PRIx32,
https_ota_handle->update_partition->subtype, https_ota_handle->update_partition->address);
const int alloc_size = MAX(ota_config->http_config->buffer_size, DEFAULT_OTA_BUF_SIZE);

View File

@@ -24,5 +24,3 @@ idf_component_register(SRCS "${srcs}"
PRIV_REQUIRES protobuf-c)
idf_component_optional_requires(PRIVATE espressif__mdns mdns)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@@ -6,6 +6,7 @@
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <esp_err.h>
#include <esp_log.h>
@@ -355,7 +356,7 @@ esp_err_t esp_local_ctrl_get_prop_values(size_t total_indices, uint32_t *indices
/* Convert indices to names */
for (size_t i = 0; i < total_indices; i++) {
if (indices[i] >= local_ctrl_inst_ctx->props_count) {
ESP_LOGE(TAG, "Invalid property index %d", indices[i]);
ESP_LOGE(TAG, "Invalid property index %" PRId32, indices[i]);
return ESP_ERR_INVALID_ARG;
}
props[i].name = local_ctrl_inst_ctx->props[indices[i]]->name;
@@ -396,7 +397,7 @@ esp_err_t esp_local_ctrl_set_prop_values(size_t total_indices, uint32_t *indices
}
for (size_t i = 0; i < total_indices; i++) {
if (indices[i] >= local_ctrl_inst_ctx->props_count) {
ESP_LOGE(TAG, "Invalid property index %d", indices[i]);
ESP_LOGE(TAG, "Invalid property index %" PRId32, indices[i]);
free(props);
return ESP_ERR_INVALID_ARG;
}

View File

@@ -48,5 +48,3 @@ idf_component_register(SRCS "${srcs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
PRIV_REQUIRES protobuf-c mbedtls console esp_http_server driver
REQUIRES bt)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@@ -6,6 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <esp_err.h>
#include <esp_log.h>
@@ -149,7 +150,7 @@ esp_err_t protocomm_open_session(protocomm_t *pc, uint32_t session_id)
if (pc->sec && pc->sec->new_transport_session) {
esp_err_t ret = pc->sec->new_transport_session(pc->sec_inst, session_id);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Failed to launch new session with ID: %d", session_id);
ESP_LOGE(TAG, "Failed to launch new session with ID: %" PRId32, session_id);
return ret;
}
}
@@ -165,7 +166,7 @@ esp_err_t protocomm_close_session(protocomm_t *pc, uint32_t session_id)
if (pc->sec && pc->sec->close_transport_session) {
esp_err_t ret = pc->sec->close_transport_session(pc->sec_inst, session_id);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Error while closing session with ID: %d", session_id);
ESP_LOGE(TAG, "Error while closing session with ID: %" PRId32, session_id);
return ret;
}
}

View File

@@ -9,6 +9,7 @@
#include <string.h>
#include <esp_err.h>
#include <esp_log.h>
#include <inttypes.h>
/* TODO: Currently MBEDTLS_ECDH_LEGACY_CONTEXT is enabled by default
* when MBEDTLS_ECP_RESTARTABLE is enabled.
@@ -459,7 +460,7 @@ static esp_err_t sec1_new_session(protocomm_security_handle_t handle, uint32_t s
if (cur_session->id != -1) {
/* Only one session is allowed at a time */
ESP_LOGE(TAG, "Closing old session with id %u", cur_session->id);
ESP_LOGE(TAG, "Closing old session with id %" PRIu32, cur_session->id);
sec1_close_session(cur_session, session_id);
}
@@ -503,7 +504,7 @@ static esp_err_t sec1_decrypt(protocomm_security_handle_t handle,
}
if (!cur_session || cur_session->id != session_id) {
ESP_LOGE(TAG, "Session with ID %d not found", session_id);
ESP_LOGE(TAG, "Session with ID %" PRId32 "not found", session_id);
return ESP_ERR_INVALID_STATE;
}
@@ -542,7 +543,7 @@ static esp_err_t sec1_req_handler(protocomm_security_handle_t handle,
}
if (session_id != cur_session->id) {
ESP_LOGE(TAG, "Invalid session ID : %d (expected %d)", session_id, cur_session->id);
ESP_LOGE(TAG, "Invalid session ID:%" PRId32 "(expected %" PRId32 ")", session_id, cur_session->id);
return ESP_ERR_INVALID_STATE;
}

View File

@@ -10,6 +10,7 @@
#include <esp_err.h>
#include <esp_log.h>
#include <esp_check.h>
#include <inttypes.h>
#include <mbedtls/gcm.h>
#include <mbedtls/error.h>
@@ -367,7 +368,7 @@ static esp_err_t sec2_new_session(protocomm_security_handle_t handle, uint32_t s
if (cur_session->id != -1) {
/* Only one session is allowed at a time */
ESP_LOGE(TAG, "Closing old session with id %u", cur_session->id);
ESP_LOGE(TAG, "Closing old session with id %" PRIu32, cur_session->id);
sec2_close_session(cur_session, session_id);
}
@@ -411,7 +412,7 @@ static esp_err_t sec2_encrypt(protocomm_security_handle_t handle,
}
if (!cur_session || cur_session->id != session_id) {
ESP_LOGE(TAG, "Session with ID %d not found", session_id);
ESP_LOGE(TAG, "Session with ID %" PRId32 "not found", session_id);
return ESP_ERR_INVALID_STATE;
}
@@ -451,7 +452,7 @@ static esp_err_t sec2_decrypt(protocomm_security_handle_t handle,
}
if (!cur_session || cur_session->id != session_id) {
ESP_LOGE(TAG, "Session with ID %d not found", session_id);
ESP_LOGE(TAG, "Session with ID %" PRId32 "not found", session_id);
return ESP_ERR_INVALID_STATE;
}
@@ -490,7 +491,7 @@ static esp_err_t sec2_req_handler(protocomm_security_handle_t handle,
}
if (session_id != cur_session->id) {
ESP_LOGE(TAG, "Invalid session ID : %d (expected %d)", session_id, cur_session->id);
ESP_LOGE(TAG, "Invalid session ID:%" PRId32 "(expected %" PRId32 ")", session_id, cur_session->id);
return ESP_ERR_INVALID_STATE;
}

View File

@@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <inttypes.h>
#include <freertos/FreeRTOS.h>
#include <esp_system.h>
#include <esp_log.h>
@@ -209,7 +210,7 @@ esp_err_t simple_ble_deinit(void)
esp_err_t simple_ble_start(simple_ble_cfg_t *cfg)
{
g_ble_cfg_p = cfg;
ESP_LOGD(TAG, "Free mem at start of simple_ble_init %d", esp_get_free_heap_size());
ESP_LOGD(TAG, "Free mem at start of simple_ble_init %" PRIu32, esp_get_free_heap_size());
esp_err_t ret;
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
@@ -267,7 +268,7 @@ esp_err_t simple_ble_start(simple_ble_cfg_t *cfg)
if (local_mtu_ret) {
ESP_LOGE(TAG, "set local MTU failed, error code = 0x%x", local_mtu_ret);
}
ESP_LOGD(TAG, "Free mem at end of simple_ble_init %d", esp_get_free_heap_size());
ESP_LOGD(TAG, "Free mem at end of simple_ble_init %" PRIu32, esp_get_free_heap_size());
/* set the security iocap & auth_req & key size & init key response key parameters to the stack*/
esp_ble_auth_req_t auth_req= ESP_LE_AUTH_REQ_MITM;
@@ -294,7 +295,7 @@ esp_err_t simple_ble_start(simple_ble_cfg_t *cfg)
esp_err_t simple_ble_stop(void)
{
esp_err_t err;
ESP_LOGD(TAG, "Free mem at start of simple_ble_stop %d", esp_get_free_heap_size());
ESP_LOGD(TAG, "Free mem at start of simple_ble_stop %" PRIu32, esp_get_free_heap_size());
err = esp_bluedroid_disable();
if (err != ESP_OK) {
return ESP_FAIL;
@@ -320,7 +321,7 @@ esp_err_t simple_ble_stop(void)
}
ESP_LOGD(TAG, "esp_bt_controller_deinit called successfully");
ESP_LOGD(TAG, "Free mem at end of simple_ble_stop %d", esp_get_free_heap_size());
ESP_LOGD(TAG, "Free mem at end of simple_ble_stop %" PRIu32, esp_get_free_heap_size());
return ESP_OK;
}

View File

@@ -8,6 +8,7 @@
#include <freertos/task.h>
#include <esp_log.h>
#include <esp_err.h>
#include <inttypes.h>
#include "esp_random.h"
#include <esp_http_server.h>
@@ -34,7 +35,7 @@ static void protocomm_httpd_session_close(void *ctx)
* request is for the same session.
*/
if (sock_session_id != PROTOCOMM_NO_SESSION_ID) {
ESP_LOGW(TAG, "Resetting socket session id as socket %d was closed", sock_session_id);
ESP_LOGW(TAG, "Resetting socket session id as socket %" PRId32 "was closed", sock_session_id);
sock_session_id = PROTOCOMM_NO_SESSION_ID;
}
}
@@ -56,12 +57,12 @@ static esp_err_t common_post_handler(httpd_req_t *req)
if (httpd_req_get_hdr_value_str(req, "Cookie", cookie_buf, sizeof(cookie_buf)) == ESP_OK) {
ESP_LOGD(TAG, "Received cookie %s", cookie_buf);
char session_cookie[20] = {0};
snprintf(session_cookie, sizeof(session_cookie), "session=%u", cookie_session_id);
snprintf(session_cookie, sizeof(session_cookie), "session=%" PRIu32, cookie_session_id);
/* If a cookie is found, check it against the session id. If it matches,
* it means that this is a continuation of the same session.
*/
if (strcmp(session_cookie, cookie_buf) == 0) {
ESP_LOGD(TAG, "Continuing Session %u", cookie_session_id);
ESP_LOGD(TAG, "Continuing Session %" PRIu32, cookie_session_id);
/* If we reach here, it means that the client supports cookies and so the
* socket session id would no more be required for checking.
*/
@@ -70,7 +71,7 @@ static esp_err_t common_post_handler(httpd_req_t *req)
}
} else if (cur_sock_session_id == sock_session_id) {
/* If the socket number matches, we assume it to be the same session */
ESP_LOGD(TAG, "Continuing Socket Session %u", sock_session_id);
ESP_LOGD(TAG, "Continuing Socket Session %" PRIu32, sock_session_id);
same_session = true;
}
if (!same_session) {
@@ -78,11 +79,11 @@ static esp_err_t common_post_handler(httpd_req_t *req)
* first close any existing sessions as applicable.
*/
if (cookie_session_id != PROTOCOMM_NO_SESSION_ID) {
ESP_LOGW(TAG, "Closing session with ID: %u", cookie_session_id);
ESP_LOGW(TAG, "Closing session with ID: %" PRIu32, cookie_session_id);
if (pc_httpd->sec && pc_httpd->sec->close_transport_session) {
ret = pc_httpd->sec->close_transport_session(pc_httpd->sec_inst, cookie_session_id);
if (ret != ESP_OK) {
ESP_LOGW(TAG, "Error closing session with ID: %u", cookie_session_id);
ESP_LOGW(TAG, "Error closing session with ID: %" PRIu32, cookie_session_id);
}
}
cookie_session_id = PROTOCOMM_NO_SESSION_ID;
@@ -104,7 +105,7 @@ static esp_err_t common_post_handler(httpd_req_t *req)
}
cookie_session_id = cur_cookie_session_id;
sock_session_id = cur_sock_session_id;
ESP_LOGD(TAG, "New socket session ID: %d", sock_session_id);
ESP_LOGD(TAG, "New socket session ID: %" PRId32, sock_session_id);
}
if (req->content_len <= 0) {
@@ -147,7 +148,7 @@ static esp_err_t common_post_handler(httpd_req_t *req)
}
/* If this is a new session, send the session id in a cookie */
if (!same_session) {
snprintf(cookie_buf, sizeof(cookie_buf), "session=%u", cookie_session_id);
snprintf(cookie_buf, sizeof(cookie_buf), "session=%" PRIu32, cookie_session_id);
ESP_LOGD(TAG, "Setting cookie %s", cookie_buf);
httpd_resp_set_hdr(req, "Set-Cookie", cookie_buf);
}

View File

@@ -7,6 +7,7 @@
#include <sys/param.h>
#include <esp_log.h>
#include <string.h>
#include <inttypes.h>
#include <protocomm.h>
#include <protocomm_ble.h>
@@ -208,7 +209,7 @@ simple_ble_advertise(void)
return;
}
/* Take note of free heap space */
ESP_LOGD(TAG, "Minimum free heap size = %d, free Heap size = %d",
ESP_LOGD(TAG, "Minimum free heap size = %" PRIu32 ", free Heap size = %" PRIu32,
esp_get_minimum_free_heap_size(), esp_get_free_heap_size());
}
@@ -488,7 +489,7 @@ static int simple_ble_start(const simple_ble_cfg_t *cfg)
{
ble_cfg_p = (void *)cfg;
int rc;
ESP_LOGD(TAG, "Free memory at start of simple_ble_init %d", esp_get_free_heap_size());
ESP_LOGD(TAG, "Free memory at start of simple_ble_init %" PRIu32, esp_get_free_heap_size());
nimble_port_init();
@@ -948,7 +949,7 @@ esp_err_t protocomm_ble_start(protocomm_t *pc, const protocomm_ble_config_t *con
}
esp_err_t err = simple_ble_start(ble_config);
ESP_LOGD(TAG, "Free Heap size after simple_ble_start= %d", esp_get_free_heap_size());
ESP_LOGD(TAG, "Free Heap size after simple_ble_start= %" PRIu32, esp_get_free_heap_size());
if (err != ESP_OK) {
ESP_LOGE(TAG, "simple_ble_start failed w/ error code 0x%x", err);