diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-07-19 13:19:12 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-19 20:59:29 +0000 |
commit | 33b42e4ab56d56ff02cd08a47c5f590875d886bf (patch) | |
tree | d168b57aa48373a3213f918471fcd1c8224d2d5d /xfa/fxfa/parser/cxfa_node.cpp | |
parent | d4c401194137f3f7f466f6daaa7fe3ffb4b6cd53 (diff) | |
download | pdfium-33b42e4ab56d56ff02cd08a47c5f590875d886bf.tar.xz |
Rename StringCs c_str() to unterminated_c_str().
Since there is no guarantee of termination if the StringC was
extracted from a snippet of another string. Make it more obvious
that things like
strlen(str.unterminated_c_str())
might be a bad idea.
Change-Id: I7832248ed89ebbddf5c0bcd402aac7d40ec2adc2
Reviewed-on: https://pdfium-review.googlesource.com/8170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 845d3f379d..5c4f8d102e 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -3591,7 +3591,7 @@ bool CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, return SetBoolean(pAttr->eName, wsValue != L"0", bNotify); case XFA_ATTRIBUTETYPE_Integer: return SetInteger(pAttr->eName, - FXSYS_round(FXSYS_wcstof(wsValue.c_str(), + FXSYS_round(FXSYS_wcstof(wsValue.unterminated_c_str(), wsValue.GetLength(), nullptr)), bNotify); case XFA_ATTRIBUTETYPE_Measure: @@ -4554,7 +4554,8 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { static_cast<CFX_XMLElement*>(pNode->m_pXMLNode); CFX_WideStringC wsAttributeName = pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); - pXMLElement->RemoveAttribute(wsAttributeName.c_str()); + // TODO(tsepez): check usage of c_str() below. + pXMLElement->RemoveAttribute(wsAttributeName.unterminated_c_str()); } CFX_WideString wsName; pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false); @@ -4850,7 +4851,7 @@ bool CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) { } void CXFA_Node::SetMapModuleString(void* pKey, const CFX_WideStringC& wsValue) { - SetMapModuleBuffer(pKey, (void*)wsValue.c_str(), + SetMapModuleBuffer(pKey, (void*)wsValue.unterminated_c_str(), wsValue.GetLength() * sizeof(wchar_t)); } |