codemaker/source/codemaker/unotype.cxx  |   20 ++++++++++----------
 codemaker/source/cppumaker/includes.cxx |    2 +-
 codemaker/source/cppumaker/includes.hxx |    2 +-
 include/codemaker/unotype.hxx           |    3 +--
 4 files changed, 13 insertions(+), 14 deletions(-)

New commits:
commit fa88fd0fc8434a4a6077dd80afcd47464669d907
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Apr 29 09:30:29 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Apr 29 11:12:54 2022 +0200

    Revert "use more string_view in codemaker"
    
    This reverts commit 9463550eabd0455c374c1369bc72388108baccad.
    
    Reason for revert: The codemaker::UnoType::decompose was previously mostly 
returning the same OString it receives, so this change is likely a pessimisation
    
    Change-Id: Ie1b41889d0a6af9247b8683075d4edd1163fecc8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133492
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/codemaker/source/codemaker/unotype.cxx 
b/codemaker/source/codemaker/unotype.cxx
index 2b8a2bfc6d1f..8c25ac8ae0dd 100644
--- a/codemaker/source/codemaker/unotype.cxx
+++ b/codemaker/source/codemaker/unotype.cxx
@@ -26,25 +26,25 @@
 
 
 OString codemaker::UnoType::decompose(
-    std::string_view type, sal_Int32 * rank,
+    OString const & type, sal_Int32 * rank,
     std::vector< OString > * arguments)
 {
-    size_t len = type.size();
-    size_t i = 0;
+    sal_Int32 len = type.getLength();
+    sal_Int32 i = 0;
     while (len - i > 1 && type[i + 1] == ']') {
         i += 2;
     }
     if (rank != nullptr) {
         *rank = i / 2;
     }
-    size_t j = arguments == nullptr ? std::string_view::npos : type.find('<', 
i);
-    if (j == std::string_view::npos) {
-        return OString(type.substr(i));
+    sal_Int32 j = arguments == nullptr ? -1 : type.indexOf('<', i);
+    if (j < 0) {
+        return type.copy(i);
     }
-    size_t k = j;
+    sal_Int32 k = j;
     do {
         ++k; // skip '<' or ','
-        size_t l = k;
+        sal_Int32 l = k;
         for (sal_Int32 level = 0; l != len; ++l) {
             char c = type[l];
             if (c == ',') {
@@ -60,11 +60,11 @@ OString codemaker::UnoType::decompose(
                 --level;
             }
         }
-        arguments->push_back(OString(type.substr(k, l - k)));
+        arguments->push_back(type.copy(k, l - k));
         k = l;
     } while (k != len && type[k] != '>');
     OSL_ASSERT(k == len - 1 && type[k] == '>');
-    return OString(type.substr(i, j - i));
+    return type.copy(i, j - i);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/codemaker/source/cppumaker/includes.cxx 
b/codemaker/source/cppumaker/includes.cxx
index 470d59ef3554..db7dae46bccc 100644
--- a/codemaker/source/cppumaker/includes.cxx
+++ b/codemaker/source/cppumaker/includes.cxx
@@ -68,7 +68,7 @@ Includes::Includes(
 Includes::~Includes()
 {}
 
-void Includes::add(std::string_view entityName) {
+void Includes::add(OString const & entityName) {
     sal_Int32 k;
     std::vector< OString > args;
     OUString n(b2u(codemaker::UnoType::decompose(entityName, &k, &args)));
diff --git a/codemaker/source/cppumaker/includes.hxx 
b/codemaker/source/cppumaker/includes.hxx
index 00c784408077..0362c417ac2a 100644
--- a/codemaker/source/cppumaker/includes.hxx
+++ b/codemaker/source/cppumaker/includes.hxx
@@ -38,7 +38,7 @@ public:
 
     ~Includes();
 
-    void add(std::string_view entityName);
+    void add(OString const & entityName);
     void addCassert() { m_includeCassert = true; }
     void addAny() { m_includeAny = true; }
     void addReference() { m_includeReference = true; }
diff --git a/include/codemaker/unotype.hxx b/include/codemaker/unotype.hxx
index 38c66f6441b8..606321873242 100644
--- a/include/codemaker/unotype.hxx
+++ b/include/codemaker/unotype.hxx
@@ -22,7 +22,6 @@
 
 #include <sal/types.h>
 
-#include <string_view>
 #include <vector>
 
 namespace rtl { class OString; }
@@ -79,7 +78,7 @@ namespace codemaker::UnoType {
        @return the base part of the given type
      */
     rtl::OString decompose(
-        std::string_view type, sal_Int32 * rank = nullptr,
+        rtl::OString const & type, sal_Int32 * rank = nullptr,
         std::vector< rtl::OString > * arguments = nullptr);
 
 }

Reply via email to