diff options
author | Lei Zhang <thestig@chromium.org> | 2017-07-25 17:20:43 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-26 00:33:29 +0000 |
commit | a27c752a048ac2b88bc0c9c293917a7a0494d8a2 (patch) | |
tree | 566d7689a11209ccb8430828b3e9c56050d3736e /xfa/fxfa/parser/cxfa_node.cpp | |
parent | 952477dbee761a6e38ce675f2095bbfc9cfd7450 (diff) | |
download | pdfium-a27c752a048ac2b88bc0c9c293917a7a0494d8a2.tar.xz |
Clean up CXFA_Measurement and callers.
Change-Id: Iaa34127aaf616a0a7bdf7ccc8f8f001d34abcca1
Reviewed-on: https://pdfium-review.googlesource.com/7371
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 11c2c3c35e..eac7ac04b0 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -2087,7 +2087,7 @@ void CXFA_Node::Script_Som_BorderWidth(CFXJSE_Value* pValue, } else { CXFA_Edge edge = border.GetEdge(0); CXFA_Measurement thickness = edge.GetMSThickness(); - thickness.ToString(wsThickness); + thickness.ToString(&wsThickness); pValue->SetString(wsThickness.UTF8Encode().AsStringC()); } } @@ -3606,9 +3606,9 @@ bool CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, CFX_WideString& wsValue, bool bUseDefault) { const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); - if (!pAttr) { + if (!pAttr) return false; - } + XFA_ATTRIBUTETYPE eType = pAttr->eType; if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { const XFA_NOTSUREATTRIBUTE* pNotsure = @@ -3618,48 +3618,47 @@ bool CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr, switch (eType) { case XFA_ATTRIBUTETYPE_Enum: { XFA_ATTRIBUTEENUM eValue; - if (!TryEnum(pAttr->eName, eValue, bUseDefault)) { + if (!TryEnum(pAttr->eName, eValue, bUseDefault)) return false; - } + wsValue = GetAttributeEnumByID(eValue)->pName; return true; - } break; + } case XFA_ATTRIBUTETYPE_Cdata: { CFX_WideStringC wsValueC; - if (!TryCData(pAttr->eName, wsValueC, bUseDefault)) { + if (!TryCData(pAttr->eName, wsValueC, bUseDefault)) return false; - } + wsValue = wsValueC; return true; - } break; + } case XFA_ATTRIBUTETYPE_Boolean: { bool bValue; - if (!TryBoolean(pAttr->eName, bValue, bUseDefault)) { + if (!TryBoolean(pAttr->eName, bValue, bUseDefault)) return false; - } + wsValue = bValue ? L"1" : L"0"; return true; - } break; + } case XFA_ATTRIBUTETYPE_Integer: { int32_t iValue; - if (!TryInteger(pAttr->eName, iValue, bUseDefault)) { + if (!TryInteger(pAttr->eName, iValue, bUseDefault)) return false; - } + wsValue.Format(L"%d", iValue); return true; - } break; + } case XFA_ATTRIBUTETYPE_Measure: { CXFA_Measurement mValue; - if (!TryMeasure(pAttr->eName, mValue, bUseDefault)) { + if (!TryMeasure(pAttr->eName, mValue, bUseDefault)) return false; - } - mValue.ToString(wsValue); + + mValue.ToString(&wsValue); return true; - } break; + } default: - break; + return false; } - return false; } bool CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr, |