diff options
-rw-r--r-- | chrome/service/cloud_print/print_system_win.cc | 2 | ||||
-rw-r--r-- | cloud_print/virtual_driver/win/port_monitor/port_monitor.cc | 2 | ||||
-rw-r--r-- | printing/backend/print_backend_win.cc | 2 | ||||
-rw-r--r-- | printing/printing_context_win.cc | 11 |
4 files changed, 7 insertions, 10 deletions
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index 82d5b43..3c3dfd1 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc @@ -209,7 +209,7 @@ class PrintSystemWatcherWin : public base::win::ObjectWatcher::Delegate { bool ret = false; GetPrinter(printer_, 2, NULL, 0, &bytes_needed); if (0 != bytes_needed) { - scoped_ptr<BYTE> printer_info_buffer(new BYTE[bytes_needed]); + scoped_array<BYTE> printer_info_buffer(new BYTE[bytes_needed]); if (GetPrinter(printer_, 2, printer_info_buffer.get(), bytes_needed, &bytes_needed)) { PRINTER_INFO_2* printer_info_win = diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc index d587eef..5141f99 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc @@ -154,7 +154,7 @@ bool GetJobTitle(HANDLE printer_handle, LOG(ERROR) << "Unable to get bytes needed for job info."; return false; } - scoped_ptr<BYTE> buffer(new BYTE[bytes_needed]); + scoped_array<BYTE> buffer(new BYTE[bytes_needed]); if (!GetJob(printer_handle, job_id, 1, diff --git a/printing/backend/print_backend_win.cc b/printing/backend/print_backend_win.cc index 480f4b8..d482a91 100644 --- a/printing/backend/print_backend_win.cc +++ b/printing/backend/print_backend_win.cc @@ -56,7 +56,7 @@ bool PrintBackendWin::EnumeratePrinters(PrinterList* printer_list) { NULL, 0, &bytes_needed, &count_returned); if (!bytes_needed) return false; - scoped_ptr<BYTE> printer_info_buffer(new BYTE[bytes_needed]); + scoped_array<BYTE> printer_info_buffer(new BYTE[bytes_needed]); ret = EnumPrinters(PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, 2, printer_info_buffer.get(), bytes_needed, &bytes_needed, &count_returned); diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index 8d6252d..884ae37 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -220,9 +220,8 @@ PrintingContext::Result PrintingContextWin::UseDefaultSettings() { &count_returned); if (ret && count_returned) { // have printers // Open the first successfully found printer. - for (DWORD count = 0; count < count_returned; count++) { - PRINTER_INFO_2* info_2; - info_2 = reinterpret_cast<PRINTER_INFO_2*>( + for (DWORD count = 0; count < count_returned; ++count) { + PRINTER_INFO_2* info_2 = reinterpret_cast<PRINTER_INFO_2*>( printer_info_buffer.get() + count * sizeof(PRINTER_INFO_2)); std::wstring printer_name = info_2->pPrinterName; if (info_2->pDevMode == NULL || printer_name.length() == 0) @@ -230,12 +229,10 @@ PrintingContext::Result PrintingContextWin::UseDefaultSettings() { if (!AllocateContext(printer_name, info_2->pDevMode, &context_)) break; if (InitializeSettings(*info_2->pDevMode, printer_name, - NULL, 0, false)) + NULL, 0, false)) { break; - if (context_) { - ::DeleteDC(context_); - context_ = NULL; } + ReleaseContext(); } if (context_) return OK; |