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

Side by Side Diff: fpdfsdk/fpdf_dataavail.cpp

Issue 2381723002: Replace std::unique_ptr.reset() with WrapUnique assignment. (Closed)
Patch Set: build 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/formfiller/cffl_textfield.cpp ('k') | fpdfsdk/fpdfdoc_unittest.cpp » ('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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "public/fpdf_dataavail.h" 7 #include "public/fpdf_dataavail.h"
8 8
9 #include <memory>
10 #include <utility>
11
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
11 #include "fpdfsdk/include/fsdk_define.h" 14 #include "fpdfsdk/include/fsdk_define.h"
12 #include "public/fpdf_formfill.h" 15 #include "public/fpdf_formfill.h"
13 16
14 // These checks are here because core/ and public/ cannot depend on each other. 17 // These checks are here because core/ and public/ cannot depend on each other.
15 static_assert(CPDF_DataAvail::DataError == PDF_DATA_ERROR, 18 static_assert(CPDF_DataAvail::DataError == PDF_DATA_ERROR,
16 "CPDF_DataAvail::DataError value mismatch"); 19 "CPDF_DataAvail::DataError value mismatch");
17 static_assert(CPDF_DataAvail::DataNotAvailable == PDF_DATA_NOTAVAIL, 20 static_assert(CPDF_DataAvail::DataNotAvailable == PDF_DATA_NOTAVAIL,
18 "CPDF_DataAvail::DataNotAvailable value mismatch"); 21 "CPDF_DataAvail::DataNotAvailable value mismatch");
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return static_cast<CFPDF_DataAvail*>(avail); 108 return static_cast<CFPDF_DataAvail*>(avail);
106 } 109 }
107 110
108 } // namespace 111 } // namespace
109 112
110 DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, 113 DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail,
111 FPDF_FILEACCESS* file) { 114 FPDF_FILEACCESS* file) {
112 CFPDF_DataAvail* pAvail = new CFPDF_DataAvail; 115 CFPDF_DataAvail* pAvail = new CFPDF_DataAvail;
113 pAvail->m_FileAvail.Set(file_avail); 116 pAvail->m_FileAvail.Set(file_avail);
114 pAvail->m_FileRead.Set(file); 117 pAvail->m_FileRead.Set(file);
115 pAvail->m_pDataAvail.reset( 118 pAvail->m_pDataAvail = WrapUnique(
116 new CPDF_DataAvail(&pAvail->m_FileAvail, &pAvail->m_FileRead, TRUE)); 119 new CPDF_DataAvail(&pAvail->m_FileAvail, &pAvail->m_FileRead, TRUE));
117 return pAvail; 120 return pAvail;
118 } 121 }
119 122
120 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail) { 123 DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail) {
121 delete (CFPDF_DataAvail*)avail; 124 delete (CFPDF_DataAvail*)avail;
122 } 125 }
123 126
124 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, 127 DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail,
125 FX_DOWNLOADHINTS* hints) { 128 FX_DOWNLOADHINTS* hints) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 CFPDF_DownloadHintsWrap hints_wrap(hints); 179 CFPDF_DownloadHintsWrap hints_wrap(hints);
177 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail( 180 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsFormAvail(
178 &hints_wrap); 181 &hints_wrap);
179 } 182 }
180 183
181 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { 184 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) {
182 if (!avail) 185 if (!avail)
183 return PDF_LINEARIZATION_UNKNOWN; 186 return PDF_LINEARIZATION_UNKNOWN;
184 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF(); 187 return CFPDFDataAvailFromFPDFAvail(avail)->m_pDataAvail->IsLinearizedPDF();
185 } 188 }
OLDNEW
« no previous file with comments | « fpdfsdk/formfiller/cffl_textfield.cpp ('k') | fpdfsdk/fpdfdoc_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698