diff options
author | craig.schlenter@chromium.org <craig.schlenter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-11 04:36:05 +0000 |
---|---|---|
committer | craig.schlenter@chromium.org <craig.schlenter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-11 04:36:05 +0000 |
commit | 4c66d2a859776c05767f05472cbfa9519ca01aff (patch) | |
tree | 4ba514f08aedb79783bc19e7c31ca1de82552ea7 | |
parent | 0b330bf9a3164dc61ce4b88c386e44c36e7bfa60 (diff) | |
download | chromium_src-4c66d2a859776c05767f05472cbfa9519ca01aff.zip chromium_src-4c66d2a859776c05767f05472cbfa9519ca01aff.tar.gz chromium_src-4c66d2a859776c05767f05472cbfa9519ca01aff.tar.bz2 |
Linux: fix compilation error with gcc 4.5.
Avoid a gcc 4.5 warning/error for values that aren't part
of NPNVariable. Also drop some unnecessary static_casts by
swapping from an int to a size_t in TemplateURLRef's
Replacement struct and use platform specific NULL or 0
constants in a couple of places.
BUG=43341
TEST=chrome target compiles with gcc 4.5.
Review URL: http://codereview.chromium.org/2019002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46889 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/clipboard/clipboard_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url.cc | 22 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url.h | 5 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_host.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_impl.cc | 4 |
8 files changed, 21 insertions, 24 deletions
diff --git a/app/clipboard/clipboard_unittest.cc b/app/clipboard/clipboard_unittest.cc index d15247b..89702f1 100644 --- a/app/clipboard/clipboard_unittest.cc +++ b/app/clipboard/clipboard_unittest.cc @@ -232,7 +232,7 @@ TEST_F(ClipboardTest, SharedBitmapTest) { ASSERT_TRUE(shared_buf.Map(bytes)); memcpy(shared_buf.memory(), fake_bitmap, bytes); base::SharedMemoryHandle handle_to_share; - base::ProcessHandle current_process = NULL; + base::ProcessHandle current_process = base::kNullProcessHandle; #if defined(OS_WIN) current_process = GetCurrentProcess(); #endif diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc index fe83561..43dae52 100644 --- a/chrome/browser/search_engines/template_url.cc +++ b/chrome/browser/search_engines/template_url.cc @@ -102,7 +102,7 @@ bool TemplateURLRef::ParseParameter(size_t start, // Remove the parameter from the string. url->erase(start, end - start + 1); if (parameter == kSearchTermsParameter) { - replacements->push_back(Replacement(SEARCH_TERMS, static_cast<int>(start))); + replacements->push_back(Replacement(SEARCH_TERMS, start)); } else if (parameter == kCountParameter) { if (!optional) url->insert(start, kDefaultCount); @@ -115,30 +115,26 @@ bool TemplateURLRef::ParseParameter(size_t start, url->insert(start, IntToWString(page_offset_)); } } else if (parameter == kLanguageParameter) { - replacements->push_back(Replacement(LANGUAGE, static_cast<int>(start))); + replacements->push_back(Replacement(LANGUAGE, start)); } else if (parameter == kInputEncodingParameter) { - replacements->push_back(Replacement(ENCODING, static_cast<int>(start))); + replacements->push_back(Replacement(ENCODING, start)); } else if (parameter == kOutputEncodingParameter) { if (!optional) url->insert(start, kOutputEncodingType); } else if (parameter == kGoogleAcceptedSuggestionParameter) { - replacements->push_back(Replacement(GOOGLE_ACCEPTED_SUGGESTION, - static_cast<int>(start))); + replacements->push_back(Replacement(GOOGLE_ACCEPTED_SUGGESTION, start)); } else if (parameter == kGoogleBaseURLParameter) { - replacements->push_back(Replacement(GOOGLE_BASE_URL, - static_cast<int>(start))); + replacements->push_back(Replacement(GOOGLE_BASE_URL, start)); } else if (WideToUTF16Hack(parameter) == ASCIIToUTF16(kGoogleBaseSuggestURLParameter)) { - replacements->push_back(Replacement(GOOGLE_BASE_SUGGEST_URL, - static_cast<int>(start))); + replacements->push_back(Replacement(GOOGLE_BASE_SUGGEST_URL, start)); } else if (parameter == kGoogleOriginalQueryForSuggestionParameter) { replacements->push_back(Replacement(GOOGLE_ORIGINAL_QUERY_FOR_SUGGESTION, - static_cast<int>(start))); + start)); } else if (parameter == kGoogleRLZParameter) { - replacements->push_back(Replacement(GOOGLE_RLZ, static_cast<int>(start))); + replacements->push_back(Replacement(GOOGLE_RLZ, start)); } else if (parameter == kGoogleUnescapedSearchTermsParameter) { - replacements->push_back(Replacement(GOOGLE_UNESCAPED_SEARCH_TERMS, - static_cast<int>(start))); + replacements->push_back(Replacement(GOOGLE_UNESCAPED_SEARCH_TERMS, start)); } else { // It can be some garbage but can also be a javascript block. Put it back. url->insert(start, full_parameter); diff --git a/chrome/browser/search_engines/template_url.h b/chrome/browser/search_engines/template_url.h index 90cd734..5a5c67f 100644 --- a/chrome/browser/search_engines/template_url.h +++ b/chrome/browser/search_engines/template_url.h @@ -136,9 +136,10 @@ class TemplateURLRef { // Used to identify an element of the raw url that can be replaced. struct Replacement { - Replacement(ReplacementType type, int index) : type(type), index(index) {} + Replacement(ReplacementType type, size_t index) + : type(type), index(index) {} ReplacementType type; - int index; + size_t index; }; // The list of elements to replace. diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc index b2ef832..5f9bfff 100644 --- a/chrome/browser/search_engines/template_url_unittest.cc +++ b/chrome/browser/search_engines/template_url_unittest.cc @@ -421,7 +421,7 @@ TEST_F(TemplateURLTest, ParseParameterKnown) { EXPECT_TRUE(url_ref.ParseParameter(0, 12, &parsed_url, &replacements)); EXPECT_EQ(std::wstring(), parsed_url); ASSERT_EQ(1U, replacements.size()); - EXPECT_EQ(0, replacements[0].index); + EXPECT_EQ(static_cast<size_t>(0), replacements[0].index); EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type); } @@ -468,7 +468,7 @@ TEST_F(TemplateURLTest, ParseURLTwoParameters) { EXPECT_EQ(L"{}{}", url_ref.ParseURL(L"{}{{searchTerms}}", &replacements, &valid)); ASSERT_EQ(1U, replacements.size()); - EXPECT_EQ(3, replacements[0].index); + EXPECT_EQ(static_cast<size_t>(3), replacements[0].index); EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type); EXPECT_TRUE(valid); } @@ -479,7 +479,7 @@ TEST_F(TemplateURLTest, ParseURLNestedParameter) { bool valid = false; EXPECT_EQ(L"{", url_ref.ParseURL(L"{{searchTerms}", &replacements, &valid)); ASSERT_EQ(1U, replacements.size()); - EXPECT_EQ(1, replacements[0].index); + EXPECT_EQ(static_cast<size_t>(1), replacements[0].index); EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type); EXPECT_TRUE(valid); } diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 9b1ec53..0f47bd8 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -158,7 +158,7 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, command_line.GetSwitchValue(switches::kPluginPath)); - gfx::PluginWindowHandle parent = 0; + gfx::PluginWindowHandle parent = gfx::kNullPluginWindow; #if defined(OS_WIN) parent = gfx::NativeViewFromId(params.containing_window); #elif defined(OS_LINUX) diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 683382d..c545c87 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -395,7 +395,7 @@ NPError WebPluginDelegatePepper::Device2DInitializeContext( // This is a windowless plugin, so set it to have no handle. Defer this // until we know the plugin will use the 2D device. If it uses the 3D device // it will have a window handle. - plugin_->SetWindow(0); + plugin_->SetWindow(gfx::kNullPluginWindow); scoped_ptr<Graphics2DDeviceContext> g2d(new Graphics2DDeviceContext(this)); NPError status = g2d->Initialize(window_rect_, config, context); diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 41d2fa2..a6e0fde 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -656,7 +656,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { NPError rv = NPERR_GENERIC_ERROR; - switch (variable) { + switch (static_cast<int>(variable)) { case NPNVWindowNPObject: { scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); NPObject *np_object = plugin->webplugin()->GetWindowScriptNPObject(); diff --git a/webkit/glue/plugins/webplugin_impl.cc b/webkit/glue/plugins/webplugin_impl.cc index 8a0e75e..693232b 100644 --- a/webkit/glue/plugins/webplugin_impl.cc +++ b/webkit/glue/plugins/webplugin_impl.cc @@ -412,7 +412,7 @@ WebPluginImpl::WebPluginImpl( WebFrame* webframe, const WebPluginParams& params, const base::WeakPtr<WebPluginPageDelegate>& page_delegate) : windowless_(false), - window_(0), + window_(gfx::kNullPluginWindow), accepts_input_events_(false), page_delegate_(page_delegate), webframe_(webframe), @@ -473,7 +473,7 @@ void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) { void WebPluginImpl::WillDestroyWindow(gfx::PluginWindowHandle window) { DCHECK_EQ(window, window_); - window_ = 0; + window_ = gfx::kNullPluginWindow; if (page_delegate_) page_delegate_->WillDestroyPluginWindow(window); } |