[PATCH] Fix for fdo43460 Part VI getLength() to isEmpty()

Olivier Hallot olivier.hallot at alta.org.br
Mon Dec 12 12:19:01 PST 2011


Part VI
Module
codemaker
---
 codemaker/source/codemaker/global.cxx    |    8 ++--
 codemaker/source/codemaker/unotype.cxx   |    2 +-
 codemaker/source/cppumaker/cppumaker.cxx |    2 +-
 codemaker/source/cppumaker/cpputype.cxx  |   46 +++++++++++++++---------------
 codemaker/source/cppumaker/includes.cxx  |    2 +-
 codemaker/source/javamaker/classfile.cxx |    8 ++--
 codemaker/source/javamaker/javamaker.cxx |    2 +-
 7 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx
index 36d06f0..af87ee8 100644
--- a/codemaker/source/codemaker/global.cxx
+++ b/codemaker/source/codemaker/global.cxx
@@ -116,7 +116,7 @@ OString createFileNameFromType( const OString& destination,
         fileNameBuf.append("/", 1);
 
     OString tmpStr(type);
-    if (prefix.getLength() > 0)
+    if (!prefix.isEmpty())
     {
         tmpStr = type.replaceAt(type.lastIndexOf('/')+1, 0, prefix);
     }
@@ -298,7 +298,7 @@ FileStream::FileStream()
 FileStream::FileStream(const OString& name, FileAccessMode mode)
     : m_file(NULL)
 {
-    if ( name.getLength() > 0 )
+    if ( !name.isEmpty() )
     {
         OUString sUrl(convertToFileUrl(name));
 #ifdef SAL_UNX
@@ -338,7 +338,7 @@ void FileStream::createTempFile(const OString& sPath)
     OUString sTmpPath;
     OUString sTmpName;
 
-    if (sPath.getLength() > 0)
+    if (!sPath.isEmpty())
         sTmp = sPath;
 
     sTmpPath = convertToFileUrl(sTmp);
@@ -364,7 +364,7 @@ void FileStream::createTempFile(const OString& sPath)
 
 void FileStream::open(const OString& name, FileAccessMode mode)
 {
-    if ( name.getLength() > 0 )
+    if ( !name.isEmpty() )
     {
         oslFileError ret =  osl_File_E_None;
         if ((ret = osl_openFile(convertToFileUrl(name).pData, &m_file, checkAccessMode(mode))) == osl_File_E_None)
diff --git a/codemaker/source/codemaker/unotype.cxx b/codemaker/source/codemaker/unotype.cxx
index 0432a29..0ae8e43 100644
--- a/codemaker/source/codemaker/unotype.cxx
+++ b/codemaker/source/codemaker/unotype.cxx
@@ -56,7 +56,7 @@ codemaker::UnoType::Sort codemaker::UnoType::getSort(rtl::OString const & type)
 }
 
 bool codemaker::UnoType::isSequenceType(rtl::OString const & type) {
-    return type.getLength() > 0 && type[0] == '[';
+    return !type.isEmpty() && type[0] == '[';
 }
 
 rtl::OString codemaker::UnoType::decompose(
diff --git a/codemaker/source/cppumaker/cppumaker.cxx b/codemaker/source/cppumaker/cppumaker.cxx
index e6cee20..0b9d8c0 100644
--- a/codemaker/source/cppumaker/cppumaker.cxx
+++ b/codemaker/source/cppumaker/cppumaker.cxx
@@ -202,7 +202,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
                     } else
                     {
                         tmpName = typeName.copy(0, typeName.lastIndexOf('.')).replace('.', '/');
-                        if (tmpName.getLength() == 0)
+                        if (tmpName.isEmpty())
                             tmpName = "/";
                         else
                             tmpName.replace('.', '/');
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index f2007e5..3a436ca 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -253,7 +253,7 @@ sal_Bool CppuType::dumpFile(CppuOptions* pOptions,
     }
 
     OString sFileName = createFileNameFromType(sOutPath, sName, sExtension);
-    if (sFileName.getLength() == 0)
+    if (sFileName.isEmpty())
         return sal_False;
 
     sal_Bool bFileExists = fileExists( sFileName );
@@ -539,7 +539,7 @@ void CppuType::dumpNormalGetCppuType(FileStream& o)
             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     }
     sal_Bool bIsBaseException = sal_False;
-    if (superType.getLength() > 0)
+    if (!superType.isEmpty())
     {
         if ( superType.equals("com/sun/star/uno/Exception") )
         {
@@ -599,7 +599,7 @@ void CppuType::dumpNormalGetCppuType(FileStream& o)
 
     o << indent() << "typelib_static_compound_type_init( &the_type, "
       << getTypeClass(m_typeName, sal_True) << ", \"" << m_typeName.replace('/', '.') << "\", ";
-    if ( superType.getLength() > 0 || bIsBaseException )
+    if ( !superType.isEmpty() || bIsBaseException )
     {
         if ( bIsBaseException )
         {
@@ -658,7 +658,7 @@ void CppuType::dumpComprehensiveGetCppuType(FileStream& o)
         superType = rtl::OUStringToOString(
             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     }
-    if (superType.getLength() > 0) {
+    if (!superType.isEmpty()) {
         o << indent()
           << "const ::com::sun::star::uno::Type& rSuperType = ::cppu::UnoType< ";
         dumpType(o, superType, false, false, false, true);
@@ -712,7 +712,7 @@ void CppuType::dumpComprehensiveGetCppuType(FileStream& o)
     o << indent() << "&pTD,\n" << indent() << "(typelib_TypeClass)"
       << getTypeClass() << ", sTypeName.pData,\n";
 
-    if (superType.getLength() > 0) {
+    if (!superType.isEmpty()) {
         o << indent() << "rSuperType.getTypeLibType(),\n";
     } else {
         o << indent() << "0,\n";
@@ -816,7 +816,7 @@ sal_uInt32 CppuType::checkInheritedMemberCount(const typereg::Reader* pReader)
         superType = rtl::OUStringToOString(
             pReader->getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     }
-    if (superType.getLength() > 0)
+    if (!superType.isEmpty())
     {
         typereg::Reader aSuperReader(m_typeMgr.getTypeReader(superType));
         if ( aSuperReader.isValid() )
@@ -856,10 +856,10 @@ sal_uInt32 CppuType::getInheritedMemberCount()
 
 OString CppuType::getTypeClass(const OString& type, sal_Bool bCStyle)
 {
-    OString     typeName = (type.getLength() > 0 ? type : m_typeName);
+    OString     typeName = (!type.isEmpty() ? type : m_typeName);
     RTTypeClass rtTypeClass = RT_TYPE_INVALID;
 
-    if (type.getLength() > 0)
+    if (!type.isEmpty())
     {
         typeName = type;
         rtTypeClass = m_typeMgr.getTypeClass(typeName);
@@ -966,7 +966,7 @@ void CppuType::dumpType(FileStream& o, const OString& type,
         case RT_TYPE_INVALID:
             {
                 OString tmp(translateSimpleUnoType(relType, cppuUnoType));
-                if (tmp.getLength() > 0)
+                if (!tmp.isEmpty())
                 {
                     o << tmp;
                 } else
@@ -2428,9 +2428,9 @@ void StructureType::dumpDeclaration(FileStream& o)
     if (m_reader.getSuperTypeCount() != 0) {
         base = rtl::OUStringToOString(
             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
-        OSL_ASSERT(base.getLength() > 0); //TODO
+        OSL_ASSERT(!base.isEmpty()); //TODO
     }
-    if (base.getLength() > 0) {
+    if (!base.isEmpty()) {
         o << ": public " << scopedCppName(base);
     }
     o << " {\n";
@@ -2480,7 +2480,7 @@ void StructureType::dumpDeclaration(FileStream& o)
             o << " "
                 << rtl::OUStringToOString(
                     m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
-            if (i == 0 && base.getLength() > 0 && type != "double"
+            if (i == 0 && !base.isEmpty() && type != "double"
                 && type != "hyper" && type != "unsigned hyper")
             {
                 OSL_ASSERT(!parameterized);
@@ -2523,7 +2523,7 @@ sal_Bool StructureType::dumpHxxFile(
             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     }
     sal_Bool first = sal_True;
-    if (superType.getLength() > 0)
+    if (!superType.isEmpty())
     {
         o << indent() << ": " << scopedCppName(superType) << "()\n";
         first = sal_False;
@@ -2599,7 +2599,7 @@ sal_Bool StructureType::dumpHxxFile(
 
         inc();
         first = sal_True;
-        if (superType.getLength() > 0)
+        if (!superType.isEmpty())
         {
             o << indent() << ": " << scopedCppName(superType) << "(";
             dumpSuperMember(o, superType, sal_False);
@@ -3001,7 +3001,7 @@ sal_Bool StructureType::dumpSuperMember(FileStream& o, const OString& superType,
 {
     sal_Bool hasMember = sal_False;
 
-    if (superType.getLength() > 0)
+    if (!superType.isEmpty())
     {
         typereg::Reader aSuperReader(m_typeMgr.getTypeReader(superType));
 
@@ -3176,7 +3176,7 @@ void ExceptionType::dumpDeclaration(FileStream& o)
         superType = rtl::OUStringToOString(
             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     }
-    if (superType.getLength() > 0)
+    if (!superType.isEmpty())
                     o << " : public " << scopedCppName(superType);
 
     o << "\n{\npublic:\n";
@@ -3240,7 +3240,7 @@ void ExceptionType::dumpDeclaration(FileStream& o)
         o << indent();
         dumpType(o, fieldType);
         o << " " << fieldName;
-        if (i == 0 && superType.getLength() &&
+        if (i == 0 && !superType.isEmpty() &&
             !fieldType.equals("double") && !fieldType.equals("hyper") && !fieldType.equals("unsigned hyper"))
         {
             o << " CPPU_GCC3_ALIGN( " << scopedCppName(superType) << " )";
@@ -3277,7 +3277,7 @@ sal_Bool ExceptionType::dumpHxxFile(
             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     }
     sal_Bool first = sal_True;
-    if (superType.getLength() > 0)
+    if (!superType.isEmpty())
     {
         o << indent() << ": " << scopedCppName(superType) << "()\n";
         first = sal_False;
@@ -3353,7 +3353,7 @@ sal_Bool ExceptionType::dumpHxxFile(
 
         inc();
         first = sal_True;
-        if (superType.getLength() > 0)
+        if (!superType.isEmpty())
         {
             o << indent() << ": " << scopedCppName(superType) << "(";
             dumpSuperMember(o, superType, sal_False);
@@ -3398,7 +3398,7 @@ sal_Bool ExceptionType::dumpHxxFile(
     o << indent() << m_name << "::" << m_name << "(" << m_name
       << " const & the_other)";
     first = true;
-    if (superType.getLength() > 0) {
+    if (!superType.isEmpty()) {
         o << ": " << scopedCppName(superType) << "(the_other)";
         first = false;
     }
@@ -3417,7 +3417,7 @@ sal_Bool ExceptionType::dumpHxxFile(
     o << indent()
       << ("//TODO: Just like its implicitly-defined counterpart, this function"
           " definition is not exception-safe\n");
-    if (superType.getLength() > 0) {
+    if (!superType.isEmpty()) {
         o << indent() << scopedCppName(superType)
           << "::operator =(the_other);\n";
     }
@@ -3446,7 +3446,7 @@ sal_Bool ExceptionType::dumpSuperMember(FileStream& o, const OString& superType,
 {
     sal_Bool hasMember = sal_False;
 
-    if (superType.getLength() > 0)
+    if (!superType.isEmpty())
     {
         typereg::Reader aSuperReader(m_typeMgr.getTypeReader(superType));
 
@@ -4124,7 +4124,7 @@ void ServiceType::addSpecialDependencies() {
 }
 
 bool ServiceType::isDefaultConstructor(sal_uInt16 ctorIndex) const {
-    return m_reader.getMethodName(ctorIndex).getLength() == 0;
+    return m_reader.getMethodName(ctorIndex).isEmpty();
 }
 
 bool ServiceType::hasRestParameter(sal_uInt16 ctorIndex) const {
diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx
index 71172f5..143826b 100644
--- a/codemaker/source/cppumaker/includes.cxx
+++ b/codemaker/source/cppumaker/includes.cxx
@@ -273,7 +273,7 @@ void Includes::dumpInclude(
 {
     static char const * extension[2] = { "hdl", "hpp" };
     out << "#include \"" << registryType;
-    if (suffix.getLength() > 0) {
+    if (!suffix.isEmpty()) {
         out << "/" << suffix;
     }
     out << "." << extension[hpp] << "\"\n";
diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx
index 4f74781..1a8bf01 100644
--- a/codemaker/source/javamaker/classfile.cxx
+++ b/codemaker/source/javamaker/classfile.cxx
@@ -490,7 +490,7 @@ ClassFile::ClassFile(
 {
     m_thisClass = addClassInfo(thisClass);
     m_superClass = addClassInfo(superClass);
-    if (signature.getLength() != 0) {
+    if (!signature.isEmpty()) {
         ++m_attributesCount;
         appendU2(
             m_attributes,
@@ -603,7 +603,7 @@ void ClassFile::addField(
     appendU2(
         m_fields,
         ((constantValueIndex == 0 ? 0 : 1)
-         + (signature.getLength() == 0 ? 0 : 1)));
+         + (signature.isEmpty() ? 0 : 1)));
     if (constantValueIndex != 0) {
         appendU2(
             m_fields,
@@ -642,7 +642,7 @@ void ClassFile::addMethod(
     appendU2(
         m_methods,
         ((code == 0 ? 0 : 1) + (exceptions.empty() ? 0 : 1)
-         + (signature.getLength() == 0 ? 0 : 1)));
+         + (signature.isEmpty() ? 0 : 1)));
     if (code != 0) {
         std::vector< unsigned char >::size_type codeSize = code->m_code.size();
         std::vector< unsigned char >::size_type exceptionTableSize
@@ -887,7 +887,7 @@ sal_uInt16 ClassFile::addNameAndTypeInfo(
 void ClassFile::appendSignatureAttribute(
     std::vector< unsigned char > & stream, rtl::OString const & signature)
 {
-    if (signature.getLength() != 0) {
+    if (!signature.isEmpty()) {
         appendU2(
             stream,
             addUtf8Info(rtl::OString(RTL_CONSTASCII_STRINGPARAM("Signature"))));
diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx
index eb9cdc9..a0beb85 100644
--- a/codemaker/source/javamaker/javamaker.cxx
+++ b/codemaker/source/javamaker/javamaker.cxx
@@ -194,7 +194,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
                     } else
                     {
                         tmpName = typeName.copy(0, typeName.lastIndexOf('.')).replace('.', '/');
-                        if (tmpName.getLength() == 0)
+                        if (tmpName.isEmpty())
                             tmpName = "/";
                         else
                             tmpName.replace('.', '/');
-- 
1.7.5.4


--------------000304070007030903060908--


More information about the LibreOffice mailing list