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

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

Issue 8207004: scoped_ptr and new[] don't mix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ffffffffff Created 9 years, 2 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
« no previous file with comments | « chrome_frame/test/urlmon_moniker_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/print_backend.h" 5 #include "printing/backend/print_backend.h"
6 6
7 #include <objidl.h> 7 #include <objidl.h>
8 #include <winspool.h> 8 #include <winspool.h>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 HANDLE printer_handle = NULL; 135 HANDLE printer_handle = NULL;
136 OpenPrinter(const_cast<LPTSTR>(printer_name_wide.c_str()), &printer_handle, 136 OpenPrinter(const_cast<LPTSTR>(printer_name_wide.c_str()), &printer_handle,
137 NULL); 137 NULL);
138 DCHECK(printer_handle); 138 DCHECK(printer_handle);
139 if (printer_handle) { 139 if (printer_handle) {
140 LONG devmode_size = DocumentProperties( 140 LONG devmode_size = DocumentProperties(
141 NULL, printer_handle, const_cast<LPTSTR>(printer_name_wide.c_str()), 141 NULL, printer_handle, const_cast<LPTSTR>(printer_name_wide.c_str()),
142 NULL, NULL, 0); 142 NULL, NULL, 0);
143 if (devmode_size <= 0) 143 if (devmode_size <= 0)
144 return false; 144 return false;
145 scoped_ptr<BYTE> devmode_out_buffer(new BYTE[devmode_size]); 145 scoped_array<BYTE> devmode_out_buffer(new BYTE[devmode_size]);
146 DEVMODE* devmode_out = 146 DEVMODE* devmode_out =
147 reinterpret_cast<DEVMODE*>(devmode_out_buffer.get()); 147 reinterpret_cast<DEVMODE*>(devmode_out_buffer.get());
148 DocumentProperties( 148 DocumentProperties(
149 NULL, printer_handle, const_cast<LPTSTR>(printer_name_wide.c_str()), 149 NULL, printer_handle, const_cast<LPTSTR>(printer_name_wide.c_str()),
150 devmode_out, NULL, DM_OUT_BUFFER); 150 devmode_out, NULL, DM_OUT_BUFFER);
151 base::win::ScopedComPtr<IStream> printer_defaults_stream; 151 base::win::ScopedComPtr<IStream> printer_defaults_stream;
152 hr = CreateStreamOnHGlobal(NULL, TRUE, 152 hr = CreateStreamOnHGlobal(NULL, TRUE,
153 printer_defaults_stream.Receive()); 153 printer_defaults_stream.Receive());
154 DCHECK(SUCCEEDED(hr)); 154 DCHECK(SUCCEEDED(hr));
155 if (printer_defaults_stream) { 155 if (printer_defaults_stream) {
(...skipping 29 matching lines...) Expand all
185 } 185 }
186 return ret; 186 return ret;
187 } 187 }
188 188
189 scoped_refptr<PrintBackend> PrintBackend::CreateInstance( 189 scoped_refptr<PrintBackend> PrintBackend::CreateInstance(
190 const base::DictionaryValue* print_backend_settings) { 190 const base::DictionaryValue* print_backend_settings) {
191 return new PrintBackendWin; 191 return new PrintBackendWin;
192 } 192 }
193 193
194 } // namespace printing 194 } // namespace printing
OLDNEW
« no previous file with comments | « chrome_frame/test/urlmon_moniker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698