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

Unified Diff: printing/pdf_metafile_skia.cc

Issue 2458513003: Addressing C4267 warnings for printing. (Closed)
Patch Set: Rebase, IsValueInRangeForNumericType for CFIndex Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/pdf_metafile_skia.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_metafile_skia.cc
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index 8725e2b81ad7bbdbfe07925de4925f3458d80e19..fa8c129e9d10f75c64d9d95149023365a5169181 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -4,7 +4,13 @@
#include "printing/pdf_metafile_skia.h"
+#include <algorithm>
+#include <string>
+#include <utility>
+#include <vector>
+
#include "base/files/file.h"
+#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "printing/print_settings.h"
#include "third_party/skia/include/core/SkDocument.h"
@@ -112,8 +118,9 @@ bool PdfMetafileSkia::Init() {
// Metafile::InitFromData is orthogonal to what the rest of
// PdfMetafileSkia does.
bool PdfMetafileSkia::InitFromData(const void* src_buffer,
- uint32_t src_buffer_size) {
- data_->pdf_data_.reset(new SkMemoryStream(src_buffer, src_buffer_size, true));
+ size_t src_buffer_size) {
+ data_->pdf_data_ = base::MakeUnique<SkMemoryStream>(
+ src_buffer, src_buffer_size, true /* copy_data? */);
return true;
}
@@ -265,8 +272,7 @@ bool PdfMetafileSkia::RenderPage(unsigned int page_number,
size_t length = data_->pdf_data_->getLength();
std::vector<uint8_t> buffer(length);
(void)WriteAssetToBuffer(data_->pdf_data_.get(), &buffer[0], length);
- data_->pdf_cg_.InitFromData(&buffer[0],
- base::checked_cast<uint32_t>(length));
+ data_->pdf_cg_.InitFromData(&buffer[0], length);
}
return data_->pdf_cg_.RenderPage(page_number, context, rect, params);
}
« no previous file with comments | « printing/pdf_metafile_skia.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698