A few fixes to make it compile under windows again

This commit is contained in:
2022-03-17 23:28:25 -04:00
parent 18c133ca9d
commit c44fe12a95
3 changed files with 7 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ static void set_nonblocking(SOCKET sock) {
} }
static std::string winsock_error_string(int errcode) { static std::string winsock_error_string(int errcode) {
drv::ostringstream oss; std::ostringstream oss;
oss << "error " << errcode; oss << "error " << errcode;
return oss.str(); return oss.str();
} }
@@ -51,7 +51,7 @@ static PADDRINFOA find_good_addr(PADDRINFOA addrinfo) {
if (addr->ai_family == AF_INET) { if (addr->ai_family == AF_INET) {
return addr; return addr;
} }
}std::string }
return nullptr; return nullptr;
} }
@@ -59,10 +59,10 @@ static SOCKET open_connection(std::string_view target, std::string &err) {
PADDRINFOA addrs = nullptr; PADDRINFOA addrs = nullptr;
PADDRINFOA goodaddr = nullptr; PADDRINFOA goodaddr = nullptr;
SOCKET sock = INVALID_SOCKET; SOCKET sock = INVALID_SOCKET;
std::string_view host, port; std::string host, port;
err.clear(); 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); int status = getaddrinfo(host.data(), port.data(), nullptr, &addrs);
while (status == WSATRY_AGAIN) { while (status == WSATRY_AGAIN) {
status = getaddrinfo(host.data(), port.data(), nullptr, &addrs); status = getaddrinfo(host.data(), port.data(), nullptr, &addrs);

View File

@@ -56,7 +56,7 @@ void* realloc(void*, size_t);
int memhash(); int memhash();
#else #else
inline void *malloc(size_t x) { return ::malloc(x); } 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 void *realloc(void *p, size_t x) { return ::realloc(p, x); }
inline int memhash() { return 0; } inline int memhash() { return 0; }
#endif #endif

View File

@@ -4,6 +4,7 @@
#include <algorithm> #include <algorithm>
#include <cstdio> #include <cstdio>
#include <cinttypes>
struct PrintBufferCore : public eng::opnew { struct PrintBufferCore : public eng::opnew {
// The most recent lines printed. // 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) { Invocation PrintChanneler::invocation(int64_t actor_id) {
char buf[80]; char buf[80];
sprintf(buf, "%ld", line_); sprintf(buf, PRId64, line_);
return Invocation(Invocation::KIND_FLUSH_PRINTS, actor_id, actor_id, buf, InvocationData()); return Invocation(Invocation::KIND_FLUSH_PRINTS, actor_id, actor_id, buf, InvocationData());
} }