diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fde/xml/cfx_saxreader.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_checksum.cpp | 86 | ||||
-rw-r--r-- | xfa/fxfa/include/xfa_checksum.h | 18 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 11 |
4 files changed, 61 insertions, 58 deletions
diff --git a/xfa/fde/xml/cfx_saxreader.h b/xfa/fde/xml/cfx_saxreader.h index 18aa039ccc..e602c3d9e2 100644 --- a/xfa/fde/xml/cfx_saxreader.h +++ b/xfa/fde/xml/cfx_saxreader.h @@ -9,6 +9,8 @@ #include "core/fxcrt/include/fx_basic.h" +class CXFA_SAXContext; + class CFX_SAXItem { public: enum class Type { @@ -29,7 +31,7 @@ class CFX_SAXItem { m_pPrev(nullptr), m_pNext(nullptr) {} - void* m_pNode; + CXFA_SAXContext* m_pNode; Type m_eNode; uint32_t m_dwID; FX_BOOL m_bSkip; diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index b279dc9596..9313ad7ea2 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -96,9 +96,10 @@ CXFA_SAXReaderHandler::CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext) ASSERT(m_pContext); } CXFA_SAXReaderHandler::~CXFA_SAXReaderHandler() {} -void* CXFA_SAXReaderHandler::OnTagEnter(const CFX_ByteStringC& bsTagName, - CFX_SAXItem::Type eType, - uint32_t dwStartPos) { +CXFA_SAXContext* CXFA_SAXReaderHandler::OnTagEnter( + const CFX_ByteStringC& bsTagName, + CFX_SAXItem::Type eType, + uint32_t dwStartPos) { UpdateChecksum(TRUE); if (eType != CFX_SAXItem::Type::Tag && eType != CFX_SAXItem::Type::Instruction) { @@ -114,78 +115,79 @@ void* CXFA_SAXReaderHandler::OnTagEnter(const CFX_ByteStringC& bsTagName, m_SAXContext.m_bsTagName = bsTagName; return &m_SAXContext; } -void CXFA_SAXReaderHandler::OnTagAttribute(void* pTag, + +void CXFA_SAXReaderHandler::OnTagAttribute(CXFA_SAXContext* pTag, const CFX_ByteStringC& bsAttri, const CFX_ByteStringC& bsValue) { - if (pTag == NULL) { + if (!pTag) return; - } - CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf; - textBuf << " " << bsAttri << "=\"" << bsValue << "\""; + + pTag->m_TextBuf << " " << bsAttri << "=\"" << bsValue << "\""; } -void CXFA_SAXReaderHandler::OnTagBreak(void* pTag) { - if (pTag == NULL) { + +void CXFA_SAXReaderHandler::OnTagBreak(CXFA_SAXContext* pTag) { + if (!pTag) return; - } - CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf; - textBuf << ">"; + + pTag->m_TextBuf << ">"; UpdateChecksum(FALSE); } -void CXFA_SAXReaderHandler::OnTagData(void* pTag, + +void CXFA_SAXReaderHandler::OnTagData(CXFA_SAXContext* pTag, CFX_SAXItem::Type eType, const CFX_ByteStringC& bsData, uint32_t dwStartPos) { - if (pTag == NULL) { + if (!pTag) return; - } - CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf; - if (eType == CFX_SAXItem::Type::CharData) { + + CFX_ByteTextBuf& textBuf = pTag->m_TextBuf; + if (eType == CFX_SAXItem::Type::CharData) textBuf << "<![CDATA["; - } + textBuf << bsData; - if (eType == CFX_SAXItem::Type::CharData) { + if (eType == CFX_SAXItem::Type::CharData) textBuf << "]]>"; - } } -void CXFA_SAXReaderHandler::OnTagClose(void* pTag, uint32_t dwEndPos) { - if (pTag == NULL) { + +void CXFA_SAXReaderHandler::OnTagClose(CXFA_SAXContext* pTag, + uint32_t dwEndPos) { + if (!pTag) return; - } - CXFA_SAXContext* pSAXContext = (CXFA_SAXContext*)pTag; - CFX_ByteTextBuf& textBuf = pSAXContext->m_TextBuf; - if (pSAXContext->m_eNode == CFX_SAXItem::Type::Instruction) { + + CFX_ByteTextBuf& textBuf = pTag->m_TextBuf; + if (pTag->m_eNode == CFX_SAXItem::Type::Instruction) textBuf << "?>"; - } else if (pSAXContext->m_eNode == CFX_SAXItem::Type::Tag) { - textBuf << "></" << pSAXContext->m_bsTagName.AsStringC() << ">"; - } + else if (pTag->m_eNode == CFX_SAXItem::Type::Tag) + textBuf << "></" << pTag->m_bsTagName.AsStringC() << ">"; + UpdateChecksum(FALSE); } -void CXFA_SAXReaderHandler::OnTagEnd(void* pTag, + +void CXFA_SAXReaderHandler::OnTagEnd(CXFA_SAXContext* pTag, const CFX_ByteStringC& bsTagName, uint32_t dwEndPos) { - if (pTag == NULL) { + if (!pTag) return; - } - CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf; - textBuf << "</" << bsTagName << ">"; + + pTag->m_TextBuf << "</" << bsTagName << ">"; UpdateChecksum(FALSE); } -void CXFA_SAXReaderHandler::OnTargetData(void* pTag, + +void CXFA_SAXReaderHandler::OnTargetData(CXFA_SAXContext* pTag, CFX_SAXItem::Type eType, const CFX_ByteStringC& bsData, uint32_t dwStartPos) { - if (pTag == NULL && eType != CFX_SAXItem::Type::Comment) { + if (!pTag && eType != CFX_SAXItem::Type::Comment) return; - } + if (eType == CFX_SAXItem::Type::Comment) { - CFX_ByteTextBuf& textBuf = m_SAXContext.m_TextBuf; - textBuf << "<!--" << bsData << "-->"; + m_SAXContext.m_TextBuf << "<!--" << bsData << "-->"; UpdateChecksum(FALSE); } else { - CFX_ByteTextBuf& textBuf = ((CXFA_SAXContext*)pTag)->m_TextBuf; - textBuf << " " << bsData; + pTag->m_TextBuf << " " << bsData; } } + void CXFA_SAXReaderHandler::UpdateChecksum(FX_BOOL bCheckSpace) { int32_t iLength = m_SAXContext.m_TextBuf.GetLength(); if (iLength < 1) { diff --git a/xfa/fxfa/include/xfa_checksum.h b/xfa/fxfa/include/xfa_checksum.h index a5e5592cec..e959a8053a 100644 --- a/xfa/fxfa/include/xfa_checksum.h +++ b/xfa/fxfa/include/xfa_checksum.h @@ -27,23 +27,23 @@ class CXFA_SAXReaderHandler { CXFA_SAXReaderHandler(CXFA_ChecksumContext* pContext); ~CXFA_SAXReaderHandler(); - void* OnTagEnter(const CFX_ByteStringC& bsTagName, - CFX_SAXItem::Type eType, - uint32_t dwStartPos); - void OnTagAttribute(void* pTag, + CXFA_SAXContext* OnTagEnter(const CFX_ByteStringC& bsTagName, + CFX_SAXItem::Type eType, + uint32_t dwStartPos); + void OnTagAttribute(CXFA_SAXContext* pTag, const CFX_ByteStringC& bsAttri, const CFX_ByteStringC& bsValue); - void OnTagBreak(void* pTag); - void OnTagData(void* pTag, + void OnTagBreak(CXFA_SAXContext* pTag); + void OnTagData(CXFA_SAXContext* pTag, CFX_SAXItem::Type eType, const CFX_ByteStringC& bsData, uint32_t dwStartPos); - void OnTagClose(void* pTag, uint32_t dwEndPos); - void OnTagEnd(void* pTag, + void OnTagClose(CXFA_SAXContext* pTag, uint32_t dwEndPos); + void OnTagEnd(CXFA_SAXContext* pTag, const CFX_ByteStringC& bsTagName, uint32_t dwEndPos); - void OnTargetData(void* pTag, + void OnTargetData(CXFA_SAXContext* pTag, CFX_SAXItem::Type eType, const CFX_ByteStringC& bsData, uint32_t dwStartPos); diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index bac3c18514..67416f2166 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -242,7 +242,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( if (!bOnPageArea) { CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, CXFA_TraverseStrategy_ContentLayoutItem> - iterator((CXFA_ContentLayoutItem*)pItem->m_pFirstChild); + iterator(static_cast<CXFA_ContentLayoutItem*>(pItem->m_pFirstChild)); for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); pItemChild; pItemChild = iterator.MoveToNext()) { if (!pItemChild->IsContentLayoutItem()) { @@ -266,7 +266,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( if (bOnPageArea) { CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, CXFA_TraverseStrategy_ContentLayoutItem> - iterator((CXFA_ContentLayoutItem*)pItem); + iterator(static_cast<CXFA_ContentLayoutItem*>(pItem)); for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); pItemChild; pItemChild = iterator.MoveToNext()) { if (!pItemChild->IsContentLayoutItem()) { @@ -306,7 +306,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( if (!bOnPageArea) { CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, CXFA_TraverseStrategy_ContentLayoutItem> - iterator((CXFA_ContentLayoutItem*)pItem->m_pFirstChild); + iterator(static_cast<CXFA_ContentLayoutItem*>(pItem->m_pFirstChild)); for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); pItemChild; pItemChild = iterator.MoveToNext()) { if (!pItemChild->IsContentLayoutItem()) @@ -323,7 +323,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( if (bOnPageArea) { CXFA_NodeIteratorTemplate<CXFA_ContentLayoutItem, CXFA_TraverseStrategy_ContentLayoutItem> - iterator((CXFA_ContentLayoutItem*)pItem); + iterator(static_cast<CXFA_ContentLayoutItem*>(pItem)); for (CXFA_ContentLayoutItem* pItemChild = iterator.GetCurrent(); pItemChild; pItemChild = iterator.MoveToNext()) { if (!pItemChild->IsContentLayoutItem()) @@ -375,8 +375,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageContent( CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); pArrayNodeList->SetArrayNodeList(retArray); pArguments->GetReturnValue()->SetObject( - (CXFA_Object*)pArrayNodeList, - m_pDocument->GetScriptContext()->GetJseNormalClass()); + pArrayNodeList, m_pDocument->GetScriptContext()->GetJseNormalClass()); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( CFXJSE_Arguments* pArguments) { |