diff options
author | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 15:38:07 +0000 |
---|---|---|
committer | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 15:38:07 +0000 |
commit | f55bd486ab0ada0402fdcd34fb70a20d155fd968 (patch) | |
tree | 1eb9cf7c078d40c20320126d34f4cc4694082b1f /sandbox | |
parent | 4b0bd5f4c2d58c1620b49628be68f877928025fd (diff) | |
download | chromium_src-f55bd486ab0ada0402fdcd34fb70a20d155fd968.zip chromium_src-f55bd486ab0ada0402fdcd34fb70a20d155fd968.tar.gz chromium_src-f55bd486ab0ada0402fdcd34fb70a20d155fd968.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/2222002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48395 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/src/file_policy_test.cc | 32 | ||||
-rw-r--r-- | sandbox/src/interception_unittest.cc | 16 | ||||
-rw-r--r-- | sandbox/src/job_unittest.cc | 18 | ||||
-rw-r--r-- | sandbox/src/restricted_token_unittest.cc | 8 | ||||
-rw-r--r-- | sandbox/src/win_utils_unittest.cc | 4 |
5 files changed, 39 insertions, 39 deletions
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)); |