From 3f85f9b755be3a56e14599931e3c2ede0ec386d8 Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Sat, 10 Dec 2022 23:38:22 +0100 Subject: [PATCH] replaced printf usage in LogFile.WriteToFile() --- code/components/jomjol_fileserver_ota/server_file.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/components/jomjol_fileserver_ota/server_file.cpp b/code/components/jomjol_fileserver_ota/server_file.cpp index 5665855b..580b0f6d 100644 --- a/code/components/jomjol_fileserver_ota/server_file.cpp +++ b/code/components/jomjol_fileserver_ota/server_file.cpp @@ -219,7 +219,7 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath, const ESP_LOGD(TAG, "entrypath: <%s>", entrypath); if (!dir) { - LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat dir: %s", dirpath); + LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat dir: " + std::string(dirpath) + "!"); /* Respond with 404 Not Found */ httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404()); return ESP_FAIL; @@ -361,7 +361,7 @@ static esp_err_t send_datafile(httpd_req_t *req, bool send_full_file) fd = OpenFileAndWait(currentfilename.c_str(), "r"); if (!fd) { - LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to read existing file: %s", filepath); + LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to read existing file: " + std::string(filepath) +"!"); /* Respond with 404 Error */ httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404()); return ESP_FAIL; @@ -446,7 +446,7 @@ static esp_err_t send_logfile(httpd_req_t *req, bool send_full_file) fd = OpenFileAndWait(currentfilename.c_str(), "r"); if (!fd) { - LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to read existing file: %s", filepath); + LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to read existing file: " + std::string(filepath) +"!"); /* Respond with 404 Error */ httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404()); return ESP_FAIL; @@ -566,7 +566,7 @@ static esp_err_t download_get_handler(httpd_req_t *req) /* If file not present on SPIFFS check if URI * corresponds to one of the hardcoded paths */ - LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat file: %s!", filepath); + LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to stat file: " + std::string(filepath) + "!"); /* Respond with 404 Not Found */ httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404()); return ESP_FAIL; @@ -574,7 +574,7 @@ static esp_err_t download_get_handler(httpd_req_t *req) fd = OpenFileAndWait(filepath, "r"); if (!fd) { - LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to read existing file: %s!", filepath); + LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Failed to read existing file: " + std::string(filepath) +"!"); /* Respond with 404 Error */ httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, get404()); return ESP_FAIL;