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

Side by Side Diff: fpdfsdk/src/fsdk_mgr.cpp

Issue 1547833002: Switch from nonstd::unique_ptr to std::unique_ptr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 12 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/src/fsdk_baseform.cpp ('k') | fpdfsdk/src/javascript/Field.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 <algorithm> 7 #include <algorithm>
8 #include <memory>
8 9
9 #include "fpdfsdk/include/fsdk_mgr.h" 10 #include "fpdfsdk/include/fsdk_mgr.h"
10 11
11 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" 12 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
12 #include "fpdfsdk/include/fsdk_define.h" 13 #include "fpdfsdk/include/fsdk_define.h"
13 #include "fpdfsdk/include/javascript/IJavaScript.h" 14 #include "fpdfsdk/include/javascript/IJavaScript.h"
14 #include "public/fpdf_ext.h" 15 #include "public/fpdf_ext.h"
15 #include "third_party/base/nonstd_unique_ptr.h"
16 #include "third_party/base/stl_util.h" 16 #include "third_party/base/stl_util.h"
17 17
18 #if _FX_OS_ == _FX_ANDROID_ 18 #if _FX_OS_ == _FX_ANDROID_
19 #include "time.h" 19 #include "time.h"
20 #else 20 #else
21 #include <ctime> 21 #include <ctime>
22 #endif 22 #endif
23 23
24 class CFX_SystemHandler : public IFX_SystemHandler { 24 class CFX_SystemHandler : public IFX_SystemHandler {
25 public: 25 public:
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (!m_pInfo || !m_pInfo->m_pJsPlatform || 266 if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
267 !m_pInfo->m_pJsPlatform->Field_browse) { 267 !m_pInfo->m_pJsPlatform->Field_browse) {
268 return L""; 268 return L"";
269 } 269 }
270 270
271 const int nRequiredLen = 271 const int nRequiredLen =
272 m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, nullptr, 0); 272 m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, nullptr, 0);
273 if (nRequiredLen <= 0) 273 if (nRequiredLen <= 0)
274 return L""; 274 return L"";
275 275
276 nonstd::unique_ptr<char[]> pBuff(new char[nRequiredLen]); 276 std::unique_ptr<char[]> pBuff(new char[nRequiredLen]);
277 memset(pBuff.get(), 0, nRequiredLen); 277 memset(pBuff.get(), 0, nRequiredLen);
278 const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse( 278 const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse(
279 m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen); 279 m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen);
280 if (nActualLen <= 0 || nActualLen > nRequiredLen) 280 if (nActualLen <= 0 || nActualLen > nRequiredLen)
281 return L""; 281 return L"";
282 282
283 CFX_ByteString bsRet = CFX_ByteString(pBuff.get(), nActualLen); 283 CFX_ByteString bsRet = CFX_ByteString(pBuff.get(), nActualLen);
284 CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet); 284 CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);
285 return wsRet; 285 return wsRet;
286 } 286 }
287 287
288 CFX_WideString CPDFDoc_Environment::JS_docGetFilePath() { 288 CFX_WideString CPDFDoc_Environment::JS_docGetFilePath() {
289 if (!m_pInfo || !m_pInfo->m_pJsPlatform || 289 if (!m_pInfo || !m_pInfo->m_pJsPlatform ||
290 !m_pInfo->m_pJsPlatform->Doc_getFilePath) { 290 !m_pInfo->m_pJsPlatform->Doc_getFilePath) {
291 return L""; 291 return L"";
292 } 292 }
293 293
294 const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( 294 const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
295 m_pInfo->m_pJsPlatform, nullptr, 0); 295 m_pInfo->m_pJsPlatform, nullptr, 0);
296 if (nRequiredLen <= 0) 296 if (nRequiredLen <= 0)
297 return L""; 297 return L"";
298 298
299 nonstd::unique_ptr<char[]> pBuff(new char[nRequiredLen]); 299 std::unique_ptr<char[]> pBuff(new char[nRequiredLen]);
300 memset(pBuff.get(), 0, nRequiredLen); 300 memset(pBuff.get(), 0, nRequiredLen);
301 const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( 301 const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
302 m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen); 302 m_pInfo->m_pJsPlatform, pBuff.get(), nRequiredLen);
303 if (nActualLen <= 0 || nActualLen > nRequiredLen) 303 if (nActualLen <= 0 || nActualLen > nRequiredLen)
304 return L""; 304 return L"";
305 305
306 CFX_ByteString bsRet = CFX_ByteString(pBuff.get(), nActualLen); 306 CFX_ByteString bsRet = CFX_ByteString(pBuff.get(), nActualLen);
307 CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet); 307 CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);
308 return wsRet; 308 return wsRet;
309 } 309 }
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); 917 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot();
918 if (!pFocusAnnot) 918 if (!pFocusAnnot)
919 return nullptr; 919 return nullptr;
920 920
921 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { 921 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) {
922 if (pAnnot == pFocusAnnot) 922 if (pAnnot == pFocusAnnot)
923 return pAnnot; 923 return pAnnot;
924 } 924 }
925 return nullptr; 925 return nullptr;
926 } 926 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | fpdfsdk/src/javascript/Field.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698