summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-03 08:39:03 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-07-20 01:26:04 -0400
commita0e8e05008e143ee5e3bbc281d1c253c7e5ed136 (patch)
treeeaf5f70a067fd48704addd9f2b582624a2fb44ae /ucb
parent9c7cae1561cfe16226b1f16dce59f08a38da3ce0 (diff)
use Any constructor instead of temporaries
(cherry picked from commit 58a32075ca4f457f570af75aef368dd6c389aca7) 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 f386d14e69ca..f6961b1b2e87 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 1f34f8fdea68..6b88bb57dc8f 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 8dfd07273e8a..20222bbadf71 100644
--- a/ucb/source/ucp/file/filrset.cxx
+++ b/ucb/source/ucp/file/filrset.cxx
@@ -752,16 +752,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 5eb00115f356..09d2184b9c1c 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 46152804180b..f422ca33a02a 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 1eb43c28b1e9..95021354a093 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -742,8 +742,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 &&
@@ -751,8 +750,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);
@@ -770,9 +768,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
@@ -784,9 +780,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 2819fc6b0eba..f8f30fe9ebc1 100644
--- a/ucb/source/ucp/ftp/ftpintreq.cxx
+++ b/ucb/source/ucp/ftp/ftpintreq.cxx
@@ -70,11 +70,9 @@ XInteractionRequestImpl::XInteractionRequestImpl()
uno::Sequence<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 207912cddaf1..66990249399f 100644
--- a/ucb/source/ucp/ftp/ftpresultsetbase.cxx
+++ b/ucb/source/ucp/ftp/ftpresultsetbase.cxx
@@ -531,16 +531,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();