Skip to content

Commit

Permalink
clang/win: Fix a few warnings in targets not in chromium_builder_tests.
Browse files Browse the repository at this point in the history
Also don't use "default" as a variable name, as it's a keyword.
Also fix a bug where a wstring was passed to %ls.

No real behavior change.

BUG=82385
R=hans@chromium.org
TBR=cpu, vitalybuka

Review URL: https://codereview.chromium.org/526513002

Cr-Commit-Position: refs/heads/master@{#292699}
  • Loading branch information
nico committed Aug 29, 2014
1 parent 62964a6 commit d857108
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion chrome/installer/gcapi/gcapi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code,
return TRUE;
}

BOOL __stdcall ReactivateChrome(wchar_t* brand_code,
BOOL __stdcall ReactivateChrome(const wchar_t* brand_code,
int shell_mode,
DWORD* error_code) {
BOOL result = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion chrome/installer/gcapi/gcapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code,
// |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or
// GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked
// from an elevated or non-elevated process.
BOOL __stdcall ReactivateChrome(wchar_t* brand_code,
BOOL __stdcall ReactivateChrome(const wchar_t* brand_code,
int shell_mode,
DWORD* error_code);

Expand Down
2 changes: 1 addition & 1 deletion chrome/installer/gcapi/gcapi_last_run_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GCAPILastRunTest : public ::testing::Test {
void SetUp() {
// Override keys - this is undone during destruction.
std::wstring hkcu_override = base::StringPrintf(
L"hkcu_override\\%ls", base::ASCIIToWide(base::GenerateGUID()));
L"hkcu_override\\%ls", base::ASCIIToWide(base::GenerateGUID()).c_str());
override_manager_.OverrideRegistry(HKEY_CURRENT_USER, hkcu_override);

// Create the client state key in the right places.
Expand Down
2 changes: 1 addition & 1 deletion cloud_print/gcp20/prototype/x_privet_token.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool XPrivetToken::CheckValidXToken(const std::string& token) const {

std::string XPrivetToken::GenerateXTokenWithTime(uint64 issue_time) const {
std::string result;
std::string issue_time_str = base::StringPrintf("%"PRIu64, issue_time);
std::string issue_time_str = base::StringPrintf("%" PRIu64, issue_time);
std::string hash = base::SHA1HashString(secret_ +
kXPrivetTokenDelimeter +
issue_time_str);
Expand Down
9 changes: 5 additions & 4 deletions cloud_print/service/win/cloud_print_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ void InvalidUsage() {
std::cout << "\n";
}

base::string16 GetOption(int string_id, const base::string16& default,
bool secure) {
base::string16 GetOption(int string_id,
const base::string16& default_option,
bool secure) {
base::string16 prompt_format = cloud_print::LoadLocalString(string_id);
std::vector<base::string16> substitutions(1, default);
std::vector<base::string16> substitutions(1, default_option);
std::cout << ReplaceStringPlaceholders(prompt_format, substitutions, NULL);
base::string16 tmp;
if (secure) {
Expand All @@ -99,7 +100,7 @@ base::string16 GetOption(int string_id, const base::string16& default,
std::getline(std::wcin, tmp);
}
if (tmp.empty())
return default;
return default_option;
return tmp;
}

Expand Down
14 changes: 7 additions & 7 deletions rlz/win/lib/machine_deal_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TEST_F(MachineDealCodeTest, SetFromPingResponse) {

// Bad responses

char* kBadDccResponse =
const char kBadDccResponse[] =
"dcc: NotMyDCCode \r\n"
"set_dcc: NewDCCode\r\n"
"crc32: 1B4D6BB3";
Expand All @@ -81,7 +81,7 @@ TEST_F(MachineDealCodeTest, SetFromPingResponse) {
EXPECT_TRUE(rlz_lib::MachineDealCode::Get(dcc_50, 50));
EXPECT_STREQ("MyDCCode", dcc_50);

char* kBadCrcResponse =
const char kBadCrcResponse[] =
"dcc: MyDCCode \r\n"
"set_dcc: NewDCCode\r\n"
"crc32: 90707106";
Expand All @@ -92,15 +92,15 @@ TEST_F(MachineDealCodeTest, SetFromPingResponse) {

// Good responses

char* kMissingSetResponse =
const char kMissingSetResponse[] =
"dcc: MyDCCode \r\n"
"crc32: 35F2E717";
EXPECT_TRUE(rlz_lib::MachineDealCode::SetFromPingResponse(
kMissingSetResponse));
EXPECT_TRUE(rlz_lib::MachineDealCode::Get(dcc_50, 50));
EXPECT_STREQ("MyDCCode", dcc_50);

char* kGoodResponse =
const char kGoodResponse[] =
"dcc: MyDCCode \r\n"
"set_dcc: NewDCCode\r\n"
"crc32: C8540E02";
Expand All @@ -109,7 +109,7 @@ TEST_F(MachineDealCodeTest, SetFromPingResponse) {
EXPECT_TRUE(rlz_lib::MachineDealCode::Get(dcc_50, 50));
EXPECT_STREQ("NewDCCode", dcc_50);

char* kGoodResponse2 =
const char kGoodResponse2[] =
"set_dcc: NewDCCode2 \r\n"
"dcc: NewDCCode \r\n"
"crc32: 60B6409A";
Expand All @@ -119,7 +119,7 @@ TEST_F(MachineDealCodeTest, SetFromPingResponse) {
EXPECT_STREQ("NewDCCode2", dcc_50);

MachineDealCodeHelper::Clear();
char* kGoodResponse3 =
const char kGoodResponse3[] =
"set_dcc: NewDCCode \r\n"
"crc32: 374C1C47";
EXPECT_TRUE(rlz_lib::MachineDealCode::SetFromPingResponse(
Expand All @@ -128,7 +128,7 @@ TEST_F(MachineDealCodeTest, SetFromPingResponse) {
EXPECT_STREQ("NewDCCode", dcc_50);

MachineDealCodeHelper::Clear();
char* kGoodResponse4 =
const char kGoodResponse4[] =
"dcc: \r\n"
"set_dcc: NewDCCode \r\n"
"crc32: 0AB1FB39";
Expand Down
2 changes: 1 addition & 1 deletion sandbox/win/sandbox_poc/pocdll/fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Tries to open a file and outputs the result.
// "path" can contain environment variables.
// "output" is the stream for the logging.
void TryOpenFile(wchar_t *path, FILE *output) {
void TryOpenFile(const wchar_t *path, FILE *output) {
wchar_t path_expanded[MAX_PATH] = {0};
DWORD size = ::ExpandEnvironmentStrings(path, path_expanded, MAX_PATH - 1);
if (!size) {
Expand Down

0 comments on commit d857108

Please sign in to comment.