From 666a98e7966e80ed1a0d52cdc9dfdb0e52ee33db Mon Sep 17 00:00:00 2001 From: dufernst Date: Sat, 21 Jan 2023 20:09:01 +0100 Subject: [PATCH] WebAPI: Use c_str for printf logging. --- src/tools/web_api/src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tools/web_api/src/main.cpp b/src/tools/web_api/src/main.cpp index 7cf4c608..b4e517a6 100644 --- a/src/tools/web_api/src/main.cpp +++ b/src/tools/web_api/src/main.cpp @@ -625,10 +625,10 @@ void printReqData(const httplib::Request& req) { printf("Did get the following parameters:"); for (const auto& param: req.params) - printf("%s:%s", param.first, param.second); + printf("%s:%s", param.first.c_str(), param.second.c_str()); printf("Did get the following headers:"); for (const auto& header: req.headers) - printf("%s:%s", header.first, header.second); + printf("%s:%s", header.first.c_str(), header.second.c_str()); } void handleVoteCallback(const VoteWebsiteData& voteWebsite, const httplib::Request& req, const unsigned char* k) @@ -637,7 +637,7 @@ void handleVoteCallback(const VoteWebsiteData& voteWebsite, const httplib::Reque { if (voteWebsite.callbackHostname == "") { - printf("Vote callback for website: %s, came in from unexpected IP: %s", voteWebsite.name, req.remote_addr); + printf("Vote callback for website: %s, came in from unexpected IP: %s", voteWebsite.name.c_str(), req.remote_addr.c_str()); return; } @@ -645,7 +645,7 @@ void handleVoteCallback(const VoteWebsiteData& voteWebsite, const httplib::Reque httplib::hosted_at(voteWebsite.callbackHostname, foundIps); if (std::find(foundIps.begin(), foundIps.end(), req.remote_addr) == foundIps.end()) { - printf("Vote callback for website: %s, came in from unexpected IP: %s", voteWebsite.name, req.remote_addr); + printf("Vote callback for website: %s, came in from unexpected IP: %s", voteWebsite.name.c_str(), req.remote_addr.c_str()); return; } } @@ -654,7 +654,7 @@ void handleVoteCallback(const VoteWebsiteData& voteWebsite, const httplib::Reque { if (!req.has_param(voteWebsite.checkKeyName) && !req.has_header(voteWebsite.checkKeyName)) { - printf("Vote callback for website: %s, came in without the expected parameter or header value.", voteWebsite.name); + printf("Vote callback for website: %s, came in without the expected parameter or header value.", voteWebsite.name.c_str()); printReqData(req); return; }