diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 13:43:42 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 13:43:42 +0000 |
commit | 659f73fa7b0a91ceef30e89fff34629f39853761 (patch) | |
tree | 54856047a10c8ba93f82c725cb0e3ee5283e707d /base | |
parent | b2be7a6889ea1af900760b6e69e22152f652e950 (diff) | |
download | chromium_src-659f73fa7b0a91ceef30e89fff34629f39853761.zip chromium_src-659f73fa7b0a91ceef30e89fff34629f39853761.tar.gz chromium_src-659f73fa7b0a91ceef30e89fff34629f39853761.tar.bz2 |
Turn NULL used as int to 0.
(Excluding chrome/browser/...)
Landing patch for Jacob Mandelson. Original review: http://codereview.chromium.org/195067
BUG=none
TEST=base_unittests & app_unittests
Review URL: http://codereview.chromium.org/267076
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28810 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/multiprocess_test.h | 10 | ||||
-rw-r--r-- | base/platform_thread.h | 2 | ||||
-rw-r--r-- | base/process.h | 4 | ||||
-rw-r--r-- | base/process_util_unittest.cc | 4 | ||||
-rw-r--r-- | base/stats_table_unittest.cc | 4 |
5 files changed, 14 insertions, 10 deletions
diff --git a/base/multiprocess_test.h b/base/multiprocess_test.h index 0662689..7b9af1a 100644 --- a/base/multiprocess_test.h +++ b/base/multiprocess_test.h @@ -1,9 +1,9 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_MULTIPROCESS_TEST_H__ -#define BASE_MULTIPROCESS_TEST_H__ +#ifndef BASE_MULTIPROCESS_TEST_H_ +#define BASE_MULTIPROCESS_TEST_H_ #include "base/base_switches.h" #include "base/command_line.h" @@ -106,7 +106,7 @@ class MultiProcessTest : public PlatformTest { const base::file_handle_mapping_vector& fds_to_map, bool debug_on_start) { CommandLine cl(*CommandLine::ForCurrentProcess()); - base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL); + base::ProcessHandle handle = base::kNullProcessHandle; cl.AppendSwitchWithValue(kRunClientProcess, procname); if (debug_on_start) @@ -118,4 +118,4 @@ class MultiProcessTest : public PlatformTest { #endif }; -#endif // BASE_MULTIPROCESS_TEST_H__ +#endif // BASE_MULTIPROCESS_TEST_H_ diff --git a/base/platform_thread.h b/base/platform_thread.h index f641f42..4478519 100644 --- a/base/platform_thread.h +++ b/base/platform_thread.h @@ -19,9 +19,11 @@ #include <windows.h> typedef DWORD PlatformThreadId; typedef void* PlatformThreadHandle; // HANDLE +const PlatformThreadHandle kNullThreadHandle = NULL; #elif defined(OS_POSIX) #include <pthread.h> typedef pthread_t PlatformThreadHandle; +const PlatformThreadHandle kNullThreadHandle = 0; #if defined(OS_MACOSX) #include <mach/mach.h> typedef mach_port_t PlatformThreadId; diff --git a/base/process.h b/base/process.h index fa076b9..7a1bfba 100644 --- a/base/process.h +++ b/base/process.h @@ -21,15 +21,17 @@ namespace base { #if defined(OS_WIN) typedef HANDLE ProcessHandle; typedef DWORD ProcessId; +const ProcessHandle kNullProcessHandle = NULL; #elif defined(OS_POSIX) // On POSIX, our ProcessHandle will just be the PID. typedef pid_t ProcessHandle; typedef pid_t ProcessId; +const ProcessHandle kNullProcessHandle = 0; #endif class Process { public: - Process() : process_(0), last_working_set_size_(0) {} + Process() : process_(kNullProcessHandle), last_working_set_size_(0) {} explicit Process(ProcessHandle handle) : process_(handle), last_working_set_size_(0) {} diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index 40e303c..4389e6e 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -41,7 +41,7 @@ MULTIPROCESS_TEST_MAIN(SimpleChildProcess) { TEST_F(ProcessUtilTest, SpawnChild) { ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess"); - ASSERT_NE(static_cast<ProcessHandle>(NULL), handle); + ASSERT_NE(base::kNullProcessHandle, handle); EXPECT_TRUE(WaitForSingleProcess(handle, 5000)); base::CloseProcessHandle(handle); } @@ -62,7 +62,7 @@ MULTIPROCESS_TEST_MAIN(SlowChildProcess) { TEST_F(ProcessUtilTest, KillSlowChild) { remove("SlowChildProcess.die"); ProcessHandle handle = this->SpawnChild(L"SlowChildProcess"); - ASSERT_NE(static_cast<ProcessHandle>(NULL), handle); + ASSERT_NE(base::kNullProcessHandle, handle); FILE *fp = fopen("SlowChildProcess.die", "w"); fclose(fp); EXPECT_TRUE(base::WaitForSingleProcess(handle, 5000)); diff --git a/base/stats_table_unittest.cc b/base/stats_table_unittest.cc index d8535cb..e321f20 100644 --- a/base/stats_table_unittest.cc +++ b/base/stats_table_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -208,7 +208,7 @@ TEST_F(StatsTableTest, MultipleProcesses) { // Spawn the processes. for (int16 index = 0; index < kMaxProcs; index++) { procs[index] = this->SpawnChild(L"StatsTableMultipleProcessMain"); - EXPECT_NE(static_cast<ProcessHandle>(NULL), procs[index]); + EXPECT_NE(base::kNullProcessHandle, procs[index]); } // Wait for the processes to finish. |