diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-21 18:38:54 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-21 18:38:54 +0000 |
commit | a5e0ef57d7e8b9518c595b4ad3cdf005c7998b4a (patch) | |
tree | cd88d897ca70bf1bda63999d93818b8555c3a449 /printing/printing_context_win.cc | |
parent | 2ddc49477b9b8a65ecd4e344019e994da405beb1 (diff) | |
download | chromium_src-a5e0ef57d7e8b9518c595b4ad3cdf005c7998b4a.zip chromium_src-a5e0ef57d7e8b9518c595b4ad3cdf005c7998b4a.tar.gz chromium_src-a5e0ef57d7e8b9518c595b4ad3cdf005c7998b4a.tar.bz2 |
Cleanup: Fix some style issues in the printing code. Fix misuse of scoped_ptr.
Patch created by arthurhsu@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6880092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82523 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/printing_context_win.cc')
-rw-r--r-- | printing/printing_context_win.cc | 11 |
1 files changed, 4 insertions, 7 deletions
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; |