summaryrefslogtreecommitdiff
path: root/basic/source/uno
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-19 16:02:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-20 07:50:06 +0200
commit6ee9f2c188290ba8a8bc6d435f645b31a05783ea (patch)
tree60a58e7c8995d64f3b22cf228480284172b6a17c /basic/source/uno
parent9c2b43e86fbb7612a58f6e55bc429f674977d6dd (diff)
loplugin:oncevar accessibility..basic
Change-Id: I8fb41b658ef0f6ad1774ea897eace3dc9bb12de6 Reviewed-on: https://gerrit.libreoffice.org/38969 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic/source/uno')
-rw-r--r--basic/source/uno/namecont.cxx19
-rw-r--r--basic/source/uno/scriptcont.cxx13
2 files changed, 11 insertions, 21 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 0d5a4c1b0e22..a76d47a23723 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1036,11 +1036,10 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
aCheckFileName, aXlbExtension, mxSFI );
// Check if module1.xba exists
- OUString aXbaExtension("xba");
aCheckFileName = "Module1";
checkAndCopyFileImpl( aUserBasicStandardInetObj,
aPrevUserBasicStandardInetObj,
- aCheckFileName, aXbaExtension, mxSFI );
+ aCheckFileName, "xba", mxSFI );
}
else
{
@@ -1102,8 +1101,8 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
OUString aSharedSearchStr("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE");
- OUString aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
- OUString aInstSearchStr("$(INST)");
+ OUString const aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
+ OUString const aInstSearchStr("$(INST)");
Sequence< OUString > aNames = pPrevCont->getElementNames();
const OUString* pNames = aNames.getConstArray();
@@ -1413,8 +1412,6 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
embed::ElementModes::READWRITE );
// throw uno::RuntimeException(); // TODO: method must either return the stream or throw an exception
- OUString aMime( "text/xml" );
-
uno::Reference< beans::XPropertySet > xProps( xElementStream, uno::UNO_QUERY );
SAL_WARN_IF(
!xProps.is(), "basic",
@@ -1423,7 +1420,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
if ( xProps.is() )
{
- xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+ xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) );
// #87671 Allow encryption
xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) );
@@ -1561,8 +1558,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
if ( xProps.is() )
{
- OUString aMime("text/xml");
- xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+ xProps->setPropertyValue("MediaType", uno::Any( OUString("text/xml") ) );
// #87671 Allow encryption
xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) );
@@ -2076,8 +2072,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
{
xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE );
uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY_THROW );
- OUString aMime( "text/xml" );
- xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+ xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) );
// #87671 Allow encryption
xProps->setPropertyValue("UseCommonStoragePasswordEncryption", uno::Any( true ) );
@@ -2224,7 +2219,7 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
OUString aSharedSearchStr("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE");
- OUString aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
+ OUString const aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
if( StorageURL.indexOf( aUserSearchStr ) != -1 )
{
pNewLib->mbExtension = true;
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index b93217485929..327e9d33fd01 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -662,8 +662,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
aSourceStreamName,
embed::ElementModes::READWRITE );
uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY_THROW );
- OUString aMime( "text/xml" );
- xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+ xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) );
// Set encryption key
setStreamKey( xSourceStream, pLib->maPassword );
@@ -746,10 +745,8 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
SbModule* pMod = pBasicLib->FindModule( aElementName );
if( pMod )
{
- OUString aCodeStreamName( "code.bin" );
-
uno::Reference< io::XStream > xCodeStream = xElementRootStorage->openStreamElement(
- aCodeStreamName,
+ "code.bin",
embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE );
SvMemoryStream aMemStream;
@@ -792,8 +789,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
}
uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY_THROW );
- OUString aMime( "text/xml" );
- xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
+ xProps->setPropertyValue("MediaType", uno::Any( OUString( "text/xml" ) ) );
Reference< XOutputStream > xOut = xSourceStream->getOutputStream();
Reference< XNameContainer > xLib( pLib );
@@ -1023,9 +1019,8 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary
try
{
- OUString aCodeStreamName( "code.bin" );
uno::Reference< io::XStream > xCodeStream = xElementRootStorage->openStreamElement(
- aCodeStreamName,
+ "code.bin",
embed::ElementModes::READ );
std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( xCodeStream ));