loplugin:oncevar: empty strings: basic

Change-Id: I4edf130e526c4004aa8913e6aafdcd1e2f4ac1ef
This commit is contained in:
Stephan Bergmann 2017-07-13 11:47:27 +02:00
parent ad4e4c7834
commit 85d71244eb
7 changed files with 13 additions and 26 deletions

View File

@ -849,8 +849,7 @@ void SbClassData::clear()
SbClassFactory::SbClassFactory() SbClassFactory::SbClassFactory()
{ {
OUString aDummyName; xClassModules = new SbxObject( OUString() );
xClassModules = new SbxObject( aDummyName );
} }
SbClassFactory::~SbClassFactory() SbClassFactory::~SbClassFactory()

View File

@ -619,8 +619,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
aClassAny <<= xClass; aClassAny <<= xClass;
// instantiate SbUnoObject // instantiate SbUnoObject
OUString aName; SbUnoObject* pSbUnoObject = new SbUnoObject( OUString(), aClassAny );
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aClassAny );
SbxObjectRef xWrapper = static_cast<SbxObject*>(pSbUnoObject); SbxObjectRef xWrapper = static_cast<SbxObject*>(pSbUnoObject);
// If the object is invalid deliver null // If the object is invalid deliver null
@ -707,8 +706,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
} }
} }
// instantiate a SbUnoObject // instantiate a SbUnoObject
OUString aName; SbUnoObject* pSbUnoObject = new SbUnoObject( OUString(), aValue );
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue );
//If this is called externally e.g. from the scripting //If this is called externally e.g. from the scripting
//framework then there is no 'active' runtime the default property will not be set up //framework then there is no 'active' runtime the default property will not be set up
//only a vba object will have XDefaultProp set anyway so... this //only a vba object will have XDefaultProp set anyway so... this

View File

@ -606,8 +606,7 @@ SbiExprNode* SbiExpression::Unary()
pParser->Next(); pParser->Next();
SbiExprNode* pObjNode = Operand( true/*bUsedForTypeOf*/ ); SbiExprNode* pObjNode = Operand( true/*bUsedForTypeOf*/ );
pParser->TestToken( IS ); pParser->TestToken( IS );
OUString aDummy; SbiSymDef* pTypeDef = new SbiSymDef( OUString() );
SbiSymDef* pTypeDef = new SbiSymDef( aDummy );
pParser->TypeDecl( *pTypeDef, true ); pParser->TypeDecl( *pTypeDef, true );
pNd = new SbiExprNode( pObjNode, pTypeDef->GetTypeId() ); pNd = new SbiExprNode( pObjNode, pTypeDef->GetTypeId() );
break; break;
@ -615,8 +614,7 @@ SbiExprNode* SbiExpression::Unary()
case NEW: case NEW:
{ {
pParser->Next(); pParser->Next();
OUString aStr; SbiSymDef* pTypeDef = new SbiSymDef( OUString() );
SbiSymDef* pTypeDef = new SbiSymDef( aStr );
pParser->TypeDecl( *pTypeDef, true ); pParser->TypeDecl( *pTypeDef, true );
pNd = new SbiExprNode( pTypeDef->GetTypeId() ); pNd = new SbiExprNode( pTypeDef->GetTypeId() );
break; break;

View File

@ -590,8 +590,7 @@ void SbiParser::Set()
if( eTok == NEW ) if( eTok == NEW )
{ {
Next(); Next();
OUString aStr; SbiSymDef* pTypeDef = new SbiSymDef( OUString() );
SbiSymDef* pTypeDef = new SbiSymDef( aStr );
TypeDecl( *pTypeDef, true ); TypeDecl( *pTypeDef, true );
aLvalue.Gen(); aLvalue.Gen();

View File

@ -3828,8 +3828,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
aAny <<= xRet; aAny <<= xRet;
// #67173 don't specify a name so that the real class name is entered // #67173 don't specify a name so that the real class name is entered
OUString aName; SbxObjectRef xWrapper = static_cast<SbxObject*>(new SbUnoObject( OUString(), aAny ));
SbxObjectRef xWrapper = static_cast<SbxObject*>(new SbUnoObject( aName, aAny ));
pElem->PutObject( xWrapper.get() ); pElem->PutObject( xWrapper.get() );
} }
else else

View File

@ -921,8 +921,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
// Link is already initialised in createLibraryLink() // Link is already initialised in createLibraryLink()
if( !pImplLib->mbInitialised && (!bStorage || xLibraryStor.is()) ) if( !pImplLib->mbInitialised && (!bStorage || xLibraryStor.is()) )
{ {
OUString aIndexFileName; bool bLoaded = implLoadLibraryIndexFile( pImplLib, rLib, xLibraryStor, OUString() );
bool bLoaded = implLoadLibraryIndexFile( pImplLib, rLib, xLibraryStor, aIndexFileName );
SAL_WARN_IF( SAL_WARN_IF(
bLoaded && aLibName != rLib.aName, "basic", bLoaded && aLibName != rLib.aName, "basic",
("Different library names in library container and" ("Different library names in library container and"
@ -1370,10 +1369,9 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
const OUString& aName, const OUString& aName,
const uno::Reference< embed::XStorage >& xStorage ) const uno::Reference< embed::XStorage >& xStorage )
{ {
OUString aDummyLocation;
Reference< XSimpleFileAccess3 > xDummySFA; Reference< XSimpleFileAccess3 > xDummySFA;
Reference< XInteractionHandler > xDummyHandler; Reference< XInteractionHandler > xDummyHandler;
implStoreLibrary( pLib, aName, xStorage, aDummyLocation, xDummySFA, xDummyHandler ); implStoreLibrary( pLib, aName, xStorage, OUString(), xDummySFA, xDummyHandler );
} }
// New variant for library export // New variant for library export
@ -1524,9 +1522,8 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
const ::xmlscript::LibDescriptor& rLib, const ::xmlscript::LibDescriptor& rLib,
const uno::Reference< embed::XStorage >& xStorage ) const uno::Reference< embed::XStorage >& xStorage )
{ {
OUString aDummyLocation;
Reference< XSimpleFileAccess3 > xDummySFA; Reference< XSimpleFileAccess3 > xDummySFA;
implStoreLibraryIndexFile( pLib, rLib, xStorage, aDummyLocation, xDummySFA ); implStoreLibraryIndexFile( pLib, rLib, xStorage, OUString(), xDummySFA );
} }
// New variant for library export // New variant for library export
@ -2199,10 +2196,9 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL; pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL;
pNewLib->maOriginalStorageURL = StorageURL; pNewLib->maOriginalStorageURL = StorageURL;
OUString aInitFileName;
uno::Reference< embed::XStorage > xDummyStor; uno::Reference< embed::XStorage > xDummyStor;
::xmlscript::LibDescriptor aLibDesc; ::xmlscript::LibDescriptor aLibDesc;
implLoadLibraryIndexFile( pNewLib, aLibDesc, xDummyStor, aInitFileName ); implLoadLibraryIndexFile( pNewLib, aLibDesc, xDummyStor, OUString() );
implImportLibDescriptor( pNewLib, aLibDesc ); implImportLibDescriptor( pNewLib, aLibDesc );
Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib ); Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib );

View File

@ -135,9 +135,8 @@ SfxLibrary* SfxScriptLibraryContainer::implCreateLibraryLink( const OUString&,
Any SAL_CALL SfxScriptLibraryContainer::createEmptyLibraryElement() Any SAL_CALL SfxScriptLibraryContainer::createEmptyLibraryElement()
{ {
OUString aMod;
Any aRetAny; Any aRetAny;
aRetAny <<= aMod; aRetAny <<= OUString();
return aRetAny; return aRetAny;
} }
@ -553,9 +552,8 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
const uno::Reference< embed::XStorage >& xStorage, const uno::Reference< embed::XStorage >& xStorage,
const css::uno::Reference< css::task::XInteractionHandler >& xHandler ) const css::uno::Reference< css::task::XInteractionHandler >& xHandler )
{ {
OUString aDummyLocation;
Reference< XSimpleFileAccess3 > xDummySFA; Reference< XSimpleFileAccess3 > xDummySFA;
return implStorePasswordLibrary( pLib, aName, xStorage, aDummyLocation, xDummySFA, xHandler ); return implStorePasswordLibrary( pLib, aName, xStorage, OUString(), xDummySFA, xHandler );
} }
bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, const OUString& aName, bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, const OUString& aName,