[Libreoffice-commits] core.git: codemaker/source

Stephan Bergmann sbergman at redhat.com
Tue Dec 1 00:33:19 PST 2015


 codemaker/source/cppumaker/cpputype.cxx |   38 +++++++++++++-------------------
 1 file changed, 16 insertions(+), 22 deletions(-)

New commits:
commit 03b9d1e720aa3c28a2406ddcc2e8758da1c9bc0b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Dec 1 09:29:18 2015 +0100

    Reduce space needed for string literals
    
    ...as had been done in 68ba6ddef50ec4aa92f55fa610c84c9f0d134e67 "codemaker:
    Allow compiler to share these generated strings" and
    2188a7ac2eb37aee89f8f305bdf99db9b05b20bf "Reduce the amount of strings in the
    release builds," and then undone in 759eb79d886b70c7e7ab86b48e63d1b627b7dc44
    "give useful details in non-debug mode too"
    
    Change-Id: Ic888d6c47449da3b3a084f863a7e0526f201a967

diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index bd74149..7a07751 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -3442,13 +3442,11 @@ private:
     rtl::Reference< unoidl::SingleInterfaceBasedServiceEntity > entity_;
 };
 
-static OUString failsToSupply(const OUString& name_, const OString& baseName)
+static void failsToSupply(
+    FileStream & o, OUString const & service, OString const & type)
 {
-    return OUString(
-            "\n"
-            "\n"
-            "                ::rtl::OUString(\"component context fails to supply service '" + name_ + "' of type '" + OStringToOUString(baseName, RTL_TEXTENCODING_UTF8) + "'\")\n"
-            "\n");
+    o << "::rtl::OUString(\"component context fails to supply service \") + \""
+      << service << "\" + \" of type \" + \"" << type << "\"";
 }
 
 void ServiceType::dumpHxxFile(
@@ -3586,18 +3584,16 @@ void ServiceType::dumpHxxFile(
                 o << indent()
                   << ("} catch (const ::css::uno::Exception & the_exception) {\n");
                 inc();
-                o << indent()
-                  << "throw ::css::uno::DeploymentException("
-                  << failsToSupply(name_, baseName)
-                  << " + \": \" + the_exception.Message, the_context);\n";
+                o << indent() << "throw ::css::uno::DeploymentException(";
+                failsToSupply(o, name_, baseName);
+                o << " + \": \" + the_exception.Message, the_context);\n";
                 dec();
                 o << indent() << "}\n" << indent()
                   << "if (!the_instance.is()) {\n";
                 inc();
-                o << indent()
-                  << "throw ::css::uno::DeploymentException("
-                  << failsToSupply(name_, baseName)
-                  << ", the_context);\n";
+                o << indent() << "throw ::css::uno::DeploymentException(";
+                failsToSupply(o, name_, baseName);
+                o << ", the_context);\n";
                 dec();
                 o << indent() << "}\n" << indent() << "return the_instance;\n";
                 dec();
@@ -3747,19 +3743,17 @@ void ServiceType::dumpHxxFile(
                       << ("} catch (const ::css::uno::Exception &"
                           " the_exception) {\n");
                     inc();
-                    o << indent()
-                      << "throw ::css::uno::DeploymentException("
-                      << failsToSupply(name_, baseName)
-                      << " + \": \" + the_exception.Message, the_context);\n";
+                    o << indent() << "throw ::css::uno::DeploymentException(";
+                    failsToSupply(o, name_, baseName);
+                    o << " + \": \" + the_exception.Message, the_context);\n";
                     dec();
                     o << indent() << "}\n";
                 }
                 o << indent() << "if (!the_instance.is()) {\n";
                 inc();
-                o << indent()
-                  << "throw ::css::uno::DeploymentException("
-                  << failsToSupply(name_, baseName)
-                  << ", the_context);\n";
+                o << indent() << "throw ::css::uno::DeploymentException(";
+                failsToSupply(o, name_, baseName);
+                o << ", the_context);\n";
                 dec();
                 o << indent() << "}\n" << indent() << "return the_instance;\n";
                 dec();


More information about the Libreoffice-commits mailing list