summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorthomasvl@google.com <thomasvl@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 14:18:59 +0000
committerthomasvl@google.com <thomasvl@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 14:18:59 +0000
commit7ee1a44c27384650612290a18ccbe736e0e4b955 (patch)
tree563b500ae9e1db27c1659456a33a5f0d7546aaad /ipc
parent23633b659e6bc5f672197eb90eb6ee50b843ba4a (diff)
downloadchromium_src-7ee1a44c27384650612290a18ccbe736e0e4b955.zip
chromium_src-7ee1a44c27384650612290a18ccbe736e0e4b955.tar.gz
chromium_src-7ee1a44c27384650612290a18ccbe736e0e4b955.tar.bz2
Up the warnings in ipc (take 2)
- add chromium_code:1 to the GYP file - Fix some unittest compares of literal 0 to apis that return size_t - initializer order match declared order - type_id is a uint32, so fix up comparison warnings by using the right type in the test code. - duplicate a type cast used in the ipc headers into the ipc impl to make windows happy. - msvc warns about getenv, avoid it. BUG=none TEST=everything still builds/works Review URL: http://codereview.chromium.org/2821028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc.gyp3
-rw-r--r--ipc/ipc_channel_posix.cc6
-rw-r--r--ipc/ipc_fuzzing_tests.cc10
-rw-r--r--ipc/ipc_logging.cc12
-rw-r--r--ipc/ipc_message_utils.cc2
-rw-r--r--ipc/ipc_sync_channel_unittest.cc4
-rw-r--r--ipc/sync_socket_unittest.cc6
7 files changed, 28 insertions, 15 deletions
diff --git a/ipc/ipc.gyp b/ipc/ipc.gyp
index 5560abe..69da83b 100644
--- a/ipc/ipc.gyp
+++ b/ipc/ipc.gyp
@@ -3,6 +3,9 @@
# found in the LICENSE file.
{
+ 'variables': {
+ 'chromium_code': 1,
+ },
'target_defaults': {
'sources/': [
['exclude', '/win/'],
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 6e8e2642..3f910cf 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -699,7 +699,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
// On non-Mac, the Hello message from the client to the server
// also contains the fd_pipe_, which will be used for all
// subsequent file descriptor passing.
- DCHECK_EQ(m.file_descriptor_set()->size(), 1);
+ DCHECK_EQ(m.file_descriptor_set()->size(), 1U);
base::FileDescriptor descriptor;
if (!m.ReadFileDescriptor(&iter, &descriptor)) {
NOTREACHED();
@@ -777,7 +777,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
NOTREACHED();
}
msg = hello.get();
- DCHECK_EQ(msg->file_descriptor_set()->size(), 1);
+ DCHECK_EQ(msg->file_descriptor_set()->size(), 1U);
}
#endif
@@ -853,7 +853,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
if (mode_ != MODE_SERVER && !uses_fifo_ &&
msg->routing_id() == MSG_ROUTING_NONE &&
msg->type() == HELLO_MESSAGE_TYPE) {
- DCHECK_EQ(msg->file_descriptor_set()->size(), 1);
+ DCHECK_EQ(msg->file_descriptor_set()->size(), 1U);
}
if (!uses_fifo_ && !msgh.msg_controllen) {
bytes_written = HANDLE_EINTR(write(pipe_, out_bytes, amt_to_write));
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc
index 37451f4b..f94e170 100644
--- a/ipc/ipc_fuzzing_tests.cc
+++ b/ipc/ipc_fuzzing_tests.cc
@@ -185,7 +185,7 @@ class FuzzerServerListener : public SimpleListener {
Cleanup();
}
- bool RoundtripAckReply(int routing, int type_id, int reply) {
+ bool RoundtripAckReply(int routing, uint32 type_id, int reply) {
IPC::Message* message = new IPC::Message(routing, type_id,
IPC::Message::PRIORITY_NORMAL);
message->WriteInt(reply + 1);
@@ -200,7 +200,7 @@ class FuzzerServerListener : public SimpleListener {
MessageLoop::current()->Quit();
}
- void ReplyMsgNotHandled(int type_id) {
+ void ReplyMsgNotHandled(uint32 type_id) {
RoundtripAckReply(FUZZER_ROUTING_ID, CLIENT_UNHANDLED_IPC, type_id);
Cleanup();
}
@@ -226,7 +226,7 @@ class FuzzerClientListener : public SimpleListener {
MessageLoop::current()->Quit();
}
- bool ExpectMessage(int value, int type_id) {
+ bool ExpectMessage(int value, uint32 type_id) {
if (!MsgHandlerInternal(type_id))
return false;
int msg_value1 = 0;
@@ -246,12 +246,12 @@ class FuzzerClientListener : public SimpleListener {
return true;
}
- bool ExpectMsgNotHandled(int type_id) {
+ bool ExpectMsgNotHandled(uint32 type_id) {
return ExpectMessage(type_id, CLIENT_UNHANDLED_IPC);
}
private:
- bool MsgHandlerInternal(int type_id) {
+ bool MsgHandlerInternal(uint32 type_id) {
MessageLoop::current()->Run();
if (NULL == last_msg_)
return false;
diff --git a/ipc/ipc_logging.cc b/ipc/ipc_logging.cc
index fb2f79b..608abcd 100644
--- a/ipc/ipc_logging.cc
+++ b/ipc/ipc_logging.cc
@@ -49,7 +49,17 @@ Logging::Logging()
sender_(NULL),
main_thread_(MessageLoop::current()),
consumer_(NULL) {
- if (getenv("CHROME_IPC_LOGGING")) {
+#if defined(OS_WIN)
+ // getenv triggers an unsafe warning. Simply check how big of a buffer
+ // would be needed to fetch the value to see if the enviornment variable is
+ // set.
+ size_t requiredSize = 0;
+ getenv_s(&requiredSize, NULL, 0, "CHROME_IPC_LOGGING");
+ bool logging_env_var_set = (requiredSize != 0);
+#else // !defined(OS_WIN)
+ bool logging_env_var_set = (getenv("CHROME_IPC_LOGGING") != NULL);
+#endif //defined(OS_WIN)
+ if (logging_env_var_set) {
enabled_ = true;
enabled_on_stderr_ = true;
}
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index 464dd26..72679aa 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -55,7 +55,7 @@ static void WriteValue(Message* m, const Value* value, int recursion) {
}
case Value::TYPE_BINARY: {
const BinaryValue* binary = static_cast<const BinaryValue*>(value);
- m->WriteData(binary->GetBuffer(), binary->GetSize());
+ m->WriteData(binary->GetBuffer(), static_cast<int>(binary->GetSize()));
break;
}
case Value::TYPE_DICTIONARY: {
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc
index 83b1a7a..87e9773 100644
--- a/ipc/ipc_sync_channel_unittest.cc
+++ b/ipc/ipc_sync_channel_unittest.cc
@@ -728,8 +728,8 @@ class QueuedReplyClient : public Worker {
const std::string& expected_text,
bool pump_during_send)
: Worker(channel_name, Channel::MODE_CLIENT),
- expected_text_(expected_text),
- pump_during_send_(pump_during_send) {
+ pump_during_send_(pump_during_send),
+ expected_text_(expected_text) {
Worker::OverrideThread(listener_thread);
}
diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc
index 8681eb7..d37247d 100644
--- a/ipc/sync_socket_unittest.cc
+++ b/ipc/sync_socket_unittest.cc
@@ -194,7 +194,7 @@ class SyncSocketClientListener : public IPC::Channel::Listener {
socket_->Receive(static_cast<void*>(buf), kHelloStringLength);
EXPECT_EQ(strcmp(str.c_str(), buf), 0);
// After receiving from the socket there should be no bytes left.
- EXPECT_EQ(0, socket_->Peek());
+ EXPECT_EQ(0U, socket_->Peek());
IPC::Message* msg = new MsgClassShutdown();
EXPECT_TRUE(chan_->Send(msg));
MessageLoop::current()->Quit();
@@ -219,8 +219,8 @@ TEST_F(SyncSocketTest, SanityTest) {
base::SyncSocket* pair[2];
base::SyncSocket::CreatePair(pair);
// Immediately after creation there should be no pending bytes.
- EXPECT_EQ(0, pair[0]->Peek());
- EXPECT_EQ(0, pair[1]->Peek());
+ EXPECT_EQ(0U, pair[0]->Peek());
+ EXPECT_EQ(0U, pair[1]->Peek());
base::SyncSocket::Handle target_handle;
// Connect the channel and listener.
ASSERT_TRUE(chan.Connect());