Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2734)

Unified Diff: core/fxcrt/fx_xml_composer.cpp

Issue 1972053003: Add CFX_ByteStringC::CharAt() to avoid c_str() and casts (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxcrt/fx_extension.cpp ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/fx_xml_composer.cpp
diff --git a/core/fxcrt/fx_xml_composer.cpp b/core/fxcrt/fx_xml_composer.cpp
index 576ff95432279ae0f5989f169e734efad8808f8a..1bad069c342d345b75498e739f9d4eb5698322b7 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;
« no previous file with comments | « core/fxcrt/fx_extension.cpp ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698