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

Side by Side Diff: printing/pdf_metafile_cg_mac.cc

Issue 2458513003: Addressing C4267 warnings for printing. (Closed)
Patch Set: same as patch set 3, to see today's try bot output Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « printing/pdf_metafile_cg_mac.h ('k') | printing/pdf_metafile_skia.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/pdf_metafile_cg_mac.h" 5 #include "printing/pdf_metafile_cg_mac.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 context_.reset(CGPDFContextCreate(pdf_consumer, nullptr, nullptr)); 80 context_.reset(CGPDFContextCreate(pdf_consumer, nullptr, nullptr));
81 if (!context_.get()) { 81 if (!context_.get()) {
82 LOG(ERROR) << "Failed to create pdf context for metafile"; 82 LOG(ERROR) << "Failed to create pdf context for metafile";
83 pdf_data_.reset(); 83 pdf_data_.reset();
84 } 84 }
85 85
86 return true; 86 return true;
87 } 87 }
88 88
89 bool PdfMetafileCg::InitFromData(const void* src_buffer, 89 bool PdfMetafileCg::InitFromData(const void* src_buffer,
90 uint32_t src_buffer_size) { 90 size_t src_buffer_size) {
91 DCHECK(!context_.get()); 91 DCHECK(!context_.get());
92 DCHECK(!pdf_data_.get()); 92 DCHECK(!pdf_data_.get());
93 93
94 if (!src_buffer || src_buffer_size == 0) { 94 if (!src_buffer || !src_buffer_size)
95 return false; 95 return false;
96 }
97 96
98 pdf_data_.reset(CFDataCreateMutable(kCFAllocatorDefault, src_buffer_size)); 97 pdf_data_.reset(CFDataCreateMutable(kCFAllocatorDefault, src_buffer_size));
Will Harris 2016/10/27 22:52:34 is a CFIndex the same type as a size_t? I have no
Lei Zhang 2016/10/27 23:15:14 Neither do I, but I found https://opensource.apple
99 CFDataAppendBytes(pdf_data_, static_cast<const UInt8*>(src_buffer), 98 CFDataAppendBytes(pdf_data_, static_cast<const UInt8*>(src_buffer),
100 src_buffer_size); 99 src_buffer_size);
101 100
102 return true; 101 return true;
103 } 102 }
104 103
105 void PdfMetafileCg::StartPage(const gfx::Size& page_size, 104 void PdfMetafileCg::StartPage(const gfx::Size& page_size,
106 const gfx::Rect& content_area, 105 const gfx::Rect& content_area,
107 const float& scale_factor) { 106 const float& scale_factor) {
108 DCHECK(context_.get()); 107 DCHECK(context_.get());
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 288
290 if (!pdf_doc_.get()) { 289 if (!pdf_doc_.get()) {
291 ScopedCFTypeRef<CGDataProviderRef> pdf_data_provider( 290 ScopedCFTypeRef<CGDataProviderRef> pdf_data_provider(
292 CGDataProviderCreateWithCFData(pdf_data_)); 291 CGDataProviderCreateWithCFData(pdf_data_));
293 pdf_doc_.reset(CGPDFDocumentCreateWithProvider(pdf_data_provider)); 292 pdf_doc_.reset(CGPDFDocumentCreateWithProvider(pdf_data_provider));
294 } 293 }
295 return pdf_doc_.get(); 294 return pdf_doc_.get();
296 } 295 }
297 296
298 } // namespace printing 297 } // namespace printing
OLDNEW
« no previous file with comments | « printing/pdf_metafile_cg_mac.h ('k') | printing/pdf_metafile_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698