summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-03-26 21:11:22 (GMT)
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-03-26 21:11:22 (GMT)
commite120fc58906cd7ca6492ba634bb7e082167bd5bf (patch)
tree27d8f2591b60bcafc03f2229fe77bbf517eb513e /include
parent3c7bbf5b46679aea4e0ac7d3ad241cb036146751 (diff)
downloadgoogletest-e120fc58906cd7ca6492ba634bb7e082167bd5bf.zip
googletest-e120fc58906cd7ca6492ba634bb7e082167bd5bf.tar.gz
googletest-e120fc58906cd7ca6492ba634bb7e082167bd5bf.tar.bz2
Works around a VC bug by avoiding defining a function named strdup().
Diffstat (limited to 'include')
-rw-r--r--include/gtest/internal/gtest-port.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index cfb214f..d4ffbb4 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -736,13 +736,18 @@ namespace posix {
typedef struct _stat stat_struct;
inline int chdir(const char* dir) { return ::_chdir(dir); }
+// We cannot write ::_fileno() as MSVC defines it as a macro.
inline int fileno(FILE* file) { return _fileno(file); }
inline int isatty(int fd) { return ::_isatty(fd); }
-inline int stat(const char* path, stat_struct* buf) { return ::_stat(path, buf); }
+inline int stat(const char* path, stat_struct* buf) {
+ return ::_stat(path, buf);
+}
inline int strcasecmp(const char* s1, const char* s2) {
return ::_stricmp(s1, s2);
}
-inline const char* strdup(const char* src) { return ::_strdup(src); }
+// We cannot define the function as strdup(const char* src), since
+// MSVC defines strdup as a macro.
+inline char* StrDup(const char* src) { return ::_strdup(src); }
inline int rmdir(const char* dir) { return ::_rmdir(dir); }
inline bool IsDir(const stat_struct& st) {
return (_S_IFDIR & st.st_mode) != 0;
@@ -757,7 +762,7 @@ using ::fileno;
using ::isatty;
using ::stat;
using ::strcasecmp;
-using ::strdup;
+inline char* StrDup(const char* src) { return ::strdup(src); }
using ::rmdir;
inline bool IsDir(const stat_struct& st) { return S_ISDIR(st.st_mode); }