diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-23 10:11:11 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-23 10:11:11 -0800 |
commit | d21cddaa7548584bfcebefe9a03e857fee3a846b (patch) | |
tree | 0211132f874bfc0ba36b339b4fe961331f88f036 | |
parent | 2eaa2ef03f7fc9417007d554ee955137fe9ff7b4 (diff) | |
download | pdfium-d21cddaa7548584bfcebefe9a03e857fee3a846b.tar.xz |
Remove many _CAPS structure names.
They're technically not allowed because they are reserved
for the preprocessor.
Also get rid of LPC* typedefs along the way.
Also provide a header for a data file containing many
instance of these found along the way.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1722873002 .
31 files changed, 278 insertions, 272 deletions
@@ -1354,6 +1354,7 @@ if (pdf_enable_xfa) { "xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp", "xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h", "xfa/src/fxfa/src/parser/xfa_basic_data.cpp", + "xfa/src/fxfa/src/parser/xfa_basic_data.h", "xfa/src/fxfa/src/parser/xfa_basic_imp.cpp", "xfa/src/fxfa/src/parser/xfa_basic_imp.h", "xfa/src/fxfa/src/parser/xfa_document_datadescription_imp.cpp", diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h index 1c120aa0ab..c1842626f0 100644 --- a/core/include/fxcodec/fx_codec.h +++ b/core/include/fxcodec/fx_codec.h @@ -461,7 +461,7 @@ class ICodec_Jbig2Encoder { }; class ICodec_IccModule { public: - typedef enum { + enum IccCS { IccCS_Unknown = 0, IccCS_XYZ, IccCS_Lab, @@ -474,8 +474,9 @@ class ICodec_IccModule { IccCS_Rgb, IccCS_Cmyk, IccCS_Cmy - } IccCS; - typedef struct _IccParam { + }; + + struct IccParam { FX_DWORD Version; IccCS ColorSpace; FX_DWORD dwProfileType; @@ -483,7 +484,7 @@ class ICodec_IccModule { uint8_t* pProfileData; FX_DWORD dwProfileSize; double Gamma; - } IccParam; + }; virtual ~ICodec_IccModule() {} diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 7ff97e5a77..1d1f006115 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -162,18 +162,6 @@ class CPDF_CMap { CPDF_CMap* m_pUseMap; }; -typedef struct _FileHeader { - uint8_t btTag[4]; - uint8_t btVersion; - uint8_t btFormat; - uint8_t btReserved1[2]; - FX_DWORD dwStartIndex; - FX_DWORD dwEndIndex; - FX_DWORD dwDataSize; - FX_DWORD dwDataOffset; - FX_DWORD dwRecordSize; -} FXMP_FILEHEADER; - class CPDF_CID2UnicodeMap { public: CPDF_CID2UnicodeMap(); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index ba75753c9a..49fb331a94 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -964,13 +964,15 @@ void CPDF_IndexedCS::EnableStdConversion(FX_BOOL bEnabled) { m_pBaseCS->EnableStdConversion(bEnabled); } } + #define MAX_PATTERN_COLORCOMPS 16 -typedef struct _PatternValue { +struct PatternValue { CPDF_Pattern* m_pPattern; CPDF_CountedPattern* m_pCountedPattern; int m_nComps; FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS]; -} PatternValue; +}; + CPDF_PatternCS::~CPDF_PatternCS() { CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : NULL; if (pCS && m_pDocument) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index 61becaee6a..799e748761 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -60,12 +60,12 @@ CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler() { return new CPDF_StandardCryptoHandler; } -typedef struct _PDF_CRYPTOITEM { +struct PDF_CRYPTOITEM { int32_t m_Cipher; int32_t m_KeyLen; FX_BOOL m_bChecked; CPDF_StandardCryptoHandler* m_pCryptoHandler; -} PDF_CRYPTOITEM; +}; CPDF_StandardSecurityHandler::CPDF_StandardSecurityHandler() { m_Version = 0; @@ -775,12 +775,14 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, CRYPT_ArcFourCryptBlock(dest_buf, dest_size, realkey, realkeylen); } } -typedef struct _AESCryptContext { + +struct AESCryptContext { uint8_t m_Context[2048]; FX_BOOL m_bIV; uint8_t m_Block[16]; FX_DWORD m_BlockOffset; -} AESCryptContext; +}; + void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt) { diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h index 6e799eb3a4..5ce29ddd50 100644 --- a/core/src/fxcrt/extension.h +++ b/core/src/fxcrt/extension.h @@ -315,16 +315,15 @@ extern "C" { #define MT_Matrix_A 0x9908b0df #define MT_Upper_Mask 0x80000000 #define MT_Lower_Mask 0x7fffffff -typedef struct _FX_MTRANDOMCONTEXT { - _FX_MTRANDOMCONTEXT() { +struct FX_MTRANDOMCONTEXT { + FX_MTRANDOMCONTEXT() { mti = MT_N + 1; bHaveSeed = FALSE; } FX_DWORD mti; FX_BOOL bHaveSeed; FX_DWORD mt[MT_N]; -} FX_MTRANDOMCONTEXT, *FX_LPMTRANDOMCONTEXT; -typedef FX_MTRANDOMCONTEXT const* FX_LPCMTRANDOMCONTEXT; +}; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); #endif diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index cae1763c7e..456e6bd7f3 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -259,7 +259,7 @@ FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, } void* FX_Random_MT_Start(FX_DWORD dwSeed) { - FX_LPMTRANDOMCONTEXT pContext = FX_Alloc(FX_MTRANDOMCONTEXT, 1); + FX_MTRANDOMCONTEXT* pContext = FX_Alloc(FX_MTRANDOMCONTEXT, 1); pContext->mt[0] = dwSeed; FX_DWORD& i = pContext->mti; FX_DWORD* pBuf = pContext->mt; @@ -271,7 +271,7 @@ void* FX_Random_MT_Start(FX_DWORD dwSeed) { } FX_DWORD FX_Random_MT_Generate(void* pContext) { FXSYS_assert(pContext); - FX_LPMTRANDOMCONTEXT pMTC = (FX_LPMTRANDOMCONTEXT)pContext; + FX_MTRANDOMCONTEXT* pMTC = static_cast<FX_MTRANDOMCONTEXT*>(pContext); FX_DWORD v; static FX_DWORD mag[2] = {0, MT_Matrix_A}; FX_DWORD& mti = pMTC->mti; diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index ce3b80506d..9c36e6c99f 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -37,11 +37,10 @@ static void FPF_SkiaStream_Close(FXFT_Stream stream) {} #ifdef __cplusplus }; #endif -typedef struct _FPF_SKIAFONTMAP { +struct FPF_SKIAFONTMAP { FX_DWORD dwFamily; FX_DWORD dwSubSt; -} FPF_SKIAFONTMAP, *FPF_LPSKIAFONTMAP; -typedef FPF_SKIAFONTMAP const* FPF_LPCSKIAFONTMAP; +}; static const FPF_SKIAFONTMAP g_SkiaFontmap[] = { {0x58c5083, 0xc8d2e345}, {0x5dfade2, 0xe1633081}, {0x684317d, 0xe1633081}, {0x14ee2d13, 0xc8d2e345}, @@ -60,7 +59,7 @@ FX_DWORD FPF_SkiaGetSubstFont(FX_DWORD dwHash) { int32_t iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP); while (iStart <= iEnd) { int32_t iMid = (iStart + iEnd) / 2; - FPF_LPCSKIAFONTMAP pItem = &g_SkiaFontmap[iMid]; + const FPF_SKIAFONTMAP* pItem = &g_SkiaFontmap[iMid]; if (dwHash < pItem->dwFamily) { iEnd = iMid - 1; } else if (dwHash > pItem->dwFamily) { @@ -81,7 +80,7 @@ FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) { int32_t iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP); while (iStart <= iEnd) { int32_t iMid = (iStart + iEnd) / 2; - FPF_LPCSKIAFONTMAP pItem = &g_SkiaSansFontMap[iMid]; + const FPF_SKIAFONTMAP* pItem = &g_SkiaSansFontMap[iMid]; if (dwHash < pItem->dwFamily) { iEnd = iMid - 1; } else if (dwHash > pItem->dwFamily) { diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index 28caa7b7b8..e23d34ca81 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -41,8 +41,8 @@ typedef enum _PDFSDK_XFAAActionType { } PDFSDK_XFAAActionType; #endif // PDF_ENABLE_XFA -typedef struct _PDFSDK_FieldAction { - _PDFSDK_FieldAction() { +struct PDFSDK_FieldAction { + PDFSDK_FieldAction() { bModifier = FALSE; bShift = FALSE; nCommitKey = 0; @@ -65,7 +65,7 @@ typedef struct _PDFSDK_FieldAction { FX_BOOL bWillCommit; // in FX_BOOL bFieldFull; // in FX_BOOL bRC; // in[out] -} PDFSDK_FieldAction; +}; class CPDFSDK_Widget : public CPDFSDK_BAAnnot { public: diff --git a/fpdfsdk/include/fx_systemhandler.h b/fpdfsdk/include/fx_systemhandler.h index 224e0758f5..6d186a7bab 100644 --- a/fpdfsdk/include/fx_systemhandler.h +++ b/fpdfsdk/include/fx_systemhandler.h @@ -18,8 +18,8 @@ typedef void* FX_HWND; typedef void* FX_HMENU; typedef void (*TimerCallback)(int32_t idEvent); -typedef struct _FX_SYSTEMTIME { - _FX_SYSTEMTIME() +struct FX_SYSTEMTIME { + FX_SYSTEMTIME() : wYear(0), wMonth(0), wDayOfWeek(0), @@ -36,7 +36,7 @@ typedef struct _FX_SYSTEMTIME { FX_WORD wMinute; FX_WORD wSecond; FX_WORD wMilliseconds; -} FX_SYSTEMTIME; +}; // cursor style #define FXCT_ARROW 0 @@ -603,6 +603,7 @@ "xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp", "xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h", "xfa/src/fxfa/src/parser/xfa_basic_data.cpp", + "xfa/src/fxfa/src/parser/xfa_basic_data.h", "xfa/src/fxfa/src/parser/xfa_basic_imp.cpp", "xfa/src/fxfa/src/parser/xfa_basic_imp.h", "xfa/src/fxfa/src/parser/xfa_document_datadescription_imp.cpp", diff --git a/xfa/include/fwl/basewidget/fwl_listbox.h b/xfa/include/fwl/basewidget/fwl_listbox.h index 49f291e813..4945ebc57f 100644 --- a/xfa/include/fwl/basewidget/fwl_listbox.h +++ b/xfa/include/fwl/basewidget/fwl_listbox.h @@ -59,10 +59,10 @@ int32_t m_index; CFX_RectF m_rect; END_FWL_EVENT_DEF typedef struct _FWL_HLISTITEM { void* pData; } * FWL_HLISTITEM; -typedef struct _FWL_ListBoxItemData { +struct FWL_ListBoxItemData { IFWL_ListBoxDP* pDataProvider; int32_t iIndex; -} FWL_ListBoxItemData; +}; class IFWL_ListBoxDP : public IFWL_DataProvider { public: virtual int32_t CountItems(IFWL_Widget* pWidget) = 0; diff --git a/xfa/include/fwl/core/fwl_widget.h b/xfa/include/fwl/core/fwl_widget.h index 01022ee762..afee2d8272 100644 --- a/xfa/include/fwl/core/fwl_widget.h +++ b/xfa/include/fwl/core/fwl_widget.h @@ -111,14 +111,6 @@ class IFWL_Proxy { virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) = 0; virtual FWL_ERR Update() = 0; }; -#define FWL_ACCEL_Control (1L << 0) -#define FWL_ACCEL_Alt (1L << 1) -#define FWL_ACCEL_Shift (1L << 2) -#define FWL_ACCEL_VirtKey (1L << 3) -typedef struct _FWL_ACCEL { - FX_DWORD dwKey; - FX_DWORD dwCmd; -} FWL_ACCEL; typedef CFX_MapPtrTemplate<FX_DWORD, FX_DWORD> CFX_MapAccelerators; FWL_ERR FWL_Accelerator_SetApp(CFX_MapAccelerators* pMapAccel); FWL_ERR FWL_Accelerator_SetThread(CFX_MapAccelerators* pMapAccel); diff --git a/xfa/include/fwl/theme/utils.h b/xfa/include/fwl/theme/utils.h index abbb47ef8f..dd6549666d 100644 --- a/xfa/include/fwl/theme/utils.h +++ b/xfa/include/fwl/theme/utils.h @@ -27,7 +27,7 @@ enum FWLTHEME_DIRECTION { FWLTHEME_DIRECTION_Left, FWLTHEME_DIRECTION_Right }; -typedef struct _FWLCOLOR { +struct FWLCOLOR { union { FX_DWORD color; struct { @@ -38,14 +38,13 @@ typedef struct _FWLCOLOR { }; }; - _FWLCOLOR() { color = 0; } - _FWLCOLOR(FX_DWORD c) { color = c; } - _FWLCOLOR(const _FWLCOLOR& c) { color = c.color; } - - bool operator==(const _FWLCOLOR& frColor) { return color == frColor.color; } + FWLCOLOR() : color(0) {} + FWLCOLOR(FX_DWORD c) : color(c) {} + FWLCOLOR(const FWLCOLOR& c) : color(c.color) {} + bool operator==(const FWLCOLOR& frColor) { return color == frColor.color; } operator FX_DWORD() { return color; } -} FWLCOLOR; +}; #define FWLTHEME_BEZIER FX_BEZIER #define FWLTHEME_PI FX_PI #define FWLTHEME_PI_2_1 (FX_PI / 2.0f) diff --git a/xfa/include/fxfa/fxfa_basic.h b/xfa/include/fxfa/fxfa_basic.h index e8731d23d8..39586ee71f 100644 --- a/xfa/include/fxfa/fxfa_basic.h +++ b/xfa/include/fxfa/fxfa_basic.h @@ -78,20 +78,18 @@ enum XFA_XDPPACKET_FLAGS { XFA_XDPPACKET_FLAGS_SUPPORTONE = 8, XFA_XDPPACKET_FLAGS_SUPPORTMANY = 16, }; -typedef struct _XFA_PACKETINFO { +struct XFA_PACKETINFO { uint32_t uHash; const FX_WCHAR* pName; XFA_XDPPACKET eName; const FX_WCHAR* pURI; FX_DWORD eFlags; -} XFA_PACKETINFO, *XFA_LPPACKETINFO; -typedef XFA_PACKETINFO const* XFA_LPCPACKETINFO; -XFA_LPCPACKETINFO XFA_GetPacketByName(const CFX_WideStringC& wsName); -XFA_LPCPACKETINFO XFA_GetPacketByID(FX_DWORD dwPacket); -extern const XFA_PACKETINFO g_XFAPacketData[]; -inline XFA_LPCPACKETINFO XFA_GetPacketByIndex(XFA_PACKET ePacket) { - return g_XFAPacketData + ePacket; -} +}; + +const XFA_PACKETINFO* XFA_GetPacketByName(const CFX_WideStringC& wsName); +const XFA_PACKETINFO* XFA_GetPacketByID(FX_DWORD dwPacket); +const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket); + enum XFA_ATTRIBUTEENUM { XFA_ATTRIBUTEENUM_Asterisk, XFA_ATTRIBUTEENUM_Slash, @@ -920,17 +918,16 @@ enum XFA_ELEMENT { XFA_ELEMENT_Items, }; #define XFA_ELEMENT_UNKNOWN ((XFA_ELEMENT)-1) -typedef struct _XFA_ELEMENTINFO { +struct XFA_ELEMENTINFO { uint32_t uHash; const FX_WCHAR* pName; XFA_ELEMENT eName; FX_DWORD dwPackets; FX_DWORD eObjectType; -} XFA_ELEMENTINFO, *XFA_LPELEMENTINFO; -typedef XFA_ELEMENTINFO const* XFA_LPCELEMENTINFO; +}; int32_t XFA_GetElementCount(); -XFA_LPCELEMENTINFO XFA_GetElementByName(const CFX_WideStringC& wsName); -XFA_LPCELEMENTINFO XFA_GetElementByID(XFA_ELEMENT eName); +const XFA_ELEMENTINFO* XFA_GetElementByName(const CFX_WideStringC& wsName); +const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_ELEMENT eName); enum XFA_ATTRIBUTETYPE { XFA_ATTRIBUTETYPE_NOTSURE, XFA_ATTRIBUTETYPE_Enum, @@ -939,18 +936,17 @@ enum XFA_ATTRIBUTETYPE { XFA_ATTRIBUTETYPE_Integer, XFA_ATTRIBUTETYPE_Measure, }; -typedef struct _XFA_ATTRIBUTEINFO { +struct XFA_ATTRIBUTEINFO { uint32_t uHash; const FX_WCHAR* pName; XFA_ATTRIBUTE eName; XFA_ATTRIBUTETYPE eType; FX_DWORD dwPackets; void* pDefValue; -} XFA_ATTRIBUTEINFO, *XFA_LPATTRIBUTEINFO; -typedef XFA_ATTRIBUTEINFO const* XFA_LPCATTRIBUTEINFO; +}; int32_t XFA_GetAttributeCount(); -XFA_LPCATTRIBUTEINFO XFA_GetAttributeByName(const CFX_WideStringC& wsName); -XFA_LPCATTRIBUTEINFO XFA_GetAttributeByID(XFA_ATTRIBUTE eName); +const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName); +const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName); FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute, @@ -971,49 +967,47 @@ int32_t XFA_GetAttributeDefaultValue_Integer(XFA_ELEMENT eElement, CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute, FX_DWORD dwPacket); -typedef struct _XFA_ELEMENTHIERARCHY { +struct XFA_ELEMENTHIERARCHY { FX_WORD wStart; FX_WORD wCount; FX_WORD wParentIndex; -} XFA_ELEMENTHIERARCHY, *XFA_LPELEMENTHIERARCHY; -typedef XFA_ELEMENTHIERARCHY const* XFA_LPCELEMENTHIERARCHY; -typedef struct _XFA_SCRIPTHIERARCHY { +}; +struct XFA_SCRIPTHIERARCHY { FX_WORD wMethodStart; FX_WORD wMethodCount; FX_WORD wAttributeStart; FX_WORD wAttributeCount; int16_t wParentIndex; -} XFA_SCRIPTHIERARCHY, *XFA_LPSCRIPTHIERARCHY; +}; typedef XFA_SCRIPTHIERARCHY const* XFA_LPCSCRIPTHIERARCHY; const FX_WORD* XFA_GetElementChildren(XFA_ELEMENT eElement, int32_t& iCount); const uint8_t* XFA_GetElementAttributes(XFA_ELEMENT eElement, int32_t& iCount); -XFA_LPCELEMENTINFO XFA_GetChildOfElement(XFA_ELEMENT eElement, - XFA_ELEMENT eChild, - FX_DWORD dwPacket); -XFA_LPCATTRIBUTEINFO XFA_GetAttributeOfElement(XFA_ELEMENT eElement, - XFA_ATTRIBUTE eAttribute, - FX_DWORD dwPacket); +const XFA_ELEMENTINFO* XFA_GetChildOfElement(XFA_ELEMENT eElement, + XFA_ELEMENT eChild, + FX_DWORD dwPacket); +const XFA_ATTRIBUTEINFO* XFA_GetAttributeOfElement(XFA_ELEMENT eElement, + XFA_ATTRIBUTE eAttribute, + FX_DWORD dwPacket); #define XFA_PROPERTYFLAG_OneOf 0x01 #define XFA_PROPERTYFLAG_DefaultOneOf 0x02 -typedef struct _XFA_PROPERTY { +struct XFA_PROPERTY { FX_WORD eName; uint8_t uOccur; uint8_t uFlags; -} XFA_PROPERTY, *XFA_LPPROPERTY; -typedef XFA_PROPERTY const* XFA_LPCPROPERTY; -XFA_LPCPROPERTY XFA_GetElementProperties(XFA_ELEMENT eElement, int32_t& iCount); -XFA_LPCPROPERTY XFA_GetPropertyOfElement(XFA_ELEMENT eElement, - XFA_ELEMENT eProperty, - FX_DWORD dwPacket); -typedef struct _XFA_ATTRIBUTEENUMINFO { +}; +const XFA_PROPERTY* XFA_GetElementProperties(XFA_ELEMENT eElement, + int32_t& iCount); +const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_ELEMENT eElement, + XFA_ELEMENT eProperty, + FX_DWORD dwPacket); +struct XFA_ATTRIBUTEENUMINFO { uint32_t uHash; const FX_WCHAR* pName; XFA_ATTRIBUTEENUM eName; -} XFA_ATTRIBUTEENUMINFO, *XFA_LPATTRIBUTEENUMINFO; -typedef XFA_ATTRIBUTEENUMINFO const* XFA_LPCATTRIBUTEENUMINFO; -XFA_LPCATTRIBUTEENUMINFO XFA_GetAttributeEnumByName( +}; +const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( const CFX_WideStringC& wsName); -XFA_LPCATTRIBUTEENUMINFO XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName); +const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName); enum XFA_UNIT { XFA_UNIT_Unknown, XFA_UNIT_Percent, @@ -1054,15 +1048,14 @@ class CXFA_Measurement { class CFXJSE_Arguments; class CXFA_Object; typedef void (CXFA_Object::*XFA_METHOD_CALLBACK)(CFXJSE_Arguments* pArguments); -typedef struct _XFA_METHODINFO { +struct XFA_METHODINFO { uint32_t uHash; const FX_WCHAR* pName; XFA_METHOD_CALLBACK lpfnCallback; -} XFA_METHODINFO, *XFA_LPMETHODINFO; -typedef XFA_METHODINFO const* XFA_LPCMETHODINFO; +}; int32_t XFA_GetMethodCount(); -XFA_LPCMETHODINFO XFA_GetMethodByName(XFA_ELEMENT eElement, - const CFX_WideStringC& wsMethodName); +const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement, + const CFX_WideStringC& wsMethodName); typedef void (CXFA_Object::*XFA_ATTRIBUTE_CALLBACK)(FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); @@ -1070,15 +1063,14 @@ enum XFA_SCRIPT_TYPE { XFA_SCRIPT_Basic, XFA_SCRIPT_Object, }; -typedef struct _XFA_SCRIPTATTRIBUTEINFO { +struct XFA_SCRIPTATTRIBUTEINFO { uint32_t uHash; const FX_WCHAR* pName; XFA_ATTRIBUTE_CALLBACK lpfnCallback; int32_t eAttribute; FX_WORD eValueType; -} XFA_SCRIPTATTRIBUTEINFO, *XFA_LPSCRIPTATTRIBUTEINFO; -typedef XFA_SCRIPTATTRIBUTEINFO const* XFA_LPCSCRIPTATTRIBUTEINFO; -XFA_LPCSCRIPTATTRIBUTEINFO XFA_GetScriptAttributeByName( +}; +const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( XFA_ELEMENT eElement, const CFX_WideStringC& wsAttributeName); 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; } |