summaryrefslogtreecommitdiffstats
path: root/sandbox/win/src/process_policy_test.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-10 22:56:22 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-10 22:56:22 +0000
commit61542fa828eea7bc31bb8d3eeefbf00acf0fc43a (patch)
treeb94073e764658c0ea65dc48fdb8630c93777cc76 /sandbox/win/src/process_policy_test.cc
parent8a6d68d19a350fa7a512b86ea97ce647d6f737e1 (diff)
downloadchromium_src-61542fa828eea7bc31bb8d3eeefbf00acf0fc43a.zip
chromium_src-61542fa828eea7bc31bb8d3eeefbf00acf0fc43a.tar.gz
chromium_src-61542fa828eea7bc31bb8d3eeefbf00acf0fc43a.tar.bz2
Fixes for re-enabling more MSVC level 4 warnings: sandbox/ edition
This contains fixes for the following sorts of issues: * Assignment inside conditional * Possibly-uninitialized local variable * Signedness mismatch This also contains a small number of other cleanups/simplifications to nearby code. BUG=81439 TEST=none Review URL: https://codereview.chromium.org/382613002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/win/src/process_policy_test.cc')
-rw-r--r--sandbox/win/src/process_policy_test.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/sandbox/win/src/process_policy_test.cc b/sandbox/win/src/process_policy_test.cc
index af64f14..ae62606 100644
--- a/sandbox/win/src/process_policy_test.cc
+++ b/sandbox/win/src/process_policy_test.cc
@@ -154,28 +154,20 @@ SBOX_TESTS_COMMAND int Process_RunApp4(int argc, wchar_t **argv) {
// TEST 4: Try file name in the app_name and current directory sets correctly.
base::string16 system32 = MakeFullPathToSystem32(L"");
wchar_t current_directory[MAX_PATH + 1];
- int result4;
- bool test_succeeded = false;
DWORD ret = ::GetCurrentDirectory(MAX_PATH, current_directory);
if (!ret)
return SBOX_TEST_FIRST_ERROR;
+ if (ret >= MAX_PATH)
+ return SBOX_TEST_FAILED;
- if (ret < MAX_PATH) {
- current_directory[ret] = L'\\';
- current_directory[ret+1] = L'\0';
- if (::SetCurrentDirectory(system32.c_str())) {
- result4 = CreateProcessHelper(argv[0], base::string16());
- if (::SetCurrentDirectory(current_directory)) {
- test_succeeded = true;
- }
- } else {
- return SBOX_TEST_SECOND_ERROR;
- }
+ current_directory[ret] = L'\\';
+ current_directory[ret+1] = L'\0';
+ if (!::SetCurrentDirectory(system32.c_str())) {
+ return SBOX_TEST_SECOND_ERROR;
}
- if (!test_succeeded)
- result4 = SBOX_TEST_FAILED;
- return result4;
+ const int result4 = CreateProcessHelper(argv[0], base::string16());
+ return ::SetCurrentDirectory(current_directory) ? result4 : SBOX_TEST_FAILED;
}
SBOX_TESTS_COMMAND int Process_RunApp5(int argc, wchar_t **argv) {