summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser/cpdf_string.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_string.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/core/fpdfapi/parser/cpdf_string.cpp b/core/fpdfapi/parser/cpdf_string.cpp
index 2116c200fe..fd4ff04ff7 100644
--- a/core/fpdfapi/parser/cpdf_string.cpp
+++ b/core/fpdfapi/parser/cpdf_string.cpp
@@ -11,8 +11,13 @@
CPDF_String::CPDF_String() : m_bHex(false) {}
-CPDF_String::CPDF_String(const CFX_ByteString& str, bool bHex)
- : m_String(str), m_bHex(bHex) {}
+CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
+ const CFX_ByteString& str,
+ bool bHex)
+ : m_String(str), m_bHex(bHex) {
+ if (pPool)
+ m_String = pPool->Intern(m_String);
+}
CPDF_String::CPDF_String(const CFX_WideString& str) : m_bHex(false) {
m_String = PDF_EncodeText(str);
@@ -25,7 +30,10 @@ CPDF_Object::Type CPDF_String::GetType() const {
}
std::unique_ptr<CPDF_Object> CPDF_String::Clone() const {
- return pdfium::MakeUnique<CPDF_String>(m_String, m_bHex);
+ auto pRet = pdfium::MakeUnique<CPDF_String>();
+ pRet->m_String = m_String;
+ pRet->m_bHex = m_bHex;
+ return std::move(pRet);
}
CFX_ByteString CPDF_String::GetString() const {