diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-14 18:34:43 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-14 18:34:43 +0000 |
commit | d1b1127cd452a173ec119587c3a6e137e27df6d7 (patch) | |
tree | 4fa719620920ad545ce2346904d253253659d4ab /xfa/fxfa/parser | |
parent | a5b0e63b66e8bc8744677f4e5b8de2fe2c1b1a7b (diff) | |
download | pdfium-d1b1127cd452a173ec119587c3a6e137e27df6d7.tar.xz |
Cleanup const refs and some enums
This CL cleans up some const refs and some enum values from the previous
rename CLs.
Change-Id: Ifaa990c9c45485bb059e0bda0026093d0a2c0944
Reviewed-on: https://pdfium-review.googlesource.com/18230
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_boxdata.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_imagedata.cpp | 13 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_imagedata.h | 13 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptdata.cpp | 17 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptdata.h | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_resolvenode_rs.h | 6 |
6 files changed, 30 insertions, 33 deletions
diff --git a/xfa/fxfa/parser/cxfa_boxdata.h b/xfa/fxfa/parser/cxfa_boxdata.h index b4c348311c..ae946c4666 100644 --- a/xfa/fxfa/parser/cxfa_boxdata.h +++ b/xfa/fxfa/parser/cxfa_boxdata.h @@ -29,7 +29,7 @@ class CXFA_BoxData : public CXFA_Data { int32_t GetHand() const; int32_t GetPresence() const; int32_t CountEdges() const; - CXFA_EdgeData GetEdgeData(int32_t nIndex = 0) const; + CXFA_EdgeData GetEdgeData(int32_t nIndex) const; std::vector<CXFA_StrokeData> GetStrokes() const; bool IsCircular() const; bool GetStartAngle(float& fStartAngle) const; @@ -46,7 +46,7 @@ class CXFA_BoxData : public CXFA_Data { return fSweepAngle; } - CXFA_FillData GetFillData(bool bModified = false) const; + CXFA_FillData GetFillData(bool bModified) const; CXFA_MarginData GetMarginData() const; int32_t Get3DStyle(bool& bVisible, float& fThickness) const; }; diff --git a/xfa/fxfa/parser/cxfa_imagedata.cpp b/xfa/fxfa/parser/cxfa_imagedata.cpp index 3ae6e5df3e..fbe707a9d4 100644 --- a/xfa/fxfa/parser/cxfa_imagedata.cpp +++ b/xfa/fxfa/parser/cxfa_imagedata.cpp @@ -26,9 +26,11 @@ bool CXFA_ImageData::GetHref(WideString& wsHref) { return m_pNode->JSNode()->GetAttribute(L"href", wsHref, true); } -int32_t CXFA_ImageData::GetTransferEncoding() { - if (m_bDefValue) - return m_pNode->JSNode()->GetEnum(XFA_Attribute::TransferEncoding); +XFA_ATTRIBUTEENUM CXFA_ImageData::GetTransferEncoding() { + if (m_bDefValue) { + return static_cast<XFA_ATTRIBUTEENUM>( + m_pNode->JSNode()->GetEnum(XFA_Attribute::TransferEncoding)); + } return XFA_ATTRIBUTEENUM_Base64; } @@ -49,11 +51,10 @@ bool CXFA_ImageData::SetHref(const WideString& wsHref) { wsHref.AsStringView(), false); } -bool CXFA_ImageData::SetTransferEncoding(int32_t iTransferEncoding) { +bool CXFA_ImageData::SetTransferEncoding(XFA_ATTRIBUTEENUM iTransferEncoding) { if (m_bDefValue) { return m_pNode->JSNode()->SetEnum(XFA_Attribute::TransferEncoding, - (XFA_ATTRIBUTEENUM)iTransferEncoding, - false); + iTransferEncoding, false); } return true; } diff --git a/xfa/fxfa/parser/cxfa_imagedata.h b/xfa/fxfa/parser/cxfa_imagedata.h index e94615ae1d..8b3ae43b98 100644 --- a/xfa/fxfa/parser/cxfa_imagedata.h +++ b/xfa/fxfa/parser/cxfa_imagedata.h @@ -18,13 +18,16 @@ class CXFA_ImageData : public CXFA_Data { CXFA_ImageData(CXFA_Node* pNode, bool bDefValue); int32_t GetAspect(); - bool GetContentType(WideString& wsContentType); - bool GetHref(WideString& wsHref); - int32_t GetTransferEncoding(); bool GetContent(WideString& wsText); - bool SetContentType(const WideString& wsContentType); + + bool GetHref(WideString& wsHref); bool SetHref(const WideString& wsHref); - bool SetTransferEncoding(int32_t iTransferEncoding); + + XFA_ATTRIBUTEENUM GetTransferEncoding(); + bool SetTransferEncoding(XFA_ATTRIBUTEENUM iTransferEncoding); + + bool GetContentType(WideString& wsContentType); + bool SetContentType(const WideString& wsContentType); private: bool m_bDefValue; diff --git a/xfa/fxfa/parser/cxfa_scriptdata.cpp b/xfa/fxfa/parser/cxfa_scriptdata.cpp index 1831046352..619dcc14b6 100644 --- a/xfa/fxfa/parser/cxfa_scriptdata.cpp +++ b/xfa/fxfa/parser/cxfa_scriptdata.cpp @@ -10,16 +10,15 @@ CXFA_ScriptData::CXFA_ScriptData(CXFA_Node* pNode) : CXFA_Data(pNode) {} -XFA_SCRIPTTYPE CXFA_ScriptData::GetContentType() { +XFA_ScriptDataType CXFA_ScriptData::GetContentType() { WideStringView cData; - if (m_pNode->JSNode()->TryCData(XFA_Attribute::ContentType, cData, false)) { - if (cData == L"application/x-javascript") - return XFA_SCRIPTTYPE_Javascript; - if (cData == L"application/x-formcalc") - return XFA_SCRIPTTYPE_Formcalc; - return XFA_SCRIPTTYPE_Unkown; - } - return XFA_SCRIPTTYPE_Formcalc; + if (!m_pNode->JSNode()->TryCData(XFA_Attribute::ContentType, cData, false)) + return XFA_ScriptDataType::Formcalc; + if (cData == L"application/x-javascript") + return XFA_ScriptDataType::Javascript; + if (cData == L"application/x-formcalc") + return XFA_ScriptDataType::Formcalc; + return XFA_ScriptDataType::Unknown; } int32_t CXFA_ScriptData::GetRunAt() { diff --git a/xfa/fxfa/parser/cxfa_scriptdata.h b/xfa/fxfa/parser/cxfa_scriptdata.h index f7b8d741fc..36c9a31e7e 100644 --- a/xfa/fxfa/parser/cxfa_scriptdata.h +++ b/xfa/fxfa/parser/cxfa_scriptdata.h @@ -12,10 +12,10 @@ #include "core/fxcrt/fx_string.h" #include "xfa/fxfa/parser/cxfa_data.h" -enum XFA_SCRIPTTYPE { - XFA_SCRIPTTYPE_Formcalc = 0, - XFA_SCRIPTTYPE_Javascript, - XFA_SCRIPTTYPE_Unkown, +enum class XFA_ScriptDataType { + Formcalc = 0, + Javascript, + Unknown, }; class CXFA_Node; @@ -24,7 +24,7 @@ class CXFA_ScriptData : public CXFA_Data { public: explicit CXFA_ScriptData(CXFA_Node* pNode); - XFA_SCRIPTTYPE GetContentType(); + XFA_ScriptDataType GetContentType(); int32_t GetRunAt(); void GetExpression(WideString& wsExpression); }; diff --git a/xfa/fxfa/parser/xfa_resolvenode_rs.h b/xfa/fxfa/parser/xfa_resolvenode_rs.h index c1c8e6b4c7..c5cdeee06f 100644 --- a/xfa/fxfa/parser/xfa_resolvenode_rs.h +++ b/xfa/fxfa/parser/xfa_resolvenode_rs.h @@ -28,12 +28,6 @@ #define XFA_RESOLVENODE_Bind 0x0800 #define XFA_RESOLVENODE_BindNew 0x1000 -enum XFA_SCRIPTLANGTYPE { - XFA_SCRIPTLANGTYPE_Formcalc = XFA_SCRIPTTYPE_Formcalc, - XFA_SCRIPTLANGTYPE_Javascript = XFA_SCRIPTTYPE_Javascript, - XFA_SCRIPTLANGTYPE_Unkown = XFA_SCRIPTTYPE_Unkown, -}; - enum XFA_RESOLVENODE_RSTYPE { XFA_RESOLVENODE_RSTYPE_Nodes, XFA_RESOLVENODE_RSTYPE_Attribute, |