Kaydet (Commit) fd866ac8 authored tarafından Olivier Hallot's avatar Olivier Hallot Kaydeden (comit) Ivan Timofeev

Fix for fdo43460 Part VI getLength() to isEmpty()

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