summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-21 17:58:28 +0000
committerjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-21 17:58:28 +0000
commit848c9c2fa8a7249f5308275fae944427f78d1974 (patch)
tree73a1bfbd73cb6c017fdf616a4ba3b5ba0271fb21 /printing
parent6ea1c1aee897c50ba8436435aa3d9d7dca38311e (diff)
downloadchromium_src-848c9c2fa8a7249f5308275fae944427f78d1974.zip
chromium_src-848c9c2fa8a7249f5308275fae944427f78d1974.tar.gz
chromium_src-848c9c2fa8a7249f5308275fae944427f78d1974.tar.bz2
Make printing build on Win64
Just adds some safe casts for the integer conversions. BUG=166496 TBR=thestig@chromium.org Review URL: https://chromiumcodereview.appspot.com/11953003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/image.cc7
-rw-r--r--printing/pdf_metafile_skia.cc6
-rw-r--r--printing/print_destination_win.cc4
3 files changed, 12 insertions, 5 deletions
diff --git a/printing/image.cc b/printing/image.cc
index ee1956c..cded369 100644
--- a/printing/image.cc
+++ b/printing/image.cc
@@ -8,6 +8,7 @@
#include "base/file_util.h"
#include "base/md5.h"
+#include "base/safe_numerics.h"
#include "base/string_number_conversions.h"
#include "printing/metafile.h"
#include "printing/metafile_impl.h"
@@ -71,7 +72,8 @@ bool Image::SaveToPng(const FilePath& filepath) const {
if (success) {
int write_bytes = file_util::WriteFile(
filepath,
- reinterpret_cast<char*>(&*compressed.begin()), compressed.size());
+ reinterpret_cast<char*>(&*compressed.begin()),
+ base::checked_numeric_cast<int>(compressed.size()));
success = (write_bytes == static_cast<int>(compressed.size()));
DCHECK(success);
}
@@ -149,7 +151,8 @@ bool Image::LoadPng(const std::string& compressed) {
bool Image::LoadMetafile(const std::string& data) {
DCHECK(!data.empty());
NativeMetafile metafile;
- if (!metafile.InitFromData(data.data(), data.size()))
+ if (!metafile.InitFromData(data.data(),
+ base::checked_numeric_cast<uint32>(data.size())))
return false;
return LoadMetafile(metafile);
}
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index 3c78d7f..fd02ec4 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -9,6 +9,7 @@
#include "base/hash_tables.h"
#include "base/metrics/histogram.h"
#include "base/posix/eintr_wrapper.h"
+#include "base/safe_numerics.h"
#include "skia/ext/vector_platform_device_skia.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -110,7 +111,7 @@ bool PdfMetafileSkia::FinishDocument() {
}
uint32 PdfMetafileSkia::GetDataSize() const {
- return data_->pdf_stream_.getOffset();
+ return base::checked_numeric_cast<uint32>(data_->pdf_stream_.getOffset());
}
bool PdfMetafileSkia::GetData(void* dst_buffer,
@@ -238,7 +239,8 @@ PdfMetafileSkia* PdfMetafileSkia::GetMetafileForCurrentPage() {
return NULL;
PdfMetafileSkia* metafile = new PdfMetafileSkia;
- metafile->InitFromData(data->bytes(), data->size());
+ metafile->InitFromData(data->bytes(),
+ base::checked_numeric_cast<uint32>(data->size()));
return metafile;
}
diff --git a/printing/print_destination_win.cc b/printing/print_destination_win.cc
index f6ffe74..6b98f4c 100644
--- a/printing/print_destination_win.cc
+++ b/printing/print_destination_win.cc
@@ -4,6 +4,7 @@
#include "printing/print_destination_interface.h"
+#include "base/safe_numerics.h"
#include "base/win/metro.h"
#include "win8/util/win8_util.h"
@@ -33,7 +34,8 @@ class PrintDestinationWin : public PrintDestinationInterface {
void* content,
size_t content_size) {
if (metro_set_print_page_content_)
- metro_set_print_page_content_(page_number - 1, content, content_size);
+ metro_set_print_page_content_(page_number - 1, content,
+ base::checked_numeric_cast<UINT32>(content_size));
}
private:
typedef void (*MetroSetPrintPageCount)(INT);