summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-25 20:21:16 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-25 20:21:16 +0000
commitbd635c097dfc689674d6b21c006850a7b07f23f4 (patch)
treeb9c8bdf9edc379e288c14f64e063e29efe7635c8
parent19dc5d7922dc07b61c037ebbcc86f20dad27eab2 (diff)
downloadchromium_src-bd635c097dfc689674d6b21c006850a7b07f23f4.zip
chromium_src-bd635c097dfc689674d6b21c006850a7b07f23f4.tar.gz
chromium_src-bd635c097dfc689674d6b21c006850a7b07f23f4.tar.bz2
Enable warning 4389 as an error on windows builds. This will make
windows builds more similar to linux/mac, which already treat signed/ unsigned equality comparisons as warnings (and hence errors). BUG=44471 TEST=none Review URL: http://codereview.chromium.org/2081007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48186 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/os_exchange_data_provider_win.cc11
-rw-r--r--app/win/window_impl.h4
-rw-r--r--base/crypto/scoped_capi_types.h2
-rw-r--r--base/event_trace_consumer_win_unittest.cc4
-rw-r--r--base/event_trace_controller_win_unittest.cc12
-rw-r--r--base/event_trace_provider_win_unittest.cc4
-rw-r--r--base/file_util_win.cc16
-rw-r--r--base/iat_patch.cc4
-rw-r--r--base/lock_impl_win.cc6
-rw-r--r--base/scoped_bstr_win_unittest.cc6
-rw-r--r--base/thread_local.h4
-rw-r--r--build/common.gypi6
-rw-r--r--chrome/app/chrome_dll_main.cc4
-rw-r--r--chrome/browser/automation/ui_controls_win.cc8
-rw-r--r--chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc4
-rw-r--r--chrome/browser/extensions/extension_uitest.cc6
-rw-r--r--chrome/browser/importer/importer_unittest.cc4
-rw-r--r--chrome/browser/sync/syncable/syncable.cc11
-rw-r--r--chrome/browser/views/select_profile_dialog.cc18
-rw-r--r--chrome_frame/chrome_active_document.cc6
-rw-r--r--chrome_frame/chrome_frame_activex.cc10
-rw-r--r--chrome_frame/chrome_launcher.cc4
-rw-r--r--chrome_frame/function_stub_unittest.cc10
-rw-r--r--chrome_frame/html_utils.cc11
-rw-r--r--chrome_frame/test/chrome_frame_test_utils.cc2
-rw-r--r--chrome_frame/test/exception_barrier_unittest.cc6
-rw-r--r--chrome_frame/test/html_util_unittests.cc6
-rw-r--r--chrome_frame/test/perf/chrome_frame_perftest.cc6
-rw-r--r--chrome_frame/test/util_unittests.cc6
-rw-r--r--chrome_frame/urlmon_url_request.cc6
-rw-r--r--gfx/icon_util.cc6
-rw-r--r--net/base/listen_socket_unittest.cc4
-rw-r--r--net/base/network_change_notifier_win.cc4
-rw-r--r--net/tools/dump_cache/cache_dumper.cc8
-rw-r--r--net/tools/dump_cache/upgrade.cc8
-rw-r--r--sandbox/src/file_policy_test.cc32
-rw-r--r--sandbox/src/interception_unittest.cc16
-rw-r--r--sandbox/src/job_unittest.cc18
-rw-r--r--sandbox/src/restricted_token_unittest.cc8
-rw-r--r--sandbox/src/win_utils_unittest.cc4
-rw-r--r--views/controls/table/table_view.cc2
-rw-r--r--webkit/default_plugin/plugin_database_handler.cc4
42 files changed, 163 insertions, 158 deletions
diff --git a/app/os_exchange_data_provider_win.cc b/app/os_exchange_data_provider_win.cc
index b977252..9429b58 100644
--- a/app/os_exchange_data_provider_win.cc
+++ b/app/os_exchange_data_provider_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -84,7 +84,7 @@ class FormatEtcEnumerator : public IEnumFORMATETC {
std::vector<FORMATETC*> contents_;
// The cursor of the active enumeration - an index into |contents_|.
- int cursor_;
+ size_t cursor_;
LONG ref_count_;
@@ -125,9 +125,8 @@ STDMETHODIMP FormatEtcEnumerator::Next(
DCHECK(count == 1);
// This method copies count elements into |elements_array|.
- int index = 0;
- while (cursor_ < static_cast<int>(contents_.size()) &&
- static_cast<ULONG>(index) < count) {
+ ULONG index = 0;
+ while (cursor_ < contents_.size() && index < count) {
CloneFormatEtc(contents_.at(cursor_), &elements_array[index]);
++cursor_;
++index;
@@ -144,7 +143,7 @@ STDMETHODIMP FormatEtcEnumerator::Skip(ULONG skip_count) {
cursor_ += skip_count;
// MSDN implies it's OK to leave the enumerator trashed.
// "Whatever you say, boss"
- return cursor_ <= static_cast<int>(contents_.size()) ? S_OK : S_FALSE;
+ return cursor_ <= contents_.size() ? S_OK : S_FALSE;
}
STDMETHODIMP FormatEtcEnumerator::Reset() {
diff --git a/app/win/window_impl.h b/app/win/window_impl.h
index 67f3bf7..f63894e 100644
--- a/app/win/window_impl.h
+++ b/app/win/window_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -65,7 +65,7 @@ class WindowImpl : public MessageMapInterface {
// Sets the class style to use. The default is CS_DBLCLKS.
void set_initial_class_style(UINT class_style) {
// We dynamically generate the class name, so don't register it globally!
- DCHECK_EQ((class_style & CS_GLOBALCLASS), 0);
+ DCHECK_EQ((class_style & CS_GLOBALCLASS), 0u);
class_style_ = class_style;
}
UINT initial_class_style() const { return class_style_; }
diff --git a/base/crypto/scoped_capi_types.h b/base/crypto/scoped_capi_types.h
index 73fe51b..bdb05c3 100644
--- a/base/crypto/scoped_capi_types.h
+++ b/base/crypto/scoped_capi_types.h
@@ -64,7 +64,7 @@ class ScopedCAPIHandle {
CAPIHandle get() const { return handle_; }
CAPIHandle* receive() {
- CHECK_EQ(NULL, handle_);
+ CHECK(handle_ == NULL);
return &handle_;
}
diff --git a/base/event_trace_consumer_win_unittest.cc b/base/event_trace_consumer_win_unittest.cc
index 9fcc4a6..6c0a740 100644
--- a/base/event_trace_consumer_win_unittest.cc
+++ b/base/event_trace_consumer_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
//
@@ -232,7 +232,7 @@ TEST_F(EtwTraceConsumerRealtimeTest, ConsumeEvent) {
INFINITE));
ASSERT_HRESULT_SUCCEEDED(controller.Stop(NULL));
ASSERT_HRESULT_SUCCEEDED(JoinConsumerThread());
- ASSERT_NE(0, TestConsumer::events_.size());
+ ASSERT_NE(0u, TestConsumer::events_.size());
}
namespace {
diff --git a/base/event_trace_controller_win_unittest.cc b/base/event_trace_controller_win_unittest.cc
index f688d48..06170de 100644
--- a/base/event_trace_controller_win_unittest.cc
+++ b/base/event_trace_controller_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
//
@@ -62,9 +62,9 @@ TEST(EtwTracePropertiesTest, Initialization) {
EtwTraceProperties prop;
EVENT_TRACE_PROPERTIES* p = prop.get();
- EXPECT_NE(0, p->Wnode.BufferSize);
- EXPECT_EQ(0, p->Wnode.ProviderId);
- EXPECT_EQ(0, p->Wnode.HistoricalContext);
+ EXPECT_NE(0u, p->Wnode.BufferSize);
+ EXPECT_EQ(0u, p->Wnode.ProviderId);
+ EXPECT_EQ(0u, p->Wnode.HistoricalContext);
EXPECT_TRUE(kGuidNull == p->Wnode.Guid);
EXPECT_EQ(0, p->Wnode.ClientContext);
@@ -86,8 +86,8 @@ TEST(EtwTracePropertiesTest, Initialization) {
EXPECT_EQ(0, p->LogBuffersLost);
EXPECT_EQ(0, p->RealTimeBuffersLost);
EXPECT_EQ(0, p->LoggerThreadId);
- EXPECT_NE(0, p->LogFileNameOffset);
- EXPECT_NE(0, p->LoggerNameOffset);
+ EXPECT_NE(0u, p->LogFileNameOffset);
+ EXPECT_NE(0u, p->LoggerNameOffset);
}
TEST(EtwTracePropertiesTest, Strings) {
diff --git a/base/event_trace_provider_win_unittest.cc b/base/event_trace_provider_win_unittest.cc
index 2ffae82..1efa74f 100644
--- a/base/event_trace_provider_win_unittest.cc
+++ b/base/event_trace_provider_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
//
@@ -88,7 +88,7 @@ TEST(EtwTraceProviderTest, Register) {
TEST(EtwTraceProviderTest, RegisterWithNoNameFails) {
EtwTraceProvider provider;
- EXPECT_NE(ERROR_SUCCESS, provider.Register());
+ EXPECT_TRUE(provider.Register() != ERROR_SUCCESS);
}
TEST(EtwTraceProviderTest, Enable) {
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 4f96ef3..fb65feb 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -656,15 +656,11 @@ int ReadFile(const FilePath& filename, char* data, int size) {
if (file == INVALID_HANDLE_VALUE)
return -1;
- int ret_value;
DWORD read;
- if (::ReadFile(file, data, size, &read, NULL) && read == size) {
- ret_value = static_cast<int>(read);
- } else {
- ret_value = -1;
- }
-
- return ret_value;
+ if (::ReadFile(file, data, size, &read, NULL) &&
+ static_cast<int>(read) == size)
+ return read;
+ return -1;
}
int WriteFile(const FilePath& filename, const char* data, int size) {
@@ -684,8 +680,8 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
DWORD written;
BOOL result = ::WriteFile(file, data, size, &written, NULL);
- if (result && written == size)
- return static_cast<int>(written);
+ if (result && static_cast<int>(written) == size)
+ return written;
if (!result) {
// WriteFile failed.
diff --git a/base/iat_patch.cc b/base/iat_patch.cc
index e705713..fa5109f 100644
--- a/base/iat_patch.cc
+++ b/base/iat_patch.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.
@@ -178,7 +178,7 @@ IATPatchFunction::IATPatchFunction()
IATPatchFunction::~IATPatchFunction() {
if (NULL != intercept_function_) {
DWORD error = Unpatch();
- DCHECK_EQ(NO_ERROR, error);
+ DCHECK(error == NO_ERROR);
}
}
diff --git a/base/lock_impl_win.cc b/base/lock_impl_win.cc
index 0f0e424..0d1ac93 100644
--- a/base/lock_impl_win.cc
+++ b/base/lock_impl_win.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.
@@ -29,7 +29,7 @@ bool LockImpl::Try() {
#ifndef NDEBUG
// ONLY access data after locking.
owning_thread_id_ = PlatformThread::CurrentId();
- DCHECK_NE(owning_thread_id_, 0);
+ DCHECK_NE(owning_thread_id_, 0u);
recursion_count_shadow_++;
if (2 == recursion_count_shadow_ && !recursion_used_) {
recursion_used_ = true;
@@ -46,7 +46,7 @@ void LockImpl::Lock() {
#ifndef NDEBUG
// ONLY access data after locking.
owning_thread_id_ = PlatformThread::CurrentId();
- DCHECK_NE(owning_thread_id_, 0);
+ DCHECK_NE(owning_thread_id_, 0u);
recursion_count_shadow_++;
if (2 == recursion_count_shadow_ && !recursion_used_) {
recursion_used_ = true;
diff --git a/base/scoped_bstr_win_unittest.cc b/base/scoped_bstr_win_unittest.cc
index a2e49ac..276f13b 100644
--- a/base/scoped_bstr_win_unittest.cc
+++ b/base/scoped_bstr_win_unittest.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.
@@ -52,10 +52,10 @@ void BasicBstrTests() {
EXPECT_TRUE(b2.ByteLength() == 100);
EXPECT_TRUE(b2.Length() == 100 / sizeof(kTestString1[0]));
lstrcpyW(static_cast<BSTR>(b2), kTestString1);
- EXPECT_TRUE(lstrlen(b2) == test1_len);
+ EXPECT_TRUE(lstrlen(b2) == static_cast<int>(test1_len));
EXPECT_TRUE(b2.Length() == 100 / sizeof(kTestString1[0]));
b2.SetByteLen(lstrlen(b2) * sizeof(kTestString2[0]));
- EXPECT_TRUE(lstrlen(b2) == b2.Length());
+ EXPECT_TRUE(lstrlen(b2) == static_cast<int>(b2.Length()));
EXPECT_TRUE(b1.Allocate(kTestString2) != NULL);
EXPECT_TRUE(b1.Length() == test2_len);
diff --git a/base/thread_local.h b/base/thread_local.h
index be387cf..ec53da5 100644
--- a/base/thread_local.h
+++ b/base/thread_local.h
@@ -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.
@@ -59,7 +59,7 @@ namespace base {
// Helper functions that abstract the cross-platform APIs. Do not use directly.
struct ThreadLocalPlatform {
#if defined(OS_WIN)
- typedef int SlotType;
+ typedef unsigned long SlotType;
#elif defined(OS_POSIX)
typedef pthread_key_t SlotType;
#endif
diff --git a/build/common.gypi b/build/common.gypi
index 0e66dba..be7a21e 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -554,6 +554,12 @@
# We use "POSIX" to refer to all non-Windows operating systems.
['OS=="win"', {
'sources/': [ ['exclude', '_posix\\.cc$'] ],
+ # turn on warnings for signed/unsigned mismatch on chromium code.
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': ['/we4389'],
+ },
+ },
}],
# Though Skia is conceptually shared by Linux and Windows,
# the only _skia files in our tree are Linux-specific.
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index edfadd9..ca682a5 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -524,7 +524,7 @@ int ChromeMain(int argc, char** argv) {
browser_pid =
static_cast<base::ProcessId>(StringToInt(WideToASCII(channel_name)));
- DCHECK_NE(browser_pid, 0);
+ DCHECK_NE(browser_pid, 0u);
#else
browser_pid = base::GetCurrentProcId();
#endif
diff --git a/chrome/browser/automation/ui_controls_win.cc b/chrome/browser/automation/ui_controls_win.cc
index 4e9f673..85aafec 100644
--- a/chrome/browser/automation/ui_controls_win.cc
+++ b/chrome/browser/automation/ui_controls_win.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.
@@ -183,7 +183,7 @@ bool SendKeyPressImpl(base::KeyboardCode key,
INPUT input[8] = { 0 }; // 8, assuming all the modifiers are activated
- int i = 0;
+ UINT i = 0;
if (control) {
if (!FillKeyboardInput(base::VKEY_CONTROL, &input[i], false))
return false;
@@ -228,9 +228,7 @@ bool SendKeyPressImpl(base::KeyboardCode key,
i++;
}
- unsigned int rv = ::SendInput(i, input, sizeof(INPUT));
-
- if (rv != i)
+ if (::SendInput(i, input, sizeof(INPUT) != i))
return false;
if (dispatcher.get())
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
index 79755e9..be08b4c6 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
+++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.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.
@@ -79,7 +79,7 @@ void DevToolsRemoteListenSocketTester::SetUp() {
// verify the connect/accept and setup test_socket_
test_socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- ASSERT_NE(-1, test_socket_);
+ ASSERT_NE(INVALID_SOCKET, test_socket_);
struct sockaddr_in client;
client.sin_family = AF_INET;
client.sin_addr.s_addr = inet_addr(kLoopback);
diff --git a/chrome/browser/extensions/extension_uitest.cc b/chrome/browser/extensions/extension_uitest.cc
index 6457728..9adb732 100644
--- a/chrome/browser/extensions/extension_uitest.cc
+++ b/chrome/browser/extensions/extension_uitest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -163,7 +163,7 @@ TEST_F(ExtensionTestSimpleApiCall, FLAKY_RunTest) {
int callback_id = 0xBAADF00D;
message_dict->GetInteger(keys::kAutomationRequestIdKey, &callback_id);
- EXPECT_NE(callback_id, 0xBAADF00D);
+ EXPECT_NE(callback_id, static_cast<int>(0xBAADF00D));
bool has_callback = true;
EXPECT_TRUE(message_dict->GetBoolean(keys::kAutomationHasCallbackKey,
@@ -246,7 +246,7 @@ public:
std::string args;
EXPECT_TRUE(request_dict->GetString(keys::kAutomationArgsKey, &args));
- EXPECT_NE(args.find("42"), -1);
+ EXPECT_NE(std::string::npos, args.find("42"));
loop_.Quit();
} else {
FAIL();
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index eac9bed..3da8361 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -122,7 +122,7 @@ const int kMaxPathSize = 5;
typedef struct {
const bool in_toolbar;
- const int path_size;
+ const size_t path_size;
const wchar_t* path[kMaxPathSize];
const wchar_t* title;
const char* url;
@@ -184,7 +184,7 @@ bool FindBookmarkEntry(const ProfileWriter::BookmarkEntry& entry,
list[i].url == entry.url.spec() &&
list[i].title == entry.title) {
bool equal = true;
- for (int k = 0; k < list[i].path_size; ++k)
+ for (size_t k = 0; k < list[i].path_size; ++k)
if (list[i].path[k] != entry.path[k]) {
equal = false;
break;
diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc
index 01c2fc7..ae0307c 100644
--- a/chrome/browser/sync/syncable/syncable.cc
+++ b/chrome/browser/sync/syncable/syncable.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -586,12 +586,13 @@ void Directory::VacuumAfterSaveChanges(const SaveChangesSnapshot& snapshot) {
size_t num_erased = 0;
kernel_->flushed_metahandles.Push(entry->ref(META_HANDLE));
num_erased = kernel_->ids_index->erase(entry);
- DCHECK(1 == num_erased);
+ DCHECK_EQ(1u, num_erased);
num_erased = kernel_->metahandles_index->erase(entry);
- DCHECK(1 == num_erased);
+ DCHECK_EQ(1u, num_erased);
- num_erased = kernel_->client_tag_index->erase(entry); // Might not be in it
- DCHECK(!entry->ref(UNIQUE_CLIENT_TAG).empty() == num_erased);
+ // Might not be in it
+ num_erased = kernel_->client_tag_index->erase(entry);
+ DCHECK_EQ(entry->ref(UNIQUE_CLIENT_TAG).empty(), !num_erased);
delete entry;
}
}
diff --git a/chrome/browser/views/select_profile_dialog.cc b/chrome/browser/views/select_profile_dialog.cc
index d4af82e..c92c2f8 100644
--- a/chrome/browser/views/select_profile_dialog.cc
+++ b/chrome/browser/views/select_profile_dialog.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.
@@ -83,8 +83,8 @@ std::wstring SelectProfileDialog::GetWindowTitle() const {
}
bool SelectProfileDialog::Accept() {
- int index = profile_combobox_->selected_item();
- if (index < 0) {
+ size_t index = profile_combobox_->selected_item();
+ if (index > profiles_.size()) {
NOTREACHED();
return true;
}
@@ -93,11 +93,10 @@ bool SelectProfileDialog::Accept() {
// new profile dialog to the user.
if (index == profiles_.size()) {
NewProfileDialog::RunDialog();
- return true;
+ } else {
+ std::wstring profile_name = profiles_[index];
+ UserDataManager::Get()->LaunchChromeForProfile(profile_name);
}
-
- std::wstring profile_name = profiles_[index];
- UserDataManager::Get()->LaunchChromeForProfile(profile_name);
return true;
}
@@ -116,10 +115,11 @@ int SelectProfileDialog::GetItemCount() {
}
std::wstring SelectProfileDialog::GetItemAt(int index) {
- DCHECK(index >= 0 && index <= static_cast<int>(profiles_.size()));
+ size_t index_size_t = index;
+ DCHECK_LE(index_size_t, profiles_.size());
// For the last item in the drop down, return the <New Profile> text,
// otherwise return the corresponding profile name from the vector.
- return index == profiles_.size() ?
+ return index_size_t == profiles_.size() ?
l10n_util::GetString(IDS_SELECT_PROFILE_DIALOG_NEW_PROFILE_ENTRY) :
profiles_[index];
}
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index 3dab106..894564a 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -873,11 +873,11 @@ bool ChromeActiveDocument::HandleContextMenuCommand(UINT cmd,
ScopedComPtr<IWebBrowser2> web_browser2;
DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive());
- if (cmd == context_menu_IDC_BACK) {
+ if (cmd == static_cast<UINT>(context_menu_IDC_BACK)) {
web_browser2->GoBack();
- } else if (cmd == context_menu_IDC_FORWARD) {
+ } else if (cmd == static_cast<UINT>(context_menu_IDC_FORWARD)) {
web_browser2->GoForward();
- } else if (cmd == context_menu_IDC_RELOAD) {
+ } else if (cmd == static_cast<UINT>(context_menu_IDC_RELOAD)) {
web_browser2->Refresh();
} else {
return BaseActiveX::HandleContextMenuCommand(cmd, params);
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc
index fb8721d..bd6b937 100644
--- a/chrome_frame/chrome_frame_activex.cc
+++ b/chrome_frame/chrome_frame_activex.cc
@@ -128,11 +128,11 @@ HRESULT ChromeFrameActivex::FinalConstruct() {
ChromeFrameActivex::~ChromeFrameActivex() {
// We expect these to be released during a call to SetClientSite(NULL).
- DCHECK_EQ(0, onmessage_.size());
- DCHECK_EQ(0, onloaderror_.size());
- DCHECK_EQ(0, onload_.size());
- DCHECK_EQ(0, onreadystatechanged_.size());
- DCHECK_EQ(0, onextensionready_.size());
+ DCHECK_EQ(0u, onmessage_.size());
+ DCHECK_EQ(0u, onloaderror_.size());
+ DCHECK_EQ(0u, onload_.size());
+ DCHECK_EQ(0u, onreadystatechanged_.size());
+ DCHECK_EQ(0u, onextensionready_.size());
if (chrome_wndproc_hook_) {
BOOL unhook_success = ::UnhookWindowsHookEx(chrome_wndproc_hook_);
diff --git a/chrome_frame/chrome_launcher.cc b/chrome_frame/chrome_launcher.cc
index 0303b3b..34f1e9f 100644
--- a/chrome_frame/chrome_launcher.cc
+++ b/chrome_frame/chrome_launcher.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -65,7 +65,7 @@ CommandLine* CreateLaunchCommandLine() {
}
void SanitizeCommandLine(const CommandLine& original, CommandLine* sanitized) {
- int num_sanitized_switches = 0;
+ size_t num_sanitized_switches = 0;
for (int i = 0; i < arraysize(kAllowedSwitches); ++i) {
const char* current_switch = kAllowedSwitches[i];
if (original.HasSwitch(current_switch)) {
diff --git a/chrome_frame/function_stub_unittest.cc b/chrome_frame/function_stub_unittest.cc
index 4ad2c31..3f89bec 100644
--- a/chrome_frame/function_stub_unittest.cc
+++ b/chrome_frame/function_stub_unittest.cc
@@ -74,13 +74,15 @@ class FunctionStubTest: public testing::Test {
static uintptr_t CALLBACK FooCallback0(FunctionStubTest* test) {
return test->Foo0();
}
- static uintptr_t CALLBACK FooCallback1(FunctionStubTest* test, uintptr_t arg) {
+ static uintptr_t CALLBACK FooCallback1(FunctionStubTest* test,
+ uintptr_t arg) {
return test->Foo1(arg);
}
static uintptr_t CALLBACK BarCallback0(FunctionStubTest* test) {
return test->Foo0();
}
- static uintptr_t CALLBACK BarCallback1(FunctionStubTest* test, uintptr_t arg) {
+ static uintptr_t CALLBACK BarCallback1(FunctionStubTest* test,
+ uintptr_t arg) {
return test->Foo1(arg);
}
@@ -119,10 +121,10 @@ TEST_F(FunctionStubTest, Accessors) {
// Check that the stub code is executable.
MEMORY_BASIC_INFORMATION info = {};
- EXPECT_NE(0, ::VirtualQuery(stub_->code(), &info, sizeof(info)));
+ EXPECT_NE(0u, ::VirtualQuery(stub_->code(), &info, sizeof(info)));
const DWORD kExecutableMask = PAGE_EXECUTE | PAGE_EXECUTE_READ |
PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY;
- EXPECT_NE(0, info.Protect & kExecutableMask);
+ EXPECT_NE(0u, info.Protect & kExecutableMask);
EXPECT_EQ(argument, stub_->argument());
EXPECT_TRUE(stub_->bypass_address() != NULL);
diff --git a/chrome_frame/html_utils.cc b/chrome_frame/html_utils.cc
index 9395afa..8c8d6d3 100644
--- a/chrome_frame/html_utils.cc
+++ b/chrome_frame/html_utils.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
//
@@ -342,15 +342,13 @@ std::string GetDefaultUserAgent() {
} else if (SUCCEEDED(hr)) {
// Truncate the extra allocation.
DCHECK(size > 0); // NOLINT
- ret.resize(size - sizeof(char)); // NOLINT
+ ret.resize(size - 1); // NOLINT
}
}
if (FAILED(hr)) {
NOTREACHED() << StringPrintf("ObtainUserAgentString==0x%08X", hr);
- return "";
- } else {
- DCHECK(ret.length() == lstrlenA(ret.c_str()));
+ return std::string();
}
return ret;
@@ -362,7 +360,8 @@ bool HasFrameBustingHeader(const std::string& http_headers) {
while (it.GetNext()) {
if (lstrcmpiA(it.name().c_str(), kXFrameOptionsHeader) == 0) {
std::string allow_all(kXFrameOptionsValueAllowAll);
- if (it.values_end() - it.values_begin() != allow_all.length() ||
+ if (it.values_end() - it.values_begin() !=
+ static_cast<int>(allow_all.length()) ||
!std::equal(it.values_begin(), it.values_end(),
allow_all.begin(),
CaseInsensitiveCompareASCII<const char>())) {
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc
index 80f2786..0659c9d 100644
--- a/chrome_frame/test/chrome_frame_test_utils.cc
+++ b/chrome_frame/test/chrome_frame_test_utils.cc
@@ -775,7 +775,7 @@ HRESULT WebBrowserEventSink::SetWebBrowser(IWebBrowser2* web_browser2) {
}
HRESULT WebBrowserEventSink::CloseWebBrowser() {
- DCHECK_EQ(process_id_to_wait_for_, 0);
+ DCHECK_EQ(process_id_to_wait_for_, 0u);
if (!web_browser2_)
return E_FAIL;
diff --git a/chrome_frame/test/exception_barrier_unittest.cc b/chrome_frame/test/exception_barrier_unittest.cc
index eeffd2a..73f006a 100644
--- a/chrome_frame/test/exception_barrier_unittest.cc
+++ b/chrome_frame/test/exception_barrier_unittest.cc
@@ -29,7 +29,7 @@ void TestSEHChainSane() {
MEMORY_BASIC_INFORMATION info = { 0 };
// Note that we pass the address of the info struct just as a handy
// moniker to anything at all inside our stack allocation
- ASSERT_NE(0, ::VirtualQuery(&info, &info, sizeof(info)));
+ ASSERT_NE(0u, ::VirtualQuery(&info, &info, sizeof(info)));
// The lower bound of our stack.
// We use the address of info as a lower bound, this assumes that if this
@@ -60,9 +60,9 @@ void TestSEHChainSane() {
ASSERT_EQ(0, (reinterpret_cast<UINT_PTR>(prev) & 0x00000003));
// find the module hosting the handler
- ASSERT_NE(0, ::VirtualQuery(curr->handler, &info, sizeof(info)));
+ ASSERT_NE(0u, ::VirtualQuery(curr->handler, &info, sizeof(info)));
wchar_t module_filename[MAX_PATH];
- ASSERT_NE(0, ::GetModuleFileName(
+ ASSERT_NE(0u, ::GetModuleFileName(
reinterpret_cast<HMODULE>(info.AllocationBase),
module_filename, ARRAYSIZE(module_filename)));
}
diff --git a/chrome_frame/test/html_util_unittests.cc b/chrome_frame/test/html_util_unittests.cc
index 1188482..5539e4a 100644
--- a/chrome_frame/test/html_util_unittests.cc
+++ b/chrome_frame/test/html_util_unittests.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 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.
@@ -292,14 +292,14 @@ TEST_F(HtmlUtilUnittest, AddChromeFrameToUserAgentValue) {
TEST_F(HtmlUtilUnittest, GetDefaultUserAgentHeaderWithCFTag) {
std::string ua(http_utils::GetDefaultUserAgentHeaderWithCFTag());
- EXPECT_NE(0, ua.length());
+ EXPECT_NE(0u, ua.length());
EXPECT_NE(std::string::npos, ua.find("Mozilla"));
EXPECT_NE(std::string::npos, ua.find(kChromeFrameUserAgent));
}
TEST_F(HtmlUtilUnittest, GetDefaultUserAgent) {
std::string ua(http_utils::GetDefaultUserAgent());
- EXPECT_NE(0, ua.length());
+ EXPECT_NE(0u, ua.length());
EXPECT_NE(std::string::npos, ua.find("Mozilla"));
}
diff --git a/chrome_frame/test/perf/chrome_frame_perftest.cc b/chrome_frame/test/perf/chrome_frame_perftest.cc
index a3d3b99..4806865 100644
--- a/chrome_frame/test/perf/chrome_frame_perftest.cc
+++ b/chrome_frame/test/perf/chrome_frame_perftest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 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.
#include "chrome_frame/test/perf/chrome_frame_perftest.h"
@@ -508,7 +508,7 @@ class ChromeFrameMemoryTest : public ChromeFramePerfTestBase {
chrome_frame_memory_test_instance_->PrintResult(
"ws_final_browser", "", trace_name + "_ws_b",
working_set_size_ / 1024, "KB", false /* not important */);
- } else if (process_id_ == GetCurrentProcessId()) {
+ } else if (process_id_ == base::GetCurrentProcId()) {
chrome_frame_memory_test_instance_->PrintResult(
"vm_current_process", "", trace_name + "_vm_c",
virtual_size_ / 1024, "KB", false /* not important */);
@@ -520,7 +520,7 @@ class ChromeFrameMemoryTest : public ChromeFramePerfTestBase {
printf("\n");
}
- int process_id_;
+ base::ProcessId process_id_;
size_t virtual_size_;
size_t working_set_size_;
// Set to true if this is the chrome browser process.
diff --git a/chrome_frame/test/util_unittests.cc b/chrome_frame/test/util_unittests.cc
index 8780d3d..81bc752 100644
--- a/chrome_frame/test/util_unittests.cc
+++ b/chrome_frame/test/util_unittests.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 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.
@@ -24,8 +24,8 @@ TEST(UtilTests, GetModuleVersionTest) {
// Use the method that doesn't go to disk
uint32 low = 0, high = 0;
EXPECT_TRUE(GetModuleVersion(mod, &high, &low));
- EXPECT_NE(high, 0);
- EXPECT_NE(low, 0);
+ EXPECT_NE(high, 0u);
+ EXPECT_NE(low, 0u);
// Make sure they give the same results.
FileVersionInfoWin* base_info_win =
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index fb7e740..922a951 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -119,7 +119,7 @@ bool UrlmonUrlRequest::Read(int bytes_to_read) {
DLOG(INFO) << __FUNCTION__ << me();
// Re-entrancy check. Thou shall not call Read() while process OnReadComplete!
- DCHECK_EQ(0, pending_read_size_);
+ DCHECK_EQ(0u, pending_read_size_);
if (pending_read_size_ != 0)
return false;
@@ -1136,7 +1136,7 @@ void UrlmonUrlRequestManager::OnResponseEnd(int request_id,
DLOG(INFO) << __FUNCTION__;
DCHECK(status.status() != URLRequestStatus::CANCELED);
RequestMap::size_type n = request_map_.erase(request_id);
- DCHECK_EQ(1, n);
+ DCHECK_EQ(1u, n);
++calling_delegate_;
delegate_->OnResponseEnd(request_id, status);
--calling_delegate_;
diff --git a/gfx/icon_util.cc b/gfx/icon_util.cc
index b3b89a8..8ce2279 100644
--- a/gfx/icon_util.cc
+++ b/gfx/icon_util.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.
@@ -176,7 +176,7 @@ SkBitmap* IconUtil::CreateSkBitmapFromHICON(HICON icon, const gfx::Size& s) {
if (!bitmap_has_alpha_channel) {
unsigned int* p = static_cast<unsigned int*>(bitmap->getPixels());
for (size_t i = 0; i < num_pixels; ++p, ++i) {
- DCHECK_EQ((*p & 0xff000000), 0);
+ DCHECK_EQ((*p & 0xff000000), 0u);
if (opaque[i])
*p |= 0xff000000;
else
@@ -259,7 +259,7 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap,
DWORD bytes_written;
bool delete_file = false;
if (!WriteFile(icon_file.Get(), buffer, buffer_size, &bytes_written, NULL) ||
- bytes_written != buffer_size) {
+ static_cast<int>(bytes_written) != buffer_size) {
delete_file = true;
}
diff --git a/net/base/listen_socket_unittest.cc b/net/base/listen_socket_unittest.cc
index eb224c3..ed2b566 100644
--- a/net/base/listen_socket_unittest.cc
+++ b/net/base/listen_socket_unittest.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.
@@ -54,7 +54,7 @@ void ListenSocketTester::SetUp() {
// verify the connect/accept and setup test_socket_
test_socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- ASSERT_NE(-1, test_socket_);
+ ASSERT_NE(INVALID_SOCKET, test_socket_);
struct sockaddr_in client;
client.sin_family = AF_INET;
client.sin_addr.s_addr = inet_addr(kLoopback);
diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc
index 8ae39fb..02b1834 100644
--- a/net/base/network_change_notifier_win.cc
+++ b/net/base/network_change_notifier_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -51,7 +51,7 @@ NetworkChangeNotifierWin::Impl::~Impl() {
void NetworkChangeNotifierWin::Impl::WatchForAddressChange() {
HANDLE handle = NULL;
DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_);
- CHECK_EQ(ERROR_IO_PENDING, ret);
+ CHECK(ret == ERROR_IO_PENDING);
addr_watcher_.StartWatching(addr_overlapped_.hEvent, this);
}
diff --git a/net/tools/dump_cache/cache_dumper.cc b/net/tools/dump_cache/cache_dumper.cc
index 20ba6b5..a2e071a3 100644
--- a/net/tools/dump_cache/cache_dumper.cc
+++ b/net/tools/dump_cache/cache_dumper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -89,6 +89,10 @@ bool DiskDumper::CreateEntry(const std::string& key,
#ifdef WIN32_LARGE_FILENAME_SUPPORT
entry_ = CreateFileW(file.c_str(), GENERIC_WRITE|GENERIC_READ, 0, 0,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+ if (entry_ == INVALID_HANDLE_VALUE) {
+ wprintf(L"CreateFileW (%s) failed: %d\n", file.c_str(), GetLastError());
+ return false;
+ }
return entry_ != INVALID_HANDLE_VALUE;
#else
entry_ = file_util::OpenFile(entry_path_, "w+");
@@ -184,7 +188,7 @@ bool DiskDumper::WriteEntry(disk_cache::Entry* entry, int index, int offset,
#ifdef WIN32_LARGE_FILENAME_SUPPORT
DWORD bytes;
DWORD rv = WriteFile(entry_, data, len, &bytes, 0);
- return rv == TRUE && bytes == len;
+ return rv == TRUE && bytes == static_cast<DWORD>(len);
#else
int bytes = fwrite(data, 1, len, entry_);
return bytes == len;
diff --git a/net/tools/dump_cache/upgrade.cc b/net/tools/dump_cache/upgrade.cc
index 566eb0b..71031dc 100644
--- a/net/tools/dump_cache/upgrade.cc
+++ b/net/tools/dump_cache/upgrade.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 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.
@@ -367,11 +367,11 @@ void MasterSM::DoGetKey(int bytes_read) {
return Fail();
std::string key(input_->buffer);
- DCHECK(key.size() == input_->msg.buffer_bytes - 1);
+ DCHECK(key.size() == static_cast<size_t>(input_->msg.buffer_bytes - 1));
if (!writer_->CreateEntry(key,
reinterpret_cast<disk_cache::Entry**>(&entry_))) {
- printf("Skipping entry \"%s\" (name conflict!)\n", key.c_str());
+ printf("Skipping entry \"%s\": %d\n", key.c_str(), GetLastError());
return SendGetPrevEntry();
}
@@ -698,7 +698,7 @@ void SlaveSM::DoGetKey() {
msg.buffer_bytes = std::min(key.size() + 1,
static_cast<size_t>(kBufferSize));
memcpy(output_->buffer, key.c_str(), msg.buffer_bytes);
- if (msg.buffer_bytes != key.size() + 1) {
+ if (msg.buffer_bytes != static_cast<int32>(key.size() + 1)) {
// We don't support moving this entry. Just tell the master.
msg.result = RESULT_NAME_OVERFLOW;
} else {
diff --git a/sandbox/src/file_policy_test.cc b/sandbox/src/file_policy_test.cc
index f4a2e19..01a8383 100644
--- a/sandbox/src/file_policy_test.cc
+++ b/sandbox/src/file_policy_test.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 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.
@@ -262,8 +262,8 @@ TEST(FilePolicyTest, AllowReadOnly) {
// Create a temp file because we need write access to it.
wchar_t temp_directory[MAX_PATH];
wchar_t temp_file_name[MAX_PATH];
- ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name), 0);
+ ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name), 0u);
EXPECT_TRUE(runner.AddFsRule(TargetPolicy::FILES_ALLOW_READONLY,
temp_file_name));
@@ -292,8 +292,8 @@ TEST(FilePolicyTest, AllowWildcard) {
// Create a temp file because we need write access to it.
wchar_t temp_directory[MAX_PATH];
wchar_t temp_file_name[MAX_PATH];
- ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name), 0);
+ ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name), 0u);
wcscat_s(temp_directory, MAX_PATH, L"*");
EXPECT_TRUE(runner.AddFsRule(TargetPolicy::FILES_ALLOW_ANY, temp_directory));
@@ -384,15 +384,15 @@ TEST(FilePolicyTest, TestRename) {
wchar_t temp_file_name6[MAX_PATH];
wchar_t temp_file_name7[MAX_PATH];
wchar_t temp_file_name8[MAX_PATH];
- ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name1), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name2), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name3), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name4), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name5), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name6), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name7), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name8), 0);
+ ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name1), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name2), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name3), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name4), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name5), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name6), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name7), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name8), 0u);
// Add rules to make file1->file2 succeed.
@@ -500,8 +500,8 @@ TEST(FilePolicyTest, TestReparsePoint) {
// Create a temp file because we need write access to it.
wchar_t temp_directory[MAX_PATH];
wchar_t temp_file_name[MAX_PATH];
- ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name), 0);
+ ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, temp_file_name), 0u);
// Delete the file and create a directory instead.
ASSERT_TRUE(::DeleteFile(temp_file_name));
diff --git a/sandbox/src/interception_unittest.cc b/sandbox/src/interception_unittest.cc
index 883cc91..604db06 100644
--- a/sandbox/src/interception_unittest.cc
+++ b/sandbox/src/interception_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 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.
@@ -37,20 +37,20 @@ void WalkBuffer(void* buffer, size_t size, int* num_dlls, int* num_functions,
DllPatchInfo *dll = &memory->dll_list[0];
for (int i = 0; i < memory->num_intercepted_dlls; i++) {
- ASSERT_NE(0, wcslen(dll->dll_name));
- ASSERT_EQ(0, dll->record_bytes % sizeof(size_t));
- ASSERT_EQ(0, dll->offset_to_functions % sizeof(size_t));
+ ASSERT_NE(0u, wcslen(dll->dll_name));
+ ASSERT_EQ(0u, dll->record_bytes % sizeof(size_t));
+ ASSERT_EQ(0u, dll->offset_to_functions % sizeof(size_t));
ASSERT_NE(0, dll->num_functions);
FunctionInfo *function = reinterpret_cast<FunctionInfo*>(
reinterpret_cast<char*>(dll) + dll->offset_to_functions);
for (int j = 0; j < dll->num_functions; j++) {
- ASSERT_EQ(0, function->record_bytes % sizeof(size_t));
+ ASSERT_EQ(0u, function->record_bytes % sizeof(size_t));
char* name = function->function;
size_t length = strlen(name);
- ASSERT_NE(0, length);
+ ASSERT_NE(0u, length);
name += length + 1;
// look for overflows
@@ -77,7 +77,7 @@ void WalkBuffer(void* buffer, size_t size, int* num_dlls, int* num_functions,
TEST(InterceptionManagerTest, BufferLayout1) {
wchar_t exe_name[MAX_PATH];
- ASSERT_NE(0, GetModuleFileName(NULL, exe_name, MAX_PATH - 1));
+ ASSERT_NE(0u, GetModuleFileName(NULL, exe_name, MAX_PATH - 1));
TargetProcess *target = MakeTestTargetProcess(::GetCurrentProcess(),
::GetModuleHandle(exe_name));
@@ -164,7 +164,7 @@ TEST(InterceptionManagerTest, BufferLayout1) {
TEST(InterceptionManagerTest, BufferLayout2) {
wchar_t exe_name[MAX_PATH];
- ASSERT_NE(0, GetModuleFileName(NULL, exe_name, MAX_PATH - 1));
+ ASSERT_NE(0u, GetModuleFileName(NULL, exe_name, MAX_PATH - 1));
TargetProcess *target = MakeTestTargetProcess(::GetCurrentProcess(),
::GetModuleHandle(exe_name));
diff --git a/sandbox/src/job_unittest.cc b/sandbox/src/job_unittest.cc
index d7d29ae..f7174e3 100644
--- a/sandbox/src/job_unittest.cc
+++ b/sandbox/src/job_unittest.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.
@@ -20,7 +20,7 @@ TEST(JobTest, TestCreation) {
// check if the job exists.
HANDLE job_handle = ::OpenJobObjectW(GENERIC_ALL, FALSE,
L"my_test_job_name");
- ASSERT_NE(NULL, reinterpret_cast<ULONG_PTR>(job_handle));
+ ASSERT_NE(reinterpret_cast<HANDLE>(NULL), job_handle);
if (job_handle)
CloseHandle(job_handle);
@@ -28,7 +28,7 @@ TEST(JobTest, TestCreation) {
// Check if the job is destroyed when the object goes out of scope.
HANDLE job_handle = ::OpenJobObjectW(GENERIC_ALL, FALSE, L"my_test_job_name");
- ASSERT_EQ(NULL, reinterpret_cast<ULONG_PTR>(job_handle));
+ ASSERT_EQ(reinterpret_cast<HANDLE>(NULL), job_handle);
ASSERT_EQ(ERROR_FILE_NOT_FOUND, ::GetLastError());
}
@@ -42,14 +42,14 @@ TEST(JobTest, TestDetach) {
ASSERT_EQ(ERROR_SUCCESS, job.Init(JOB_LOCKDOWN, L"my_test_job_name", 0));
job_handle = job.Detach();
- ASSERT_NE(NULL, reinterpret_cast<ULONG_PTR>(job_handle));
+ ASSERT_NE(reinterpret_cast<HANDLE>(NULL), job_handle);
}
// Check to be sure that the job is still alive even after the object is gone
// out of scope.
HANDLE job_handle_dup = ::OpenJobObjectW(GENERIC_ALL, FALSE,
L"my_test_job_name");
- ASSERT_NE(NULL, reinterpret_cast<ULONG_PTR>(job_handle_dup));
+ ASSERT_NE(reinterpret_cast<HANDLE>(NULL), job_handle_dup);
// Remove all references.
if (job_handle_dup)
@@ -60,7 +60,7 @@ TEST(JobTest, TestDetach) {
// Check if the jbo is really dead.
job_handle = ::OpenJobObjectW(GENERIC_ALL, FALSE, L"my_test_job_name");
- ASSERT_EQ(NULL, reinterpret_cast<ULONG_PTR>(job_handle));
+ ASSERT_EQ(reinterpret_cast<HANDLE>(NULL), job_handle);
ASSERT_EQ(ERROR_FILE_NOT_FOUND, ::GetLastError());
}
@@ -75,7 +75,7 @@ TEST(JobTest, TestExceptions) {
JOB_OBJECT_UILIMIT_READCLIPBOARD));
job_handle = job.Detach();
- ASSERT_NE(NULL, reinterpret_cast<ULONG_PTR>(job_handle));
+ ASSERT_NE(reinterpret_cast<HANDLE>(NULL), job_handle);
JOBOBJECT_BASIC_UI_RESTRICTIONS jbur = {0};
DWORD size = sizeof(jbur);
@@ -95,7 +95,7 @@ TEST(JobTest, TestExceptions) {
ASSERT_EQ(ERROR_SUCCESS, job.Init(JOB_LOCKDOWN, L"my_test_job_name", 0));
job_handle = job.Detach();
- ASSERT_NE(NULL, reinterpret_cast<ULONG_PTR>(job_handle));
+ ASSERT_NE(reinterpret_cast<HANDLE>(NULL), job_handle);
JOBOBJECT_BASIC_UI_RESTRICTIONS jbur = {0};
DWORD size = sizeof(jbur);
@@ -124,7 +124,7 @@ TEST(JobTest, NoInit) {
Job job;
ASSERT_EQ(ERROR_NO_DATA, job.UserHandleGrantAccess(NULL));
ASSERT_EQ(ERROR_NO_DATA, job.AssignProcessToJob(NULL));
- ASSERT_EQ(NULL, reinterpret_cast<ULONG_PTR>(job.Detach()));
+ ASSERT_EQ(reinterpret_cast<HANDLE>(NULL), job.Detach());
}
// Tests the initialization of the job with different security level.
diff --git a/sandbox/src/restricted_token_unittest.cc b/sandbox/src/restricted_token_unittest.cc
index d8fe233..310b73f 100644
--- a/sandbox/src/restricted_token_unittest.cc
+++ b/sandbox/src/restricted_token_unittest.cc
@@ -23,11 +23,11 @@ TEST(RestrictedTokenTest, InvalidHandle) {
// Tests the initialization with NULL as parameter.
TEST(RestrictedTokenTest, DefaultInit) {
// Get the current process token.
- HANDLE token_handle = NULL;
+ HANDLE token_handle = INVALID_HANDLE_VALUE;
ASSERT_TRUE(::OpenProcessToken(::GetCurrentProcess(), TOKEN_ALL_ACCESS,
&token_handle));
- ASSERT_NE(NULL, reinterpret_cast<ULONG_PTR>(token_handle));
+ ASSERT_NE(INVALID_HANDLE_VALUE, token_handle);
ATL::CAccessToken access_token;
access_token.Attach(token_handle);
@@ -62,11 +62,11 @@ TEST(RestrictedTokenTest, DefaultInit) {
// Tests the initialization with a custom token as parameter.
TEST(RestrictedTokenTest, CustomInit) {
// Get the current process token.
- HANDLE token_handle = NULL;
+ HANDLE token_handle = INVALID_HANDLE_VALUE;
ASSERT_TRUE(::OpenProcessToken(::GetCurrentProcess(), TOKEN_ALL_ACCESS,
&token_handle));
- ASSERT_NE(NULL, reinterpret_cast<ULONG_PTR>(token_handle));
+ ASSERT_NE(INVALID_HANDLE_VALUE, token_handle);
ATL::CAccessToken access_token;
access_token.Attach(token_handle);
diff --git a/sandbox/src/win_utils_unittest.cc b/sandbox/src/win_utils_unittest.cc
index a7dc998..27b49af 100644
--- a/sandbox/src/win_utils_unittest.cc
+++ b/sandbox/src/win_utils_unittest.cc
@@ -14,8 +14,8 @@ TEST(WinUtils, IsReparsePoint) {
// Create a temp file because we need write access to it.
wchar_t temp_directory[MAX_PATH];
wchar_t my_folder[MAX_PATH];
- ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0);
- ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, my_folder), 0);
+ ASSERT_NE(::GetTempPath(MAX_PATH, temp_directory), 0u);
+ ASSERT_NE(::GetTempFileName(temp_directory, L"test", 0, my_folder), 0u);
// Delete the file and create a directory instead.
ASSERT_TRUE(::DeleteFile(my_folder));
diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc
index fad9413..2363985 100644
--- a/views/controls/table/table_view.cc
+++ b/views/controls/table/table_view.cc
@@ -370,7 +370,7 @@ void TableView::OnItemsRemoved(int start, int length) {
}
void TableView::AddColumn(const TableColumn& col) {
- DCHECK_EQ(0, all_columns_.count(col.id));
+ DCHECK_EQ(0u, all_columns_.count(col.id));
all_columns_[col.id] = col;
}
diff --git a/webkit/default_plugin/plugin_database_handler.cc b/webkit/default_plugin/plugin_database_handler.cc
index d35fdb1..3aeff63 100644
--- a/webkit/default_plugin/plugin_database_handler.cc
+++ b/webkit/default_plugin/plugin_database_handler.cc
@@ -144,13 +144,13 @@ int32 PluginDatabaseHandler::Write(NPStream* stream, int32 offset,
}
}
- unsigned long bytes_written = 0;
+ DWORD bytes_written = 0;
if (0 == lstrcmpiA(stream->url, plugin_finder_url_.c_str())) {
DCHECK(plugin_downloads_file_ != INVALID_HANDLE_VALUE);
WriteFile(plugin_downloads_file_, buffer, buffer_length, &bytes_written,
NULL);
- DCHECK(buffer_length == bytes_written);
+ DCHECK_EQ(buffer_length, static_cast<int32>(bytes_written));
}
return bytes_written;
}