summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-03-06 15:29:08 +0200
committerNoel Grandin <noel@peralex.com>2014-03-18 08:32:26 +0200
commit86a32589e90ee983159fb5b2c6a594428ab7d422 (patch)
tree6de946fe2b9b25614f0d197af95e9d3aadcd1bd9 /package
parentbb17844099ba98a77c8e5d7a25c0c416a4b0641e (diff)
Find places where OUString and OString are passed by value.
It's not very efficient, because we generally end up copying it twice - once into the parameter and again into the destination OUString. So I create a clang plugin that finds such places and generates a warning so that we can convert them to pass-by-reference. Change-Id: I5341a6ea9e3190f4b4c05c42c85595e3dcd83361
Diffstat (limited to 'package')
-rw-r--r--package/inc/ZipFile.hxx2
-rw-r--r--package/source/xstor/xstorage.cxx10
-rw-r--r--package/source/xstor/xstorage.hxx10
-rw-r--r--package/source/zipapi/ZipFile.cxx2
4 files changed, 12 insertions, 12 deletions
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index c3dd7a1a2c46..be3c32cd6bdc 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -87,7 +87,7 @@ protected:
const ::rtl::Reference < EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bDecrypt,
- OUString aMediaType = OUString() );
+ const OUString& aMediaType = OUString() );
sal_Bool hasValidPassword ( ZipEntry & rEntry, const rtl::Reference < EncryptionData > &rData );
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 1c00a5d68dc8..c3a621279cc6 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -776,7 +776,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes
void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement,
uno::Reference< embed::XStorage > xDest,
- OUString aName,
+ const OUString& aName,
sal_Bool bDirect )
{
SAL_WARN_IF( !xDest.is(), "package.xstor", "No destination storage!" );
@@ -1384,7 +1384,7 @@ SotElement_Impl* OStorage_Impl::FindElement( const OUString& rName )
return NULL;
}
-SotElement_Impl* OStorage_Impl::InsertStream( OUString aName, sal_Bool bEncr )
+SotElement_Impl* OStorage_Impl::InsertStream( const OUString& aName, sal_Bool bEncr )
{
SAL_WARN_IF( !m_xPackage.is(), "package.xstor", "Not possible to refer to package as to factory!" );
if ( !m_xPackage.is() )
@@ -1418,7 +1418,7 @@ SotElement_Impl* OStorage_Impl::InsertStream( OUString aName, sal_Bool bEncr )
return pNewElement;
}
-SotElement_Impl* OStorage_Impl::InsertRawStream( OUString aName, const uno::Reference< io::XInputStream >& xInStream )
+SotElement_Impl* OStorage_Impl::InsertRawStream( const OUString& aName, const uno::Reference< io::XInputStream >& xInStream )
{
// insert of raw stream means insert and commit
SAL_WARN_IF( !m_xPackage.is(), "package.xstor", "Not possible to refer to package as to factory!" );
@@ -1486,7 +1486,7 @@ OStorage_Impl* OStorage_Impl::CreateNewStorageImpl( sal_Int32 nStorageMode )
return pResult;
}
-SotElement_Impl* OStorage_Impl::InsertStorage( OUString aName, sal_Int32 nStorageMode )
+SotElement_Impl* OStorage_Impl::InsertStorage( const OUString& aName, sal_Int32 nStorageMode )
{
SotElement_Impl* pNewElement = InsertElement( aName, sal_True );
@@ -1497,7 +1497,7 @@ SotElement_Impl* OStorage_Impl::InsertStorage( OUString aName, sal_Int32 nStorag
return pNewElement;
}
-SotElement_Impl* OStorage_Impl::InsertElement( OUString aName, sal_Bool bIsStorage )
+SotElement_Impl* OStorage_Impl::InsertElement( const OUString& aName, sal_Bool bIsStorage )
{
OSL_ENSURE( FindElement( aName ) == NULL, "Should not try to insert existing element" );
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index 53883be585ee..3e968e29c3d6 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -232,19 +232,19 @@ struct OStorage_Impl
sal_Bool bDirect );
void CopyStorageElement( SotElement_Impl* pElement,
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > xDest,
- OUString aName,
+ const OUString& aName,
sal_Bool bDirect );
void SetModified( sal_Bool bModified );
SotElement_Impl* FindElement( const OUString& rName );
- SotElement_Impl* InsertStream( OUString aName, sal_Bool bEncr );
- SotElement_Impl* InsertRawStream( OUString aName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream );
+ SotElement_Impl* InsertStream( const OUString& aName, sal_Bool bEncr );
+ SotElement_Impl* InsertRawStream( const OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream );
OStorage_Impl* CreateNewStorageImpl( sal_Int32 nStorageMode );
- SotElement_Impl* InsertStorage( OUString aName, sal_Int32 nStorageMode );
- SotElement_Impl* InsertElement( OUString aName, sal_Bool bIsStorage );
+ SotElement_Impl* InsertStorage( const OUString& aName, sal_Int32 nStorageMode );
+ SotElement_Impl* InsertElement( const OUString& aName, sal_Bool bIsStorage );
void OpenSubStorage( SotElement_Impl* pElement, sal_Int32 nStorageMode );
void OpenSubStream( SotElement_Impl* pElement );
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 76ff293aa926..72551857dbdf 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -518,7 +518,7 @@ uno::Reference< XInputStream > ZipFile::createUnbufferedStream(
const ::rtl::Reference< EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bIsEncrypted,
- OUString aMediaType )
+ const OUString& aMediaType )
{
::osl::MutexGuard aGuard( m_aMutex );