diff --git a/adb/adb_utils.cpp b/adb/adb_utils.cpp index 3846c2112..cd3c7bc6b 100644 --- a/adb/adb_utils.cpp +++ b/adb/adb_utils.cpp @@ -18,7 +18,6 @@ #include "adb_utils.h" -#include #include #include #include @@ -34,6 +33,12 @@ #include "adb_trace.h" #include "sysdeps.h" +#if defined(_WIN32) +#include +#else +#include +#endif + bool getcwd(std::string* s) { char* cwd = getcwd(nullptr, 0); if (cwd != nullptr) *s = cwd; @@ -168,7 +173,7 @@ int network_connect(const std::string& host, int port, int type, int timeout, st return fd; } if (getaddrinfo_error != 0) { - // TODO: not thread safe on Win32. + // TODO: gai_strerror is not thread safe on Win32. *error = gai_strerror(getaddrinfo_error); } else { *error = strerror(errno); diff --git a/adb/sysdeps.h b/adb/sysdeps.h index c051eb324..616092399 100644 --- a/adb/sysdeps.h +++ b/adb/sysdeps.h @@ -187,11 +187,6 @@ static __inline__ int unix_open(const char* path, int options,...) /* normally provided by */ extern void* load_file(const char* pathname, unsigned* psize); -/* normally provided by */ -extern int socket_loopback_client(int port, int type); -extern int socket_loopback_server(int port, int type); -extern int socket_inaddr_any_server(int port, int type); - /* normally provided by "fdevent.h" */ #define FDE_READ 0x0001 diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp index 91e14953f..a27489217 100644 --- a/adb/sysdeps_win32.cpp +++ b/adb/sysdeps_win32.cpp @@ -25,6 +25,8 @@ #include #include +#include + #include "adb.h" extern void fatal(const char *fmt, ...); @@ -669,7 +671,7 @@ int socket_loopback_server(int port, int type) int socket_network_client_timeout(const char *host, int port, int type, int timeout, - std::string* error) { + int* getaddrinfo_error) { FH f = _fh_alloc( &_fh_socket_class ); if (!f) return -1;