diff options
author | brucedawson <brucedawson@chromium.org> | 2015-02-03 11:53:48 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-03 19:55:19 +0000 |
commit | 944c28c5ee375cd1eec61e4530750e37c29f65be (patch) | |
tree | 382217ab01049d310732854888b6418306810a78 /chrome/installer | |
parent | 959eaea45546260d8517de3d1cabace790c5b5a7 (diff) | |
download | chromium_src-944c28c5ee375cd1eec61e4530750e37c29f65be.zip chromium_src-944c28c5ee375cd1eec61e4530750e37c29f65be.tar.gz chromium_src-944c28c5ee375cd1eec61e4530750e37c29f65be.tar.bz2 |
Rewriting patch logic without the comma operator.
When running /analyze on all of Chrome there were three warnings about
using the comma operator in a tested expression. One was a genuine bug
and the other two were in UncompressAndPatchChromeArchive. Rewriting
to use nested if statements resolves these warnings (getting the count
to zero) and makes the code clearer.
Resolving the warning is not crucial, but it makes it easier to make a
zero-tolerance policy for that warning and thus avoid future bugs.
Plus, it makes the setup code easier to read.
The warnings are:
src\chrome\installer\setup\setup_main.cc(174) : warning C6319: Use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects.
src\chrome\installer\setup\setup_main.cc(176) : warning C6319: Use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects.
The bug that was found through this warning, which could eventually
have been very serious, was fixed here:
https://codereview.chromium.org/678193003
BUG=427616
Review URL: https://codereview.chromium.org/893703004
Cr-Commit-Position: refs/heads/master@{#314389}
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 2372e9d..5454e8d 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -170,15 +170,15 @@ bool UncompressAndPatchChromeArchive( archive_helper->set_patch_source(patch_source); // Try courgette first. Failing that, try bspatch. - if ((installer_state.UpdateStage(installer::ENSEMBLE_PATCHING), - !archive_helper->EnsemblePatch()) && - (installer_state.UpdateStage(installer::BINARY_PATCHING), - !archive_helper->BinaryPatch())) { - *install_status = installer::APPLY_DIFF_PATCH_FAILED; - installer_state.WriteInstallerResult(*install_status, - IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, - NULL); - return false; + installer_state.UpdateStage(installer::ENSEMBLE_PATCHING); + if (!archive_helper->EnsemblePatch()) { + installer_state.UpdateStage(installer::BINARY_PATCHING); + if (!archive_helper->BinaryPatch()) { + *install_status = installer::APPLY_DIFF_PATCH_FAILED; + installer_state.WriteInstallerResult( + *install_status, IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, NULL); + return false; + } } *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE; |