diff options
author | rubidium42 <rubidium@openttd.org> | 2021-06-12 09:10:17 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-06-13 12:45:45 +0200 |
commit | 55a11710a6c0f7942f3947711f2050c34782c39d (patch) | |
tree | 491b3009324e623236977614e91371a0ea4abac7 /src/network/core/tcp_http.cpp | |
parent | a99ac62c1ab816ee48cac85fdf834f9fdc599cb1 (diff) | |
download | openttd-55a11710a6c0f7942f3947711f2050c34782c39d.tar.xz |
Codechange: convert printf DEBUG statements to fmt Debug statements
Diffstat (limited to 'src/network/core/tcp_http.cpp')
-rw-r--r-- | src/network/core/tcp_http.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/network/core/tcp_http.cpp b/src/network/core/tcp_http.cpp index f11722ae3..abb240708 100644 --- a/src/network/core/tcp_http.cpp +++ b/src/network/core/tcp_http.cpp @@ -45,7 +45,7 @@ NetworkHTTPSocketHandler::NetworkHTTPSocketHandler(SOCKET s, size_t bufferSize = strlen(url) + strlen(host) + strlen(GetNetworkRevisionString()) + (data == nullptr ? 0 : strlen(data)) + 128; char *buffer = AllocaM(char, bufferSize); - DEBUG(net, 5, "[tcp/http] Requesting %s%s", host, url); + Debug(net, 5, "[tcp/http] Requesting {}{}", host, url); if (data != nullptr) { seprintf(buffer, buffer + bufferSize - 1, "POST %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: OpenTTD/%s\r\nContent-Type: text/plain\r\nContent-Length: %d\r\n\r\n%s\r\n", url, host, GetNetworkRevisionString(), (int)strlen(data), data); } else { @@ -86,7 +86,7 @@ void NetworkHTTPSocketHandler::CloseSocket() * Helper to simplify the error handling. * @param msg the error message to show. */ -#define return_error(msg) { DEBUG(net, 1, msg); return -1; } +#define return_error(msg) { Debug(net, 1, msg); return -1; } static const char * const NEWLINE = "\r\n"; ///< End of line marker static const char * const END_OF_HEADER = "\r\n\r\n"; ///< End of header marker @@ -142,7 +142,7 @@ int NetworkHTTPSocketHandler::HandleHeader() * wrong. You can't have gzips of 0 bytes! */ if (len == 0) return_error("[tcp/http] Refusing to download 0 bytes"); - DEBUG(net, 7, "[tcp/http] Downloading %i bytes", len); + Debug(net, 7, "[tcp/http] Downloading {} bytes", len); return len; } @@ -155,7 +155,7 @@ int NetworkHTTPSocketHandler::HandleHeader() /* Search the end of the line. This is safe because the header will * always end with two newlines. */ *strstr(status, NEWLINE) = '\0'; - DEBUG(net, 1, "[tcp/http] Unhandled status reply %s", status); + Debug(net, 1, "[tcp/http] Unhandled status reply {}", status); return -1; } @@ -172,7 +172,7 @@ int NetworkHTTPSocketHandler::HandleHeader() char *end_of_line = strstr(uri, NEWLINE); *end_of_line = '\0'; - DEBUG(net, 7, "[tcp/http] Redirecting to %s", uri); + Debug(net, 7, "[tcp/http] Redirecting to {}", uri); int ret = NetworkHTTPSocketHandler::Connect(uri, this->callback, this->data, this->redirect_depth + 1); if (ret != 0) return ret; @@ -229,7 +229,7 @@ int NetworkHTTPSocketHandler::Receive() NetworkError err = NetworkError::GetLast(); if (!err.WouldBlock()) { /* Something went wrong... */ - if (!err.IsConnectionReset()) DEBUG(net, 0, "Recv failed: %s", err.AsString()); + if (!err.IsConnectionReset()) Debug(net, 0, "Recv failed: {}", err.AsString()); return -1; } /* Connection would block, so stop for now */ @@ -257,7 +257,7 @@ int NetworkHTTPSocketHandler::Receive() if (end_of_header == nullptr) { if (read == lengthof(this->recv_buffer)) { - DEBUG(net, 1, "[tcp/http] Header too big"); + Debug(net, 1, "[tcp/http] Header too big"); return -1; } this->recv_pos = read; |