From 565876c9cd121654cea4ef83427779b0b10baf52 Mon Sep 17 00:00:00 2001 From: "scottmg@chromium.org" Date: Fri, 18 Jan 2013 23:14:34 +0000 Subject: some size_t -> uint32/ulong to match windows api for x64 (I looked at changing size_t to unsigned int elsewhere, but then the interactions with std::vector get messier then). R=cpu@chromium.org BUG=166496 Review URL: https://chromiumcodereview.appspot.com/11876033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177790 0039d316-1c4b-4281-b951-d872f2087c98 --- win8/metro_driver/print_document_source.cc | 6 ++++-- win8/metro_driver/print_handler.cc | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'win8') diff --git a/win8/metro_driver/print_document_source.cc b/win8/metro_driver/print_document_source.cc index 7469597..91842b7 100644 --- a/win8/metro_driver/print_document_source.cc +++ b/win8/metro_driver/print_document_source.cc @@ -8,6 +8,7 @@ #include #include "base/logging.h" +#include "base/safe_numerics.h" namespace { @@ -250,8 +251,9 @@ STDMETHODIMP PrintDocumentSource::Paginate(uint32 page, // A page_count of 0 means abort... if (page_count == 0) return S_FALSE; - hr = dxgi_preview_target_->SetJobPageCount(PageCountType::FinalPageCount, - page_count); + hr = dxgi_preview_target_->SetJobPageCount( + PageCountType::FinalPageCount, + base::checked_numeric_cast(page_count)); if (FAILED(hr)) { LOG(ERROR) << "Failed to SetJobPageCount " << std::hex << hr; return hr; diff --git a/win8/metro_driver/print_handler.cc b/win8/metro_driver/print_handler.cc index dce321a..43563b2f 100644 --- a/win8/metro_driver/print_handler.cc +++ b/win8/metro_driver/print_handler.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/logging.h" +#include "base/safe_numerics.h" #include "chrome/app/chrome_command_ids.h" #include "win8/metro_driver/chrome_app_view.h" #include "win8/metro_driver/winrt_utils.h" @@ -472,7 +473,9 @@ void MetroSetPrintPageContent(size_t page_number, NULL, TRUE, metafile_stream.GetAddressOf()); if (metafile_stream.Get() != NULL) { ULONG bytes_written = 0; - hr = metafile_stream->Write(data, data_size, &bytes_written); + hr = metafile_stream->Write(data, + base::checked_numeric_cast(data_size), + &bytes_written); LOG_IF(ERROR, FAILED(hr)) << "Failed to Write to Stream " << std::hex << hr; DCHECK(bytes_written == data_size); -- cgit v1.1