Skip to content

Commit

Permalink
Enable warning 4389 as an error on windows builds. This will make
Browse files Browse the repository at this point in the history
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/2222002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48395 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mbelshe@chromium.org committed May 27, 2010
1 parent 4b0bd5f commit f55bd48
Show file tree
Hide file tree
Showing 44 changed files with 166 additions and 161 deletions.
11 changes: 5 additions & 6 deletions app/os_exchange_data_provider_win.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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_;

Expand Down Expand Up @@ -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;
Expand All @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions app/win/window_impl.h
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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_; }
Expand Down
2 changes: 1 addition & 1 deletion base/crypto/scoped_capi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ScopedCAPIHandle {
CAPIHandle get() const { return handle_; }

CAPIHandle* receive() {
CHECK_EQ(NULL, handle_);
CHECK(handle_ == NULL);
return &handle_;
}

Expand Down
4 changes: 2 additions & 2 deletions base/event_trace_consumer_win_unittest.cc
Original file line number Diff line number Diff line change
@@ -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.
//
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions base/event_trace_controller_win_unittest.cc
Original file line number Diff line number Diff line change
@@ -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.
//
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions base/event_trace_provider_win_unittest.cc
Original file line number Diff line number Diff line change
@@ -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.
//
Expand Down Expand Up @@ -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) {
Expand Down
16 changes: 6 additions & 10 deletions base/file_util_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -647,15 +647,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) {
Expand All @@ -675,8 +671,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.
Expand Down
4 changes: 2 additions & 2 deletions base/iat_patch.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -178,7 +178,7 @@ IATPatchFunction::IATPatchFunction()
IATPatchFunction::~IATPatchFunction() {
if (NULL != intercept_function_) {
DWORD error = Unpatch();
DCHECK_EQ(NO_ERROR, error);
DCHECK(error == NO_ERROR);
}
}

Expand Down
6 changes: 3 additions & 3 deletions base/lock_impl_win.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions base/scoped_bstr_win_unittest.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions base/thread_local.h
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions chrome/app/chrome_dll_main.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions chrome/browser/automation/ui_controls_win.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/extensions/extension_uitest.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -246,7 +246,7 @@ class ExtensionTestRoundtripApiCall : public ExtensionUITest {

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();
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/importer/importer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 6 additions & 5 deletions chrome/browser/sync/syncable/syncable.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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;
}
}
Expand Down
Loading

0 comments on commit f55bd48

Please sign in to comment.