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

Side by Side Diff: fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: Plug leaks 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
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h" 7 #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h"
8 8
9 #include "core/fpdfapi/parser/cpdf_array.h" 9 #include "core/fpdfapi/parser/cpdf_array.h"
10 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 10 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); 391 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
392 csTitle.ReleaseBuffer(csTitle.GetLength()); 392 csTitle.ReleaseBuffer(csTitle.GetLength());
393 } 393 }
394 394
395 void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc, 395 void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
396 const CFX_WideString& wsTitle) { 396 const CFX_WideString& wsTitle) {
397 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc()) 397 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
398 return; 398 return;
399 399
400 if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo()) 400 if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo())
401 pInfoDict->SetFor("Title", new CPDF_String(wsTitle)); 401 pInfoDict->SetNewFor<CPDF_String>("Title", wsTitle);
402 } 402 }
403 403
404 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, 404 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
405 const CFX_WideString& wsFilePath, 405 const CFX_WideString& wsFilePath,
406 bool bXDP) { 406 bool bXDP) {
407 if (hDoc != m_pContext->GetXFADoc()) 407 if (hDoc != m_pContext->GetXFADoc())
408 return; 408 return;
409 409
410 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA && 410 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
411 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) { 411 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 !m_pContext->GetFormFillEnv()->GetJSRuntime()) { 1017 !m_pContext->GetFormFillEnv()->GetJSRuntime()) {
1018 return false; 1018 return false;
1019 } 1019 }
1020 1020
1021 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 1021 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
1022 if (!m_pJSContext) 1022 if (!m_pJSContext)
1023 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); 1023 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext();
1024 1024
1025 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); 1025 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue);
1026 } 1026 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698