esp_http_client: fix -Werror-format compile errors for linux target

This commit is contained in:
Harshit Malpani 2022-12-23 17:52:48 +05:30
parent 1c77e13d35
commit 68ded2c350
No known key found for this signature in database
GPG Key ID: FF1193D150EF75C3
2 changed files with 8 additions and 8 deletions

View File

@ -269,7 +269,7 @@ static int http_on_headers_complete(http_parser *parser)
static int http_on_body(http_parser *parser, const char *at, size_t length)
{
esp_http_client_t *client = parser->data;
ESP_LOGD(TAG, "http_on_body %d", length);
ESP_LOGD(TAG, "http_on_body %zu", length);
if (client->response->buffer->output_ptr) {
memcpy(client->response->buffer->output_ptr, (char *)at, length);
@ -277,7 +277,7 @@ static int http_on_body(http_parser *parser, const char *at, size_t length)
} else {
/* Do not cache body when http_on_body is called from esp_http_client_perform */
if (client->state < HTTP_STATE_RES_ON_DATA_START && client->cache_data_in_fetch_hdr) {
ESP_LOGI(TAG, "Body received in fetch header state, %p, %d", at, length);
ESP_LOGI(TAG, "Body received in fetch header state, %p, %zu", at, length);
esp_http_buffer_t *res_buffer = client->response->buffer;
assert(res_buffer->orig_raw_data == res_buffer->raw_data);
res_buffer->orig_raw_data = (char *)realloc(res_buffer->orig_raw_data, res_buffer->raw_len + length);
@ -298,7 +298,7 @@ static int http_on_body(http_parser *parser, const char *at, size_t length)
static int http_on_message_complete(http_parser *parser)
{
ESP_LOGD(TAG, "http_on_message_complete, parser=%x", parser);
ESP_LOGD(TAG, "http_on_message_complete, parser=%p", parser);
esp_http_client_handle_t client = parser->data;
client->is_chunk_complete = true;
return 0;
@ -1041,7 +1041,7 @@ static int esp_http_client_get_data(esp_http_client_handle_t client)
esp_http_buffer_t *res_buffer = client->response->buffer;
ESP_LOGD(TAG, "data_process=%lld, content_length=%lld", client->response->data_process, client->response->content_length);
ESP_LOGD(TAG, "data_process=%"PRId64", content_length=%"PRId64, client->response->data_process, client->response->content_length);
int rlen = esp_transport_read(client->transport, res_buffer->data, client->buffer_size_rx, client->timeout_ms);
if (rlen >= 0) {
@ -1059,7 +1059,7 @@ bool esp_http_client_is_complete_data_received(esp_http_client_handle_t client)
}
} else {
if (client->response->data_process != client->response->content_length) {
ESP_LOGD(TAG, "Data processed %lld != Data specified in content length %lld", client->response->data_process, client->response->content_length);
ESP_LOGD(TAG, "Data processed %"PRId64" != Data specified in content length %"PRId64, client->response->data_process, client->response->content_length);
return false;
}
}
@ -1092,7 +1092,7 @@ int esp_http_client_read(esp_http_client_handle_t client, char *buffer, int len)
} else {
is_data_remain = client->response->data_process < client->response->content_length;
}
ESP_LOGD(TAG, "is_data_remain=%d, is_chunked=%d, content_length=%lld", is_data_remain, client->response->is_chunked, client->response->content_length);
ESP_LOGD(TAG, "is_data_remain=%"PRId8", is_chunked=%d"PRId8", content_length=%"PRId64, is_data_remain, client->response->is_chunked, client->response->content_length);
if (!is_data_remain) {
break;
}
@ -1279,7 +1279,7 @@ int64_t esp_http_client_fetch_headers(esp_http_client_handle_t client)
http_parser_execute(client->parser, client->parser_settings, buffer->data, buffer->len);
}
client->state = HTTP_STATE_RES_ON_DATA_START;
ESP_LOGD(TAG, "content_length = %lld", client->response->content_length);
ESP_LOGD(TAG, "content_length = %"PRId64, client->response->content_length);
if (client->response->content_length <= 0) {
client->response->is_chunked = true;
return 0;

View File

@ -117,7 +117,7 @@ char *http_auth_digest(const char *username, const char *password, esp_http_auth
}
}
int rc = asprintf(&auth_str, "Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", algorithm=\"MD5\", "
"response=\"%s\", qop=%s, nc=%08x, cnonce=\"%016llx\"",
"response=\"%s\", qop=%s, nc=%08x, cnonce=%016"PRIx64,
username, auth_data->realm, auth_data->nonce, auth_data->uri, digest, auth_data->qop, auth_data->nc, auth_data->cnonce);
if (rc < 0) {
ESP_LOGE(TAG, "asprintf() returned: %d", rc);