summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-18 11:42:46 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-18 19:22:52 +0000
commit690d456ad54f021063dcc17fde27c7ba4d910717 (patch)
tree75ff5c3a11aa2f1cfc739e20179a8640bd0baae9 /core/fpdfdoc
parente6792f9901267b2b65611e94713462bc9d0b5191 (diff)
downloadpdfium-690d456ad54f021063dcc17fde27c7ba4d910717.tar.xz
Use UnownedPtr to check CFX_*StringC lifetimeschromium/3104
Change interform to avoid temp StringC with dangling ptr. Change-Id: I8d8659973bcdf2cdbcaa6efa6012e4acce5f1604 Reviewed-on: https://pdfium-review.googlesource.com/5571 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_filespec.cpp8
-rw-r--r--core/fpdfdoc/cpdf_filespec.h6
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp4
-rw-r--r--core/fpdfdoc/cpdf_interform.h4
4 files changed, 11 insertions, 11 deletions
diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp
index 7fe8ec8c03..59915eaa05 100644
--- a/core/fpdfdoc/cpdf_filespec.cpp
+++ b/core/fpdfdoc/cpdf_filespec.cpp
@@ -50,7 +50,7 @@ CFX_WideString ChangeSlashToPDF(const wchar_t* str) {
} // namespace
-CFX_WideString CPDF_FileSpec::DecodeFileName(const CFX_WideStringC& filepath) {
+CFX_WideString CPDF_FileSpec::DecodeFileName(const CFX_WideString& filepath) {
if (filepath.GetLength() <= 1)
return CFX_WideString();
@@ -108,7 +108,7 @@ bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const {
} else {
return false;
}
- *csFileName = DecodeFileName(csFileName->AsStringC());
+ *csFileName = DecodeFileName(*csFileName);
return true;
}
@@ -116,7 +116,7 @@ CPDF_FileSpec::CPDF_FileSpec(CPDF_Object* pObj) : m_pObj(pObj) {}
CPDF_FileSpec::~CPDF_FileSpec() {}
-CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideStringC& filepath) {
+CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideString& filepath) {
if (filepath.GetLength() <= 1)
return CFX_WideString();
@@ -145,7 +145,7 @@ CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideStringC& filepath) {
#endif
}
-void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName) {
+void CPDF_FileSpec::SetFileName(const CFX_WideString& wsFileName) {
if (!m_pObj)
return;
diff --git a/core/fpdfdoc/cpdf_filespec.h b/core/fpdfdoc/cpdf_filespec.h
index fb71b57186..04baf2e63f 100644
--- a/core/fpdfdoc/cpdf_filespec.h
+++ b/core/fpdfdoc/cpdf_filespec.h
@@ -20,16 +20,16 @@ class CPDF_FileSpec {
~CPDF_FileSpec();
// Convert a platform dependent file name into pdf format.
- static CFX_WideString EncodeFileName(const CFX_WideStringC& filepath);
+ static CFX_WideString EncodeFileName(const CFX_WideString& filepath);
// Convert a pdf file name into platform dependent format.
- static CFX_WideString DecodeFileName(const CFX_WideStringC& filepath);
+ static CFX_WideString DecodeFileName(const CFX_WideString& filepath);
CPDF_Object* GetObj() const { return m_pObj.Get(); }
bool GetFileName(CFX_WideString* wsFileName) const;
// Set this file spec to refer to a file name (not a url).
- void SetFileName(const CFX_WideStringC& wsFileName);
+ void SetFileName(const CFX_WideString& wsFileName);
private:
CFX_UnownedPtr<CPDF_Object> const m_pObj;
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 766ec6cd4f..88787d2e5b 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -1179,7 +1179,7 @@ bool CPDF_InterForm::CheckRequiredFields(
}
std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
- const CFX_WideStringC& pdf_path,
+ const CFX_WideString& pdf_path,
bool bSimpleFileSpec) const {
std::vector<CPDF_FormField*> fields;
size_t nCount = m_pFieldTree->m_Root.CountFields();
@@ -1189,7 +1189,7 @@ std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
}
std::unique_ptr<CFDF_Document> CPDF_InterForm::ExportToFDF(
- const CFX_WideStringC& pdf_path,
+ const CFX_WideString& pdf_path,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bSimpleFileSpec) const {
diff --git a/core/fpdfdoc/cpdf_interform.h b/core/fpdfdoc/cpdf_interform.h
index 5399392734..23530e57b2 100644
--- a/core/fpdfdoc/cpdf_interform.h
+++ b/core/fpdfdoc/cpdf_interform.h
@@ -71,11 +71,11 @@ class CPDF_InterForm {
bool CheckRequiredFields(const std::vector<CPDF_FormField*>* fields,
bool bIncludeOrExclude) const;
- std::unique_ptr<CFDF_Document> ExportToFDF(const CFX_WideStringC& pdf_path,
+ std::unique_ptr<CFDF_Document> ExportToFDF(const CFX_WideString& pdf_path,
bool bSimpleFileSpec) const;
std::unique_ptr<CFDF_Document> ExportToFDF(
- const CFX_WideStringC& pdf_path,
+ const CFX_WideString& pdf_path,
const std::vector<CPDF_FormField*>& fields,
bool bIncludeOrExclude,
bool bSimpleFileSpec) const;