diff options
Diffstat (limited to 'xfa/src/fxfa')
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_document.h | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/common/xfa_script.h | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_basic_data.cpp | 44 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_basic_data.h | 48 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_basic_imp.cpp | 111 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_basic_imp.h | 12 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_document_imp.cpp | 7 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_document_serialize.cpp | 4 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_object_imp.cpp | 72 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_parser_imp.cpp | 12 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_script_imp.cpp | 10 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp | 18 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp | 8 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.h | 2 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_utils_imp.cpp | 4 |
16 files changed, 195 insertions, 165 deletions
diff --git a/xfa/src/fxfa/src/common/xfa_document.h b/xfa/src/fxfa/src/common/xfa_document.h index 1978a619b2..f75b350786 100644 --- a/xfa/src/fxfa/src/common/xfa_document.h +++ b/xfa/src/fxfa/src/common/xfa_document.h @@ -124,7 +124,7 @@ class IXFA_ObjFactory { public: virtual ~IXFA_ObjFactory() {} virtual CXFA_Node* CreateNode(FX_DWORD dwPacket, XFA_ELEMENT eElement) = 0; - virtual CXFA_Node* CreateNode(XFA_LPCPACKETINFO pPacket, + virtual CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_ELEMENT eElement) = 0; }; #define XFA_DOCFLAG_StrictScoping 0x0001 @@ -157,7 +157,7 @@ class CXFA_Document : public IXFA_ObjFactory { XFA_VERSION RecognizeXFAVersionNumber(CFX_WideString& wsTemplateNS); CXFA_LocaleMgr* GetLocalMgr(); virtual CXFA_Node* CreateNode(FX_DWORD dwPacket, XFA_ELEMENT eElement); - virtual CXFA_Node* CreateNode(XFA_LPCPACKETINFO pPacket, + virtual CXFA_Node* CreateNode(const XFA_PACKETINFO* pPacket, XFA_ELEMENT eElement); void DoProtoMerge(); CXFA_Node* GetNodeByID(CXFA_Node* pRoot, const CFX_WideStringC& wsID); diff --git a/xfa/src/fxfa/src/common/xfa_script.h b/xfa/src/fxfa/src/common/xfa_script.h index 0a859476c1..f8ee46dea2 100644 --- a/xfa/src/fxfa/src/common/xfa_script.h +++ b/xfa/src/fxfa/src/common/xfa_script.h @@ -64,7 +64,7 @@ typedef struct _XFA_RESOLVENODE_RS { } CXFA_ObjArray nodes; XFA_RESOVENODE_RSTYPE dwFlags; - XFA_LPCSCRIPTATTRIBUTEINFO pScriptAttribute; + const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; } XFA_RESOLVENODE_RS, *XFA_LPRESOLVENODE_RS; typedef struct _XFA_JSBUILTININFO { uint32_t uUnicodeHash; diff --git a/xfa/src/fxfa/src/parser/xfa_basic_data.cpp b/xfa/src/fxfa/src/parser/xfa_basic_data.cpp index cfae869f3d..d73557db2c 100644 --- a/xfa/src/fxfa/src/parser/xfa_basic_data.cpp +++ b/xfa/src/fxfa/src/parser/xfa_basic_data.cpp @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "xfa/src/fxfa/src/parser/xfa_basic_data.h" + #include "xfa/src/foxitlib.h" #include "xfa/src/fxfa/src/common/xfa_docdata.h" #include "xfa/src/fxfa/src/common/xfa_doclayout.h" @@ -21,7 +23,7 @@ #include "xfa/src/fxfa/src/parser/xfa_script_layoutpseudomodel.h" #include "xfa/src/fxfa/src/parser/xfa_script_logpseudomodel.h" #include "xfa/src/fxfa/src/parser/xfa_script_signaturepseudomodel.h" -extern const XFA_ATTRIBUTEENUMINFO g_XFAEnumData[] = { +const XFA_ATTRIBUTEENUMINFO g_XFAEnumData[] = { {0x2a, L"*", XFA_ATTRIBUTEENUM_Asterisk}, {0x2f, L"/", XFA_ATTRIBUTEENUM_Slash}, {0x5c, L"\\", XFA_ATTRIBUTEENUM_Backslash}, @@ -290,7 +292,7 @@ extern const XFA_ATTRIBUTEENUMINFO g_XFAEnumData[] = { {0xfefc4885, L"urlencoded", XFA_ATTRIBUTEENUM_Urlencoded}, {0xff795ad2, L"lowered", XFA_ATTRIBUTEENUM_Lowered}, }; -extern const int32_t g_iXFAEnumCount = +const int32_t g_iXFAEnumCount = sizeof(g_XFAEnumData) / sizeof(XFA_ATTRIBUTEENUMINFO); static const CXFA_Measurement g_XFAMeasurementData[] = { CXFA_Measurement(0, XFA_UNIT_In), @@ -303,7 +305,7 @@ static const CXFA_Measurement g_XFAMeasurementData[] = { CXFA_Measurement(360, XFA_UNIT_Angle), CXFA_Measurement(0.5, XFA_UNIT_Pt), }; -extern const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { +const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { {0x68, L"h", XFA_ATTRIBUTE_H, XFA_ATTRIBUTETYPE_Measure, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)(g_XFAMeasurementData + 0)}, @@ -966,9 +968,9 @@ extern const XFA_ATTRIBUTEINFO g_XFAAttributeData[] = { XFA_ATTRIBUTETYPE_Cdata, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, (void*)NULL}, }; -extern const int32_t g_iXFAAttributeCount = +const int32_t g_iXFAAttributeCount = sizeof(g_XFAAttributeData) / sizeof(XFA_ATTRIBUTEINFO); -extern const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[] = { +const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[] = { {XFA_ELEMENT_SubformSet, XFA_ATTRIBUTE_Relation, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_Ordered}, {XFA_ELEMENT_NumberPattern, XFA_ATTRIBUTE_Name, XFA_ATTRIBUTETYPE_Enum, @@ -1065,9 +1067,9 @@ extern const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[] = { {XFA_ELEMENT_NumberSymbol, XFA_ATTRIBUTE_Name, XFA_ATTRIBUTETYPE_Enum, (void*)XFA_ATTRIBUTEENUM_Decimal}, }; -extern const int32_t g_iXFANotsureCount = +const int32_t g_iXFANotsureCount = sizeof(g_XFANotsureAttributes) / sizeof(XFA_NOTSUREATTRIBUTE); -extern const XFA_ELEMENTINFO g_XFAElementData[] = { +const XFA_ELEMENTINFO g_XFAElementData[] = { {0x23ee3, L"ps", XFA_ELEMENT_Ps, XFA_XDPPACKET_Config, XFA_OBJECTTYPE_Node}, {0x25363, L"to", XFA_ELEMENT_To, XFA_XDPPACKET_Config, XFA_OBJECTTYPE_ContentNode}, @@ -1715,9 +1717,9 @@ extern const XFA_ELEMENTINFO g_XFAElementData[] = { {0xff063802, L"items", XFA_ELEMENT_Items, XFA_XDPPACKET_Template | XFA_XDPPACKET_Form, XFA_OBJECTTYPE_Node}, }; -extern const int32_t g_iXFAElementCount = +const int32_t g_iXFAElementCount = sizeof(g_XFAElementData) / sizeof(XFA_ELEMENTINFO); -extern const XFA_ELEMENTHIERARCHY g_XFAElementPropertyIndex[] = { +const XFA_ELEMENTHIERARCHY g_XFAElementPropertyIndex[] = { {0, 8}, {8, 0}, {8, 14}, {22, 0}, {22, 0}, {22, 6}, {28, 0}, {28, 0}, {28, 1}, {29, 3}, {32, 0}, {32, 0}, {32, 0}, {32, 3}, {35, 1}, {36, 0}, {36, 0}, {36, 2}, {38, 0}, {38, 0}, {38, 0}, @@ -1764,7 +1766,7 @@ extern const XFA_ELEMENTHIERARCHY g_XFAElementPropertyIndex[] = { {423, 0}, {423, 1}, {424, 1}, {425, 0}, {425, 1}, {426, 0}, {426, 0}, {426, 0}, {426, 0}, {426, 0}, {426, 0}, }; -extern const XFA_PROPERTY g_XFAElementPropertyData[] = { +const XFA_PROPERTY g_XFAElementPropertyData[] = { {XFA_ELEMENT_FontInfo, 1, 0}, {XFA_ELEMENT_Jog, 1, 0}, {XFA_ELEMENT_Xdc, 1, 0}, @@ -2193,7 +2195,7 @@ extern const XFA_PROPERTY g_XFAElementPropertyData[] = { {XFA_ELEMENT_Extras, 1, 0}, {XFA_ELEMENT_Month, 12, 0}, }; -extern const XFA_ELEMENTHIERARCHY g_XFAElementChildrenIndex[] = { +const XFA_ELEMENTHIERARCHY g_XFAElementChildrenIndex[] = { {0, 0}, {0, 0}, {0, 0}, {0, 1}, {1, 0}, {1, 4}, {5, 0}, {5, 0}, {5, 0}, {5, 3}, {8, 0}, {8, 0}, {8, 0}, {8, 0}, {8, 0}, {8, 1}, {9, 0}, {9, 0}, {9, 0}, {9, 0}, {9, 0}, @@ -2240,7 +2242,7 @@ extern const XFA_ELEMENTHIERARCHY g_XFAElementChildrenIndex[] = { {228, 0}, {228, 2}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 0}, {230, 10}, }; -extern const FX_WORD g_XFAElementChildrenData[] = { +const FX_WORD g_XFAElementChildrenData[] = { XFA_ELEMENT_Extras, XFA_ELEMENT_SubformSet, XFA_ELEMENT_BreakBefore, @@ -2482,7 +2484,7 @@ extern const FX_WORD g_XFAElementChildrenData[] = { XFA_ELEMENT_Date, XFA_ELEMENT_Float, }; -extern const XFA_ELEMENTHIERARCHY g_XFAElementAttributeIndex[] = { +const XFA_ELEMENTHIERARCHY g_XFAElementAttributeIndex[] = { {0, 3}, {3, 2}, {5, 3}, {8, 10}, {18, 2}, {20, 6}, {26, 2}, {28, 1}, {29, 13}, {42, 2}, {44, 1}, {45, 2}, {47, 2}, {49, 7}, {56, 0}, {56, 4}, {60, 2}, {62, 7}, {69, 0}, {69, 0}, {69, 2}, @@ -2529,7 +2531,7 @@ extern const XFA_ELEMENTHIERARCHY g_XFAElementAttributeIndex[] = { {1096, 0}, {1096, 4}, {1100, 6}, {1106, 2}, {1108, 1}, {1109, 2}, {1111, 2}, {1113, 2}, {1115, 1}, {1116, 2}, {1118, 7}, }; -extern const uint8_t g_XFAElementAttributeData[] = { +const uint8_t g_XFAElementAttributeData[] = { XFA_ATTRIBUTE_Name, XFA_ATTRIBUTE_Desc, XFA_ATTRIBUTE_Lock, @@ -3656,7 +3658,7 @@ extern const uint8_t g_XFAElementAttributeData[] = { XFA_ATTRIBUTE_Save, XFA_ATTRIBUTE_Usehref, }; -extern const XFA_PACKETINFO g_XFAPacketData[] = { +const XFA_PACKETINFO g_XFAPacketData[] = { {0x0, NULL, XFA_XDPPACKET_USER, NULL, XFA_XDPPACKET_FLAGS_NOMATCH | XFA_XDPPACKET_FLAGS_SUPPORTMANY}, {0x811929d, L"sourceSet", XFA_XDPPACKET_SourceSet, @@ -3698,9 +3700,9 @@ extern const XFA_PACKETINFO g_XFAPacketData[] = { L"http://www.xfa.org/schema/xfa-connection-set/", XFA_XDPPACKET_FLAGS_NOMATCH | XFA_XDPPACKET_FLAGS_SUPPORTONE}, }; -extern const int32_t g_iXFAPacketCount = +const int32_t g_iXFAPacketCount = sizeof(g_XFAPacketData) / sizeof(XFA_PACKETINFO); -extern const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[] = { +const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[] = { {0, 0, 0, 2, 316}, {0, 0, 2, 2, 316}, {0, 0, 4, 2, 316}, {0, 0, 6, 8, 316}, {0, 0, 14, 4, 316}, {0, 0, 18, 5, 317}, {0, 0, 23, 2, 316}, {0, 0, 25, 1, 316}, {0, 0, 26, 12, 316}, @@ -3809,7 +3811,7 @@ extern const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[] = { {120, 2, 1060, 8, 312}, {122, 11, 1068, 6, 315}, {133, 2, 1074, 0, 316}, {135, 0, 1074, 0, 316}, {135, 3, 1074, 2, 316}, {138, 0, 1076, 2, 316}, }; -extern const XFA_METHODINFO g_SomMethodData[] = { +const XFA_METHODINFO g_SomMethodData[] = { {0x3c752495, L"verify", (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel:: Script_SignaturePseudoModel_Verify}, {0xa68635f1, L"sign", (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel:: @@ -4100,9 +4102,9 @@ extern const XFA_METHODINFO g_SomMethodData[] = { {0x83a6411d, L"isCompatibleNS", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_ModelClass_IsCompatibleNS}, }; -extern const int32_t g_iSomMethodCount = +const int32_t g_iSomMethodCount = sizeof(g_SomMethodData) / sizeof(XFA_METHODINFO); -extern const _XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { +const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { {0xbe52dfbf, L"desc", (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_String, XFA_ATTRIBUTE_Desc, XFA_SCRIPT_Basic}, @@ -7327,5 +7329,5 @@ extern const _XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Som_DefaultValue, -1, XFA_SCRIPT_Basic}, }; -extern const int32_t g_iSomAttributeCount = +const int32_t g_iSomAttributeCount = sizeof(g_SomAttributeData) / sizeof(XFA_ATTRIBUTEINFO); diff --git a/xfa/src/fxfa/src/parser/xfa_basic_data.h b/xfa/src/fxfa/src/parser/xfa_basic_data.h new file mode 100644 index 0000000000..3e8b112a2b --- /dev/null +++ b/xfa/src/fxfa/src/parser/xfa_basic_data.h @@ -0,0 +1,48 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_SRC_FXFA_SRC_PARSER_XFA_BASIC_DATA_H_ +#define XFA_SRC_FXFA_SRC_PARSER_XFA_BASIC_DATA_H_ + +#include "xfa/include/fxfa/fxfa_basic.h" +#include "xfa/src/fxfa/src/parser/xfa_basic_imp.h" + +extern const XFA_PACKETINFO g_XFAPacketData[]; +extern const int32_t g_iXFAPacketCount; + +extern const XFA_ATTRIBUTEENUMINFO g_XFAEnumData[]; +extern const int32_t g_iXFAEnumCount; + +extern const XFA_ATTRIBUTEINFO g_XFAAttributeData[]; +extern const int32_t g_iXFAAttributeCount; + +extern const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[]; +extern const int32_t g_iXFANotsureCount; + +extern const XFA_ELEMENTINFO g_XFAElementData[]; +extern const int32_t g_iXFAElementCount; + +extern const XFA_ELEMENTHIERARCHY g_XFAElementChildrenIndex[]; +extern const FX_WORD g_XFAElementChildrenData[]; + +extern const XFA_ELEMENTHIERARCHY g_XFAElementAttributeIndex[]; +extern const uint8_t g_XFAElementAttributeData[]; + +extern const XFA_ELEMENTHIERARCHY g_XFAElementPropertyIndex[]; +extern const XFA_PROPERTY g_XFAElementPropertyData[]; + +extern const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[]; + +extern const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[]; +extern const int32_t g_iXFANotsureCount; + +extern const XFA_METHODINFO g_SomMethodData[]; +extern const int32_t g_iSomMethodCount; + +extern const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[]; +extern const int32_t g_iSomAttributeCount; + +#endif // XFA_SRC_FXFA_SRC_PARSER_XFA_BASIC_DATA_H_ diff --git a/xfa/src/fxfa/src/parser/xfa_basic_imp.cpp b/xfa/src/fxfa/src/parser/xfa_basic_imp.cpp index 3c32811bbd..3349d78561 100644 --- a/xfa/src/fxfa/src/parser/xfa_basic_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_basic_imp.cpp @@ -14,29 +14,10 @@ #include "xfa/src/fxfa/src/common/xfa_parser.h" #include "xfa/src/fxfa/src/common/xfa_script.h" #include "xfa/src/fxfa/src/common/xfa_utils.h" +#include "xfa/src/fxfa/src/parser/xfa_basic_data.h" #include "xfa/src/fxfa/src/parser/xfa_basic_imp.h" -extern const XFA_PACKETINFO g_XFAPacketData[]; -extern const int32_t g_iXFAPacketCount; -extern const XFA_ATTRIBUTEENUMINFO g_XFAEnumData[]; -extern const int32_t g_iXFAEnumCount; -extern const XFA_ATTRIBUTEINFO g_XFAAttributeData[]; -extern const int32_t g_iXFAAttributeCount; -extern const XFA_ELEMENTINFO g_XFAElementData[]; -extern const int32_t g_iXFAElementCount; -extern const XFA_ELEMENTHIERARCHY g_XFAElementChildrenIndex[]; -extern const FX_WORD g_XFAElementChildrenData[]; -extern const XFA_ELEMENTHIERARCHY g_XFAElementAttributeIndex[]; -extern const uint8_t g_XFAElementAttributeData[]; -extern const XFA_NOTSUREATTRIBUTE g_XFANotsureAttributes[]; -extern const int32_t g_iXFANotsureCount; -extern const XFA_ELEMENTHIERARCHY g_XFAElementPropertyIndex[]; -extern const XFA_PROPERTY g_XFAElementPropertyData[]; -extern const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[]; -extern const XFA_METHODINFO g_SomMethodData[]; -extern const int32_t g_iSomMethodCount; -extern const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[]; -extern const int32_t g_iSomAttributeCount; -XFA_LPCPACKETINFO XFA_GetPacketByName(const CFX_WideStringC& wsName) { + +const XFA_PACKETINFO* XFA_GetPacketByName(const CFX_WideStringC& wsName) { int32_t iLength = wsName.GetLength(); if (iLength == 0) { return NULL; @@ -45,7 +26,7 @@ XFA_LPCPACKETINFO XFA_GetPacketByName(const CFX_WideStringC& wsName) { int32_t iStart = 0, iEnd = g_iXFAPacketCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; - XFA_LPCPACKETINFO pInfo = g_XFAPacketData + iMid; + const XFA_PACKETINFO* pInfo = g_XFAPacketData + iMid; if (uHash == pInfo->uHash) { return pInfo; } else if (uHash < pInfo->uHash) { @@ -56,7 +37,8 @@ XFA_LPCPACKETINFO XFA_GetPacketByName(const CFX_WideStringC& wsName) { } while (iStart <= iEnd); return NULL; } -XFA_LPCPACKETINFO XFA_GetPacketByID(FX_DWORD dwPacket) { + +const XFA_PACKETINFO* XFA_GetPacketByID(FX_DWORD dwPacket) { int32_t iStart = 0, iEnd = g_iXFAPacketCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; @@ -71,7 +53,12 @@ XFA_LPCPACKETINFO XFA_GetPacketByID(FX_DWORD dwPacket) { } while (iStart <= iEnd); return NULL; } -XFA_LPCATTRIBUTEENUMINFO XFA_GetAttributeEnumByName( + +const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket) { + return g_XFAPacketData + ePacket; +} + +const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( const CFX_WideStringC& wsName) { int32_t iLength = wsName.GetLength(); if (iLength == 0) { @@ -81,7 +68,7 @@ XFA_LPCATTRIBUTEENUMINFO XFA_GetAttributeEnumByName( int32_t iStart = 0, iEnd = g_iXFAEnumCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; - XFA_LPCATTRIBUTEENUMINFO pInfo = g_XFAEnumData + iMid; + const XFA_ATTRIBUTEENUMINFO* pInfo = g_XFAEnumData + iMid; if (uHash == pInfo->uHash) { return pInfo; } else if (uHash < pInfo->uHash) { @@ -92,13 +79,13 @@ XFA_LPCATTRIBUTEENUMINFO XFA_GetAttributeEnumByName( } while (iStart <= iEnd); return NULL; } -XFA_LPCATTRIBUTEENUMINFO XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName) { +const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName) { return g_XFAEnumData + eName; } int32_t XFA_GetAttributeCount() { return g_iXFAAttributeCount; } -XFA_LPCATTRIBUTEINFO XFA_GetAttributeByName(const CFX_WideStringC& wsName) { +const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { int32_t iLength = wsName.GetLength(); if (iLength == 0) { return NULL; @@ -107,7 +94,7 @@ XFA_LPCATTRIBUTEINFO XFA_GetAttributeByName(const CFX_WideStringC& wsName) { int32_t iStart = 0, iEnd = g_iXFAAttributeCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; - XFA_LPCATTRIBUTEINFO pInfo = g_XFAAttributeData + iMid; + const XFA_ATTRIBUTEINFO* pInfo = g_XFAAttributeData + iMid; if (uHash == pInfo->uHash) { return pInfo; } else if (uHash < pInfo->uHash) { @@ -118,7 +105,7 @@ XFA_LPCATTRIBUTEINFO XFA_GetAttributeByName(const CFX_WideStringC& wsName) { } while (iStart <= iEnd); return NULL; } -XFA_LPCATTRIBUTEINFO XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { +const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName) : NULL; } FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, @@ -126,7 +113,7 @@ FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, XFA_ATTRIBUTE eAttribute, XFA_ATTRIBUTETYPE eType, FX_DWORD dwPacket) { - XFA_LPCATTRIBUTEINFO pInfo = XFA_GetAttributeByID(eAttribute); + const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); if (pInfo == NULL) { return FALSE; } @@ -137,7 +124,7 @@ FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, pValue = pInfo->pDefValue; return TRUE; } else if (pInfo->eType == XFA_ATTRIBUTETYPE_NOTSURE) { - XFA_LPCNOTSUREATTRIBUTE pAttr = + const XFA_NOTSUREATTRIBUTE* pAttr = XFA_GetNotsureAttribute(eElement, eAttribute, eType); if (pAttr) { pValue = pAttr->pValue; @@ -199,7 +186,7 @@ CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_ELEMENT eElement, int32_t XFA_GetElementCount() { return g_iXFAElementCount; } -XFA_LPCELEMENTINFO XFA_GetElementByName(const CFX_WideStringC& wsName) { +const XFA_ELEMENTINFO* XFA_GetElementByName(const CFX_WideStringC& wsName) { int32_t iLength = wsName.GetLength(); if (iLength == 0) { return NULL; @@ -208,7 +195,7 @@ XFA_LPCELEMENTINFO XFA_GetElementByName(const CFX_WideStringC& wsName) { int32_t iStart = 0, iEnd = g_iXFAElementCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; - XFA_LPCELEMENTINFO pInfo = g_XFAElementData + iMid; + const XFA_ELEMENTINFO* pInfo = g_XFAElementData + iMid; if (uHash == pInfo->uHash) { return pInfo; } else if (uHash < pInfo->uHash) { @@ -219,14 +206,14 @@ XFA_LPCELEMENTINFO XFA_GetElementByName(const CFX_WideStringC& wsName) { } while (iStart <= iEnd); return NULL; } -XFA_LPCELEMENTINFO XFA_GetElementByID(XFA_ELEMENT eName) { +const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_ELEMENT eName) { return (eName < g_iXFAElementCount) ? (g_XFAElementData + eName) : NULL; } const FX_WORD* XFA_GetElementChildren(XFA_ELEMENT eElement, int32_t& iCount) { if (eElement >= g_iXFAElementCount) { return NULL; } - XFA_LPCELEMENTHIERARCHY pElement = g_XFAElementChildrenIndex + eElement; + const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementChildrenIndex + eElement; iCount = pElement->wCount; return g_XFAElementChildrenData + pElement->wStart; } @@ -234,13 +221,13 @@ const uint8_t* XFA_GetElementAttributes(XFA_ELEMENT eElement, int32_t& iCount) { if (eElement >= g_iXFAElementCount) { return NULL; } - XFA_LPCELEMENTHIERARCHY pElement = g_XFAElementAttributeIndex + eElement; + const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementAttributeIndex + eElement; iCount = pElement->wCount; return g_XFAElementAttributeData + pElement->wStart; } -XFA_LPCATTRIBUTEINFO XFA_GetAttributeOfElement(XFA_ELEMENT eElement, - XFA_ATTRIBUTE eAttribute, - FX_DWORD dwPacket) { +const XFA_ATTRIBUTEINFO* XFA_GetAttributeOfElement(XFA_ELEMENT eElement, + XFA_ATTRIBUTE eAttribute, + FX_DWORD dwPacket) { int32_t iCount = 0; const uint8_t* pAttr = XFA_GetElementAttributes(eElement, iCount); if (pAttr == NULL || iCount < 1) { @@ -251,16 +238,16 @@ XFA_LPCATTRIBUTEINFO XFA_GetAttributeOfElement(XFA_ELEMENT eElement, if (index < 0) { return NULL; } - XFA_LPCATTRIBUTEINFO pInfo = XFA_GetAttributeByID(eAttribute); + const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); ASSERT(pInfo != NULL); if (dwPacket == XFA_XDPPACKET_UNKNOWN) { return pInfo; } return (dwPacket & pInfo->dwPackets) ? pInfo : NULL; } -XFA_LPCELEMENTINFO XFA_GetChildOfElement(XFA_ELEMENT eElement, - XFA_ELEMENT eChild, - FX_DWORD dwPacket) { +const XFA_ELEMENTINFO* XFA_GetChildOfElement(XFA_ELEMENT eElement, + XFA_ELEMENT eChild, + FX_DWORD dwPacket) { int32_t iCount = 0; const FX_WORD* pChild = XFA_GetElementChildren(eElement, iCount); if (pChild == NULL || iCount < 1) { @@ -271,27 +258,27 @@ XFA_LPCELEMENTINFO XFA_GetChildOfElement(XFA_ELEMENT eElement, if (index < 0) { return NULL; } - XFA_LPCELEMENTINFO pInfo = XFA_GetElementByID(eChild); + const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eChild); ASSERT(pInfo != NULL); if (dwPacket == XFA_XDPPACKET_UNKNOWN) { return pInfo; } return (dwPacket & pInfo->dwPackets) ? pInfo : NULL; } -XFA_LPCPROPERTY XFA_GetElementProperties(XFA_ELEMENT eElement, - int32_t& iCount) { +const XFA_PROPERTY* XFA_GetElementProperties(XFA_ELEMENT eElement, + int32_t& iCount) { if (eElement >= g_iXFAElementCount) { return NULL; } - XFA_LPCELEMENTHIERARCHY pElement = g_XFAElementPropertyIndex + eElement; + const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementPropertyIndex + eElement; iCount = pElement->wCount; return g_XFAElementPropertyData + pElement->wStart; } -XFA_LPCPROPERTY XFA_GetPropertyOfElement(XFA_ELEMENT eElement, - XFA_ELEMENT eProperty, - FX_DWORD dwPacket) { +const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_ELEMENT eElement, + XFA_ELEMENT eProperty, + FX_DWORD dwPacket) { int32_t iCount = 0; - XFA_LPCPROPERTY pProperty = XFA_GetElementProperties(eElement, iCount); + const XFA_PROPERTY* pProperty = XFA_GetElementProperties(eElement, iCount); if (pProperty == NULL || iCount < 1) { return NULL; } @@ -310,20 +297,20 @@ XFA_LPCPROPERTY XFA_GetPropertyOfElement(XFA_ELEMENT eElement, if (iStart > iEnd) { return NULL; } - XFA_LPCELEMENTINFO pInfo = XFA_GetElementByID(eProperty); + const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eProperty); ASSERT(pInfo != NULL); if (dwPacket == XFA_XDPPACKET_UNKNOWN) { return pProperty + iMid; } return (dwPacket & pInfo->dwPackets) ? (pProperty + iMid) : NULL; } -XFA_LPCNOTSUREATTRIBUTE XFA_GetNotsureAttribute(XFA_ELEMENT eElement, - XFA_ATTRIBUTE eAttribute, - XFA_ATTRIBUTETYPE eType) { +const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_ELEMENT eElement, + XFA_ATTRIBUTE eAttribute, + XFA_ATTRIBUTETYPE eType) { int32_t iStart = 0, iEnd = g_iXFANotsureCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; - XFA_LPCNOTSUREATTRIBUTE pAttr = g_XFANotsureAttributes + iMid; + const XFA_NOTSUREATTRIBUTE* pAttr = g_XFANotsureAttributes + iMid; if (eElement == pAttr->eElement) { if (pAttr->eAttribute == eAttribute) { if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { @@ -378,8 +365,8 @@ XFA_LPCNOTSUREATTRIBUTE XFA_GetNotsureAttribute(XFA_ELEMENT eElement, int32_t XFA_GetMethodCount() { return g_iSomMethodCount; } -XFA_LPCMETHODINFO XFA_GetMethodByName(XFA_ELEMENT eElement, - const CFX_WideStringC& wsMethodName) { +const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement, + const CFX_WideStringC& wsMethodName) { int32_t iLength = wsMethodName.GetLength(); if (iLength == 0) { return NULL; @@ -396,7 +383,7 @@ XFA_LPCMETHODINFO XFA_GetMethodByName(XFA_ELEMENT eElement, int32_t iStart = scriptIndex->wMethodStart, iEnd = iStart + icount - 1; do { int32_t iMid = (iStart + iEnd) / 2; - XFA_LPCMETHODINFO pInfo = g_SomMethodData + iMid; + const XFA_METHODINFO* pInfo = g_SomMethodData + iMid; if (uHash == pInfo->uHash) { return pInfo; } else if (uHash < pInfo->uHash) { @@ -409,7 +396,7 @@ XFA_LPCMETHODINFO XFA_GetMethodByName(XFA_ELEMENT eElement, } return NULL; } -XFA_LPCSCRIPTATTRIBUTEINFO XFA_GetScriptAttributeByName( +const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( XFA_ELEMENT eElement, const CFX_WideStringC& wsAttributeName) { int32_t iLength = wsAttributeName.GetLength(); @@ -428,7 +415,7 @@ XFA_LPCSCRIPTATTRIBUTEINFO XFA_GetScriptAttributeByName( int32_t iStart = scriptIndex->wAttributeStart, iEnd = iStart + icount - 1; do { int32_t iMid = (iStart + iEnd) / 2; - XFA_LPCSCRIPTATTRIBUTEINFO pInfo = g_SomAttributeData + iMid; + const XFA_SCRIPTATTRIBUTEINFO* pInfo = g_SomAttributeData + iMid; if (uHash == pInfo->uHash) { return pInfo; } else if (uHash < pInfo->uHash) { diff --git a/xfa/src/fxfa/src/parser/xfa_basic_imp.h b/xfa/src/fxfa/src/parser/xfa_basic_imp.h index 966d27e946..fb24d7c4eb 100644 --- a/xfa/src/fxfa/src/parser/xfa_basic_imp.h +++ b/xfa/src/fxfa/src/parser/xfa_basic_imp.h @@ -7,18 +7,20 @@ #ifndef XFA_SRC_FXFA_SRC_PARSER_XFA_BASIC_IMP_H_ #define XFA_SRC_FXFA_SRC_PARSER_XFA_BASIC_IMP_H_ -typedef struct _XFA_NOTSUREATTRIBUTE { +#include "xfa/include/fxfa/fxfa_basic.h" +#include "xfa/src/fgas/include/fx_stm.h" + +struct XFA_NOTSUREATTRIBUTE { XFA_ELEMENT eElement; XFA_ATTRIBUTE eAttribute; XFA_ATTRIBUTETYPE eType; void* pValue; -} XFA_NOTSUREATTRIBUTE, *XFA_LPNOTSUREATTRIBUTE; - -typedef XFA_NOTSUREATTRIBUTE const* XFA_LPCNOTSUREATTRIBUTE; -XFA_LPCNOTSUREATTRIBUTE XFA_GetNotsureAttribute( +}; +const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute( XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute, XFA_ATTRIBUTETYPE eType = XFA_ATTRIBUTETYPE_NOTSURE); + class CXFA_WideTextRead : public IFX_Stream { public: CXFA_WideTextRead(const CFX_WideString& wsBuffer); diff --git a/xfa/src/fxfa/src/parser/xfa_document_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_imp.cpp index 8980ad9535..6cf8f06301 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_imp.cpp @@ -168,15 +168,14 @@ CXFA_Object* CXFA_Document::GetXFAObject(FX_DWORD dwNodeNameHash) { } } CXFA_Node* CXFA_Document::CreateNode(FX_DWORD dwPacket, XFA_ELEMENT eElement) { - XFA_LPCPACKETINFO pPacket = XFA_GetPacketByID(dwPacket); - return CreateNode(pPacket, eElement); + return CreateNode(XFA_GetPacketByID(dwPacket), eElement); } -CXFA_Node* CXFA_Document::CreateNode(XFA_LPCPACKETINFO pPacket, +CXFA_Node* CXFA_Document::CreateNode(const XFA_PACKETINFO* pPacket, XFA_ELEMENT eElement) { if (pPacket == NULL) { return NULL; } - XFA_LPCELEMENTINFO pElement = XFA_GetElementByID(eElement); + const XFA_ELEMENTINFO* pElement = XFA_GetElementByID(eElement); if (pElement && (pElement->dwPackets & pPacket->eName)) { CXFA_Node* pNode = new CXFA_Node(this, pPacket->eName, pElement->eName); if (pNode) { diff --git a/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp b/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp index bbcf8d27c4..bdfc90bd71 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_serialize.cpp @@ -211,7 +211,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( int32_t iAttrs = 0; const uint8_t* pAttrs = XFA_GetElementAttributes(pNode->GetClassID(), iAttrs); while (iAttrs--) { - XFA_LPCATTRIBUTEINFO pAttr = + const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID((XFA_ATTRIBUTE)pAttrs[iAttrs]); if (pAttr->eName == XFA_ATTRIBUTE_Name || (XFA_DataExporter_AttributeSaveInDataModel(pNode, pAttr->eName) && @@ -396,7 +396,7 @@ static void XFA_DataExporter_RegenerateFormFile_Container( int32_t iAttrs = 0; const uint8_t* pAttrs = XFA_GetElementAttributes(pNode->GetClassID(), iAttrs); while (iAttrs--) { - XFA_LPCATTRIBUTEINFO pAttr = + const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID((XFA_ATTRIBUTE)pAttrs[iAttrs]); if (pAttr->eName == XFA_ATTRIBUTE_Name) { continue; diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index f3f2836ea7..a4fd017c52 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -19,14 +19,10 @@ CXFA_Object::CXFA_Object(CXFA_Document* pDocument, FX_DWORD uFlags) : m_pDocument(pDocument), m_uFlags(uFlags) {} void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { - XFA_LPCELEMENTINFO pElement = XFA_GetElementByID(GetClassID()); - ASSERT(pElement != NULL); - wsName = pElement->pName; + wsName = XFA_GetElementByID(GetClassID())->pName; } uint32_t CXFA_Object::GetClassHashCode() const { - XFA_LPCELEMENTINFO pElement = XFA_GetElementByID(GetClassID()); - ASSERT(pElement != NULL); - return pElement->uHash; + return XFA_GetElementByID(GetClassID())->uHash; } XFA_ELEMENT CXFA_Object::GetClassID() const { if (IsNode()) { @@ -82,9 +78,7 @@ static void XFA_CopyWideString(void*& pData) { static XFA_MAPDATABLOCKCALLBACKINFO deleteWideStringCallBack = { XFA_DeleteWideString, XFA_CopyWideString}; static XFA_OBJECTTYPE XFA_GetElementObjectType(XFA_ELEMENT eElement) { - XFA_LPCELEMENTINFO pElement = XFA_GetElementByID(eElement); - ASSERT(pElement != NULL); - return (XFA_OBJECTTYPE)pElement->eObjectType; + return (XFA_OBJECTTYPE)XFA_GetElementByID(eElement)->eObjectType; } CXFA_Node::CXFA_Node(CXFA_Document* pDoc, FX_WORD ePacket, XFA_ELEMENT eElement) : CXFA_Object(pDoc, XFA_GetElementObjectType(eElement)), @@ -252,13 +246,13 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, (dwTypeFilter & XFA_NODEFILTER_OneOfProperty) != 0; CXFA_Node* pChild = m_pChild; while (pChild) { - XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( + const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN); - if (pPropert) { + if (pProperty) { if (bFilterProperties) { nodes.Add(pChild); } else if (bFilterOneOfProperties && - (pPropert->uFlags & XFA_PROPERTYFLAG_OneOf)) { + (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { nodes.Add(pChild); } else if (bFilterChildren && (pChild->GetClassID() == XFA_ELEMENT_Variables || @@ -274,7 +268,7 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, } if (bFilterOneOfProperties && nodes.GetSize() < 1) { int32_t iProperties = 0; - XFA_LPCPROPERTY pProperty = + const XFA_PROPERTY* pProperty = XFA_GetElementProperties(GetClassID(), iProperties); if (pProperty == NULL || iProperties < 1) { return 0; @@ -282,7 +276,7 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes, for (int32_t i = 0; i < iProperties; i++) { if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); - XFA_LPCPACKETINFO pPacket = XFA_GetPacketByID(GetPacketID()); + const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); CXFA_Node* pNewNode = pFactory->CreateNode(pPacket, (XFA_ELEMENT)pProperty[i].eName); if (!pNewNode) { @@ -647,7 +641,8 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { hValue = pScriptContext->GetJSValueFromMap(pNode); FXJSE_Value_Set(pArguments->GetReturnValue(), hValue); } else { - XFA_LPCSCRIPTATTRIBUTEINFO lpAttributeInfo = resoveNodeRS.pScriptAttribute; + const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = + resoveNodeRS.pScriptAttribute; if (lpAttributeInfo && lpAttributeInfo->eValueType == XFA_SCRIPT_Object) { hValue = FXJSE_Value_Create(pScriptContext->GetRuntime()); (resoveNodeRS.nodes[0]->*(lpAttributeInfo->lpfnCallback))( @@ -886,7 +881,7 @@ void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { if (iLength >= 2) { iValue = pArguments->GetInt32(1); } - XFA_LPCELEMENTINFO pElementInfo = XFA_GetElementByName(wsExpression); + const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); CXFA_Node* pNode = this->GetProperty(iValue, pElementInfo->eName); FXJSE_Value_Set(pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); @@ -914,13 +909,14 @@ void CXFA_Node::Script_NodeClass_IsPropertySpecified( iIndex = pArguments->GetInt32(2); } FX_BOOL bHas = FALSE; - XFA_LPCATTRIBUTEINFO pAttributeInfo = XFA_GetAttributeByName(wsExpression); + const XFA_ATTRIBUTEINFO* pAttributeInfo = + XFA_GetAttributeByName(wsExpression); CFX_WideString wsValue; if (pAttributeInfo) { bHas = this->HasAttribute(pAttributeInfo->eName); } if (!bHas) { - XFA_LPCELEMENTINFO pElementInfo = XFA_GetElementByName(wsExpression); + const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); bHas = (this->GetProperty(iIndex, pElementInfo->eName) != NULL); } FXJSE_HVALUE hValue = pArguments->GetReturnValue(); @@ -2113,7 +2109,7 @@ void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue, validate.SetNullTest(wsValue); } else { int32_t iValue = validate.GetNullTest(); - XFA_LPCATTRIBUTEENUMINFO pInfo = + const XFA_ATTRIBUTEENUMINFO* pInfo = XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue); if (pInfo) { wsValue = pInfo->pName; @@ -2718,7 +2714,7 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength()); } } - XFA_LPCELEMENTINFO pElement = XFA_GetElementByName(strTagName); + const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(strTagName); CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); if (!pNewNode) { FXJSE_Value_SetNull(pArguments->GetReturnValue()); @@ -3756,19 +3752,19 @@ FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, const CFX_WideStringC& wsValue, FX_BOOL bNotify) { - XFA_LPCATTRIBUTEINFO pAttr = XFA_GetAttributeByID(eAttr); + const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); if (pAttr == NULL) { return FALSE; } XFA_ATTRIBUTETYPE eType = pAttr->eType; if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { - XFA_LPCNOTSUREATTRIBUTE pNotsure = + const XFA_NOTSUREATTRIBUTE* pNotsure = XFA_GetNotsureAttribute(GetClassID(), pAttr->eName); eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; } switch (eType) { case XFA_ATTRIBUTETYPE_Enum: { - XFA_LPCATTRIBUTEENUMINFO pEnum = XFA_GetAttributeEnumByName(wsValue); + const XFA_ATTRIBUTEENUMINFO* pEnum = XFA_GetAttributeEnumByName(wsValue); return SetEnum(pAttr->eName, pEnum ? pEnum->eName : (XFA_ATTRIBUTEENUM)(intptr_t)(pAttr->pDefValue), @@ -3793,13 +3789,13 @@ FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, CFX_WideString& wsValue, FX_BOOL bUseDefault) { - XFA_LPCATTRIBUTEINFO pAttr = XFA_GetAttributeByID(eAttr); + const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); if (pAttr == NULL) { return FALSE; } XFA_ATTRIBUTETYPE eType = pAttr->eType; if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { - XFA_LPCNOTSUREATTRIBUTE pNotsure = + const XFA_NOTSUREATTRIBUTE* pNotsure = XFA_GetNotsureAttribute(GetClassID(), pAttr->eName); eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; } @@ -3852,7 +3848,7 @@ FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr, const CFX_WideStringC& wsValue, FX_BOOL bNotify) { - XFA_LPCATTRIBUTEINFO pAttributeInfo = XFA_GetAttributeByName(wsValue); + const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsValue); if (pAttributeInfo) { return SetAttribute(pAttributeInfo->eName, wsValue, bNotify); } @@ -3863,7 +3859,7 @@ FX_BOOL CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr, FX_BOOL CXFA_Node::GetAttribute(const CFX_WideStringC& wsAttr, CFX_WideString& wsValue, FX_BOOL bUseDefault) { - XFA_LPCATTRIBUTEINFO pAttributeInfo = XFA_GetAttributeByName(wsAttr); + const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsAttr); if (pAttributeInfo) { return GetAttribute(pAttributeInfo->eName, wsValue, bUseDefault); } @@ -4002,7 +3998,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, } return TRUE; } - XFA_LPCATTRIBUTEINFO pInfo = XFA_GetAttributeByID(eAttr); + const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); if (pInfo) { FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); CFX_WideString wsAttrName = pInfo->pName; @@ -4155,7 +4151,7 @@ FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, OnChanged(eAttr, pValue, bNotify); if (IsNeedSavingXMLNode()) { FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); - XFA_LPCATTRIBUTEINFO pInfo = XFA_GetAttributeByID(eAttr); + const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); if (pInfo) { switch (eType) { case XFA_ATTRIBUTETYPE_Enum: @@ -4529,7 +4525,7 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index, FX_BOOL bCreateProperty) { XFA_ELEMENT eElement = GetClassID(); FX_DWORD dwPacket = GetPacketID(); - XFA_LPCPROPERTY pProperty = + const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(eElement, eProperty, dwPacket); if (pProperty == NULL || index >= pProperty->uOccur) { return NULL; @@ -4550,15 +4546,15 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index, if (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf) { pNode = m_pChild; for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - XFA_LPCPROPERTY pExistProterty = + const XFA_PROPERTY* pExistProperty = XFA_GetPropertyOfElement(eElement, pNode->GetClassID(), dwPacket); - if (pExistProterty && (pExistProterty->uFlags & XFA_PROPERTYFLAG_OneOf)) { + if (pExistProperty && (pExistProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { return NULL; } } } IXFA_ObjFactory* pFactory = m_pDocument->GetParser()->GetFactory(); - XFA_LPCPACKETINFO pPacket = XFA_GetPacketByID(dwPacket); + const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); CXFA_Node* pNewNode; for (; iCount <= index; iCount++) { pNewNode = pFactory->CreateNode(pPacket, eProperty); @@ -4576,9 +4572,9 @@ int32_t CXFA_Node::CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild) { for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) { if (bOnlyChild) { - XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( + const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); - if (pPropert) { + if (pProperty) { continue; } } @@ -4596,9 +4592,9 @@ CXFA_Node* CXFA_Node::GetChild(int32_t index, for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) { if (bOnlyChild) { - XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( + const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); - if (pPropert) { + if (pProperty) { continue; } } @@ -4987,7 +4983,7 @@ int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, return iRet; } void CXFA_Node::UpdateNameHash() { - XFA_LPCNOTSUREATTRIBUTE pNotsure = + const XFA_NOTSUREATTRIBUTE* pNotsure = XFA_GetNotsureAttribute(GetClassID(), XFA_ATTRIBUTE_Name); if (!pNotsure || pNotsure->eType == XFA_ATTRIBUTETYPE_Cdata) { CFX_WideStringC wsName = GetCData(XFA_ATTRIBUTE_Name); diff --git a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp index 449c1b84fa..725bc05b95 100644 --- a/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp @@ -1006,7 +1006,7 @@ int32_t CXFA_Validate::GetFormatTest() { FX_BOOL CXFA_Validate::SetTestValue(int32_t iType, CFX_WideString& wsValue, XFA_ATTRIBUTEENUM eName) { - XFA_LPCATTRIBUTEENUMINFO pInfo = XFA_GetAttributeEnumByName(wsValue); + const XFA_ATTRIBUTEENUMINFO* pInfo = XFA_GetAttributeEnumByName(wsValue); if (pInfo) { eName = pInfo->eName; } diff --git a/xfa/src/fxfa/src/parser/xfa_parser_imp.cpp b/xfa/src/fxfa/src/parser/xfa_parser_imp.cpp index 94a3739fb1..4bbfe4af9a 100644 --- a/xfa/src/fxfa/src/parser/xfa_parser_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_parser_imp.cpp @@ -415,7 +415,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( pXMLDocumentNode->GetNodeItem(IFDE_XMLNode::FirstChild); pChildItem; pChildItem = pChildItem->GetNodeItem(IFDE_XMLNode::NextSibling)) { - XFA_LPCPACKETINFO pPacketInfo = XFA_GetPacketByIndex(XFA_PACKET_Config); + const XFA_PACKETINFO* pPacketInfo = + XFA_GetPacketByIndex(XFA_PACKET_Config); if (!XFA_FDEExtension_MatchNodeName(pChildItem, pPacketInfo->pName, pPacketInfo->pURI, pPacketInfo->eFlags)) { @@ -448,7 +449,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( reinterpret_cast<IFDE_XMLElement*>(pChildItem); CFX_WideString wsPacketName; pElement->GetLocalTagName(wsPacketName); - XFA_LPCPACKETINFO pPacketInfo = XFA_GetPacketByName(wsPacketName); + const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByName(wsPacketName); if (pPacketInfo && pPacketInfo->pURI) { if (!XFA_FDEExtension_MatchNodeName(pElement, pPacketInfo->pName, pPacketInfo->pURI, @@ -835,11 +836,11 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, IFDE_XMLElement* pXMLElement = (IFDE_XMLElement*)pXMLChild; CFX_WideString wsTagName; pXMLElement->GetLocalTagName(wsTagName); - XFA_LPCELEMENTINFO pElemInfo = XFA_GetElementByName(wsTagName); + const XFA_ELEMENTINFO* pElemInfo = XFA_GetElementByName(wsTagName); if (!pElemInfo) { continue; } - XFA_LPCPROPERTY pPropertyInfo = XFA_GetPropertyOfElement( + const XFA_PROPERTY* pPropertyInfo = XFA_GetPropertyOfElement( pXFANode->GetClassID(), pElemInfo->eName, ePacketID); if (pPropertyInfo && ((pPropertyInfo->uFlags & @@ -870,7 +871,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, wsAttrValue == FX_WSTRC(L"true")) { IsNeedValue = FALSE; } - XFA_LPCATTRIBUTEINFO lpAttrInfo = XFA_GetAttributeByName(wsAttrName); + const XFA_ATTRIBUTEINFO* lpAttrInfo = + XFA_GetAttributeByName(wsAttrName); if (!lpAttrInfo) { continue; } diff --git a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp index 1c913cceae..21309f6c8d 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp @@ -153,7 +153,7 @@ FX_BOOL CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode, return true; } if (resolveRs.dwFlags == XFA_RESOVENODE_RSTYPE_Attribute) { - XFA_LPCSCRIPTATTRIBUTEINFO lpAttributeInfo = resolveRs.pScriptAttribute; + const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = resolveRs.pScriptAttribute; if (lpAttributeInfo) { (resolveRs.nodes[0]->*(lpAttributeInfo->lpfnCallback))( hValue, bSetting, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); @@ -277,7 +277,7 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); CFX_WideString wsPropName = CFX_WideString::FromUTF8( (const FX_CHAR*)szPropName.GetPtr(), szPropName.GetLength()); - XFA_LPCSCRIPTATTRIBUTEINFO lpAttributeInfo = + const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(pObject->GetClassID(), wsPropName); if (lpAttributeInfo) { (pObject->*(lpAttributeInfo->lpfnCallback))( @@ -289,7 +289,7 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, } CXFA_Node* pNode = ToNode(pObject); CXFA_Node* pPropOrChild = NULL; - XFA_LPCELEMENTINFO lpElementInfo = XFA_GetElementByName(wsPropName); + const XFA_ELEMENTINFO* lpElementInfo = XFA_GetElementByName(wsPropName); if (lpElementInfo) { pPropOrChild = pNode->GetProperty(0, lpElementInfo->eName); } else { @@ -297,7 +297,7 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, } if (pPropOrChild) { CFX_WideString wsDefaultName = FX_WSTRC(L"{default}"); - XFA_LPCSCRIPTATTRIBUTEINFO lpAttributeInfo = + const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), wsDefaultName); if (lpAttributeInfo) { @@ -368,7 +368,7 @@ void CXFA_ScriptContext::NormalMethodCall(FXJSE_HOBJECT hThis, pObject = lpScriptContext->GetVariablesThis(pObject); CFX_WideString wsFunName = CFX_WideString::FromUTF8( (const FX_CHAR*)szFuncName.GetPtr(), szFuncName.GetLength()); - XFA_LPCMETHODINFO lpMethodInfo = + const XFA_METHODINFO* lpMethodInfo = XFA_GetMethodByName(pObject->GetClassID(), wsFunName); if (NULL == lpMethodInfo) { return; diff --git a/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp b/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp index 1107091180..1574ef5148 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_nodehelper.cpp @@ -49,9 +49,9 @@ int32_t CXFA_NodeHelper::XFA_CountSiblings(CXFA_Node* pNode, XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent); if (!parent) return 0; - XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( + const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( parent->GetClassID(), pNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); - if (!pPropert && eLogicType == XFA_LOGIC_Transparent) { + if (!pProperty && eLogicType == XFA_LOGIC_Transparent) { parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); if (parent == NULL) { return 0; @@ -365,7 +365,7 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( XFA_CreateNode_ForCondition(wsCondition); } if (bIsClassName) { - XFA_LPCELEMENTINFO lpElement = XFA_GetElementByName(wsName); + const XFA_ELEMENTINFO* lpElement = XFA_GetElementByName(wsName); if (lpElement == NULL) { return FALSE; } @@ -418,15 +418,9 @@ void CXFA_NodeHelper::XFA_SetCreateNodeType(CXFA_Node* refNode) { } } FX_BOOL CXFA_NodeHelper::XFA_NodeIsProperty(CXFA_Node* refNode) { - FX_BOOL bRes = FALSE; CXFA_Node* parent = XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); - if (parent != NULL && refNode != NULL) { - XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( - parent->GetClassID(), refNode->GetClassID(), XFA_XDPPACKET_UNKNOWN); - if (pPropert) { - bRes = TRUE; - } - } - return bRes; + return parent && refNode && + XFA_GetPropertyOfElement(parent->GetClassID(), refNode->GetClassID(), + XFA_XDPPACKET_UNKNOWN); } diff --git a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp index dcdbc8b83c..fcbf08b5a7 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.cpp @@ -194,7 +194,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_ForAttributeRs( CXFA_Object* curNode, CXFA_ResolveNodesData& rnd, const CFX_WideStringC& strAttr) { - XFA_LPCSCRIPTATTRIBUTEINFO lpScriptAttribute = + const XFA_SCRIPTATTRIBUTEINFO* lpScriptAttribute = XFA_GetScriptAttributeByName(curNode->GetClassID(), strAttr); if (lpScriptAttribute) { rnd.m_pScriptAttribute = lpScriptAttribute; @@ -240,7 +240,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); continue; } else { - XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( + const XFA_PROPERTY* pPropert = XFA_GetPropertyOfElement( curNode->GetClassID(), pChild->GetClassID(), XFA_XDPPACKET_UNKNOWN); if (pPropert) { properties.Add(pChild); @@ -362,7 +362,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( pProp = pInstanceManager->GetProperty(0, XFA_ELEMENT_Occur, TRUE); } } else { - XFA_LPCELEMENTINFO pElement = XFA_GetElementByName(wsName); + const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(wsName); if (pElement) { pProp = curNode->AsNode()->GetProperty( 0, pElement->eName, pElement->eName != XFA_ELEMENT_PageSet); @@ -423,7 +423,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } else if (child->GetNameHash() == uNameHash) { nodes.Add(child); } - XFA_LPCPROPERTY pPropert = XFA_GetPropertyOfElement( + const XFA_PROPERTY* pPropert = XFA_GetPropertyOfElement( parentNode->GetClassID(), child->GetClassID(), XFA_XDPPACKET_UNKNOWN); FX_BOOL bInnerSearch = FALSE; if (pPropert) { diff --git a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.h b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.h index 445982303a..29ba96476b 100644 --- a/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.h +++ b/xfa/src/fxfa/src/parser/xfa_script_resolveprocessor.h @@ -31,7 +31,7 @@ class CXFA_ResolveNodesData { int32_t m_nLevel; CXFA_ObjArray m_Nodes; FX_DWORD m_dwStyles; - XFA_LPCSCRIPTATTRIBUTEINFO m_pScriptAttribute; + const XFA_SCRIPTATTRIBUTEINFO* m_pScriptAttribute; XFA_RESOVENODE_RSTYPE m_dwFlag; }; class CXFA_ResolveProcessor { diff --git a/xfa/src/fxfa/src/parser/xfa_utils_imp.cpp b/xfa/src/fxfa/src/parser/xfa_utils_imp.cpp index ec17992e9c..be096d08ee 100644 --- a/xfa/src/fxfa/src/parser/xfa_utils_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_utils_imp.cpp @@ -65,9 +65,9 @@ CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_ELEMENT& eWidgetType) { if (eChild == XFA_ELEMENT_Extras || eChild == XFA_ELEMENT_Picture) { continue; } - XFA_LPCPROPERTY pProterty = + const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(XFA_ELEMENT_Ui, eChild, XFA_XDPPACKET_Form); - if (pProterty && (pProterty->uFlags & XFA_PROPERTYFLAG_OneOf)) { + if (pProperty && (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { pUIChild = pChild; break; } |