diff options
author | tsepez <tsepez@chromium.org> | 2016-05-12 15:52:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-12 15:52:14 -0700 |
commit | 28c7844c1ef5ea0c8727b890e9ff56b593119a00 (patch) | |
tree | a96e31bbff3c221a0030e3a8a6501a5f81379d0f /core/fxcrt/fx_xml_composer.cpp | |
parent | ade9465067098d9f94a13f61741cebf4bb8aac47 (diff) | |
download | pdfium-28c7844c1ef5ea0c8727b890e9ff56b593119a00.tar.xz |
Add CFX_ByteStringC::CharAt() to avoid c_str() and casts.
Most of the time, we want to operate on chars as if they
were unsigned, but there are a few places where we need
the default (questionably signed) values. Consolidate
the casting in a single place rather than forcing callers
to get a char* ptr.
BUG=pdfium:493
Review-Url: https://codereview.chromium.org/1972053003
Diffstat (limited to 'core/fxcrt/fx_xml_composer.cpp')
-rw-r--r-- | core/fxcrt/fx_xml_composer.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/core/fxcrt/fx_xml_composer.cpp b/core/fxcrt/fx_xml_composer.cpp index 576ff95432..1bad069c34 100644 --- a/core/fxcrt/fx_xml_composer.cpp +++ b/core/fxcrt/fx_xml_composer.cpp @@ -11,24 +11,18 @@ void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, CFX_ByteStringC& bsSpace, CFX_ByteStringC& bsName) { - if (bsFullName.IsEmpty()) { + if (bsFullName.IsEmpty()) return; - } - int32_t iStart = 0; - for (; iStart < bsFullName.GetLength(); iStart++) { - if (bsFullName.GetAt(iStart) == ':') { - break; - } - } - if (iStart >= bsFullName.GetLength()) { + + FX_STRSIZE iStart = bsFullName.Find(':'); + if (iStart == -1) { bsName = bsFullName; } else { - bsSpace = CFX_ByteStringC(bsFullName.c_str(), iStart); - iStart++; - bsName = CFX_ByteStringC(bsFullName.c_str() + iStart, - bsFullName.GetLength() - iStart); + bsSpace = bsFullName.Mid(0, iStart); + bsName = bsFullName.Mid(iStart + 1); } } + void CXML_Element::SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname) { m_QSpaceName = qSpace; |