Repository: thrift Updated Branches: refs/heads/master ff296c884 -> c9bdd5027
THRIFT-2579 C++ lib Windows CE support Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/c9bdd502 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/c9bdd502 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/c9bdd502 Branch: refs/heads/master Commit: c9bdd50270d2eb60488ef38c56f990b781bbb3d2 Parents: ff296c8 Author: henrique <[email protected]> Authored: Wed Jun 25 13:13:23 2014 +0200 Committer: henrique <[email protected]> Committed: Wed Jun 25 13:13:23 2014 +0200 ---------------------------------------------------------------------- lib/cpp/src/thrift/transport/PlatformSocket.h | 6 +++++- lib/cpp/src/thrift/windows/WinFcntl.cpp | 6 ++++++ lib/cpp/src/thrift/windows/WinFcntl.h | 8 ++++++++ lib/cpp/src/thrift/windows/config.h | 5 ++++- 4 files changed, 23 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/c9bdd502/lib/cpp/src/thrift/transport/PlatformSocket.h ---------------------------------------------------------------------- diff --git a/lib/cpp/src/thrift/transport/PlatformSocket.h b/lib/cpp/src/thrift/transport/PlatformSocket.h index 019f4cb..d28978e 100644 --- a/lib/cpp/src/thrift/transport/PlatformSocket.h +++ b/lib/cpp/src/thrift/transport/PlatformSocket.h @@ -50,7 +50,11 @@ # define THRIFT_READ _read # define THRIFT_FSTAT _fstat # define THRIFT_STAT _stat -# define THRIFT_GAI_STRERROR gai_strerrorA +# ifdef _WIN32_WCE +# define THRIFT_GAI_STRERROR(...) thrift_wstr2str(gai_strerrorW(__VA_ARGS__)) +# else +# define THRIFT_GAI_STRERROR gai_strerrorA +# endif # define THRIFT_SSIZET ptrdiff_t # define THRIFT_SNPRINTF _snprintf # define THRIFT_SLEEP_SEC thrift_sleep http://git-wip-us.apache.org/repos/asf/thrift/blob/c9bdd502/lib/cpp/src/thrift/windows/WinFcntl.cpp ---------------------------------------------------------------------- diff --git a/lib/cpp/src/thrift/windows/WinFcntl.cpp b/lib/cpp/src/thrift/windows/WinFcntl.cpp index f7b4337..3dd4e3d 100644 --- a/lib/cpp/src/thrift/windows/WinFcntl.cpp +++ b/lib/cpp/src/thrift/windows/WinFcntl.cpp @@ -102,3 +102,9 @@ int thrift_poll(THRIFT_POLLFD *fdArray, ULONG nfds, INT timeout) } #endif // WINVER +#ifdef _WIN32_WCE +std::string thrift_wstr2str(std::wstring ws) { + std::string s(ws.begin(), ws.end()); + return s; +} +#endif http://git-wip-us.apache.org/repos/asf/thrift/blob/c9bdd502/lib/cpp/src/thrift/windows/WinFcntl.h ---------------------------------------------------------------------- diff --git a/lib/cpp/src/thrift/windows/WinFcntl.h b/lib/cpp/src/thrift/windows/WinFcntl.h index f30c0de..118c9a4 100644 --- a/lib/cpp/src/thrift/windows/WinFcntl.h +++ b/lib/cpp/src/thrift/windows/WinFcntl.h @@ -28,6 +28,10 @@ #error This is a MSVC header only. #endif +#ifdef _WIN32_WCE +#include <string> +#endif + // Win32 #include <Winsock2.h> #include <thrift/transport/PlatformSocket.h> @@ -45,4 +49,8 @@ int thrift_fcntl(THRIFT_SOCKET fd, int cmd, int flags); int thrift_poll(THRIFT_POLLFD *fdArray, ULONG nfds, INT timeout); } +#ifdef _WIN32_WCE +std::string thrift_wstr2str(std::wstring ws); +#endif + #endif // _THRIFT_WINDOWS_FCNTL_H_ http://git-wip-us.apache.org/repos/asf/thrift/blob/c9bdd502/lib/cpp/src/thrift/windows/config.h ---------------------------------------------------------------------- diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h index 0555e07..dca55c9 100644 --- a/lib/cpp/src/thrift/windows/config.h +++ b/lib/cpp/src/thrift/windows/config.h @@ -84,7 +84,10 @@ typedef boost::uint8_t uint8_t; // windows #include <Winsock2.h> #include <ws2tcpip.h> +#ifdef _WIN32_WCE +#pragma comment(lib, "Ws2.lib") +#else #pragma comment(lib, "Ws2_32.lib") #pragma comment(lib, "advapi32.lib") //For security APIs in TPipeServer - +#endif #endif // _THRIFT_WINDOWS_CONFIG_H_
