diff options
-rw-r--r-- | app/clipboard/clipboard_linux.cc | 2 | ||||
-rw-r--r-- | app/gfx/native_widget_types.h | 3 | ||||
-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 | ||||
-rw-r--r-- | chrome/common/child_process_host.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/render_widget.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 12 | ||||
-rw-r--r-- | chrome/test/render_view_test.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 2 | ||||
-rw-r--r-- | media/filters/null_audio_renderer.cc | 4 | ||||
-rw-r--r-- | media/filters/video_renderer_base.cc | 4 | ||||
-rw-r--r-- | net/base/directory_lister.cc | 4 | ||||
-rw-r--r-- | net/socket/ssl_test_util.cc | 11 | ||||
-rw-r--r-- | webkit/glue/webcursor_unittest.cc | 10 | ||||
-rw-r--r-- | webkit/tools/test_shell/webwidget_host_gtk.cc | 2 |
19 files changed, 47 insertions, 39 deletions
diff --git a/app/clipboard/clipboard_linux.cc b/app/clipboard/clipboard_linux.cc index 8b30ffd..bc8a0b4 100644 --- a/app/clipboard/clipboard_linux.cc +++ b/app/clipboard/clipboard_linux.cc @@ -204,7 +204,7 @@ void Clipboard::WriteBookmark(const char* title_data, size_t title_len, // Write as a URI. char* data = new char[url_len + 1]; memcpy(data, url_data, url_len); - data[url_len] = NULL; + data[url_len] = '\0'; InsertMapping(kMimeURI, data, url_len + 1); } diff --git a/app/gfx/native_widget_types.h b/app/gfx/native_widget_types.h index d116d9c..0153194 100644 --- a/app/gfx/native_widget_types.h +++ b/app/gfx/native_widget_types.h @@ -129,13 +129,16 @@ NativeViewId IdFromNativeView(NativeView view); // window id. #if defined(OS_WIN) typedef HWND PluginWindowHandle; + const PluginWindowHandle kNullPluginWindow = NULL; #elif defined(USE_X11) typedef unsigned long PluginWindowHandle; + const PluginWindowHandle kNullPluginWindow = 0; #else // On OS X we don't have windowed plugins. // We use a NULL/0 PluginWindowHandle in shared code to indicate there // is no window present, so mirror that behavior here. typedef bool PluginWindowHandle; + const PluginWindowHandle kNullPluginWindow = false; #endif } // namespace gfx 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. diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc index 830d7e0..4b7a999 100644 --- a/chrome/common/child_process_host.cc +++ b/chrome/common/child_process_host.cc @@ -205,7 +205,7 @@ void ChildProcessHost::OnChildDied() { // On POSIX, once we've called DidProcessCrash, handle() is no longer // valid. Ensure the destructor doesn't try to use it. - set_handle(NULL); + set_handle(base::kNullProcessHandle); delete this; } diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 9dc6e92..9600b8d 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -1316,7 +1316,7 @@ WebView* RenderView::createView(WebFrame* creator) { return NULL; RenderView* view = RenderView::Create(render_thread_, - NULL, + 0, routing_id_, renderer_preferences_, webkit_preferences_, diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 0d7fadf..0c5e970 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -46,7 +46,7 @@ RenderWidget::RenderWidget(RenderThreadBase* render_thread, bool activatable) webwidget_(NULL), opener_id_(MSG_ROUTING_NONE), render_thread_(render_thread), - host_window_(NULL), + host_window_(0), current_paint_buf_(NULL), current_scroll_buf_(NULL), next_paint_flags_(0), diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index d67a68e..b15de39 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -60,7 +60,7 @@ class ResourceClientProxy : public webkit_glue::WebPluginResourceClient { public: ResourceClientProxy(PluginChannelHost* channel, int instance_id) : channel_(channel), instance_id_(instance_id), resource_id_(0), - notify_needed_(false), notify_data_(NULL), + notify_needed_(false), notify_data_(0), multibyte_response_expected_(false) { } @@ -161,7 +161,7 @@ WebPluginDelegateProxy::WebPluginDelegateProxy( : render_view_(render_view), plugin_(NULL), windowless_(false), - window_(NULL), + window_(gfx::kNullPluginWindow), mime_type_(mime_type), instance_id_(MSG_ROUTING_NONE), npobject_(NULL), @@ -656,8 +656,8 @@ bool WebPluginDelegateProxy::BackgroundChanged( #else const unsigned char* page_bytes = cairo_image_surface_get_data(page_surface); int page_stride = cairo_image_surface_get_stride(page_surface); - int page_start_x = page_x_double; - int page_start_y = page_y_double; + int page_start_x = static_cast<int>(page_x_double); + int page_start_y = static_cast<int>(page_y_double); skia::PlatformDevice& device = background_store_canvas_->getTopPlatformDevice(); @@ -786,7 +786,7 @@ void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { void WebPluginDelegateProxy::WillDestroyWindow() { DCHECK(window_); plugin_->WillDestroyWindow(window_); - window_ = NULL; + window_ = gfx::kNullPluginWindow; } #if defined(OS_WIN) @@ -936,7 +936,7 @@ void WebPluginDelegateProxy::OnGetDragData(const NPVariant_Param& object, for (size_t i = 0; i < arraysize(results); ++i) { values->push_back(NPVariant_Param()); CreateNPVariantParam( - results[i], NULL, &values->back(), false, NULL, page_url_); + results[i], NULL, &values->back(), false, 0, page_url_); } *success = true; diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index 2f8943d..54fde06 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -96,7 +96,7 @@ void RenderViewTest::SetUp() { render_thread_.set_routing_id(kRouteId); // This needs to pass the mock render thread to the view. - view_ = RenderView::Create(&render_thread_, NULL, kOpenerId, + view_ = RenderView::Create(&render_thread_, 0, kOpenerId, RendererPreferences(), WebPreferences(), new SharedRenderViewCounter(0), kRouteId); diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index c4a37e2..d0959ca 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -420,7 +420,7 @@ void UITest::QuitBrowser() { // Don't forget to close the handle base::CloseProcessHandle(process_); - process_ = NULL; + process_ = base::kNullProcessHandle; } void UITest::AssertAppNotRunning(const std::wstring& error_message) { diff --git a/media/filters/null_audio_renderer.cc b/media/filters/null_audio_renderer.cc index d977b08..544b588 100644 --- a/media/filters/null_audio_renderer.cc +++ b/media/filters/null_audio_renderer.cc @@ -18,7 +18,7 @@ NullAudioRenderer::NullAudioRenderer() : AudioRendererBase(), bytes_per_millisecond_(0), buffer_size_(0), - thread_(NULL), + thread_(kNullThreadHandle), shutdown_(false) { } @@ -89,7 +89,7 @@ void NullAudioRenderer::OnStop() { shutdown_ = true; if (thread_) { PlatformThread::Join(thread_); - thread_ = NULL; + thread_ = kNullThreadHandle; } } diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc index 5a320c9..77a736d 100644 --- a/media/filters/video_renderer_base.cc +++ b/media/filters/video_renderer_base.cc @@ -39,7 +39,7 @@ VideoRendererBase::VideoRendererBase() height_(0), frame_available_(&lock_), state_(kUninitialized), - thread_(NULL), + thread_(kNullThreadHandle), pending_reads_(0), playback_rate_(0) { } @@ -105,7 +105,7 @@ void VideoRendererBase::Stop() { AutoUnlock auto_unlock(lock_); PlatformThread::Join(thread_); } - thread_ = NULL; + thread_ = kNullThreadHandle; } } diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc index 7ea862f..8204fd8 100644 --- a/net/base/directory_lister.cc +++ b/net/base/directory_lister.cc @@ -55,7 +55,7 @@ DirectoryLister::DirectoryLister(const FilePath& dir, : dir_(dir), delegate_(delegate), message_loop_(NULL), - thread_(NULL), + thread_(kNullThreadHandle), canceled_(false) { DCHECK(!dir.value().empty()); } @@ -88,7 +88,7 @@ void DirectoryLister::Cancel() { if (thread_) { PlatformThread::Join(thread_); - thread_ = NULL; + thread_ = kNullThreadHandle; } } diff --git a/net/socket/ssl_test_util.cc b/net/socket/ssl_test_util.cc index 763031f..c0ef832 100644 --- a/net/socket/ssl_test_util.cc +++ b/net/socket/ssl_test_util.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. @@ -136,7 +136,8 @@ const int TestServerLauncher::kBadHTTPSPort = 9666; // The issuer name of the cert that should be trusted for the test to work. const wchar_t TestServerLauncher::kCertIssuerName[] = L"Test CA"; -TestServerLauncher::TestServerLauncher() : process_handle_(NULL), +TestServerLauncher::TestServerLauncher() : process_handle_( + base::kNullProcessHandle), forking_(false), connection_attempts_(10), connection_timeout_(1000) @@ -149,7 +150,7 @@ TestServerLauncher::TestServerLauncher() : process_handle_(NULL), TestServerLauncher::TestServerLauncher(int connection_attempts, int connection_timeout) - : process_handle_(NULL), + : process_handle_(base::kNullProcessHandle), forking_(false), connection_attempts_(connection_attempts), connection_timeout_(connection_timeout) @@ -331,7 +332,7 @@ bool TestServerLauncher::WaitToFinish(int timeout_ms) { bool ret = base::WaitForSingleProcess(process_handle_, timeout_ms); if (ret) { base::CloseProcessHandle(process_handle_); - process_handle_ = NULL; + process_handle_ = base::kNullProcessHandle; LOG(INFO) << "Finished."; } else { LOG(INFO) << "Timed out."; @@ -346,7 +347,7 @@ bool TestServerLauncher::Stop() { bool ret = base::KillProcess(process_handle_, 1, true); if (ret) { base::CloseProcessHandle(process_handle_); - process_handle_ = NULL; + process_handle_ = base::kNullProcessHandle; LOG(INFO) << "Stopped."; } else { LOG(INFO) << "Kill failed?"; diff --git a/webkit/glue/webcursor_unittest.cc b/webkit/glue/webcursor_unittest.cc index 1a15bf8..51fd433 100644 --- a/webkit/glue/webcursor_unittest.cc +++ b/webkit/glue/webcursor_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. @@ -22,7 +22,7 @@ TEST(WebCursorTest, CursorSerialization) { ok_custom_pickle.WriteInt(4); ok_custom_pickle.WriteUInt32(0); // Custom Windows message. - ok_custom_pickle.WriteIntPtr(NULL); + ok_custom_pickle.WriteIntPtr(0); void* iter = NULL; EXPECT_TRUE(custom_cursor.Deserialize(&ok_custom_pickle, &iter)); @@ -39,7 +39,7 @@ TEST(WebCursorTest, CursorSerialization) { short_custom_pickle.WriteInt(3); short_custom_pickle.WriteUInt32(0); // Custom Windows message. - ok_custom_pickle.WriteIntPtr(NULL); + ok_custom_pickle.WriteIntPtr(0); iter = NULL; EXPECT_FALSE(custom_cursor.Deserialize(&short_custom_pickle, &iter)); @@ -58,7 +58,7 @@ TEST(WebCursorTest, CursorSerialization) { for (int i = 0; i < kTooBigSize; ++i) large_custom_pickle.WriteUInt32(0); // Custom Windows message. - ok_custom_pickle.WriteIntPtr(NULL); + ok_custom_pickle.WriteIntPtr(0); iter = NULL; EXPECT_FALSE(custom_cursor.Deserialize(&large_custom_pickle, &iter)); @@ -75,7 +75,7 @@ TEST(WebCursorTest, CursorSerialization) { neg_custom_pickle.WriteInt(4); neg_custom_pickle.WriteUInt32(0); // Custom Windows message. - neg_custom_pickle.WriteIntPtr(NULL); + neg_custom_pickle.WriteIntPtr(0); iter = NULL; EXPECT_FALSE(custom_cursor.Deserialize(&neg_custom_pickle, &iter)); } diff --git a/webkit/tools/test_shell/webwidget_host_gtk.cc b/webkit/tools/test_shell/webwidget_host_gtk.cc index 97dd3f8..f9d23a1 100644 --- a/webkit/tools/test_shell/webwidget_host_gtk.cc +++ b/webkit/tools/test_shell/webwidget_host_gtk.cc @@ -319,7 +319,7 @@ WebWidgetHost::~WebWidgetHost() { // attempt to invoke something on a deleted object. g_object_set_data(G_OBJECT(view_), kWebWidgetHostKey, NULL); g_signal_handlers_disconnect_matched(view_, - G_SIGNAL_MATCH_DATA, 0, NULL, NULL, NULL, this); + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this); webwidget_->close(); } |