diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-03-25 03:55:18 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-03-25 03:55:18 +0000 |
commit | f3c6efd8d78f96a9a500b3ba7e024de122b9afa1 (patch) | |
tree | 632b58b9180caa30a8fd3ed1752db194a5a66aba /src | |
parent | 2c0fc6d415343b732a4ae39cce1458be1170b9f6 (diff) | |
download | googletest-f3c6efd8d78f96a9a500b3ba7e024de122b9afa1.tar.gz googletest-f3c6efd8d78f96a9a500b3ba7e024de122b9afa1.tar.bz2 googletest-f3c6efd8d78f96a9a500b3ba7e024de122b9afa1.zip |
Makes gtest compile without warning with gcc 4.0.3 and -Wall -Wextra.
Diffstat (limited to 'src')
-rw-r--r-- | src/gtest-death-test.cc | 2 | ||||
-rw-r--r-- | src/gtest-filepath.cc | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/gtest-death-test.cc b/src/gtest-death-test.cc index 18eaaeca..5e7eca0d 100644 --- a/src/gtest-death-test.cc +++ b/src/gtest-death-test.cc @@ -945,7 +945,7 @@ bool StackGrowsDown() { // wrong. static pid_t ExecDeathTestFork(char* const* argv, int close_fd) { ExecDeathTestArgs args = { argv, close_fd }; - pid_t child_pid; + pid_t child_pid = -1; #if GTEST_HAS_CLONE const bool use_fork = GTEST_FLAG(death_test_use_fork); diff --git a/src/gtest-filepath.cc b/src/gtest-filepath.cc index 32fd3bcb..d0cc5ffa 100644 --- a/src/gtest-filepath.cc +++ b/src/gtest-filepath.cc @@ -33,6 +33,7 @@ #include <gtest/internal/gtest-port.h> #include <stdlib.h> +#include <string.h> #ifdef _WIN32_WCE #include <windows.h> @@ -166,20 +167,19 @@ FilePath FilePath::ConcatPaths(const FilePath& directory, // Returns true if pathname describes something findable in the file-system, // either a file, directory, or whatever. bool FilePath::FileOrDirectoryExists() const { -#if GTEST_OS_WINDOWS #ifdef _WIN32_WCE LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str()); const DWORD attributes = GetFileAttributes(unicode); delete [] unicode; return attributes != kInvalidFileAttributes; -#else +#elif GTEST_OS_WINDOWS struct _stat file_stat = {}; return _stat(pathname_.c_str(), &file_stat) == 0; -#endif // _WIN32_WCE #else - struct stat file_stat = {}; + struct stat file_stat; + memset(&file_stat, 0, sizeof(file_stat)); return stat(pathname_.c_str(), &file_stat) == 0; -#endif // GTEST_OS_WINDOWS +#endif // _WIN32_WCE } // Returns true if pathname describes a directory in the file-system @@ -205,7 +205,8 @@ bool FilePath::DirectoryExists() const { (_S_IFDIR & file_stat.st_mode) != 0; #endif // _WIN32_WCE #else - struct stat file_stat = {}; + struct stat file_stat; + memset(&file_stat, 0, sizeof(file_stat)); result = stat(pathname_.c_str(), &file_stat) == 0 && S_ISDIR(file_stat.st_mode); #endif // GTEST_OS_WINDOWS |