diff options
-rw-r--r-- | configmgr/source/access.cxx | 15 | ||||
-rw-r--r-- | configmgr/source/access.hxx | 2 | ||||
-rw-r--r-- | configmgr/source/data.cxx | 20 | ||||
-rw-r--r-- | configmgr/source/data.hxx | 2 | ||||
-rw-r--r-- | configmgr/source/partial.cxx | 8 |
5 files changed, 23 insertions, 24 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 06c000dcdbd3..865d383002d3 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -74,7 +74,6 @@ #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weak.hxx> -#include <o3tl/string_view.hxx> #include <osl/interlck.h> #include <osl/mutex.hxx> #include <rtl/character.hxx> @@ -1971,10 +1970,10 @@ rtl::Reference< ChildAccess > Access::getUnmodifiedChild( return createUnmodifiedChild(name,node); } -rtl::Reference< ChildAccess > Access::getSubChild(std::u16string_view path) { +rtl::Reference< ChildAccess > Access::getSubChild(OUString const & path) { sal_Int32 i = 0; // For backwards compatibility, allow absolute paths where meaningful: - if( o3tl::starts_with(path, u"/") ) { + if( path.startsWith("/") ) { ++i; if (!getRootAccess().is()) { return rtl::Reference< ChildAccess >(); @@ -1987,7 +1986,7 @@ rtl::Reference< ChildAccess > Access::getSubChild(std::u16string_view path) { OUString templateName1; i = Data::parseSegment( path, i, &name1, &setElement1, &templateName1); - if (i == -1 || (i != static_cast<sal_Int32>(path.size()) && path[i] != '/')) { + if (i == -1 || (i != path.getLength() && path[i] != '/')) { return rtl::Reference< ChildAccess >(); } OUString name2; @@ -2000,7 +1999,7 @@ rtl::Reference< ChildAccess > Access::getSubChild(std::u16string_view path) { { return rtl::Reference< ChildAccess >(); } - if (i != static_cast<sal_Int32>(path.size())) { + if (i != path.getLength()) { ++i; } } @@ -2010,7 +2009,7 @@ rtl::Reference< ChildAccess > Access::getSubChild(std::u16string_view path) { bool setElement; OUString templateName; i = Data::parseSegment(path, i, &name, &setElement, &templateName); - if (i == -1 || (i != static_cast<sal_Int32>(path.size()) && path[i] != '/')) { + if (i == -1 || (i != path.getLength() && path[i] != '/')) { return rtl::Reference< ChildAccess >(); } rtl::Reference< ChildAccess > child(parent->getChild(name)); @@ -2042,9 +2041,9 @@ rtl::Reference< ChildAccess > Access::getSubChild(std::u16string_view path) { // For backwards compatibility, ignore a final slash after non-value // nodes: if (child->isValue()) { - return i == static_cast<sal_Int32>(path.size()) + return i == path.getLength() ? child : rtl::Reference< ChildAccess >(); - } else if (i >= static_cast<sal_Int32>(path.size()) - 1) { + } else if (i >= path.getLength() - 1) { return child; } ++i; diff --git a/configmgr/source/access.hxx b/configmgr/source/access.hxx index dba29c7c6495..51e43d5bcfcc 100644 --- a/configmgr/source/access.hxx +++ b/configmgr/source/access.hxx @@ -366,7 +366,7 @@ private: rtl::Reference< ChildAccess > getUnmodifiedChild( OUString const & name); - rtl::Reference< ChildAccess > getSubChild(std::u16string_view path); + rtl::Reference< ChildAccess > getSubChild(OUString const & path); bool setChildProperty( OUString const & name, css::uno::Any const & value, diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index d321723eadda..f173ee1556fb 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -110,18 +110,18 @@ OUString Data::createSegment( } sal_Int32 Data::parseSegment( - std::u16string_view path, sal_Int32 index, OUString * name, + OUString const & path, sal_Int32 index, OUString * name, bool * setElement, OUString * templateName) { assert( - index >= 0 && index <= static_cast<sal_Int32>(path.size()) && name != nullptr && + index >= 0 && index <= path.getLength() && name != nullptr && setElement != nullptr); - size_t i = index; - while (i < path.size() && path[i] != '/' && path[i] != '[') { + sal_Int32 i = index; + while (i < path.getLength() && path[i] != '/' && path[i] != '[') { ++i; } - if (i == path.size() || path[i] == '/') { - *name = path.substr(index, i - index); + if (i == path.getLength() || path[i] == '/') { + *name = path.copy(index, i - index); *setElement = false; return i; } @@ -129,18 +129,18 @@ sal_Int32 Data::parseSegment( if (i - index == 1 && path[index] == '*') { templateName->clear(); } else { - *templateName = path.substr(index, i - index); + *templateName = path.copy(index, i - index); } } - if (++i == path.size()) { + if (++i == path.getLength()) { return -1; } sal_Unicode del = path[i++]; if (del != '\'' && del != '"') { return -1; } - size_t j = path.find(del, i); - if (j == std::u16string_view::npos || j + 1 == path.size() || path[j + 1] != ']' || + sal_Int32 j = path.indexOf(del, i); + if (j == -1 || j + 1 == path.getLength() || path[j + 1] != ']' || !decode(path, i, j, name)) { return -1; diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx index 32a08e3437ce..c3614e6435da 100644 --- a/configmgr/source/data.hxx +++ b/configmgr/source/data.hxx @@ -54,7 +54,7 @@ struct Data { std::u16string_view templateName, OUString const & name); static sal_Int32 parseSegment( - std::u16string_view path, sal_Int32 index, OUString * name, + OUString const & path, sal_Int32 index, OUString * name, bool * setElement, OUString * templateName); static OUString fullTemplateName( diff --git a/configmgr/source/partial.cxx b/configmgr/source/partial.cxx index ae8ec599906e..f31e98549684 100644 --- a/configmgr/source/partial.cxx +++ b/configmgr/source/partial.cxx @@ -34,10 +34,10 @@ namespace configmgr { namespace { bool parseSegment( - std::u16string_view path, sal_Int32 * index, OUString * segment) + OUString const & path, sal_Int32 * index, OUString * segment) { assert( - index != nullptr && *index >= 0 && *index <= static_cast<sal_Int32>(path.size()) && + index != nullptr && *index >= 0 && *index <= path.getLength() && segment != nullptr); if (path[(*index)++] == '/') { OUString name; @@ -47,10 +47,10 @@ bool parseSegment( path, *index, &name, &setElement, &templateName); if (*index != -1) { *segment = Data::createSegment(templateName, name); - return *index == static_cast<sal_Int32>(path.size()); + return *index == path.getLength(); } } - throw css::uno::RuntimeException(OUString::Concat("bad path ") + path); + throw css::uno::RuntimeException("bad path " + path); } } |