Merge branch 'master' into jgrpp

# Conflicts:
#	src/cheat_gui.cpp
#	src/industry_gui.cpp
#	src/linkgraph/linkgraphschedule.cpp
#	src/misc/getoptdata.h
#	src/music/dmusic.cpp
#	src/network/core/os_abstraction.cpp
#	src/newgrf_engine.cpp
#	src/openttd.cpp
#	src/order_gui.cpp
#	src/os/windows/win32.cpp
#	src/pathfinder/npf/queue.cpp
#	src/smallmap_gui.cpp
#	src/strgen/strgen.cpp
This commit is contained in:
Jonathan G Rennison
2024-06-08 22:55:56 +01:00
31 changed files with 202 additions and 278 deletions

View File

@@ -78,7 +78,7 @@ static std::string GetLastErrorAsString()
DWORD error_code = GetLastError();
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_IGNORE_INSERTS, GetModuleHandle(L"winhttp.dll"), error_code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, lengthof(buffer), nullptr) == 0) {
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, static_cast<DWORD>(std::size(buffer)), nullptr) == 0) {
return fmt::format("unknown error {}", error_code);
}
@@ -222,11 +222,11 @@ void NetworkHTTPRequest::Connect()
/* Convert the URL to its components. */
url_components.dwStructSize = sizeof(url_components);
url_components.lpszScheme = scheme;
url_components.dwSchemeLength = lengthof(scheme);
url_components.dwSchemeLength = static_cast<DWORD>(std::size(scheme));
url_components.lpszHostName = hostname;
url_components.dwHostNameLength = lengthof(hostname);
url_components.dwHostNameLength = static_cast<DWORD>(std::size(hostname));
url_components.lpszUrlPath = url_path;
url_components.dwUrlPathLength = lengthof(url_path);
url_components.dwUrlPathLength = static_cast<DWORD>(std::size(url_path));
WinHttpCrackUrl(this->uri.c_str(), 0, 0, &url_components);
/* Create the HTTP connection. */

View File

@@ -82,7 +82,7 @@ const char *NetworkError::AsString() const
#if defined(_WIN32)
wchar_t buffer[512];
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, this->error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, lengthof(buffer), nullptr) == 0) {
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, static_cast<DWORD>(std::size(buffer)), nullptr) == 0) {
char errbuffer[32];
seprintf(errbuffer, lastof(errbuffer), "Unknown error %d", this->error);
this->message.assign(errbuffer);