diff options
-rw-r--r-- | unodevtools/inc/options.hxx | 2 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/cppcompskeleton.cxx | 6 | ||||
-rw-r--r-- | unodevtools/source/unodevtools/options.cxx | 13 |
3 files changed, 11 insertions, 10 deletions
diff --git a/unodevtools/inc/options.hxx b/unodevtools/inc/options.hxx index 8cbaf50e190b..2ec56abeffaf 100644 --- a/unodevtools/inc/options.hxx +++ b/unodevtools/inc/options.hxx @@ -29,7 +29,7 @@ namespace unodevtools { bool readOption( OUString * pValue, const char * pOpt, - sal_uInt32 * pnIndex, const OUString & aArg); + sal_uInt32 * pnIndex, std::u16string_view aArg); // throws CannotDumpException diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx index 301aebff8906..0e57d1132921 100644 --- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx +++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx @@ -34,7 +34,7 @@ namespace skeletonmaker::cpp { static void generateIncludes(std::ostream & o, const std::set< OUString >& interfaces, - const OUString & propertyhelper, const bool serviceobject, + std::u16string_view propertyhelper, const bool serviceobject, const bool supportxcomponent) { o << "#include \"sal/config.h\"\n"; @@ -51,8 +51,8 @@ static void generateIncludes(std::ostream & o, o << "#include \"cppuhelper/implbase" << interfaces.size() << ".hxx\"\n"; } - if (propertyhelper.getLength() > 1) { - if (propertyhelper == "_") + if (propertyhelper.size() > 1) { + if (propertyhelper == u"_") o << "#include \"cppuhelper/rpopshlp.hxx\"\n"; else o << "#include \"cppuhelper/propertysetmixin.hxx\"\n"; diff --git a/unodevtools/source/unodevtools/options.cxx b/unodevtools/source/unodevtools/options.cxx index 290f70ce06ce..bf465af09f51 100644 --- a/unodevtools/source/unodevtools/options.cxx +++ b/unodevtools/source/unodevtools/options.cxx @@ -18,6 +18,7 @@ */ #include <codemaker/global.hxx> +#include <o3tl/safeint.hxx> #include <o3tl/string_view.hxx> #include <rtl/ustring.hxx> #include <rtl/process.h> @@ -28,18 +29,18 @@ namespace unodevtools { bool readOption( OUString * pValue, const char * pOpt, - sal_uInt32 * pnIndex, const OUString & aArg) + sal_uInt32 * pnIndex, std::u16string_view aArg) { static const OUStringLiteral dash = u"-"; - if(aArg.indexOf(dash) != 0) + if(aArg.find(dash) != 0) return false; OUString aOpt = OUString::createFromAscii( pOpt ); - if (aArg.getLength() < aOpt.getLength()) + if (aArg.size() < o3tl::make_unsigned(aOpt.getLength())) return false; - if (aOpt.equalsIgnoreAsciiCase( aArg.subView(1) )) { + if (aOpt.equalsIgnoreAsciiCase( aArg.substr(1) )) { // take next argument ++(*pnIndex); @@ -53,8 +54,8 @@ bool readOption( OUString * pValue, const char * pOpt, SAL_INFO("unodevtools", "identified option -" << pOpt << " = " << *pValue); ++(*pnIndex); return true; - } else if (aArg.indexOf(aOpt) == 1) { - *pValue = aArg.copy(1 + aOpt.getLength()); + } else if (aArg.find(aOpt) == 1) { + *pValue = aArg.substr(1 + aOpt.getLength()); SAL_INFO("unodevtools", "identified option -" << pOpt << " = " << *pValue); ++(*pnIndex); |