summaryrefslogtreecommitdiffstats
path: root/googletest/src/gtest-port.cc
diff options
context:
space:
mode:
Diffstat (limited to 'googletest/src/gtest-port.cc')
-rw-r--r--googletest/src/gtest-port.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc
index fecb5d1..91f285c 100644
--- a/googletest/src/gtest-port.cc
+++ b/googletest/src/gtest-port.cc
@@ -935,7 +935,7 @@ const char kUnknownFile[] = "unknown file";
// Formats a source file path and a line number as they would appear
// in an error message from the compiler used to compile this code.
GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
- const std::string file_name(file == NULL ? kUnknownFile : file);
+ const std::string file_name(file == nullptr ? kUnknownFile : file);
if (line < 0) {
return file_name + ":";
@@ -954,7 +954,7 @@ GTEST_API_ ::std::string FormatFileLocation(const char* file, int line) {
// to the file location it produces, unlike FormatFileLocation().
GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(
const char* file, int line) {
- const std::string file_name(file == NULL ? kUnknownFile : file);
+ const std::string file_name(file == nullptr ? kUnknownFile : file);
if (line < 0)
return file_name;
@@ -1034,7 +1034,7 @@ class CapturedStream {
const int captured_fd = mkstemp(name_template);
filename_ = name_template;
# endif // GTEST_OS_WINDOWS
- fflush(NULL);
+ fflush(nullptr);
dup2(captured_fd, fd_);
close(captured_fd);
}
@@ -1046,7 +1046,7 @@ class CapturedStream {
std::string GetCapturedString() {
if (uncaptured_fd_ != -1) {
// Restores the original stream.
- fflush(NULL);
+ fflush(nullptr);
dup2(uncaptured_fd_, fd_);
close(uncaptured_fd_);
uncaptured_fd_ = -1;
@@ -1069,13 +1069,13 @@ class CapturedStream {
GTEST_DISABLE_MSC_DEPRECATED_POP_()
-static CapturedStream* g_captured_stderr = NULL;
-static CapturedStream* g_captured_stdout = NULL;
+static CapturedStream* g_captured_stderr = nullptr;
+static CapturedStream* g_captured_stdout = nullptr;
// Starts capturing an output stream (stdout/stderr).
static void CaptureStream(int fd, const char* stream_name,
CapturedStream** stream) {
- if (*stream != NULL) {
+ if (*stream != nullptr) {
GTEST_LOG_(FATAL) << "Only one " << stream_name
<< " capturer can exist at a time.";
}
@@ -1087,7 +1087,7 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) {
const std::string content = (*captured_stream)->GetCapturedString();
delete *captured_stream;
- *captured_stream = NULL;
+ *captured_stream = nullptr;
return content;
}
@@ -1146,10 +1146,11 @@ std::string ReadEntireFile(FILE* file) {
}
#if GTEST_HAS_DEATH_TEST
-static const std::vector<std::string>* g_injected_test_argvs = NULL; // Owned.
+static const std::vector<std::string>* g_injected_test_argvs =
+ nullptr; // Owned.
std::vector<std::string> GetInjectableArgvs() {
- if (g_injected_test_argvs != NULL) {
+ if (g_injected_test_argvs != nullptr) {
return *g_injected_test_argvs;
}
return GetArgvs();
@@ -1174,7 +1175,7 @@ void SetInjectableArgvs(const std::vector< ::string>& new_argvs) {
void ClearInjectableArgvs() {
delete g_injected_test_argvs;
- g_injected_test_argvs = NULL;
+ g_injected_test_argvs = nullptr;
}
#endif // GTEST_HAS_DEATH_TEST
@@ -1207,7 +1208,7 @@ static std::string FlagToEnvVar(const char* flag) {
// unchanged and returns false.
bool ParseInt32(const Message& src_text, const char* str, Int32* value) {
// Parses the environment variable as a decimal integer.
- char* end = NULL;
+ char* end = nullptr;
const long long_value = strtol(str, &end, 10); // NOLINT
// Has strtol() consumed all characters in the string?
@@ -1296,7 +1297,7 @@ Int32 Int32FromGTestEnv(const char* flag, Int32 default_value) {
std::string OutputFlagAlsoCheckEnvVar(){
std::string default_value_for_output_flag = "";
const char* xml_output_file_env = posix::GetEnv("XML_OUTPUT_FILE");
- if (NULL != xml_output_file_env) {
+ if (nullptr != xml_output_file_env) {
default_value_for_output_flag = std::string("xml:") + xml_output_file_env;
}
return default_value_for_output_flag;