unodevtools/inc/options.hxx                          |    2 +-
 unodevtools/source/skeletonmaker/cppcompskeleton.cxx |    6 +++---
 unodevtools/source/unodevtools/options.cxx           |   13 +++++++------
 3 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 7e3c2e46c61c4ff29b4f4e62aa7a7660042d091e
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Apr 27 16:08:54 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Apr 28 11:45:30 2022 +0200

    use more string_view in unodevtools
    
    Change-Id: I60e090381e6e56d531b9727604b4755b96c608c5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133516
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

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);
 

Reply via email to