From bf9b4b48dc65adc2edd44175f77b4a7363c59234 Mon Sep 17 00:00:00 2001 From: shiqian Date: Thu, 31 Jul 2008 18:34:08 +0000 Subject: Makes gtest work on Windows Mobile and Symbian. By Mika Raento. --- include/gtest/internal/gtest-port.h | 9 +++++++++ include/gtest/internal/gtest-string.h | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'include/gtest') diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index 0c422cde..1b7c6a73 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -582,6 +582,15 @@ inline const char* GetEnv(const char* name) { #endif } +#ifdef _WIN32_WCE +// Windows CE has no C library. The abort() function is used in +// several places in Google Test. This implementation provides a reasonable +// imitation of standard behaviour. +void abort(); +#else +inline void abort() { ::abort(); } +#endif // _WIN32_WCE + // Macro for referencing flags. #define GTEST_FLAG(name) FLAGS_gtest_##name diff --git a/include/gtest/internal/gtest-string.h b/include/gtest/internal/gtest-string.h index b5a303fd..612b6cef 100644 --- a/include/gtest/internal/gtest-string.h +++ b/include/gtest/internal/gtest-string.h @@ -107,6 +107,32 @@ class String { // memory using malloc(). static const char* CloneCString(const char* c_str); +#ifdef _WIN32_WCE + // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be + // able to pass strings to Win32 APIs on CE we need to convert them + // to 'Unicode', UTF-16. + + // Creates a UTF-16 wide string from the given ANSI string, allocating + // memory using new. The caller is responsible for deleting the return + // value using delete[]. Returns the wide string, or NULL if the + // input is NULL. + // + // The wide string is created using the ANSI codepage (CP_ACP) to + // match the behaviour of the ANSI versions of Win32 calls and the + // C runtime. + static LPCWSTR AnsiToUtf16(const char* c_str); + + // Creates an ANSI string from the given wide string, allocating + // memory using new. The caller is responsible for deleting the return + // value using delete[]. Returns the ANSI string, or NULL if the + // input is NULL. + // + // The returned string is created using the ANSI codepage (CP_ACP) to + // match the behaviour of the ANSI versions of Win32 calls and the + // C runtime. + static const char* Utf16ToAnsi(LPCWSTR utf16_str); +#endif + // Compares two C strings. Returns true iff they have the same content. // // Unlike strcmp(), this function can handle NULL argument(s). A -- cgit v1.2.3