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

Side by Side Diff: cloud_print/service/win/cloud_print_service.cc

Issue 731373002: Enable MSVC warning for unused locals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Work around warning in atlbase.h
6 // https://connect.microsoft.com/VisualStudio/feedback/details/1032199/atlbase-h -gives-warning-c4189-when-compiling-with-atl-no-com-support
7 #pragma warning(push)
8 #pragma warning(disable:4189)
5 #include <atlbase.h> 9 #include <atlbase.h>
10 #pragma warning(pop)
6 #include <security.h> 11 #include <security.h>
7 12
8 #include <iomanip> 13 #include <iomanip>
9 #include <iostream> 14 #include <iostream>
10 #include <iterator> 15 #include <iterator>
11 #include <string> 16 #include <string>
12 #include <vector> 17 #include <vector>
13 18
14 #include "base/at_exit.h" 19 #include "base/at_exit.h"
15 #include "base/bind.h" 20 #include "base/bind.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 *printers = setup.printers(); 332 *printers = setup.printers();
328 return S_OK; 333 return S_OK;
329 } 334 }
330 335
331 HRESULT SetupServiceState(const base::FilePath& user_data_dir, 336 HRESULT SetupServiceState(const base::FilePath& user_data_dir,
332 const std::vector<std::string>& printers) { 337 const std::vector<std::string>& printers) {
333 base::FilePath file = user_data_dir.Append(chrome::kServiceStateFileName); 338 base::FilePath file = user_data_dir.Append(chrome::kServiceStateFileName);
334 339
335 std::string contents; 340 std::string contents;
336 ServiceState service_state; 341 ServiceState service_state;
342 if (!base::ReadFileToString(file, &contents) ||
343 !service_state.FromString(contents)) {
344 return ReportError(E_FAIL, IDS_ERROR_FAILED_CREATE_CONFIG);
Peter Kasting 2014/11/18 00:41:03 We never checked the value of |is_valid| before.
345 }
337 346
338 bool is_valid = base::ReadFileToString(file, &contents) &&
339 service_state.FromString(contents);
340 std::string proxy_id = service_state.proxy_id(); 347 std::string proxy_id = service_state.proxy_id();
341 348
342 LOG(INFO) << file.value() << ": " << contents; 349 LOG(INFO) << file.value() << ": " << contents;
343 350
344 base::string16 message = 351 base::string16 message =
345 cloud_print::LoadLocalString(IDS_ADD_PRINTERS_USING_CHROME); 352 cloud_print::LoadLocalString(IDS_ADD_PRINTERS_USING_CHROME);
346 std::cout << "\n" << message.c_str() << "\n" ; 353 std::cout << "\n" << message.c_str() << "\n" ;
347 std::string new_contents = 354 std::string new_contents =
348 ChromeLauncher::CreateServiceStateFile(proxy_id, printers); 355 ChromeLauncher::CreateServiceStateFile(proxy_id, printers);
349 356
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 418 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
412 logging::InitLogging(settings); 419 logging::InitLogging(settings);
413 420
414 logging::SetMinLogLevel( 421 logging::SetMinLogLevel(
415 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableLogging) ? 422 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableLogging) ?
416 logging::LOG_INFO : logging::LOG_FATAL); 423 logging::LOG_INFO : logging::LOG_FATAL);
417 424
418 return _AtlModule.WinMain(0); 425 return _AtlModule.WinMain(0);
419 } 426 }
420 427
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698