From 690d456ad54f021063dcc17fde27c7ba4d910717 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 18 May 2017 11:42:46 -0700 Subject: Use UnownedPtr to check CFX_*StringC lifetimes Change interform to avoid temp StringC with dangling ptr. Change-Id: I8d8659973bcdf2cdbcaa6efa6012e4acce5f1604 Reviewed-on: https://pdfium-review.googlesource.com/5571 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- fpdfsdk/cpdfsdk_interform.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'fpdfsdk/cpdfsdk_interform.cpp') diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 2d02a7ab93..76cb6fdabf 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -502,9 +502,8 @@ bool CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( const std::vector& fields, bool bIncludeOrExclude, CFX_ByteTextBuf& textBuf) { - std::unique_ptr pFDF = - m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath().AsStringC(), - fields, bIncludeOrExclude, false); + std::unique_ptr pFDF = m_pInterForm->ExportToFDF( + m_pFormFillEnv->JS_docGetFilePath(), fields, bIncludeOrExclude, false); return pFDF ? pFDF->WriteBuf(textBuf) : false; } @@ -521,8 +520,8 @@ bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, if (!m_pFormFillEnv || !m_pInterForm) return false; - std::unique_ptr pFDFDoc = m_pInterForm->ExportToFDF( - m_pFormFillEnv->JS_docGetFilePath().AsStringC(), false); + std::unique_ptr pFDFDoc = + m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath(), false); if (!pFDFDoc) return false; @@ -543,8 +542,8 @@ bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, } bool CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) { - std::unique_ptr pFDF = m_pInterForm->ExportToFDF( - m_pFormFillEnv->JS_docGetFilePath().AsStringC(), false); + std::unique_ptr pFDF = + m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath(), false); return pFDF && pFDF->WriteBuf(textBuf); } -- cgit v1.2.3