Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1660)

Unified Diff: chrome/installer/setup/setup_util.cc

Issue 10912096: C++ reability review for gab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix up last backward if else block found with regex('if \(.* != .*\) \{(\n[^}]*)*\} else') Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/setup/setup_util.cc
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc
index a190862da4f39e1fbbd7e8aafdd2ef01eacf13bc..41072423847c0225ffffdf0e49d37d2c91eb908d 100644
--- a/chrome/installer/setup/setup_util.cc
+++ b/chrome/installer/setup/setup_util.cc
@@ -4,6 +4,8 @@
//
// This file declares util functions for setup project.
+//Pickup file for readability review.
+
#include "chrome/installer/setup/setup_util.h"
#include <windows.h>
@@ -88,8 +90,8 @@ bool DeleteFileFromTempProcess(const FilePath& path,
static const wchar_t kRunDll32Path[] =
L"%SystemRoot%\\System32\\rundll32.exe";
wchar_t rundll32[MAX_PATH];
- DWORD size = ExpandEnvironmentStrings(kRunDll32Path, rundll32,
- arraysize(rundll32));
+ DWORD size =
+ ExpandEnvironmentStrings(kRunDll32Path, rundll32, arraysize(rundll32));
if (!size || size >= MAX_PATH)
return false;
@@ -110,7 +112,8 @@ bool DeleteFileFromTempProcess(const FilePath& path,
PAGE_READWRITE);
if (mem) {
SIZE_T written = 0;
- ::WriteProcessMemory(pi.hProcess, mem, path.value().c_str(),
+ ::WriteProcessMemory(
+ pi.hProcess, mem, path.value().c_str(),
(path.value().size() + 1) * sizeof(path.value()[0]), &written);
HMODULE kernel32 = ::GetModuleHandle(L"kernel32.dll");
PAPCFUNC sleep = reinterpret_cast<PAPCFUNC>(
@@ -149,7 +152,8 @@ string16 GetActiveSetupPath(BrowserDistribution* dist) {
ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name)
: is_enabled_(false) {
if (!::OpenProcessToken(::GetCurrentProcess(),
- TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, token_.Receive())) {
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
+ token_.Receive())) {
return;
}
@@ -167,11 +171,11 @@ ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name)
tp.Privileges[0].Luid = privilege_luid;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
DWORD return_length;
- if (!::AdjustTokenPrivileges(token_, FALSE, &tp, sizeof(TOKEN_PRIVILEGES),
- &previous_privileges_, &return_length)) {
- token_.Close();
- } else {
+ if (::AdjustTokenPrivileges(token_, FALSE, &tp, sizeof(TOKEN_PRIVILEGES),
dominich 2012/09/10 15:40:42 this might be more readable as: is_enabled_ = ::A
gab 2012/09/10 19:14:05 Done.
+ &previous_privileges_, &return_length)) {
is_enabled_ = true;
+ } else {
+ token_.Close();
}
}

Powered by Google App Engine
This is Rietveld 408576698