[PATCH] Removed last RTL_CONST* macros from codemaker

Marcos Souza (via Code Review) gerrit at gerrit.libreoffice.org
Fri Mar 8 09:27:15 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2605

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/05/2605/1

Removed last RTL_CONST* macros from codemaker

Also, change ".equals" fro "==" and drop a useless function.

Change-Id: I5ce4fd2cc7c62a18e059e945b42cc01425802aa0
---
M codemaker/source/codemaker/codemaker.cxx
M codemaker/source/codemaker/typemanager.cxx
M codemaker/source/cppumaker/cppumaker.cxx
M codemaker/source/cppumaker/cpputype.cxx
M codemaker/source/javamaker/classfile.cxx
M codemaker/source/javamaker/javamaker.cxx
M codemaker/source/javamaker/javatype.cxx
7 files changed, 60 insertions(+), 80 deletions(-)



diff --git a/codemaker/source/codemaker/codemaker.cxx b/codemaker/source/codemaker/codemaker.cxx
index b6169b8..bf5b618 100644
--- a/codemaker/source/codemaker/codemaker.cxx
+++ b/codemaker/source/codemaker/codemaker.cxx
@@ -62,10 +62,6 @@
     return s;
 }
 
-OString errorMsg(OString const & desc, OString const & type) {
-    return desc + type;
-}
-
 codemaker::UnoType::Sort decomposeAndResolve(
     TypeManager const & manager, rtl::OString const & type,
     bool resolveTypedefs, bool allowVoid, bool allowExtraEntities,
@@ -78,7 +74,7 @@
         sal_Int32 n = 0;
         *name = codemaker::UnoType::decompose(t, &n, arguments);
         if (n > SAL_MAX_INT32 - *rank) {
-            throw CannotDumpException(errorMsg("Bad type information: ", type));
+            throw CannotDumpException("Bad type information: " + type);
             //TODO
         }
         *rank += n;
@@ -90,7 +86,7 @@
         switch (sort) {
         case codemaker::UnoType::SORT_VOID:
             if (!allowVoid) {
-                throw CannotDumpException( errorMsg("Bad type information: ", type));
+                throw CannotDumpException("Bad type information: " + type);
                 //TODO
             }
         default:
@@ -113,7 +109,7 @@
                         || (static_cast< sal_uInt16 >(arguments->size())
                             != reader.getReferenceCount())))
                 {
-                    throw CannotDumpException(errorMsg("Bad type information: ", type));
+                    throw CannotDumpException("Bad type information: " + type);
                     //TODO
                 }
                 return sort;
@@ -124,7 +120,7 @@
             case RT_TYPE_SINGLETON:
             case RT_TYPE_CONSTANTS:
                 if (!allowExtraEntities) {
-                    throw CannotDumpException(errorMsg("Bad type information: ", type));
+                    throw CannotDumpException("Bad type information: " + type);
                     //TODO
                 }
                 checkNoTypeArguments(*arguments);
@@ -146,7 +142,7 @@
                     }
                 }
             default:
-                throw CannotDumpException(errorMsg("Bad type information: ", type));
+                throw CannotDumpException("Bad type information: " + type);
                 //TODO
             }
         }
diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx
index d223e48..4e53e5f 100644
--- a/codemaker/source/codemaker/typemanager.cxx
+++ b/codemaker/source/codemaker/typemanager.cxx
@@ -56,35 +56,35 @@
 
 sal_Bool TypeManager::isBaseType(const ::rtl::OString& name)
 {
-    if ( name.equals(OString("short")) )
+    if ( name == "short" )
         return sal_True;
-    if ( name.equals(OString("unsigned short")) )
+    if ( name == "unsigned short" )
         return sal_True;
-    if ( name.equals(OString("long")) )
+    if ( name == "long" )
         return sal_True;
-    if ( name.equals(OString("unsigned long")) )
+    if ( name == "unsigned long" )
         return sal_True;
-    if ( name.equals(OString("hyper")) )
+    if ( name == "hyper" )
         return sal_True;
-    if ( name.equals(OString("unsigned hyper")) )
+    if ( name == "unsigned hyper" )
         return sal_True;
-    if ( name.equals(OString("string")) )
+    if ( name == "string" )
         return sal_True;
-    if ( name.equals(OString("boolean")) )
+    if ( name == "boolean" )
         return sal_True;
-    if ( name.equals(OString("char")) )
+    if ( name == "char" )
         return sal_True;
-    if ( name.equals(OString("byte")) )
+    if ( name == "byte" )
         return sal_True;
-    if ( name.equals(OString("any")) )
+    if ( name == "any" )
         return sal_True;
-    if ( name.equals(OString("type")) )
+    if ( name == "type" )
         return sal_True;
-    if ( name.equals(OString("float")) )
+    if ( name == "float" )
         return sal_True;
-    if ( name.equals(OString("double")) )
+    if ( name == "double" )
         return sal_True;
-    if ( name.equals(OString("void")) )
+    if ( name == "void" )
         return sal_True;
 
     return sal_False;
@@ -355,10 +355,10 @@
 {
     RegistryKeyList keyList= RegistryKeyList();
     OString tmpName;
-    if ( name_.equals("/") || name_.equals(m_pImpl->m_base) ) {
+    if ( name_ == "/" || name_ == m_pImpl->m_base ) {
         tmpName = m_pImpl->m_base;
     } else {
-        if ( m_pImpl->m_base.equals("/") )
+        if ( m_pImpl->m_base == "/" )
             tmpName = name_;
         else
             tmpName = m_pImpl->m_base + "/" + name_;
diff --git a/codemaker/source/cppumaker/cppumaker.cxx b/codemaker/source/cppumaker/cppumaker.cxx
index 7910149..38b8cce 100644
--- a/codemaker/source/cppumaker/cppumaker.cxx
+++ b/codemaker/source/cppumaker/cppumaker.cxx
@@ -187,7 +187,7 @@
                 if (tmpName == "*")
                 {
                     // produce this type and his scope
-                    if (typeName.equals("*"))
+                    if (typeName == "*")
                     {
                         tmpName = "/";
                     } else
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 1ac9673..c348729 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -136,7 +136,7 @@
         "com/sun/star/util/XMacroExpander"
     }; // cf. cppuhelper/unotypes/Makefile UNOTYPES (plus missing dependencies)
     for (std::size_t i = 0; i < SAL_N_ELEMENTS(names); ++i) {
-        if (name.equals(names[i])) {
+        if (name == names[i]) {
             return true;
         }
     }
@@ -315,7 +315,7 @@
 
     OString sTmpExt(".tml");
     sal_Bool bHdl = sal_True;    ;
-    if (sExtension.equals(".hpp")) {
+    if (sExtension == ".hpp") {
         sTmpExt = ".tmp";
         bHdl = sal_False;
     }
@@ -389,7 +389,7 @@
 OString CppuType::dumpHeaderDefine(
     FileStream& o, char const * prefix, sal_Bool bExtended)
 {
-    if (m_typeName.equals("/"))
+    if (m_typeName == "/")
     {
         bExtended = sal_False;
         m_typeName = "global";
@@ -535,7 +535,7 @@
 }
 
 void CppuType::dumpGetCppuType(FileStream & out) {
-    if (m_typeName.equals("com/sun/star/uno/XInterface")) {
+    if (m_typeName == "com/sun/star/uno/XInterface") {
         out << indent()
             << ("inline ::com::sun::star::uno::Type const & SAL_CALL"
                 " getCppuType(SAL_UNUSED_PARAMETER ");
@@ -547,7 +547,7 @@
                 " >::get();\n");
         dec();
         out << indent() << "}\n";
-    } else if (m_typeName.equals("com/sun/star/uno/Exception")) {
+    } else if (m_typeName == "com/sun/star/uno/Exception") {
         out << indent()
             << ("inline ::com::sun::star::uno::Type const & SAL_CALL"
                 " getCppuType(SAL_UNUSED_PARAMETER ");
@@ -604,7 +604,7 @@
     sal_Bool bIsBaseException = sal_False;
     if (!superType.isEmpty())
     {
-        if ( superType.equals("com/sun/star/uno/Exception") )
+        if ( superType == "com/sun/star/uno/Exception" )
         {
             bIsBaseException = sal_True;
         } else
@@ -953,35 +953,35 @@
             return bCStyle ? "typelib_TypeClass_SERVICE" : "::com::sun::star::uno::TypeClass_SERVICE";
         case RT_TYPE_INVALID:
             {
-                if (type.equals("long"))
+                if (type == "long")
                     return bCStyle ? "typelib_TypeClass_LONG" : "::com::sun::star::uno::TypeClass_LONG";
-                if (type.equals("short"))
+                if (type == "short")
                     return bCStyle ? "typelib_TypeClass_SHORT" : "::com::sun::star::uno::TypeClass_SHORT";
-                if (type.equals("hyper"))
+                if (type == "hyper")
                     return bCStyle ? "typelib_TypeClass_HYPER" : "::com::sun::star::uno::TypeClass_HYPER";
-                if (type.equals("string"))
+                if (type == "string")
                     return bCStyle ? "typelib_TypeClass_STRING" : "::com::sun::star::uno::TypeClass_STRING";
-                if (type.equals("boolean"))
+                if (type == "boolean")
                     return bCStyle ? "typelib_TypeClass_BOOLEAN" : "::com::sun::star::uno::TypeClass_BOOLEAN";
-                if (type.equals("char"))
+                if (type == "char")
                     return bCStyle ? "typelib_TypeClass_CHAR" : "::com::sun::star::uno::TypeClass_CHAR";
-                if (type.equals("byte"))
+                if (type == "byte")
                     return bCStyle ? "typelib_TypeClass_BYTE" : "::com::sun::star::uno::TypeClass_BYTE";
-                if (type.equals("any"))
+                if (type == "any")
                     return bCStyle ? "typelib_TypeClass_ANY" : "::com::sun::star::uno::TypeClass_ANY";
-                if (type.equals("type"))
+                if (type == "type")
                     return bCStyle ? "typelib_TypeClass_TYPE" : "::com::sun::star::uno::TypeClass_TYPE";
-                if (type.equals("float"))
+                if (type == "float")
                     return bCStyle ? "typelib_TypeClass_FLOAT" : "::com::sun::star::uno::TypeClass_FLOAT";
-                if (type.equals("double"))
+                if (type == "double")
                     return bCStyle ? "typelib_TypeClass_DOUBLE" : "::com::sun::star::uno::TypeClass_DOUBLE";
-                if (type.equals("void"))
+                if (type == "void")
                     return bCStyle ? "typelib_TypeClass_VOID" : "::com::sun::star::uno::TypeClass_VOID";
-                if (type.equals("unsigned long"))
+                if (type == "unsigned long")
                     return bCStyle ? "typelib_TypeClass_UNSIGNED_LONG" : "::com::sun::star::uno::TypeClass_UNSIGNED_LONG";
-                if (type.equals("unsigned short"))
+                if (type == "unsigned short")
                     return bCStyle ? "typelib_TypeClass_UNSIGNED_SHORT" : "::com::sun::star::uno::TypeClass_UNSIGNED_SHORT";
-                if (type.equals("unsigned hyper"))
+                if (type == "unsigned hyper")
                     return bCStyle ? "typelib_TypeClass_UNSIGNED_HYPER" : "::com::sun::star::uno::TypeClass_UNSIGNED_HYPER";
             }
             break;
@@ -1521,7 +1521,7 @@
             m_reader.getMethodReturnTypeName(i), RTL_TEXTENCODING_UTF8);
         paramCount = m_reader.getMethodParameterCount(i);
 
-        if ( methodName.equals("acquire") || methodName.equals("release") )
+        if ( methodName == "acquire" || methodName == "release"  )
         {
             bWithRunTimeExcp = sal_False;
         }
@@ -2051,7 +2051,7 @@
                 sal_True);
             paramCount = m_reader.getMethodParameterCount(i);
 
-            if ( methodName.equals("acquire") || methodName.equals("release") )
+            if ( methodName == "acquire" || methodName == "release" )
             {
                 bWithRuntimeException = sal_False;
             }
@@ -2454,7 +2454,7 @@
     CppuOptions * options, rtl::OString const & outPath)
 {
     rtl::OString tmpName(m_typeName);
-    if (tmpName.equals("/")) {
+    if (tmpName == "/") {
         tmpName = "global";
     } else {
         tmpName += "/" + m_typeName.copy(m_typeName.lastIndexOf('/') + 1);
@@ -2937,8 +2937,8 @@
     inc();
     if (isPolymorphic()) {
         out << indent() << "::rtl::OUStringBuffer the_buffer;\n" << indent()
-            << "the_buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM(\""
-            << m_typeName.replace('/', '.') << "<\"));\n";
+            << "the_buffer.append(\""
+            << m_typeName.replace('/', '.') << "<\");\n";
         sal_uInt16 n = m_reader.getReferenceCount();
         for (sal_uInt16 i = 0; i < n; ++i) {
             out << indent()
@@ -3321,7 +3321,7 @@
         dumpType(o, fieldType);
         o << " " << fieldName;
         if (i == 0 && !superType.isEmpty() &&
-            !fieldType.equals("double") && !fieldType.equals("hyper") && !fieldType.equals("unsigned hyper"))
+            !(fieldType == "double") && !(fieldType == "hyper") && !(fieldType == "unsigned hyper"))
         {
             o << " CPPU_GCC3_ALIGN( " << scopedCppName(superType) << " )";
         }
@@ -4289,7 +4289,7 @@
                  CppuOptions* pOptions)
     throw( CannotDumpException )
 {
-    if (typeName.equals("/") || typeName.equals(typeMgr.getBase()) ||
+    if (typeName == "/" || typeName == typeMgr.getBase() ||
         TypeManager::isBaseType(typeName) || generated.contains(typeName))
     {
         return true;
@@ -4425,7 +4425,7 @@
 {
     OString typeName = typeMgr.getTypeName(rTypeKey);
 
-    if (typeName.equals("/") ||typeName.equals(typeMgr.getBase()) ||
+    if (typeName == "/" ||typeName == typeMgr.getBase() ||
         TypeManager::isBaseType(typeName) || generated.contains(typeName))
     {
         return true;
diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx
index e9d1b91..0f115b2 100644
--- a/codemaker/source/javamaker/classfile.cxx
+++ b/codemaker/source/javamaker/classfile.cxx
@@ -475,9 +475,7 @@
     m_superClass = addClassInfo(superClass);
     if (!signature.isEmpty()) {
         ++m_attributesCount;
-        appendU2(
-            m_attributes,
-            addUtf8Info(rtl::OString(RTL_CONSTASCII_STRINGPARAM("Signature"))));
+        appendU2(m_attributes, addUtf8Info("Signature"));
         appendU4(m_attributes, 2);
         appendU2(m_attributes, addUtf8Info(signature));
     }
@@ -582,10 +580,7 @@
         ((constantValueIndex == 0 ? 0 : 1)
          + (signature.isEmpty() ? 0 : 1)));
     if (constantValueIndex != 0) {
-        appendU2(
-            m_fields,
-            addUtf8Info(
-                rtl::OString(RTL_CONSTASCII_STRINGPARAM("ConstantValue"))));
+        appendU2(m_fields, addUtf8Info("ConstantValue"));
         appendU4(m_fields, 2);
         appendU2(m_fields, constantValueIndex);
     }
@@ -624,9 +619,7 @@
         {
             throw CannotDumpException("Code block is too big for Java class file format");
         }
-        appendU2(
-            m_methods,
-            addUtf8Info(rtl::OString(RTL_CONSTASCII_STRINGPARAM("Code"))));
+        appendU2(m_methods, addUtf8Info("Code"));
         appendU4(
             m_methods,
             (2 + 2 + 4 + static_cast< sal_uInt32 >(codeSize) + 2
@@ -640,10 +633,7 @@
         appendU2(m_methods, 0);
     }
     if (!exceptions.empty()) {
-        appendU2(
-            m_methods,
-            addUtf8Info(
-                rtl::OString(RTL_CONSTASCII_STRINGPARAM("Exceptions"))));
+        appendU2(m_methods, addUtf8Info("Exceptions"));
         appendU4(
             m_methods,
             static_cast< sal_uInt32 >(2 + 2 * static_cast< sal_uInt32 >(excs)));
@@ -848,9 +838,7 @@
     std::vector< unsigned char > & stream, rtl::OString const & signature)
 {
     if (!signature.isEmpty()) {
-        appendU2(
-            stream,
-            addUtf8Info(rtl::OString(RTL_CONSTASCII_STRINGPARAM("Signature"))));
+        appendU2(stream, addUtf8Info("Signature"));
         appendU4(stream, 2);
         appendU2(stream, addUtf8Info(signature));
     }
diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx
index af4796d..182eb2d 100644
--- a/codemaker/source/javamaker/javamaker.cxx
+++ b/codemaker/source/javamaker/javamaker.cxx
@@ -179,7 +179,7 @@
                 if (tmpName == "*")
                 {
                     // produce this type and his scope.
-                    if (typeName.equals("*"))
+                    if (typeName == "*")
                     {
                         tmpName = "/";
                     } else
diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx
index b5662bb..108dc6c 100644
--- a/codemaker/source/javamaker/javatype.cxx
+++ b/codemaker/source/javamaker/javatype.cxx
@@ -2474,9 +2474,7 @@
     codemaker::GeneratedTypeSet & generated, JavaOptions * options)
 {
     OSL_ASSERT(options != 0);
-    if (type.equals("/")
-        || type.equals(manager.getBase())
-        || generated.contains(type))
+    if (type == "/" || type == manager.getBase() || generated.contains(type))
     {
         return true;
     }
@@ -2548,9 +2546,7 @@
     ::rtl::OString typeName = manager.getTypeName(rTypeKey);
 
     OSL_ASSERT(options != 0);
-    if (typeName.equals("/")
-        || typeName.equals(manager.getBase())
-        || generated.contains(typeName))
+    if (typeName == "/" || typeName == manager.getBase() || generated.contains(typeName))
     {
         return true;
     }

-- 
To view, visit https://gerrit.libreoffice.org/2605
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ce4fd2cc7c62a18e059e945b42cc01425802aa0
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Marcos Souza <marcos.souza.org at gmail.com>



More information about the LibreOffice mailing list