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

Side by Side Diff: cloud_print/virtual_driver/win/install/setup.cc

Issue 543923002: win/clang: Fix all remaining -Wformat warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 6 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 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 #include <iomanip> 5 #include <iomanip>
6 #include <windows.h> 6 #include <windows.h>
7 #include <winspool.h> 7 #include <winspool.h>
8 #include <setupapi.h> // Must be included after windows.h 8 #include <setupapi.h> // Must be included after windows.h
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // None of the print API structures likes constant strings even though they 338 // None of the print API structures likes constant strings even though they
339 // don't modify the string. const_casting is the cleanest option. 339 // don't modify the string. const_casting is the cleanest option.
340 base::string16 driver_name = LoadLocalString(IDS_DRIVER_NAME); 340 base::string16 driver_name = LoadLocalString(IDS_DRIVER_NAME);
341 printer_info.pDriverName = const_cast<LPWSTR>(driver_name.c_str()); 341 printer_info.pDriverName = const_cast<LPWSTR>(driver_name.c_str());
342 printer_info.pPrinterName = const_cast<LPWSTR>(driver_name.c_str()); 342 printer_info.pPrinterName = const_cast<LPWSTR>(driver_name.c_str());
343 printer_info.pComment = const_cast<LPWSTR>(driver_name.c_str()); 343 printer_info.pComment = const_cast<LPWSTR>(driver_name.c_str());
344 printer_info.pLocation = const_cast<LPWSTR>(kGcpUrl); 344 printer_info.pLocation = const_cast<LPWSTR>(kGcpUrl);
345 base::string16 port_name; 345 base::string16 port_name;
346 printer_info.pPortName = const_cast<LPWSTR>(kPortName); 346 printer_info.pPortName = const_cast<LPWSTR>(kPortName);
347 printer_info.Attributes = PRINTER_ATTRIBUTE_DIRECT|PRINTER_ATTRIBUTE_LOCAL; 347 printer_info.Attributes = PRINTER_ATTRIBUTE_DIRECT|PRINTER_ATTRIBUTE_LOCAL;
348 printer_info.pPrintProcessor = L"winprint"; 348 printer_info.pPrintProcessor = const_cast<LPWSTR>(L"winprint");
349 HANDLE handle = AddPrinter(NULL, 2, reinterpret_cast<BYTE*>(&printer_info)); 349 HANDLE handle = AddPrinter(NULL, 2, reinterpret_cast<BYTE*>(&printer_info));
350 if (handle == NULL) { 350 if (handle == NULL) {
351 HRESULT result = GetLastHResult(); 351 HRESULT result = GetLastHResult();
352 LOG(ERROR) << "Unable to add printer"; 352 LOG(ERROR) << "Unable to add printer";
353 return result; 353 return result;
354 } 354 }
355 ClosePrinter(handle); 355 ClosePrinter(handle);
356 return S_OK; 356 return S_OK;
357 } 357 }
358 358
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 550
551 VLOG(0) << GetErrorMessage(retval) 551 VLOG(0) << GetErrorMessage(retval)
552 << " HRESULT=0x" << std::setbase(16) << retval; 552 << " HRESULT=0x" << std::setbase(16) << retval;
553 553
554 // Installer is silent by default as required by Google Update. 554 // Installer is silent by default as required by Google Update.
555 if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) { 555 if (CommandLine::ForCurrentProcess()->HasSwitch("verbose")) {
556 DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME)); 556 DisplayWindowsMessage(NULL, retval, LoadLocalString(IDS_DRIVER_NAME));
557 } 557 }
558 return retval; 558 return retval;
559 } 559 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698