From c44fe12a952ac955ac9ba4c2a5d8df0719ffce73 Mon Sep 17 00:00:00 2001 From: Joshua Yelon Date: Thu, 17 Mar 2022 23:28:25 -0400 Subject: [PATCH] A few fixes to make it compile under windows again --- luprex/core/cpp/driver-mingw.cpp | 8 ++++---- luprex/core/cpp/eng-malloc.hpp | 2 +- luprex/core/cpp/printbuffer.cpp | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/luprex/core/cpp/driver-mingw.cpp b/luprex/core/cpp/driver-mingw.cpp index 1fa476b4..b48682df 100644 --- a/luprex/core/cpp/driver-mingw.cpp +++ b/luprex/core/cpp/driver-mingw.cpp @@ -41,7 +41,7 @@ static void set_nonblocking(SOCKET sock) { } static std::string winsock_error_string(int errcode) { - drv::ostringstream oss; + std::ostringstream oss; oss << "error " << errcode; return oss.str(); } @@ -51,7 +51,7 @@ static PADDRINFOA find_good_addr(PADDRINFOA addrinfo) { if (addr->ai_family == AF_INET) { return addr; } - }std::string + } return nullptr; } @@ -59,10 +59,10 @@ static SOCKET open_connection(std::string_view target, std::string &err) { PADDRINFOA addrs = nullptr; PADDRINFOA goodaddr = nullptr; SOCKET sock = INVALID_SOCKET; - std::string_view host, port; + std::string host, port; err.clear(); - util::split_host_port(target, host, port); + drv::split_host_port(target, host, port); int status = getaddrinfo(host.data(), port.data(), nullptr, &addrs); while (status == WSATRY_AGAIN) { status = getaddrinfo(host.data(), port.data(), nullptr, &addrs); diff --git a/luprex/core/cpp/eng-malloc.hpp b/luprex/core/cpp/eng-malloc.hpp index 929e1981..30afaf53 100644 --- a/luprex/core/cpp/eng-malloc.hpp +++ b/luprex/core/cpp/eng-malloc.hpp @@ -56,7 +56,7 @@ void* realloc(void*, size_t); int memhash(); #else inline void *malloc(size_t x) { return ::malloc(x); } -inline void free(void *p) { return ::free(x); } +inline void free(void *p) { return ::free(p); } inline void *realloc(void *p, size_t x) { return ::realloc(p, x); } inline int memhash() { return 0; } #endif diff --git a/luprex/core/cpp/printbuffer.cpp b/luprex/core/cpp/printbuffer.cpp index 79422361..ef823390 100644 --- a/luprex/core/cpp/printbuffer.cpp +++ b/luprex/core/cpp/printbuffer.cpp @@ -4,6 +4,7 @@ #include #include +#include struct PrintBufferCore : public eng::opnew { // The most recent lines printed. @@ -190,7 +191,7 @@ bool PrintChanneler::channel(const PrintBuffer *printbuffer, std::ostream &ostre Invocation PrintChanneler::invocation(int64_t actor_id) { char buf[80]; - sprintf(buf, "%ld", line_); + sprintf(buf, PRId64, line_); return Invocation(Invocation::KIND_FLUSH_PRINTS, actor_id, actor_id, buf, InvocationData()); }