Skip to content

Commit

Permalink
Rewrite scoped_array<T> to scoped_ptr<T[]> in printing.
Browse files Browse the repository at this point in the history
This is a manual cleanup pass using sed for files which are not built on
Linux.

BUG=171111


Review URL: https://chromiumcodereview.appspot.com/14115002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193577 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dcheng@chromium.org committed Apr 11, 2013
1 parent fd895ff commit fb3a97c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions printing/backend/print_backend_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ bool PrintBackendWin::EnumeratePrinters(PrinterList* printer_list) {
kLevel, NULL, 0, &bytes_needed, &count_returned);
if (!bytes_needed)
return false;
scoped_array<BYTE> printer_info_buffer(new BYTE[bytes_needed]);
scoped_ptr<BYTE[]> printer_info_buffer(new BYTE[bytes_needed]);
ret = EnumPrinters(PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS, NULL, kLevel,
printer_info_buffer.get(), bytes_needed, &bytes_needed,
&count_returned);
Expand Down Expand Up @@ -208,7 +208,7 @@ bool PrintBackendWin::GetPrinterCapsAndDefaults(
NULL, NULL, 0);
if (devmode_size <= 0)
return false;
scoped_array<BYTE> devmode_out_buffer(new BYTE[devmode_size]);
scoped_ptr<BYTE[]> devmode_out_buffer(new BYTE[devmode_size]);
DEVMODE* devmode_out =
reinterpret_cast<DEVMODE*>(devmode_out_buffer.get());
DocumentProperties(
Expand Down
4 changes: 2 additions & 2 deletions printing/backend/printing_info_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ uint8* GetDriverInfo(HANDLE printer, int level) {
if (size == 0) {
return NULL;
}
scoped_array<uint8> buffer(new uint8[size]);
scoped_ptr<uint8[]> buffer(new uint8[size]);
memset(buffer.get(), 0, size);
if (!::GetPrinterDriver(printer, NULL, level, buffer.get(), size, &size)) {
return NULL;
Expand All @@ -32,7 +32,7 @@ uint8* GetPrinterInfo(HANDLE printer, int level) {
", error = " << GetLastError();
return NULL;
}
scoped_array<uint8> buffer(new uint8[size]);
scoped_ptr<uint8[]> buffer(new uint8[size]);
memset(buffer.get(), 0, size);
if (!::GetPrinter(printer, level, buffer.get(), size, &size)) {
LOG(WARNING) << "Failed to get PRINTER_INFO_" << level <<
Expand Down
4 changes: 2 additions & 2 deletions printing/backend/printing_info_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PrinterInfo {
}

private:
scoped_array<uint8> buffer_;
scoped_ptr<uint8[]> buffer_;
};

// This class is designed to work with DRIVER_INFO_X structures
Expand All @@ -51,7 +51,7 @@ class DriverInfo {
}

private:
scoped_array<uint8> buffer_;
scoped_ptr<uint8[]> buffer_;
};

} // namespace internal
Expand Down
4 changes: 2 additions & 2 deletions printing/printing_context_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ PrintingContext::Result PrintingContextWin::UseDefaultSettings() {
NULL, 2, NULL, 0, &bytes_needed, &count_returned);
if (bytes_needed) {
DCHECK(bytes_needed >= count_returned * sizeof(PRINTER_INFO_2));
scoped_array<BYTE> printer_info_buffer(new BYTE[bytes_needed]);
scoped_ptr<BYTE[]> printer_info_buffer(new BYTE[bytes_needed]);
BOOL ret = ::EnumPrinters(PRINTER_ENUM_LOCAL|PRINTER_ENUM_CONNECTIONS,
NULL, 2, printer_info_buffer.get(),
bytes_needed, &bytes_needed,
Expand Down Expand Up @@ -360,7 +360,7 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(

// Make printer changes local to Chrome.
// See MSDN documentation regarding DocumentProperties.
scoped_array<uint8> buffer;
scoped_ptr<uint8[]> buffer;
DEVMODE* dev_mode = NULL;
LONG buffer_size = DocumentProperties(NULL, printer, device_name_wide,
NULL, NULL, 0);
Expand Down
2 changes: 1 addition & 1 deletion printing/printing_context_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) {
if (!OpenPrinter(const_cast<wchar_t*>(printer_name.c_str()), &printer, NULL))
return E_FAIL;

scoped_array<uint8> buffer;
scoped_ptr<uint8[]> buffer;
const DEVMODE* dev_mode = NULL;
HRESULT result = S_OK;
lppd->hDC = NULL;
Expand Down

0 comments on commit fb3a97c

Please sign in to comment.