diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_boolean.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_boolean.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp | 8 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_security_handler.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h | 5 | ||||
-rw-r--r-- | core/fpdfdoc/doc_action.cpp | 39 | ||||
-rw-r--r-- | core/fpdfdoc/doc_utils.cpp | 8 | ||||
-rw-r--r-- | core/fpdfdoc/include/fpdf_doc.h | 14 |
9 files changed, 20 insertions, 69 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_boolean.cpp b/core/fpdfapi/fpdf_parser/cpdf_boolean.cpp index cd7ed32a96..c5fd277d74 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_boolean.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_boolean.cpp @@ -8,7 +8,7 @@ CPDF_Boolean::CPDF_Boolean() : m_bValue(false) {} -CPDF_Boolean::CPDF_Boolean(FX_BOOL value) : m_bValue(value) {} +CPDF_Boolean::CPDF_Boolean(bool value) : m_bValue(value) {} CPDF_Boolean::~CPDF_Boolean() {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_boolean.h b/core/fpdfapi/fpdf_parser/cpdf_boolean.h index c92bf41b86..adbb721f35 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_boolean.h +++ b/core/fpdfapi/fpdf_parser/cpdf_boolean.h @@ -14,7 +14,7 @@ class CPDF_Boolean : public CPDF_Object { public: CPDF_Boolean(); - explicit CPDF_Boolean(FX_BOOL value); + explicit CPDF_Boolean(bool value); // CPDF_Object. Type GetType() const override; @@ -29,7 +29,7 @@ class CPDF_Boolean : public CPDF_Object { protected: ~CPDF_Boolean() override; - FX_BOOL m_bValue; + bool m_bValue; }; #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_BOOLEAN_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp index 27b866a65b..4ea8f438bd 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp @@ -96,10 +96,10 @@ FX_FLOAT CPDF_Dictionary::GetNumberBy(const CFX_ByteString& key) const { return p ? p->GetNumber() : 0; } -FX_BOOL CPDF_Dictionary::GetBooleanBy(const CFX_ByteString& key, - FX_BOOL bDefault) const { +bool CPDF_Dictionary::GetBooleanBy(const CFX_ByteString& key, + bool bDefault) const { CPDF_Object* p = GetObjectBy(key); - return ToBoolean(p) ? p->GetInteger() : bDefault; + return ToBoolean(p) ? p->GetInteger() != 0 : bDefault; } CPDF_Dictionary* CPDF_Dictionary::GetDictBy(const CFX_ByteString& key) const { @@ -224,7 +224,7 @@ void CPDF_Dictionary::SetAtNumber(const CFX_ByteString& key, FX_FLOAT f) { SetAt(key, new CPDF_Number(f)); } -void CPDF_Dictionary::SetAtBoolean(const CFX_ByteString& key, FX_BOOL bValue) { +void CPDF_Dictionary::SetAtBoolean(const CFX_ByteString& key, bool bValue) { SetAt(key, new CPDF_Boolean(bValue)); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp index 94ef042bc0..054266765a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp @@ -512,8 +512,9 @@ FX_BOOL CPDF_SecurityHandler::CheckOwnerPassword(const uint8_t* password, return CheckUserPassword(user_pass.raw_str(), user_pass.GetLength(), TRUE, key, key_len); } -FX_BOOL CPDF_SecurityHandler::IsMetadataEncrypted() { - return m_pEncryptDict->GetBooleanBy("EncryptMetadata", TRUE); + +bool CPDF_SecurityHandler::IsMetadataEncrypted() const { + return m_pEncryptDict->GetBooleanBy("EncryptMetadata", true); } void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, @@ -545,7 +546,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, AES256_SetPassword(pEncryptDict, owner_pass, owner_size, TRUE, m_EncryptKey); AES256_SetPerms(pEncryptDict, m_Permissions, - pEncryptDict->GetBooleanBy("EncryptMetadata", TRUE), + pEncryptDict->GetBooleanBy("EncryptMetadata", true), m_EncryptKey); } return; diff --git a/core/fpdfapi/fpdf_parser/cpdf_security_handler.h b/core/fpdfapi/fpdf_parser/cpdf_security_handler.h index d342c1484e..3cf4d2cd19 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_security_handler.h +++ b/core/fpdfapi/fpdf_parser/cpdf_security_handler.h @@ -30,7 +30,7 @@ class CPDF_SecurityHandler { FX_BOOL OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict); uint32_t GetPermissions(); FX_BOOL GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen); - FX_BOOL IsMetadataEncrypted(); + bool IsMetadataEncrypted() const; CPDF_CryptoHandler* CreateCryptoHandler(); void OnCreate(CPDF_Dictionary* pEncryptDict, diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h index e3b7496da7..41cec0cda2 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h @@ -39,8 +39,7 @@ class CPDF_Dictionary : public CPDF_Object { CFX_WideString GetUnicodeTextBy(const CFX_ByteString& key) const; int GetIntegerBy(const CFX_ByteString& key) const; int GetIntegerBy(const CFX_ByteString& key, int default_int) const; - FX_BOOL GetBooleanBy(const CFX_ByteString& key, - FX_BOOL bDefault = FALSE) const; + bool GetBooleanBy(const CFX_ByteString& key, bool bDefault = false) const; FX_FLOAT GetNumberBy(const CFX_ByteString& key) const; CPDF_Dictionary* GetDictBy(const CFX_ByteString& key) const; CPDF_Stream* GetStreamBy(const CFX_ByteString& key) const; @@ -70,7 +69,7 @@ class CPDF_Dictionary : public CPDF_Object { } void SetAtRect(const CFX_ByteString& key, const CFX_FloatRect& rect); void SetAtMatrix(const CFX_ByteString& key, const CFX_Matrix& matrix); - void SetAtBoolean(const CFX_ByteString& key, FX_BOOL bValue); + void SetAtBoolean(const CFX_ByteString& key, bool bValue); void AddReference(const CFX_ByteString& key, CPDF_IndirectObjectHolder* pDoc, diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index 6f3e2945fa..e646df2b4c 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -193,44 +193,7 @@ CFX_WideString CPDF_Action::GetJavaScript() const { CPDF_Object* pJS = m_pDict->GetDirectObjectBy("JS"); return pJS ? pJS->GetUnicodeText() : csJS; } -CPDF_Dictionary* CPDF_Action::GetAnnot() const { - if (!m_pDict) { - return nullptr; - } - CFX_ByteString csType = m_pDict->GetStringBy("S"); - if (csType == "Rendition") { - return m_pDict->GetDictBy("AN"); - } - if (csType == "Movie") { - return m_pDict->GetDictBy("Annotation"); - } - return nullptr; -} -int32_t CPDF_Action::GetOperationType() const { - if (!m_pDict) { - return 0; - } - CFX_ByteString csType = m_pDict->GetStringBy("S"); - if (csType == "Rendition") { - return m_pDict->GetIntegerBy("OP"); - } - if (csType == "Movie") { - CFX_ByteString csOP = m_pDict->GetStringBy("Operation"); - if (csOP == "Play") { - return 0; - } - if (csOP == "Stop") { - return 1; - } - if (csOP == "Pause") { - return 2; - } - if (csOP == "Resume") { - return 3; - } - } - return 0; -} + size_t CPDF_Action::GetSubActionsCount() const { if (!m_pDict || !m_pDict->KeyExist("Next")) return 0; diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index 408f0065e2..6c61c3d75e 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -716,11 +716,9 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { } } } -FX_BOOL CPDF_IconFit::GetFittingBounds() { - if (!m_pDict) { - return FALSE; - } - return m_pDict->GetBooleanBy("FB"); + +bool CPDF_IconFit::GetFittingBounds() { + return m_pDict ? m_pDict->GetBooleanBy("FB") : false; } std::vector<bool> SaveCheckedFieldStatus(CPDF_FormField* pField) { diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h index 4fc5b5232b..3ee583d778 100644 --- a/core/fpdfdoc/include/fpdf_doc.h +++ b/core/fpdfdoc/include/fpdf_doc.h @@ -188,24 +188,14 @@ class CPDF_Action { explicit CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) {} CPDF_Dictionary* GetDict() const { return m_pDict; } - CFX_ByteString GetTypeName() const { return m_pDict->GetStringBy("S"); } ActionType GetType() const; CPDF_Dest GetDest(CPDF_Document* pDoc) const; CFX_WideString GetFilePath() const; - FX_BOOL GetNewWindow() const { return m_pDict->GetBooleanBy("NewWindow"); } CFX_ByteString GetURI(CPDF_Document* pDoc) const; - FX_BOOL GetMouseMap() const { return m_pDict->GetBooleanBy("IsMap"); } - FX_BOOL GetHideStatus() const { return m_pDict->GetBooleanBy("H", TRUE); } + bool GetHideStatus() const { return m_pDict->GetBooleanBy("H", true); } CFX_ByteString GetNamedAction() const { return m_pDict->GetStringBy("N"); } uint32_t GetFlags() const { return m_pDict->GetIntegerBy("Flags"); } CFX_WideString GetJavaScript() const; - CPDF_Dictionary* GetAnnot() const; - int32_t GetOperationType() const; - CPDF_Stream* GetSoundStream() const { return m_pDict->GetStreamBy("Sound"); } - FX_FLOAT GetVolume() const { return m_pDict->GetNumberBy("Volume"); } - FX_BOOL IsSynchronous() const { return m_pDict->GetBooleanBy("Synchronous"); } - FX_BOOL IsRepeat() const { return m_pDict->GetBooleanBy("Repeat"); } - FX_BOOL IsMixPlay() const { return m_pDict->GetBooleanBy("Mix"); } size_t GetSubActionsCount() const; CPDF_Action GetSubAction(size_t iIndex) const; @@ -794,7 +784,7 @@ class CPDF_IconFit { ScaleMethod GetScaleMethod(); FX_BOOL IsProportionalScale(); void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); - FX_BOOL GetFittingBounds(); + bool GetFittingBounds(); const CPDF_Dictionary* GetDict() const { return m_pDict; } protected: |