summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-03 08:39:03 +0200
committerNoel Grandin <noel@peralex.com>2016-05-04 12:39:40 +0200
commit58a32075ca4f457f570af75aef368dd6c389aca7 (patch)
treee437dcbdeb248b4316cb8a9281d1543419853f6d /ucb
parent7d47700972d267fe7c5270c5dadd45a523a2baec (diff)
use Any constructor instead of temporaries
Change-Id: Iffb82a2cee1a28d89eeea2b905aaa14086ee475a
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/core/FileAccess.cxx8
-rw-r--r--ucb/source/ucp/file/filglob.cxx22
-rw-r--r--ucb/source/ucp/file/filrset.cxx8
-rw-r--r--ucb/source/ucp/file/prov.cxx12
-rw-r--r--ucb/source/ucp/file/shell.cxx14
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx14
-rw-r--r--ucb/source/ucp/ftp/ftpintreq.cxx4
-rw-r--r--ucb/source/ucp/ftp/ftpresultsetbase.cxx8
8 files changed, 25 insertions, 65 deletions
diff --git a/ucb/source/core/FileAccess.cxx b/ucb/source/core/FileAccess.cxx
index a330c2f5632a..e88ef9d403ac 100644
--- a/ucb/source/core/FileAccess.cxx
+++ b/ucb/source/core/FileAccess.cxx
@@ -347,9 +347,7 @@ void OFileAccess::setReadOnly( const OUString& FileURL, sal_Bool bReadOnly )
{
INetURLObject aURLObj( FileURL, INetProtocol::File );
ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
- Any aAny;
- aAny <<= bReadOnly;
- aCnt.setPropertyValue("IsReadOnly", aAny );
+ aCnt.setPropertyValue("IsReadOnly", Any(bReadOnly) );
}
void OFileAccess::createFolder( const OUString& NewFolderURL )
@@ -759,9 +757,7 @@ void OFileAccess::setHidden( const OUString& FileURL, sal_Bool bHidden )
{
INetURLObject aURLObj( FileURL, INetProtocol::File );
ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment, comphelper::getProcessComponentContext() );
- Any aAny;
- aAny <<= bHidden;
- aCnt.setPropertyValue("IsHidden", aAny );
+ aCnt.setPropertyValue("IsHidden", Any(bHidden) );
}
}; // namespace end
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index 5b1613d9df5f..7bf7aca1a7d0 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -263,16 +263,13 @@ namespace fileaccess {
{
IllegalArgumentException excep;
excep.ArgumentPosition = 0;
- aAny <<= excep;
- cancelCommandExecution(
- aAny,xEnv);
+ cancelCommandExecution(Any(excep), xEnv);
}
else if( errorCode == TASKHANDLING_UNSUPPORTED_OPEN_MODE )
{
UnsupportedOpenModeException excep;
excep.Mode = sal::static_int_cast< sal_Int16 >(minorCode);
- aAny <<= excep;
- cancelCommandExecution( aAny,xEnv );
+ cancelCommandExecution( Any(excep),xEnv );
}
else if(errorCode == TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND ||
errorCode == TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND ||
@@ -554,8 +551,7 @@ namespace fileaccess {
excep.Classification = InteractionClassification_ERROR;
excep.Context = Reference<XInterface>( xComProc, UNO_QUERY );
excep.Message = "file exists and overwrite forbidden";
- aAny <<= excep;
- cancelCommandExecution( aAny,xEnv );
+ cancelCommandExecution( Any(excep), xEnv );
}
else if( errorCode == TASKHANDLING_INVALID_NAME_MKDIR )
{
@@ -579,8 +575,7 @@ namespace fileaccess {
if(isHandled)
throw excep;
else {
- aAny <<= excep;
- cancelCommandExecution( aAny,xEnv );
+ cancelCommandExecution( Any(excep), xEnv );
}
// ioErrorCode = IOErrorCode_INVALID_CHARACTER;
// cancelCommandExecution(
@@ -600,8 +595,7 @@ namespace fileaccess {
if(isHandled)
throw excep;
else {
- aAny <<= excep;
- cancelCommandExecution( aAny,xEnv );
+ cancelCommandExecution( Any(excep), xEnv );
}
// ioErrorCode = IOErrorCode_ALREADY_EXISTING;
// cancelCommandExecution(
@@ -853,9 +847,8 @@ namespace fileaccess {
excep.Classification = InteractionClassification_ERROR;
excep.Context = Reference<XInterface>( xComProc, UNO_QUERY );
excep.Message = "name clash during copy or move";
- aAny <<= excep;
- cancelCommandExecution(aAny,xEnv);
+ cancelCommandExecution(Any(excep), xEnv);
}
else if( errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_MOVE ||
errorCode == TASKHANDLING_NAMECLASHSUPPORT_FOR_COPY )
@@ -865,8 +858,7 @@ namespace fileaccess {
excep.Context = Reference<XInterface>( xComProc, UNO_QUERY );
excep.Message = "name clash value not supported during copy or move";
- aAny <<= excep;
- cancelCommandExecution(aAny,xEnv);
+ cancelCommandExecution(Any(excep), xEnv);
}
else
{
diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx
index acace4e175c5..cc0414a867b2 100644
--- a/ucb/source/ucp/file/filrset.cxx
+++ b/ucb/source/ucp/file/filrset.cxx
@@ -751,16 +751,12 @@ uno::Any SAL_CALL XResultSet_impl::getPropertyValue(
{
if( PropertyName == "IsRowCountFinal" )
{
- uno::Any aAny;
- aAny <<= m_bRowCountFinal;
- return aAny;
+ return uno::Any(m_bRowCountFinal);
}
else if ( PropertyName == "RowCount" )
{
- uno::Any aAny;
sal_Int32 count = sal::static_int_cast<sal_Int32>(m_aItems.size());
- aAny <<= count;
- return aAny;
+ return uno::Any(count);
}
else
throw beans::UnknownPropertyException( THROW_WHERE );
diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx
index d0181b57239d..313bdcccafc9 100644
--- a/ucb/source/ucp/file/prov.cxx
+++ b/ucb/source/ucp/file/prov.cxx
@@ -456,21 +456,15 @@ FileProvider::getPropertyValue(
initProperties();
if( aPropertyName == "FileSystemNotation" )
{
- Any aAny;
- aAny <<= m_FileSystemNotation;
- return aAny;
+ return Any(m_FileSystemNotation);
}
else if( aPropertyName == "HomeDirectory" )
{
- Any aAny;
- aAny <<= m_HomeDirectory;
- return aAny;
+ return Any(m_HomeDirectory);
}
else if( aPropertyName == "HostName" )
{
- Any aAny;
- aAny <<= m_HostName;
- return aAny;
+ return Any(m_HostName);
}
else
throw UnknownPropertyException( THROW_WHERE );
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index 6dd405ad5d63..8e18a0715842 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -294,13 +294,11 @@ shell::shell( const uno::Reference< uno::XComponentContext >& rxContext,
// ContentType
- uno::Any aAny;
- aAny <<= OUString();
m_aDefaultProperties.insert( MyProperty( false,
ContentType,
-1 ,
cppu::UnoType<OUString>::get(),
- aAny,
+ uno::Any(OUString()),
beans::PropertyState_DEFAULT_VALUE,
beans::PropertyAttribute::MAYBEVOID
| beans::PropertyAttribute::BOUND
@@ -2203,7 +2201,6 @@ void SAL_CALL
shell::commit( const shell::ContentMap::iterator& it,
const osl::FileStatus& aFileStatus )
{
- uno::Any aAny;
shell::PropertySet::iterator it1;
if( it->second.properties == nullptr )
@@ -2219,8 +2216,7 @@ shell::commit( const shell::ContentMap::iterator& it,
{
if( aFileStatus.isValid( osl_FileStatus_Mask_FileName ) )
{
- aAny <<= aFileStatus.getFileName();
- it1->setValue( aAny );
+ it1->setValue( uno::Any(aFileStatus.getFileName()) );
}
}
@@ -2229,8 +2225,7 @@ shell::commit( const shell::ContentMap::iterator& it,
{
if( aFileStatus.isValid( osl_FileStatus_Mask_FileURL ) )
{
- aAny <<= aFileStatus.getFileURL();
- it1->setValue( aAny );
+ it1->setValue( uno::Any(aFileStatus.getFileURL()) );
}
}
@@ -2327,8 +2322,7 @@ shell::commit( const shell::ContentMap::iterator& it,
}
else
{
- bool dummy = false;
- aAny <<= dummy;
+ uno::Any aAny(false);
it1 = properties.find( MyProperty( IsRemote ) );
if( it1 != properties.end() )
it1->setValue( aAny );
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index 3fd5c366893a..42b40b09a56a 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -735,8 +735,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
MissingPropertiesException excep;
excep.Properties.realloc(1);
excep.Properties[0] = "Title";
- Any aAny; aAny <<= excep;
- ucbhelper::cancelCommandExecution(aAny,Env);
+ ucbhelper::cancelCommandExecution(Any(excep), Env);
}
if(m_bInserted &&
@@ -744,8 +743,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
!aInsertCommand.Data.is())
{
MissingInputStreamException excep;
- Any aAny; aAny <<= excep;
- ucbhelper::cancelCommandExecution(aAny,Env);
+ ucbhelper::cancelCommandExecution(Any(excep), Env);
}
bool bReplace(aInsertCommand.ReplaceExisting);
@@ -763,9 +761,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
// Deprecated, not used anymore:
NameClashException excep;
excep.Name = m_aFTPURL.child();
- Any aAny;
- aAny <<= excep;
- ucbhelper::cancelCommandExecution(aAny,Env);
+ ucbhelper::cancelCommandExecution(Any(excep), Env);
} else if(e.code() == FOLDER_MIGHT_EXIST_DURING_INSERT ||
e.code() == FILE_MIGHT_EXIST_DURING_INSERT) {
// Interact
@@ -777,9 +773,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
excep.NameClash = 0; //NameClash::ERROR;
if(!xInt.is()) {
- Any aAny;
- aAny <<= excep;
- ucbhelper::cancelCommandExecution(aAny,Env);
+ ucbhelper::cancelCommandExecution(Any(excep), Env);
}
XInteractionRequestImpl request;
diff --git a/ucb/source/ucp/ftp/ftpintreq.cxx b/ucb/source/ucp/ftp/ftpintreq.cxx
index 35a51c18f2f9..380b7df711b1 100644
--- a/ucb/source/ucp/ftp/ftpintreq.cxx
+++ b/ucb/source/ucp/ftp/ftpintreq.cxx
@@ -70,11 +70,9 @@ XInteractionRequestImpl::XInteractionRequestImpl()
std::vector<uno::Reference<task::XInteractionContinuation>> continuations{
Reference<XInteractionContinuation>(p1),
Reference<XInteractionContinuation>(p2) };
- Any aAny;
UnsupportedNameClashException excep;
excep.NameClash = NameClash::ERROR;
- aAny <<= excep;
- m_xRequest.set(new ::comphelper::OInteractionRequest(aAny, continuations));
+ m_xRequest.set(new ::comphelper::OInteractionRequest(Any(excep), continuations));
}
bool XInteractionRequestImpl::approved() const
diff --git a/ucb/source/ucp/ftp/ftpresultsetbase.cxx b/ucb/source/ucp/ftp/ftpresultsetbase.cxx
index baa69a2c0f8e..2940e6ffe412 100644
--- a/ucb/source/ucp/ftp/ftpresultsetbase.cxx
+++ b/ucb/source/ucp/ftp/ftpresultsetbase.cxx
@@ -529,16 +529,12 @@ uno::Any SAL_CALL ResultSetBase::getPropertyValue(
{
if( PropertyName == "IsRowCountFinal" )
{
- uno::Any aAny;
- aAny <<= m_bRowCountFinal;
- return aAny;
+ return uno::Any(m_bRowCountFinal);
}
else if ( PropertyName == "RowCount" )
{
- uno::Any aAny;
sal_Int32 count = m_aItems.size();
- aAny <<= count;
- return aAny;
+ return uno::Any(count);
}
else
throw beans::UnknownPropertyException();