diff options
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_name.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_number.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_parser.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp | 8 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_string.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/include/cpdf_object.h | 2 |
8 files changed, 17 insertions, 12 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_name.cpp b/core/fpdfapi/fpdf_parser/cpdf_name.cpp index db37754b66..a7adf1b3d6 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_name.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_name.cpp @@ -29,7 +29,7 @@ CFX_ByteString CPDF_Name::GetString() const { } CFX_ByteStringC CPDF_Name::GetConstString() const { - return CFX_ByteStringC(m_Name); + return m_Name.AsByteStringC(); } void CPDF_Name::SetString(const CFX_ByteString& str) { diff --git a/core/fpdfapi/fpdf_parser/cpdf_number.cpp b/core/fpdfapi/fpdf_parser/cpdf_number.cpp index d2f0503bc1..dbc17d5dd6 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_number.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_number.cpp @@ -47,7 +47,7 @@ const CPDF_Number* CPDF_Number::AsNumber() const { } void CPDF_Number::SetString(const CFX_ByteString& str) { - FX_atonum(str, m_bInteger, &m_Integer); + FX_atonum(str.AsByteStringC(), m_bInteger, &m_Integer); } CFX_ByteString CPDF_Number::GetString() const { diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp index 2069a161ea..6c1738d5a6 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp @@ -135,7 +135,7 @@ class PDFObjectsTest : public testing::Test { return false; for (CPDF_Dictionary::const_iterator it = dict1->begin(); it != dict1->end(); ++it) { - if (!Equal(it->second, dict2->GetObjectBy(it->first))) + if (!Equal(it->second, dict2->GetObjectBy(it->first.AsByteStringC()))) return false; } return true; diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index 305401525c..73ca71ef1a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -822,10 +822,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { uint32_t dwObjNum = pElement ? pElement->GetObjNum() : 0; if (dwObjNum) { - m_pTrailer->SetAtReference(key, m_pDocument, - dwObjNum); + m_pTrailer->SetAtReference(key.AsByteStringC(), + m_pDocument, dwObjNum); } else { - m_pTrailer->SetAt(key, pElement->Clone()); + m_pTrailer->SetAt(key.AsByteStringC(), + pElement->Clone()); } } } diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp index ac7667c3ea..9846c40d8f 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp @@ -166,14 +166,15 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) { m_Revision = pEncryptDict->GetIntegerBy("R"); m_Permissions = pEncryptDict->GetIntegerBy("P", -1); if (m_Version < 4) { - return _LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen); + return _LoadCryptInfo(pEncryptDict, CFX_ByteStringC(), m_Cipher, m_KeyLen); } CFX_ByteString stmf_name = pEncryptDict->GetStringBy("StmF"); CFX_ByteString strf_name = pEncryptDict->GetStringBy("StrF"); if (stmf_name != strf_name) { return FALSE; } - if (!_LoadCryptInfo(pEncryptDict, strf_name, m_Cipher, m_KeyLen)) { + if (!_LoadCryptInfo(pEncryptDict, strf_name.AsByteStringC(), m_Cipher, + m_KeyLen)) { return FALSE; } return TRUE; @@ -195,7 +196,8 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, return FALSE; } } - if (!_LoadCryptInfo(pEncryptDict, strf_name, cipher, key_len)) { + if (!_LoadCryptInfo(pEncryptDict, strf_name.AsByteStringC(), cipher, + key_len)) { return FALSE; } m_Cipher = cipher; diff --git a/core/fpdfapi/fpdf_parser/cpdf_string.cpp b/core/fpdfapi/fpdf_parser/cpdf_string.cpp index 9a88e937ab..3f04d125a2 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_string.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_string.cpp @@ -32,7 +32,7 @@ CFX_ByteString CPDF_String::GetString() const { } CFX_ByteStringC CPDF_String::GetConstString() const { - return CFX_ByteStringC(m_String); + return m_String.AsByteStringC(); } void CPDF_String::SetString(const CFX_ByteString& str) { diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index 5a3db292e0..d04a682b77 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -399,7 +399,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList, } } m_Pos = SavedPos; - return new CPDF_Number(word); + return new CPDF_Number(word.AsByteStringC()); } if (word == "true" || word == "false") @@ -521,7 +521,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( return new CPDF_Reference(pObjList, FXSYS_atoui(word)); } m_Pos = SavedPos; - return new CPDF_Number(word); + return new CPDF_Number(word.AsByteStringC()); } if (word == "true" || word == "false") diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h index 802cbbc638..6cdaaf58fd 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h @@ -46,6 +46,8 @@ class CPDF_Object { void Release(); virtual CFX_ByteString GetString() const; + + // Note: |this| must outlive the use of |GetConstString|'s result. virtual CFX_ByteStringC GetConstString() const; virtual CFX_WideString GetUnicodeText() const; virtual FX_FLOAT GetNumber() const; |