diff options
author | jeanluc@chromium.org <jeanluc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-30 22:57:35 +0000 |
---|---|---|
committer | jeanluc@chromium.org <jeanluc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-30 22:57:35 +0000 |
commit | 107446884c2e92b17f494ded21b315a052e51928 (patch) | |
tree | 35ff2b61b9a8a4ae0c07bbbb30d1fcb05d364ff7 | |
parent | c90d849636fd9db7f79f2f2b4611f2bcff0c5700 (diff) | |
download | chromium_src-107446884c2e92b17f494ded21b315a052e51928.zip chromium_src-107446884c2e92b17f494ded21b315a052e51928.tar.gz chromium_src-107446884c2e92b17f494ded21b315a052e51928.tar.bz2 |
In Visual Studio 2010, pass a nullptr rather than NULL when building a std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair
BUG=71138
TEST=Successful compile
Review URL: http://codereview.chromium.org/6366023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73120 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_url_handler.cc | 16 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_widget_helper.cc | 12 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_model.cc | 12 | ||||
-rw-r--r-- | webkit/blob/deletable_file_reference.cc | 11 |
4 files changed, 44 insertions, 7 deletions
diff --git a/chrome/browser/browser_url_handler.cc b/chrome/browser/browser_url_handler.cc index 6854556..806f1bd 100644 --- a/chrome/browser/browser_url_handler.cc +++ b/chrome/browser/browser_url_handler.cc @@ -83,13 +83,23 @@ void BrowserURLHandler::InitURLHandlers() { if (!url_handlers_.empty()) return; + // Visual Studio 2010 has problems converting NULL to the null pointer for + // std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair + // It will work if we pass nullptr. +#if defined(_MSC_VER) && _MSC_VER >= 1600 + URLHandler null_handler = nullptr; +#else + URLHandler null_handler = NULL; +#endif + // Add the default URL handlers. url_handlers_.push_back( - HandlerPair(&ExtensionDOMUI::HandleChromeURLOverride, NULL)); + HandlerPair(&ExtensionDOMUI::HandleChromeURLOverride, null_handler)); // about: - url_handlers_.push_back(HandlerPair(&WillHandleBrowserAboutURL, NULL)); + url_handlers_.push_back(HandlerPair(&WillHandleBrowserAboutURL, + null_handler)); // chrome: & friends. - url_handlers_.push_back(HandlerPair(&HandleDOMUI, NULL)); + url_handlers_.push_back(HandlerPair(&HandleDOMUI, null_handler)); // view-source: url_handlers_.push_back(HandlerPair(&HandleViewSource, &ReverseViewSource)); } diff --git a/chrome/browser/renderer_host/render_widget_helper.cc b/chrome/browser/renderer_host/render_widget_helper.cc index d94ae33..5f54eef 100644 --- a/chrome/browser/renderer_host/render_widget_helper.cc +++ b/chrome/browser/renderer_host/render_widget_helper.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -141,7 +141,15 @@ void RenderWidgetHelper::DidReceiveUpdateMsg(const IPC::Message& msg) { { base::AutoLock lock(pending_paints_lock_); - UpdateMsgProxyMap::value_type new_value(render_widget_id, NULL); + // Visual Studio 2010 has problems converting NULL to the null pointer for + // std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair + // It will work if we pass nullptr. +#if defined(_MSC_VER) && _MSC_VER >= 1600 + RenderWidgetHelper::UpdateMsgProxy* null_proxy = nullptr; +#else + RenderWidgetHelper::UpdateMsgProxy* null_proxy = NULL; +#endif + UpdateMsgProxyMap::value_type new_value(render_widget_id, null_proxy); // We expect only a single PaintRect message at a time. Optimize for the // case that we don't already have an entry by using the 'insert' method. diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc index a1cfdac..9a7a193 100644 --- a/chrome/browser/search_engines/template_url_model.cc +++ b/chrome/browser/search_engines/template_url_model.cc @@ -246,6 +246,15 @@ void TemplateURLModel::FindMatchingKeywords( DCHECK(matches != NULL); DCHECK(matches->empty()); // The code for exact matches assumes this. + // Visual Studio 2010 has problems converting NULL to the null pointer for + // std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair + // It will work if we pass nullptr. +#if defined(_MSC_VER) && _MSC_VER >= 1600 + const TemplateURL* null_url = nullptr; +#else + const TemplateURL* null_url = NULL; +#endif + // Find matching keyword range. Searches the element map for keywords // beginning with |prefix| and stores the endpoints of the resulting set in // |match_range|. @@ -253,7 +262,8 @@ void TemplateURLModel::FindMatchingKeywords( KeywordToTemplateMap::const_iterator> match_range( std::equal_range( keyword_to_template_map_.begin(), keyword_to_template_map_.end(), - KeywordToTemplateMap::value_type(prefix, NULL), LessWithPrefix())); + KeywordToTemplateMap::value_type(prefix, null_url), + LessWithPrefix())); // Return vector of matching keywords. for (KeywordToTemplateMap::const_iterator i(match_range.first); diff --git a/webkit/blob/deletable_file_reference.cc b/webkit/blob/deletable_file_reference.cc index 7a5cfac..3f2daed 100644 --- a/webkit/blob/deletable_file_reference.cc +++ b/webkit/blob/deletable_file_reference.cc @@ -34,8 +34,17 @@ scoped_refptr<DeletableFileReference> DeletableFileReference::GetOrCreate( const FilePath& path, base::MessageLoopProxy* file_thread) { DCHECK(file_thread); typedef std::pair<DeleteableFileMap::iterator, bool> InsertResult; + + // Visual Studio 2010 has problems converting NULL to the null pointer for + // std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair + // It will work if we pass nullptr. +#if defined(_MSC_VER) && _MSC_VER >= 1600 + webkit_blob::DeletableFileReference* null_reference = nullptr; +#else + webkit_blob::DeletableFileReference* null_reference = NULL; +#endif InsertResult result = g_deletable_file_map.Get().insert( - DeleteableFileMap::value_type(path, NULL)); + DeleteableFileMap::value_type(path, null_reference)); if (result.second == false) return scoped_refptr<DeletableFileReference>(result.first->second); |