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

Side by Side Diff: printing/backend/win_helper.cc

Issue 413763003: clang/win: Fix most -Wwriteable-strings warnings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 | Annotate | Revision Log
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 "printing/backend/win_helper.h" 5 #include "printing/backend/win_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 scoped_ptr<DEVMODE, base::FreeDeleter> ticket = 465 scoped_ptr<DEVMODE, base::FreeDeleter> ticket =
466 printing::XpsTicketToDevMode(printer_name, xps_ticket); 466 printing::XpsTicketToDevMode(printer_name, xps_ticket);
467 if (!ticket) 467 if (!ticket)
468 return default_ticket.Pass(); 468 return default_ticket.Pass();
469 469
470 return ticket.Pass(); 470 return ticket.Pass();
471 } 471 }
472 472
473 scoped_ptr<DEVMODE, base::FreeDeleter> CreateDevMode(HANDLE printer, 473 scoped_ptr<DEVMODE, base::FreeDeleter> CreateDevMode(HANDLE printer,
474 DEVMODE* in) { 474 DEVMODE* in) {
475 LONG buffer_size = DocumentProperties(NULL, printer, L"", NULL, NULL, 0); 475 LONG buffer_size = DocumentProperties(
476 NULL, printer, const_cast<wchar_t*>(L""), NULL, NULL, 0);
476 if (buffer_size < static_cast<int>(sizeof(DEVMODE))) 477 if (buffer_size < static_cast<int>(sizeof(DEVMODE)))
477 return scoped_ptr<DEVMODE, base::FreeDeleter>(); 478 return scoped_ptr<DEVMODE, base::FreeDeleter>();
478 scoped_ptr<DEVMODE, base::FreeDeleter> out( 479 scoped_ptr<DEVMODE, base::FreeDeleter> out(
479 reinterpret_cast<DEVMODE*>(malloc(buffer_size))); 480 reinterpret_cast<DEVMODE*>(malloc(buffer_size)));
480 DWORD flags = (in ? (DM_IN_BUFFER) : 0) | DM_OUT_BUFFER; 481 DWORD flags = (in ? (DM_IN_BUFFER) : 0) | DM_OUT_BUFFER;
481 if (DocumentProperties(NULL, printer, L"", out.get(), in, flags) != IDOK) 482 if (DocumentProperties(
483 NULL, printer, const_cast<wchar_t*>(L""), out.get(), in, flags) !=
484 IDOK) {
482 return scoped_ptr<DEVMODE, base::FreeDeleter>(); 485 return scoped_ptr<DEVMODE, base::FreeDeleter>();
486 }
483 CHECK_GE(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra); 487 CHECK_GE(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra);
484 return out.Pass(); 488 return out.Pass();
485 } 489 }
486 490
487 } // namespace printing 491 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698