Linux: fix a bunch of NULL vs. 0 issues spotted by gcc 4.5.

There are more gcc 4.5 issues to be solved so GYP_DEFINES=='werror='
is still required to build with 4.5 even with these changes.

BUG=66652
TEST=compiles with gcc 4.5 and trybots

Review URL: http://codereview.chromium.org/6186008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71325 0039d316-1c4b-4281-b951-d872f2087c98
parent 0d75bad6
...@@ -46,7 +46,7 @@ TEST(GtkDndUtilTest, ExtractNamedURLInvalidURL) { ...@@ -46,7 +46,7 @@ TEST(GtkDndUtilTest, ExtractNamedURLInvalidURL) {
GURL url; GURL url;
string16 title; string16 title;
EXPECT_EQ(false, gtk_dnd_util::ExtractNamedURL(&data, &url, &title)); EXPECT_FALSE(gtk_dnd_util::ExtractNamedURL(&data, &url, &title));
} }
TEST(GtkDndUtilTest, ExtractNamedURLInvalidInput) { TEST(GtkDndUtilTest, ExtractNamedURLInvalidInput) {
...@@ -56,13 +56,13 @@ TEST(GtkDndUtilTest, ExtractNamedURLInvalidInput) { ...@@ -56,13 +56,13 @@ TEST(GtkDndUtilTest, ExtractNamedURLInvalidInput) {
data.data = NULL; data.data = NULL;
data.length = 0; data.length = 0;
EXPECT_EQ(false, gtk_dnd_util::ExtractNamedURL(&data, &url, &title)); EXPECT_FALSE(gtk_dnd_util::ExtractNamedURL(&data, &url, &title));
guchar empty_data[] = ""; guchar empty_data[] = "";
data.data = empty_data; data.data = empty_data;
data.length = 0; data.length = 0;
EXPECT_EQ(false, gtk_dnd_util::ExtractNamedURL(&data, &url, &title)); EXPECT_FALSE(gtk_dnd_util::ExtractNamedURL(&data, &url, &title));
const std::string kTitle = "title"; const std::string kTitle = "title";
Pickle pickle; Pickle pickle;
...@@ -73,5 +73,5 @@ TEST(GtkDndUtilTest, ExtractNamedURLInvalidInput) { ...@@ -73,5 +73,5 @@ TEST(GtkDndUtilTest, ExtractNamedURLInvalidInput) {
data.data = test_data.get(); data.data = test_data.get();
data.length = pickle.size(); data.length = pickle.size();
EXPECT_EQ(false, gtk_dnd_util::ExtractNamedURL(&data, &url, &title)); EXPECT_FALSE(gtk_dnd_util::ExtractNamedURL(&data, &url, &title));
} }
...@@ -1431,7 +1431,7 @@ NTPInfoObserver::NTPInfoObserver( ...@@ -1431,7 +1431,7 @@ NTPInfoObserver::NTPInfoObserver(
: automation_(automation), : automation_(automation),
reply_message_(reply_message), reply_message_(reply_message),
consumer_(consumer), consumer_(consumer),
request_(NULL), request_(0),
ntp_info_(new DictionaryValue) { ntp_info_(new DictionaryValue) {
top_sites_ = automation_->profile()->GetTopSites(); top_sites_ = automation_->profile()->GetTopSites();
if (!top_sites_) { if (!top_sites_) {
......
...@@ -256,7 +256,7 @@ TEST_F(LanguagesPageGtkTest, EnableSpellChecking) { ...@@ -256,7 +256,7 @@ TEST_F(LanguagesPageGtkTest, EnableSpellChecking) {
gtk_button_clicked(GTK_BUTTON(page.enable_spellchecking_checkbox_)); gtk_button_clicked(GTK_BUTTON(page.enable_spellchecking_checkbox_));
EXPECT_EQ(FALSE, gtk_toggle_button_get_active( EXPECT_EQ(FALSE, gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page.enable_spellchecking_checkbox_))); GTK_TOGGLE_BUTTON(page.enable_spellchecking_checkbox_)));
EXPECT_EQ(false, profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); EXPECT_FALSE(profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck));
gtk_button_clicked(GTK_BUTTON(page.enable_spellchecking_checkbox_)); gtk_button_clicked(GTK_BUTTON(page.enable_spellchecking_checkbox_));
EXPECT_EQ(TRUE, gtk_toggle_button_get_active( EXPECT_EQ(TRUE, gtk_toggle_button_get_active(
......
...@@ -443,7 +443,7 @@ void TopSites::DiffMostVisited(const MostVisitedURLList& old_list, ...@@ -443,7 +443,7 @@ void TopSites::DiffMostVisited(const MostVisitedURLList& old_list,
CancelableRequestProvider::Handle TopSites::StartQueryForMostVisited() { CancelableRequestProvider::Handle TopSites::StartQueryForMostVisited() {
DCHECK(loaded_); DCHECK(loaded_);
if (!profile_) if (!profile_)
return NULL; return 0;
HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
// |hs| may be null during unit tests. // |hs| may be null during unit tests.
...@@ -454,7 +454,7 @@ CancelableRequestProvider::Handle TopSites::StartQueryForMostVisited() { ...@@ -454,7 +454,7 @@ CancelableRequestProvider::Handle TopSites::StartQueryForMostVisited() {
&cancelable_consumer_, &cancelable_consumer_,
NewCallback(this, &TopSites::OnTopSitesAvailableFromHistory)); NewCallback(this, &TopSites::OnTopSitesAvailableFromHistory));
} }
return NULL; return 0;
} }
TopSites::~TopSites() { TopSites::~TopSites() {
......
...@@ -28,7 +28,7 @@ void PpapiPluginProcessHost::Init(const FilePath& path, ...@@ -28,7 +28,7 @@ void PpapiPluginProcessHost::Init(const FilePath& path,
reply_msg_.reset(reply_msg); reply_msg_.reset(reply_msg);
if (!CreateChannel()) { if (!CreateChannel()) {
ReplyToRenderer(NULL, IPC::ChannelHandle()); ReplyToRenderer(base::kNullProcessHandle, IPC::ChannelHandle());
return; return;
} }
...@@ -38,7 +38,7 @@ void PpapiPluginProcessHost::Init(const FilePath& path, ...@@ -38,7 +38,7 @@ void PpapiPluginProcessHost::Init(const FilePath& path,
FilePath exe_path = ChildProcessHost::GetChildPath(plugin_launcher.empty()); FilePath exe_path = ChildProcessHost::GetChildPath(plugin_launcher.empty());
if (exe_path.empty()) { if (exe_path.empty()) {
ReplyToRenderer(NULL, IPC::ChannelHandle()); ReplyToRenderer(base::kNullProcessHandle, IPC::ChannelHandle());
return; return;
} }
...@@ -92,13 +92,13 @@ void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) { ...@@ -92,13 +92,13 @@ void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) {
PpapiMsg_LoadPlugin* msg = new PpapiMsg_LoadPlugin( PpapiMsg_LoadPlugin* msg = new PpapiMsg_LoadPlugin(
plugins_renderer_handle, plugin_path_, filter_->render_process_id()); plugins_renderer_handle, plugin_path_, filter_->render_process_id());
if (!Send(msg)) // Just send an empty handle on failure. if (!Send(msg)) // Just send an empty handle on failure.
ReplyToRenderer(NULL, IPC::ChannelHandle()); ReplyToRenderer(base::kNullProcessHandle, IPC::ChannelHandle());
// This function will result in OnChannelCreated getting called to finish. // This function will result in OnChannelCreated getting called to finish.
} }
void PpapiPluginProcessHost::OnChannelError() { void PpapiPluginProcessHost::OnChannelError() {
if (reply_msg_.get()) if (reply_msg_.get())
ReplyToRenderer(NULL, IPC::ChannelHandle()); ReplyToRenderer(base::kNullProcessHandle, IPC::ChannelHandle());
} }
void PpapiPluginProcessHost::OnPluginLoaded( void PpapiPluginProcessHost::OnPluginLoaded(
......
...@@ -38,7 +38,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { ...@@ -38,7 +38,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> {
explicit ChromeStarter(int timeout_ms, const FilePath& user_data_dir) explicit ChromeStarter(int timeout_ms, const FilePath& user_data_dir)
: ready_event_(false /* manual */, false /* signaled */), : ready_event_(false /* manual */, false /* signaled */),
done_event_(false /* manual */, false /* signaled */), done_event_(false /* manual */, false /* signaled */),
process_handle_(NULL), process_handle_(base::kNullProcessHandle),
process_terminated_(false), process_terminated_(false),
timeout_ms_(timeout_ms), timeout_ms_(timeout_ms),
user_data_dir_(user_data_dir) { user_data_dir_(user_data_dir) {
......
...@@ -1087,7 +1087,7 @@ BaseTransaction::BaseTransaction(Directory* directory) ...@@ -1087,7 +1087,7 @@ BaseTransaction::BaseTransaction(Directory* directory)
dirkernel_(NULL), dirkernel_(NULL),
name_(NULL), name_(NULL),
source_file_(NULL), source_file_(NULL),
line_(NULL), line_(0),
writer_(INVALID) { writer_(INVALID) {
} }
......
...@@ -101,7 +101,7 @@ TEST(DockInfoTest, IsCloseToMonitorPoint) { ...@@ -101,7 +101,7 @@ TEST(DockInfoTest, IsCloseToMonitorPoint) {
TEST(DockInfoTest, IsValidForPoint) { TEST(DockInfoTest, IsValidForPoint) {
DockInfo d; DockInfo d;
EXPECT_EQ(false, d.IsValidForPoint(gfx::Point(0, 0))); EXPECT_FALSE(d.IsValidForPoint(gfx::Point(0, 0)));
d.set_monitor_bounds(gfx::Rect(0, 0, kPopupWidth, kPopupHeight)); d.set_monitor_bounds(gfx::Rect(0, 0, kPopupWidth, kPopupHeight));
d.set_hot_spot(gfx::Point(0, 0)); d.set_hot_spot(gfx::Point(0, 0));
d.set_type(DockInfo::LEFT_HALF); d.set_type(DockInfo::LEFT_HALF);
...@@ -126,7 +126,7 @@ TEST(DockInfoTest, equals) { ...@@ -126,7 +126,7 @@ TEST(DockInfoTest, equals) {
DockInfo dd; DockInfo dd;
EXPECT_EQ(true, d.equals(dd)); EXPECT_EQ(true, d.equals(dd));
d.set_type(DockInfo::MAXIMIZE); d.set_type(DockInfo::MAXIMIZE);
EXPECT_EQ(false, d.equals(dd)); EXPECT_FALSE(d.equals(dd));
} }
TEST(DockInfoTest, CheckMonitorPoint) { TEST(DockInfoTest, CheckMonitorPoint) {
......
...@@ -57,8 +57,8 @@ NPVariant_Param::~NPVariant_Param() { ...@@ -57,8 +57,8 @@ NPVariant_Param::~NPVariant_Param() {
PluginMsg_UpdateGeometry_Param::PluginMsg_UpdateGeometry_Param() PluginMsg_UpdateGeometry_Param::PluginMsg_UpdateGeometry_Param()
: transparent(false), : transparent(false),
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
windowless_buffer(NULL), windowless_buffer(TransportDIB::DefaultHandleValue()),
background_buffer(NULL) background_buffer(TransportDIB::DefaultHandleValue())
#else #else
ack_key(-1) ack_key(-1)
#endif // !defined(OS_MACOSX) #endif // !defined(OS_MACOSX)
......
...@@ -384,7 +384,7 @@ PepperPluginDelegateImpl::CreatePepperPlugin(const FilePath& path) { ...@@ -384,7 +384,7 @@ PepperPluginDelegateImpl::CreatePepperPlugin(const FilePath& path) {
return module; // Return the NULL module. return module; // Return the NULL module.
// Out of process: have the browser start the plugin process for us. // Out of process: have the browser start the plugin process for us.
base::ProcessHandle plugin_process_handle = NULL; base::ProcessHandle plugin_process_handle = base::kNullProcessHandle;
IPC::ChannelHandle channel_handle; IPC::ChannelHandle channel_handle;
render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin( render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin(
path, &plugin_process_handle, &channel_handle)); path, &plugin_process_handle, &channel_handle));
......
...@@ -676,7 +676,7 @@ TEST_F(RenderViewTest, OnHandleKeyboardEvent) { ...@@ -676,7 +676,7 @@ TEST_F(RenderViewTest, OnHandleKeyboardEvent) {
// We format a string that emulates a DOM-event string produced hy // We format a string that emulates a DOM-event string produced hy
// our JavaScript function. (See the above comment for the format.) // our JavaScript function. (See the above comment for the format.)
static char expected_result[1024]; static char expected_result[1024];
expected_result[0] = NULL; expected_result[0] = 0;
base::snprintf(&expected_result[0], base::snprintf(&expected_result[0],
sizeof(expected_result), sizeof(expected_result),
"\n" // texts in the <input> element "\n" // texts in the <input> element
......
...@@ -174,7 +174,7 @@ TEST(StreamsTest, StreamSetReadWrite) { ...@@ -174,7 +174,7 @@ TEST(StreamsTest, StreamSetReadWrite) {
courgette::SourceStreamSet subset1; courgette::SourceStreamSet subset1;
bool can_read_1 = in.ReadSet(&subset1); bool can_read_1 = in.ReadSet(&subset1);
EXPECT_EQ(true, can_read_1); EXPECT_EQ(true, can_read_1);
EXPECT_EQ(false, in.Empty()); EXPECT_FALSE(in.Empty());
courgette::SourceStreamSet subset2; courgette::SourceStreamSet subset2;
bool can_read_2 = in.ReadSet(&subset2); bool can_read_2 = in.ReadSet(&subset2);
...@@ -183,10 +183,10 @@ TEST(StreamsTest, StreamSetReadWrite) { ...@@ -183,10 +183,10 @@ TEST(StreamsTest, StreamSetReadWrite) {
courgette::SourceStreamSet subset3; courgette::SourceStreamSet subset3;
bool can_read_3 = in.ReadSet(&subset3); bool can_read_3 = in.ReadSet(&subset3);
EXPECT_EQ(false, can_read_3); EXPECT_FALSE(can_read_3);
EXPECT_EQ(false, subset1.Empty()); EXPECT_FALSE(subset1.Empty());
EXPECT_EQ(false, subset1.Empty()); EXPECT_FALSE(subset1.Empty());
uint32 datum; uint32 datum;
EXPECT_EQ(true, subset1.stream(3)->ReadVarint32(&datum)); EXPECT_EQ(true, subset1.stream(3)->ReadVarint32(&datum));
......
...@@ -90,7 +90,7 @@ base::ProcessHandle IPCChannelTest::SpawnChild(ChildType child_type, ...@@ -90,7 +90,7 @@ base::ProcessHandle IPCChannelTest::SpawnChild(ChildType child_type,
fds_to_map.push_back(std::pair<int, int>(ipcfd, kPrimaryIPCChannel + 3)); fds_to_map.push_back(std::pair<int, int>(ipcfd, kPrimaryIPCChannel + 3));
} }
base::ProcessHandle ret = NULL; base::ProcessHandle ret = base::kNullProcessHandle;
switch (child_type) { switch (child_type) {
case TEST_CLIENT: case TEST_CLIENT:
ret = MultiProcessTest::SpawnChild("RunTestClient", ret = MultiProcessTest::SpawnChild("RunTestClient",
...@@ -123,7 +123,7 @@ base::ProcessHandle IPCChannelTest::SpawnChild(ChildType child_type, ...@@ -123,7 +123,7 @@ base::ProcessHandle IPCChannelTest::SpawnChild(ChildType child_type,
debug_on_start); debug_on_start);
break; break;
default: default:
return NULL; return base::kNullProcessHandle;
break; break;
} }
return ret; return ret;
...@@ -367,7 +367,7 @@ MULTIPROCESS_TEST_MAIN(RunTestClient) { ...@@ -367,7 +367,7 @@ MULTIPROCESS_TEST_MAIN(RunTestClient) {
// run message loop // run message loop
MessageLoop::current()->Run(); MessageLoop::current()->Run();
// return true; // return true;
return NULL; return 0;
} }
#endif // !PERFORMANCE_TEST #endif // !PERFORMANCE_TEST
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment