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

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

Part X
Module
cppu
cppuhelper
cpputools
üst f26635c3
......@@ -203,7 +203,7 @@ static int s_getNextEnv(uno_Environment ** ppEnv, uno_Environment * pCurrEnv, un
res = 1;
}
if (nextPurpose.getLength())
if (!nextPurpose.isEmpty())
{
rtl::OUString next_envDcp(s_uno_envDcp);
next_envDcp += nextPurpose;
......
......@@ -1031,7 +1031,7 @@ inline void EnvironmentsData::getRegisteredEnvironments(
iPos != aName2EnvMap.end(); ++iPos )
{
uno_Environment * pWeak = iPos->second;
if (!rEnvDcp.getLength() ||
if (rEnvDcp.isEmpty() ||
rEnvDcp.equals( pWeak->pTypeName ))
{
ppFound[nSize] = 0;
......@@ -1116,7 +1116,7 @@ static uno_Environment * initDefaultEnvironment(
that->releaseInterface = unoenv_releaseInterface;
OUString envPurpose = cppu::EnvDcp::getPurpose(rEnvDcp);
if (envPurpose.getLength())
if (!envPurpose.isEmpty())
{
rtl::OUString libStem = envPurpose.copy(envPurpose.lastIndexOf(':') + 1);
libStem += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_uno_uno") );
......
......@@ -312,7 +312,7 @@ static inline OUString getBridgeName(
SAL_THROW( () )
{
OUStringBuffer aBridgeName( 16 );
if (rAddPurpose.getLength())
if (!rAddPurpose.isEmpty())
{
aBridgeName.append( rAddPurpose );
aBridgeName.append( (sal_Unicode)'_' );
......@@ -469,7 +469,7 @@ static Mapping getMediateMapping(
}
// connect to uno
if (rAddPurpose.getLength()) // insert purpose mapping between new ano_uno <-> uno
if (!rAddPurpose.isEmpty()) // insert purpose mapping between new ano_uno <-> uno
{
// create anonymous uno env
Environment aAnUno;
......@@ -540,7 +540,7 @@ void SAL_CALL uno_getMapping(
}
// See if an identity mapping does fit.
if (!aRet.is() && pFrom == pTo && !aAddPurpose.getLength())
if (!aRet.is() && pFrom == pTo && aAddPurpose.isEmpty())
aRet = createIdentityMapping(pFrom);
if (!aRet.is())
......
......@@ -81,13 +81,13 @@ namespace cppu
OUString const & get_this_libpath()
{
static OUString s_path;
if (0 == s_path.getLength())
if (s_path.isEmpty())
{
OUString path;
Module::getUrlFromAddress( reinterpret_cast<oslGenericFunction>(get_this_libpath), path );
path = path.copy( 0, path.lastIndexOf( '/' ) );
MutexGuard guard( Mutex::getGlobalMutex() );
if (0 == s_path.getLength())
if (s_path.isEmpty())
s_path = path;
}
return s_path;
......@@ -317,7 +317,7 @@ Reference< registry::XSimpleRegistry > nestRegistries(
sal_Int32 index;
Reference< registry::XSimpleRegistry > lastRegistry;
if(write_rdb.getLength()) // is there a write registry given?
if(!write_rdb.isEmpty()) // is there a write registry given?
{
lastRegistry.set(xSimRegFac->createInstance(), UNO_QUERY);
......@@ -533,7 +533,7 @@ Reference< XComponentContext > SAL_CALL bootstrap()
throw BootstrapException(
OUSTR("cannot convert soffice installation path to URL!"));
}
if (path.getLength() > 0 && path[path.getLength() - 1] != '/') {
if (!path.isEmpty() && path[path.getLength() - 1] != '/') {
path += OUSTR("/");
}
......
......@@ -593,7 +593,7 @@ Any ComponentContext::lookupMap( OUString const & rName )
{
OUString serviceName;
if ((usesService >>= serviceName) &&
serviceName.getLength())
!serviceName.isEmpty())
{
xInstance = args.getLength()
? m_xSMgr->createInstanceWithArgumentsAndContext(
......
......@@ -876,7 +876,7 @@ Reference< XInterface > ORegistryFactoryHelper::createModuleFactory()
}
Reference< XInterface > xFactory;
if( aActivatorName.getLength() != 0 )
if( !aActivatorName.isEmpty() )
{
Reference<XInterface > x = xSMgr->createInstance( aActivatorName );
Reference<XImplementationLoader > xLoader( x, UNO_QUERY );
......
......@@ -1022,7 +1022,7 @@ PropertySetMixinImpl::~PropertySetMixinImpl() {
}
void PropertySetMixinImpl::checkUnknown(rtl::OUString const & propertyName) {
if (propertyName.getLength() != 0) {
if (!propertyName.isEmpty()) {
m_impl->get(
static_cast< css::beans::XPropertySet * >(this), propertyName);
}
......
......@@ -311,7 +311,7 @@ void OPropertySetHelper::addPropertyChangeListener(
{
// only add listeners if you are not disposed
// a listener with no name means all properties
if( rPropertyName.getLength() )
if( !rPropertyName.isEmpty() )
{
// get the map table
IPropertyArrayHelper & rPH = getInfoHelper();
......@@ -357,7 +357,7 @@ void OPropertySetHelper::removePropertyChangeListener(
// all listeners are automaticly released in a dispose call
if( !rBHelper.bInDispose && !rBHelper.bDisposed )
{
if( rPropertyName.getLength() )
if( !rPropertyName.isEmpty() )
{
// get the map table
IPropertyArrayHelper & rPH = getInfoHelper();
......@@ -393,7 +393,7 @@ void OPropertySetHelper::addVetoableChangeListener(
{
// only add listeners if you are not disposed
// a listener with no name means all properties
if( rPropertyName.getLength() )
if( !rPropertyName.isEmpty() )
{
// get the map table
IPropertyArrayHelper & rPH = getInfoHelper();
......@@ -437,7 +437,7 @@ void OPropertySetHelper::removeVetoableChangeListener(
// all listeners are automaticly released in a dispose call
if( !rBHelper.bInDispose && !rBHelper.bDisposed )
{
if( rPropertyName.getLength() )
if( !rPropertyName.isEmpty() )
{
// get the map table
IPropertyArrayHelper & rPH = getInfoHelper();
......
......@@ -113,7 +113,7 @@ Reference< registry::XSimpleRegistry > SAL_CALL createSimpleRegistry(
createInstance(
loadSharedLibComponentFactory(
OUSTR("bootstrap.uno" SAL_DLLEXTENSION),
0 == rBootstrapPath.getLength()
rBootstrapPath.isEmpty()
? get_this_libpath() : rBootstrapPath,
OUSTR("com.sun.star.comp.stoc.SimpleRegistry"),
Reference< lang::XMultiServiceFactory >(),
......@@ -144,7 +144,7 @@ Reference< registry::XSimpleRegistry > SAL_CALL createNestedRegistry(
createInstance(
loadSharedLibComponentFactory(
OUSTR("bootstrap.uno" SAL_DLLEXTENSION),
0 == rBootstrapPath.getLength()
rBootstrapPath.isEmpty()
? get_this_libpath() : rBootstrapPath,
OUSTR("com.sun.star.comp.stoc.NestedRegistry"),
Reference< lang::XMultiServiceFactory >(),
......@@ -247,7 +247,7 @@ static void add_access_control_entries(
if (bootstrap.getFrom( OUSTR("UNO_AC_SINGLEUSER"), ac_user ))
{
// ac in single-user mode
if (ac_user.getLength())
if (!ac_user.isEmpty())
{
// - ac prop: single-user-id
entry.bLateInitService = false;
......@@ -383,7 +383,7 @@ Reference< lang::XMultiComponentFactory > bootstrapInitialSF(
SAL_THROW( (Exception) )
{
OUString const & bootstrap_path =
0 == rBootstrapPath.getLength() ? get_this_libpath() : rBootstrapPath;
rBootstrapPath.isEmpty() ? get_this_libpath() : rBootstrapPath;
Reference< lang::XMultiComponentFactory > xMgr(
createInstance(
......@@ -542,7 +542,7 @@ Reference< XComponentContext > bootstrapInitialContext(
Reference< lang::XSingleComponentFactory > xFac(
loadSharedLibComponentFactory(
OUSTR("bootstrap.uno" SAL_DLLEXTENSION),
0 == rBootstrapPath.getLength()
rBootstrapPath.isEmpty()
? get_this_libpath() : rBootstrapPath,
OUSTR("com.sun.star.comp.stoc.RegistryTypeDescriptionProvider"),
Reference< lang::XMultiServiceFactory >( xSF, UNO_QUERY ),
......@@ -587,7 +587,7 @@ static Reference< lang::XMultiComponentFactory > createImplServiceFactory(
// open a registry
sal_Bool bRegistryShouldBeValid = sal_False;
if (rWriteRegistry.getLength() && !rReadRegistry.getLength())
if (!rWriteRegistry.isEmpty() && rReadRegistry.isEmpty())
{
bRegistryShouldBeValid = sal_True;
xRegistry.set( createSimpleRegistry( rBootstrapPath ) );
......@@ -603,7 +603,7 @@ static Reference< lang::XMultiComponentFactory > createImplServiceFactory(
}
}
}
else if (rWriteRegistry.getLength() && rReadRegistry.getLength())
else if (!rWriteRegistry.isEmpty() && !rReadRegistry.isEmpty())
{
// default registry
bRegistryShouldBeValid = sal_True;
......
......@@ -228,7 +228,7 @@ static OUString makeComponentPath(
OSL_ASSERT( FileBase::E_None ==
FileBase::getSystemPathFromFileURL( rLibName, aComp ) );
OSL_ASSERT(
! rPath.getLength() ||
rPath.isEmpty() ||
FileBase::E_None ==
FileBase::getSystemPathFromFileURL( rPath, aComp ) );
}
......@@ -236,7 +236,7 @@ static OUString makeComponentPath(
OUStringBuffer buf( rPath.getLength() + rLibName.getLength() + 12 );
if (0 != rPath.getLength())
if (!rPath.isEmpty())
{
buf.append( rPath );
if (rPath[ rPath.getLength() -1 ] != '/')
......
......@@ -264,7 +264,7 @@ sal_Bool parseOptions(int ac, char* av[], Options& rOptions, sal_Bool bCmdFile)
{
i++;
OUString regName = OStringToOUString(av[i], osl_getThreadTextEncoding());
if( ! rOptions.sBootRegName.getLength() )
if( rOptions.sBootRegName.isEmpty() )
{
rOptions.sBootRegName = regName;
}
......@@ -321,7 +321,7 @@ sal_Bool parseOptions(int ac, char* av[], Options& rOptions, sal_Bool bCmdFile)
sUrls = OStringToOUString(av[i]+2, osl_getThreadTextEncoding());
}
if (rOptions.sComponentUrls.getLength())
if (!rOptions.sComponentUrls.isEmpty())
{
OUString tmp(rOptions.sComponentUrls + OUString(";", 1, osl_getThreadTextEncoding()) + sUrls);
rOptions.sComponentUrls = tmp;
......@@ -660,7 +660,7 @@ static void bootstrap(
if ( opt.sRegName.equals(opt.sBootRegName) )
{
if( opt.sBootRegName2.getLength() )
if( !opt.sBootRegName2.isEmpty() )
{
xSMgr = createRegistryServiceFactory(
convertToFileUrl(opt.sRegName),
......@@ -675,14 +675,14 @@ static void bootstrap(
}
else
{
if( opt.sBootRegName2.getLength() )
if( !opt.sBootRegName2.isEmpty() )
{
xSMgr = createRegistryServiceFactory(
convertToFileUrl( opt.sBootRegName2 ),
convertToFileUrl( opt.sBootRegName ),
sal_True );
}
else if ( opt.sBootRegName.getLength() )
else if ( !opt.sBootRegName.isEmpty() )
{
xSMgr = createRegistryServiceFactory(
convertToFileUrl( opt.sBootRegName ),
......@@ -766,12 +766,12 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
exit(1);
}
if( ! aOptions.sRegName.getLength() )
if( aOptions.sRegName.isEmpty() )
{
fprintf( stderr, "ERROR: target registry missing (-r option)\n" );
exit( 1 );
}
if ( aOptions.sComponentUrls.getLength() == 0 )
if ( aOptions.sComponentUrls.isEmpty() )
{
fprintf(stderr, "ERROR: no component url is specified!\n");
exit(1);
......@@ -786,7 +786,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
catch( Exception& e )
{
fprintf(stderr, "ERROR: create ServiceManager failed!\n");
if ( e.Message.getLength() )
if ( !e.Message.isEmpty() )
{
fprintf(stderr, "ERROR description: %s\n",
OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr());
......
......@@ -128,7 +128,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
if (insert_entry)
{
if (service.getLength())
if (!service.isEmpty())
{
Reference< registry::XRegistryKey > xEntry( xKey->openKey( singleton ) );
if (! xEntry.is())
......
......@@ -510,7 +510,7 @@ inline Reference< XInterface > OInstanceProvider::createInstance()
throw (Exception)
{
Reference< XInterface > xRet;
if (_aImplName.getLength()) // manually via loader
if (!_aImplName.isEmpty()) // manually via loader
xRet = loadComponent( _xContext, _aImplName, _aLocation );
else // via service manager
unoexe::createInstance( xRet, _xContext, _aServiceName );
......@@ -532,7 +532,7 @@ Reference< XInterface > OInstanceProvider::getInstance( const OUString & rName )
{
Reference< XInterface > xRet;
if (_aImplName.getLength() == 0 && _aServiceName.getLength() == 0)
if (_aImplName.isEmpty() && _aServiceName.isEmpty())
{
OSL_ASSERT(
rName.equalsAsciiL(
......@@ -702,9 +702,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc,)
}
}
if ((aImplName.getLength() != 0) && (aServiceName.getLength() != 0))
if (!(aImplName.isEmpty() || aServiceName.isEmpty()))
throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM("give component exOR service name!" ) ), Reference< XInterface >() );
if (aImplName.getLength() == 0 && aServiceName.getLength() == 0)
if (aImplName.isEmpty() && aServiceName.isEmpty())
{
if (! aUnoUrl.endsWithIgnoreAsciiCaseAsciiL(
RTL_CONSTASCII_STRINGPARAM(";uno.ComponentContext") ))
......@@ -719,9 +719,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc,)
"unexpected option --singleinstance!") ),
Reference<XInterface>() );
}
if (aImplName.getLength() && !aLocation.getLength())
if (!aImplName.isEmpty() && aLocation.isEmpty())
throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM("give component location!" ) ), Reference< XInterface >() );
if (aServiceName.getLength() && aLocation.getLength())
if (!aServiceName.isEmpty() && !aLocation.isEmpty())
out( "\n> warning: service name given, will ignore location!" );
// read component params
......@@ -761,7 +761,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc,)
xRegistry = (xRegistry.is() ? nestRegistries(
xNewReg, xRegistry ) : xNewReg);
}
if (aReadWriteRegistry.getLength())
if (!aReadWriteRegistry.isEmpty())
{
#if OSL_DEBUG_LEVEL > 1
out( "\n> trying to open rw registry: " );
......@@ -788,7 +788,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc,)
//#### accept, instanciate, etc. ###########################################################
if (aUnoUrl.getLength()) // accepting connections
if (!aUnoUrl.isEmpty()) // accepting connections
{
sal_Int32 nIndex = 0, nTokens = 0;
do { aUnoUrl.getToken( 0, ';', nIndex ); nTokens++; } while( nIndex != -1 );
......@@ -854,7 +854,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc,)
else // no uno url
{
Reference< XInterface > xInstance;
if (aImplName.getLength()) // manually via loader
if (!aImplName.isEmpty()) // manually via loader
xInstance = loadComponent( xContext, aImplName, aLocation );
else // via service manager
createInstance( xInstance, xContext, aServiceName );
......
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