summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/referencecasting.cxx172
-rw-r--r--compilerplugins/clang/test/referencecasting.cxx34
-rw-r--r--drawinglayer/qa/unit/border.cxx2
-rw-r--r--drawinglayer/source/tools/wmfemfhelper.cxx2
-rw-r--r--include/vcl/transfer.hxx6
-rw-r--r--include/xmloff/xmlexp.hxx2
-rw-r--r--io/source/acceptor/acc_pipe.cxx2
-rw-r--r--io/source/acceptor/acc_socket.cxx2
-rw-r--r--io/source/connector/connector.cxx4
-rw-r--r--ucbhelper/source/provider/cancelcommandexecution.cxx4
-rw-r--r--ucbhelper/source/provider/contenthelper.cxx6
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx2
-rw-r--r--vcl/source/app/svapp.cxx2
-rw-r--r--vcl/unx/generic/dtrans/X11_clipboard.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx11
-rw-r--r--xmlhelp/source/cxxhelp/provider/content.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/provider.cxx2
18 files changed, 175 insertions, 84 deletions
diff --git a/compilerplugins/clang/referencecasting.cxx b/compilerplugins/clang/referencecasting.cxx
index aa11bc0738d7..496654237b7d 100644
--- a/compilerplugins/clang/referencecasting.cxx
+++ b/compilerplugins/clang/referencecasting.cxx
@@ -61,16 +61,34 @@ public:
bool VisitCXXConstructExpr(const CXXConstructExpr* cce);
bool VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce);
bool VisitCallExpr(const CallExpr*);
+ bool VisitInitListExpr(const InitListExpr*);
private:
- bool CheckForUnnecessaryGet(const Expr*);
+ bool CheckForUnnecessaryGet(const Expr*, bool includeRtlReference);
};
-static const RecordType* extractTemplateType(const clang::Type*);
+static const RecordType* extractTemplateType(QualType);
static bool isDerivedFrom(const CXXRecordDecl* subtypeRecord, const CXXRecordDecl* baseRecord);
+bool ReferenceCasting::VisitInitListExpr(const InitListExpr* ile)
+{
+ if (ignoreLocation(ile))
+ return true;
+ for (const Expr* expr : ile->inits())
+ {
+ if (CheckForUnnecessaryGet(expr, /*includeRtlReference*/ true))
+ {
+ report(DiagnosticsEngine::Warning, "unnecessary get() call", compat::getBeginLoc(expr))
+ << expr->getSourceRange();
+ return true;
+ }
+ }
+ return true;
+}
bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
{
+ if (ignoreLocation(cce))
+ return true;
// don't bother processing anything in the Reference.h file. Makes my life easier when debugging this.
StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(cce)));
@@ -79,24 +97,46 @@ bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Reference.hxx"))
return true;
+ if (cce->getNumArgs() == 0)
+ return true;
+
// look for calls to the Reference<T>(x, UNO_something) constructor
auto constructorClass = cce->getConstructor()->getParent();
- if (!constructorClass->getIdentifier() || constructorClass->getName() != "Reference")
+ auto dc = loplugin::DeclCheck(constructorClass);
+ bool isUnoReference(dc.Class("Reference").Namespace("uno"));
+ bool isRtlReference(dc.Class("Reference").Namespace("rtl").GlobalNamespace());
+ if (!isUnoReference && !isRtlReference)
return true;
- if (cce->getNumArgs() != 2)
- return true;
+ if (isUnoReference)
+ if (CheckForUnnecessaryGet(cce->getArg(0), /*includeRtlReference*/ cce->getNumArgs() == 1))
+ {
+ report(DiagnosticsEngine::Warning, "unnecessary get() call",
+ compat::getBeginLoc(cce->getArg(0)))
+ << cce->getArg(0)->getSourceRange();
+ return true;
+ }
+ if (isRtlReference && cce->getNumArgs() == 1)
+ if (CheckForUnnecessaryGet(cce->getArg(0), /*includeRtlReference*/ true))
+ {
+ report(DiagnosticsEngine::Warning, "unnecessary get() call",
+ compat::getBeginLoc(cce->getArg(0)))
+ << cce->getArg(0)->getSourceRange();
+ return true;
+ }
- if (CheckForUnnecessaryGet(cce->getArg(0)))
- report(DiagnosticsEngine::Warning, "unnecessary get() call", compat::getBeginLoc(cce))
- << cce->getSourceRange();
+ if (isRtlReference)
+ return true;
+ if (isUnoReference && cce->getNumArgs() != 2)
+ return true;
- // ignore the up-casting constructor
- if (!isa<EnumType>(cce->getConstructor()->getParamDecl(1)->getType()))
+ // ignore the up-casting constructor, which has a std::enable_if second parameter
+ if (isUnoReference && cce->getNumArgs() == 2
+ && !isa<EnumType>(cce->getConstructor()->getParamDecl(1)->getType()))
return true;
// extract the type parameter passed to the template
- const RecordType* templateParamType = extractTemplateType(cce->getType().getTypePtr());
+ const RecordType* templateParamType = extractTemplateType(cce->getType());
if (!templateParamType)
return true;
@@ -106,7 +146,7 @@ bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
return true;
// drill down the expression tree till we hit the bottom, because at the top, the type is BaseReference
- const clang::Type* argType;
+ QualType argType;
for (;;)
{
if (auto castExpr = dyn_cast<CastExpr>(constructorArg0))
@@ -134,7 +174,7 @@ bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
constructorArg0 = parenExpr->getSubExpr();
continue;
}
- argType = constructorArg0->getType().getTypePtr();
+ argType = constructorArg0->getType();
break;
}
@@ -155,19 +195,20 @@ bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
if (templateParamRD->getName() == "XShape")
return true;
- if (auto declRefExpr = dyn_cast<DeclRefExpr>(cce->getArg(1)))
- {
- // no warning expected, used to reject null references
- if (auto enumConstantDecl = dyn_cast<EnumConstantDecl>(declRefExpr->getDecl()))
+ if (cce->getNumArgs() == 2)
+ if (auto declRefExpr = dyn_cast<DeclRefExpr>(cce->getArg(1)))
{
- if (enumConstantDecl->getName() == "UNO_SET_THROW")
- return true;
- if (enumConstantDecl->getName() == "UNO_QUERY_THROW")
- return true;
- if (enumConstantDecl->getName() == "SAL_NO_ACQUIRE")
- return true;
+ // no warning expected, used to reject null references
+ if (auto enumConstantDecl = dyn_cast<EnumConstantDecl>(declRefExpr->getDecl()))
+ {
+ if (enumConstantDecl->getName() == "UNO_SET_THROW")
+ return true;
+ if (enumConstantDecl->getName() == "UNO_QUERY_THROW")
+ return true;
+ if (enumConstantDecl->getName() == "SAL_NO_ACQUIRE")
+ return true;
+ }
}
- }
if (constructorArgRD->Equals(templateParamRD)
|| isDerivedFrom(constructorArgRD, templateParamRD))
@@ -182,6 +223,8 @@ bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
bool ReferenceCasting::VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce)
{
+ if (ignoreLocation(mce))
+ return true;
// don't bother processing anything in the Reference.h file. Makes my life easier when debugging this.
StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(mce)));
@@ -190,21 +233,29 @@ bool ReferenceCasting::VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce)
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Reference.hxx"))
return true;
+ if (mce->getNumArgs() == 0)
+ return true;
+
// look for calls to the Reference<T>.set(x, UNO_QUERY) constructor
auto method = mce->getMethodDecl();
if (!method || !method->getIdentifier() || method->getName() != "set")
return true;
- if (mce->getNumArgs() != 2)
- return true;
auto methodRecordDecl = dyn_cast<ClassTemplateSpecializationDecl>(mce->getRecordDecl());
if (!methodRecordDecl || !methodRecordDecl->getIdentifier()
|| methodRecordDecl->getName() != "Reference")
return true;
- if (CheckForUnnecessaryGet(mce->getArg(0)))
- report(DiagnosticsEngine::Warning, "unnecessary get() call", compat::getBeginLoc(mce))
- << mce->getSourceRange();
+ if (CheckForUnnecessaryGet(mce->getArg(0), /*includeRtlReference*/ mce->getNumArgs() == 1))
+ {
+ report(DiagnosticsEngine::Warning, "unnecessary get() call",
+ compat::getBeginLoc(mce->getArg(0)))
+ << mce->getArg(0)->getSourceRange();
+ return true;
+ }
+
+ if (mce->getNumArgs() != 2)
+ return true;
// extract the type parameter passed to the template
const RecordType* templateParamType
@@ -218,7 +269,7 @@ bool ReferenceCasting::VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce)
return true;
// drill down the expression tree till we hit the bottom, because at the top, the type is BaseReference
- const clang::Type* argType;
+ QualType argType;
for (;;)
{
if (auto castExpr = dyn_cast<CastExpr>(arg0))
@@ -246,7 +297,7 @@ bool ReferenceCasting::VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce)
arg0 = parenExpr->getSubExpr();
continue;
}
- argType = arg0->getType().getTypePtr();
+ argType = arg0->getType();
break;
}
@@ -267,19 +318,20 @@ bool ReferenceCasting::VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce)
if (templateParamRD->getName() == "XShape")
return true;
- if (auto declRefExpr = dyn_cast<DeclRefExpr>(mce->getArg(1)))
- {
- // no warning expected, used to reject null references
- if (auto enumConstantDecl = dyn_cast<EnumConstantDecl>(declRefExpr->getDecl()))
+ if (mce->getNumArgs() == 2)
+ if (auto declRefExpr = dyn_cast<DeclRefExpr>(mce->getArg(1)))
{
- if (enumConstantDecl->getName() == "UNO_SET_THROW")
- return true;
- if (enumConstantDecl->getName() == "UNO_QUERY_THROW")
- return true;
- if (enumConstantDecl->getName() == "SAL_NO_ACQUIRE")
- return true;
+ // no warning expected, used to reject null references
+ if (auto enumConstantDecl = dyn_cast<EnumConstantDecl>(declRefExpr->getDecl()))
+ {
+ if (enumConstantDecl->getName() == "UNO_SET_THROW")
+ return true;
+ if (enumConstantDecl->getName() == "UNO_QUERY_THROW")
+ return true;
+ if (enumConstantDecl->getName() == "SAL_NO_ACQUIRE")
+ return true;
+ }
}
- }
if (methodArgRD->Equals(templateParamRD) || isDerivedFrom(methodArgRD, templateParamRD))
{
@@ -293,6 +345,8 @@ bool ReferenceCasting::VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce)
bool ReferenceCasting::VisitCallExpr(const CallExpr* ce)
{
+ if (ignoreLocation(ce))
+ return true;
// don't bother processing anything in the Reference.h file. Makes my life easier when debugging this.
StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(ce)));
@@ -313,9 +367,10 @@ bool ReferenceCasting::VisitCallExpr(const CallExpr* ce)
|| methodRecordDecl->getName() != "Reference")
return true;
- if (CheckForUnnecessaryGet(ce->getArg(0)))
- report(DiagnosticsEngine::Warning, "unnecessary get() call", compat::getBeginLoc(ce))
- << ce->getSourceRange();
+ if (CheckForUnnecessaryGet(ce->getArg(0), /*includeRtlReference*/ true))
+ report(DiagnosticsEngine::Warning, "unnecessary get() call",
+ compat::getBeginLoc(ce->getArg(0)))
+ << ce->getArg(0)->getSourceRange();
// extract the type parameter passed to the template
const RecordType* templateParamType
@@ -329,7 +384,7 @@ bool ReferenceCasting::VisitCallExpr(const CallExpr* ce)
return true;
// drill down the expression tree till we hit the bottom, because at the top, the type is BaseReference
- const clang::Type* argType;
+ QualType argType;
for (;;)
{
if (auto castExpr = dyn_cast<CastExpr>(arg0))
@@ -357,7 +412,7 @@ bool ReferenceCasting::VisitCallExpr(const CallExpr* ce)
arg0 = parenExpr->getSubExpr();
continue;
}
- argType = arg0->getType().getTypePtr();
+ argType = arg0->getType();
break;
}
@@ -393,9 +448,9 @@ bool ReferenceCasting::VisitCallExpr(const CallExpr* ce)
Reference<T>(x.get(), UNO_QUERY)
because sometimes simplifying that means the main purpose of this plugin can kick in.
*/
-bool ReferenceCasting::CheckForUnnecessaryGet(const Expr* expr)
+bool ReferenceCasting::CheckForUnnecessaryGet(const Expr* expr, bool includeRtlReference)
{
- expr = expr->IgnoreImplicit();
+ expr = compat::IgnoreImplicit(expr);
auto cxxMemberCallExpr = dyn_cast<CXXMemberCallExpr>(expr);
if (!cxxMemberCallExpr)
return false;
@@ -407,7 +462,12 @@ bool ReferenceCasting::CheckForUnnecessaryGet(const Expr* expr)
if (!loplugin::TypeCheck(expr->getType()).Pointer())
return false;
- if (!loplugin::DeclCheck(methodDecl->getParent()).Class("Reference").Namespace("uno"))
+ auto dc = loplugin::DeclCheck(methodDecl->getParent());
+ if (dc.Class("Reference").Namespace("uno"))
+ ; // ok
+ else if (includeRtlReference && dc.Class("Reference").Namespace("rtl"))
+ ; // ok
+ else
return false;
StringRef aFileName = getFilenameOfLocation(
@@ -418,7 +478,7 @@ bool ReferenceCasting::CheckForUnnecessaryGet(const Expr* expr)
return true;
}
-static const RecordType* extractTemplateType(const clang::Type* cceType)
+static const RecordType* extractTemplateType(QualType cceType)
{
// check for passing raw pointer to interface case
if (cceType->isPointerType())
@@ -426,6 +486,8 @@ static const RecordType* extractTemplateType(const clang::Type* cceType)
auto pointeeType = cceType->getPointeeType();
if (auto elaboratedType = dyn_cast<ElaboratedType>(pointeeType))
pointeeType = elaboratedType->desugar();
+ if (auto substTemplateTypeParmType = dyn_cast<SubstTemplateTypeParmType>(pointeeType))
+ pointeeType = substTemplateTypeParmType->desugar();
if (auto recordType = dyn_cast<RecordType>(pointeeType))
return recordType;
}
@@ -433,7 +495,7 @@ static const RecordType* extractTemplateType(const clang::Type* cceType)
// extract Foo from Reference<Foo>
if (auto subst = dyn_cast<SubstTemplateTypeParmType>(cceType))
{
- if (auto recType = dyn_cast<RecordType>(subst->desugar().getTypePtr()))
+ if (auto recType = dyn_cast<RecordType>(subst->desugar()))
{
if (auto ctsd = dyn_cast<ClassTemplateSpecializationDecl>(recType->getDecl()))
{
@@ -445,16 +507,16 @@ static const RecordType* extractTemplateType(const clang::Type* cceType)
}
if (auto elaboratedType = dyn_cast<ElaboratedType>(cceType))
- cceType = elaboratedType->desugar().getTypePtr();
+ cceType = elaboratedType->desugar();
auto cceTST = dyn_cast<TemplateSpecializationType>(cceType);
if (!cceTST)
return NULL;
if (cceTST->getNumArgs() != 1)
return NULL;
const TemplateArgument& cceTA = cceTST->getArg(0);
- const clang::Type* templateParamType = cceTA.getAsType().getTypePtr();
+ QualType templateParamType = cceTA.getAsType();
if (auto elaboratedType = dyn_cast<ElaboratedType>(templateParamType))
- templateParamType = elaboratedType->desugar().getTypePtr();
+ templateParamType = elaboratedType->desugar();
return dyn_cast<RecordType>(templateParamType);
}
diff --git a/compilerplugins/clang/test/referencecasting.cxx b/compilerplugins/clang/test/referencecasting.cxx
index 0864aec0f697..bb52cfbfdd17 100644
--- a/compilerplugins/clang/test/referencecasting.cxx
+++ b/compilerplugins/clang/test/referencecasting.cxx
@@ -8,12 +8,15 @@
*/
#include "sal/config.h"
+#include "config_clang.h"
+#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XInterface.hpp"
#include "com/sun/star/io/XStreamListener.hpp"
#include "com/sun/star/lang/XTypeProvider.hpp"
#include "com/sun/star/lang/XComponent.hpp"
#include "cppuhelper/weak.hxx"
+#include "rtl/ref.hxx"
void test1(const css::uno::Reference<css::io::XStreamListener>& a)
{
@@ -79,6 +82,37 @@ void test(css::uno::Reference<css::io::XStreamListener> l)
// expected-error@+1 {{unnecessary get() call [loplugin:referencecasting]}}
a.set(l.get(), css::uno::UNO_QUERY);
}
+
+class FooStream : public css::io::XStreamListener
+{
+ virtual ~FooStream();
+};
+void test(rtl::Reference<FooStream> l)
+{
+ // expected-error@+1 {{unnecessary get() call [loplugin:referencecasting]}}
+ css::uno::Reference<css::io::XStreamListener> a(l.get());
+ // expected-error@+1 {{the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]}}
+ a.set(l.get(), css::uno::UNO_QUERY);
+ // expected-error@+1 {{unnecessary get() call [loplugin:referencecasting]}}
+ a.set(l.get());
+ // expected-error@+1 {{the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]}}
+ css::uno::Reference<css::io::XStreamListener> b(l.get(), css::uno::UNO_QUERY);
+ // no warning expected
+ css::uno::Reference<css::lang::XTypeProvider> c(l.get(), css::uno::UNO_QUERY);
+ // no warning expected
+ css::uno::Reference<css::io::XStreamListener> a2 = l;
+ (void)a2;
+}
+// not should about the exact version I should use here,
+// clang 5.0.2 visits the CXXConstructorExpr inside the initializer, while clang 11 does not
+#if CLANG_VERSION >= 60000
+css::uno::Sequence<css::uno::Reference<css::io::XStreamListener>> getContinuations()
+{
+ rtl::Reference<FooStream> noel1;
+ // expected-error@+1 {{unnecessary get() call [loplugin:referencecasting]}}
+ return { noel1.get() };
+}
+#endif
}
namespace test8
diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx
index 8c4e6e08419b..a3f7029b7350 100644
--- a/drawinglayer/qa/unit/border.cxx
+++ b/drawinglayer/qa/unit/border.cxx
@@ -130,7 +130,7 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing)
aStrokeAttribute));
drawinglayer::primitive2d::Primitive2DContainer aPrimitives;
- aPrimitives.push_back(drawinglayer::primitive2d::Primitive2DReference(aBorder.get()));
+ aPrimitives.push_back(drawinglayer::primitive2d::Primitive2DReference(aBorder));
// Process the primitives.
pProcessor->process(aPrimitives);
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index 00ec09c9ab00..f5a171b9e204 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -967,7 +967,7 @@ namespace wmfemfhelper
if(!rPropertyHolder.getTransformation().isIdentity())
{
- const drawinglayer::primitive2d::Primitive2DReference xPrim(pRetval.get());
+ const drawinglayer::primitive2d::Primitive2DReference xPrim(pRetval);
const drawinglayer::primitive2d::Primitive2DContainer xSeq { xPrim };
pRetval = new drawinglayer::primitive2d::TransformPrimitive2D(
diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx
index f7c41fafa00b..d24fd560de31 100644
--- a/include/vcl/transfer.hxx
+++ b/include/vcl/transfer.hxx
@@ -177,7 +177,7 @@ protected:
const css::uno::Reference< css::datatransfer::clipboard::XClipboard >&
getOwnClipboard() const { return mxClipboard; }
-private:
+public:
// XTransferable
virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& rFlavor ) override;
@@ -189,6 +189,8 @@ private:
const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
virtual sal_Bool SAL_CALL isComplex() override;
+private:
+
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
@@ -199,8 +201,6 @@ private:
virtual void SAL_CALL dragOver( const css::datatransfer::dnd::DragSourceDragEvent& dsde ) override;
virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DragSourceDragEvent& dsde ) override;
-private:
-
// XClipboardOwner
virtual void SAL_CALL lostOwnership( const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& xClipboard, const css::uno::Reference< css::datatransfer::XTransferable >& xTrans ) override;
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index 7ea66274bb54..d1925585431d 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -378,7 +378,7 @@ public:
// Get common attribute list as implementation or interface.
SvXMLAttributeList &GetAttrList() { return *mxAttrList; }
- css::uno::Reference< css::xml::sax::XAttributeList > GetXAttrList() { return mxAttrList.get(); }
+ css::uno::Reference< css::xml::sax::XAttributeList > GetXAttrList() { return mxAttrList; }
// Get document handler. This methods are not const, because the
// reference allows modifications through the handler.
diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx
index 0718834e3115..62f90993dca7 100644
--- a/io/source/acceptor/acc_pipe.cxx
+++ b/io/source/acceptor/acc_pipe.cxx
@@ -163,7 +163,7 @@ namespace io_acceptor
}
else if( osl_Pipe_E_None == status )
{
- return pConn.get();
+ return pConn;
}
else
{
diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx
index 57c8a179885b..96d777fd0d8b 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -343,7 +343,7 @@ namespace io_acceptor {
sizeof( nTcpNoDelay ) , osl_Socket_LevelTcp );
}
- return pConn.get();
+ return pConn;
}
void SocketAcceptor::stopAccepting()
diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx
index 6072afb9dbff..87e60934cfb6 100644
--- a/io/source/connector/connector.cxx
+++ b/io/source/connector/connector.cxx
@@ -85,7 +85,7 @@ Reference< XConnection > SAL_CALL OConnector::connect( const OUString& sConnecti
if( pConn->m_pipe.create( aName.pData, osl_Pipe_OPEN, osl::Security() ) )
{
- r.set( pConn.get() );
+ r = pConn;
}
else
{
@@ -128,7 +128,7 @@ Reference< XConnection > SAL_CALL OConnector::connect( const OUString& sConnecti
sizeof( nTcpNoDelay ) , osl_Socket_LevelTcp );
}
pConn->completeConnectionString();
- r.set( pConn.get() );
+ r = pConn;
}
else
{
diff --git a/ucbhelper/source/provider/cancelcommandexecution.cxx b/ucbhelper/source/provider/cancelcommandexecution.cxx
index f700c8a4afc1..8aac85c240aa 100644
--- a/ucbhelper/source/provider/cancelcommandexecution.cxx
+++ b/ucbhelper/source/provider/cancelcommandexecution.cxx
@@ -58,7 +58,7 @@ void cancelCommandExecution( const uno::Any & rException,
xRequest->setContinuations( aContinuations );
- xIH->handle( xRequest.get() );
+ xIH->handle( xRequest );
rtl::Reference< ucbhelper::InteractionContinuation > xSelection
= xRequest->getSelection();
@@ -94,7 +94,7 @@ void cancelCommandExecution( const ucb::IOErrorCode eError,
task::XInteractionHandler > xIH = xEnv->getInteractionHandler();
if ( xIH.is() )
{
- xIH->handle( xRequest.get() );
+ xIH->handle( xRequest );
rtl::Reference< ucbhelper::InteractionContinuation > xSelection
= xRequest->getSelection();
diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx
index 32dff58783e6..f273d51907d4 100644
--- a/ucbhelper/source/provider/contenthelper.cxx
+++ b/ucbhelper/source/provider/contenthelper.cxx
@@ -854,8 +854,7 @@ ContentImplHelper::getCommandInfo(
else if ( !bCache )
m_pImpl->m_xCommandsInfo->reset();
- return uno::Reference< css::ucb::XCommandInfo >(
- m_pImpl->m_xCommandsInfo.get() );
+ return m_pImpl->m_xCommandsInfo;
}
uno::Reference< beans::XPropertySetInfo >
@@ -871,8 +870,7 @@ ContentImplHelper::getPropertySetInfo(
else if ( !bCache )
m_pImpl->m_xPropSetInfo->reset();
- return uno::Reference< beans::XPropertySetInfo >(
- m_pImpl->m_xPropSetInfo.get() );
+ return m_pImpl->m_xPropSetInfo;
}
} // namespace ucbhelper
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 4be8eee0d0c0..a06d8850496e 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -272,7 +272,7 @@ public:
if (!m_xDropTarget)
m_xDropTarget.set(new JSDropTarget);
- return m_xDropTarget.get();
+ return m_xDropTarget;
}
virtual void freeze() override
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index aa3dbb0a18b3..0c1a0f67cdf0 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1518,7 +1518,7 @@ css::uno::Reference< css::awt::XDisplayConnection > Application::GetDisplayConne
pSVData->mxDisplayConnection->start();
}
- return pSVData->mxDisplayConnection.get();
+ return pSVData->mxDisplayConnection;
}
void Application::SetFilterHdl( const Link<ConvertData&,bool>& rLink )
diff --git a/vcl/unx/generic/dtrans/X11_clipboard.cxx b/vcl/unx/generic/dtrans/X11_clipboard.cxx
index 17104ca75eca..b42f0f5bc828 100644
--- a/vcl/unx/generic/dtrans/X11_clipboard.cxx
+++ b/vcl/unx/generic/dtrans/X11_clipboard.cxx
@@ -66,7 +66,7 @@ X11Clipboard::create( SelectionManager& rManager, Atom aSelection )
rManager.registerHandler(XA_PRIMARY, *cb);
rManager.registerHandler(rManager.getAtom("CLIPBOARD"), *cb);
}
- return cb.get();
+ return cb;
}
X11Clipboard::~X11Clipboard()
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index edffff102d48..9a9f80ef9f46 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2053,12 +2053,9 @@ protected:
void do_enable_drag_source(const rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants)
{
- css::uno::Reference<css::datatransfer::XTransferable> xTrans(rHelper.get());
- css::uno::Reference<css::datatransfer::dnd::XDragSourceListener> xListener(rHelper.get());
-
ensure_drag_source();
- auto aFormats = xTrans->getTransferDataFlavors();
+ auto aFormats = rHelper->getTransferDataFlavors();
std::vector<GtkTargetEntry> aGtkTargets(m_xDragSource->FormatsToGtk(aFormats));
m_eDragAction = VclToGdk(eDNDConstants);
@@ -2067,7 +2064,7 @@ protected:
for (auto &a : aGtkTargets)
g_free(a.target);
- m_xDragSource->set_datatransfer(xTrans, xListener);
+ m_xDragSource->set_datatransfer(rHelper, rHelper);
}
void localizeDecimalSeparator()
@@ -3026,7 +3023,7 @@ public:
m_nDragDropReceivedSignalId = g_signal_connect(m_pWidget, "drag-data-received", G_CALLBACK(signalDragDropReceived), this);
m_nDragLeaveSignalId = g_signal_connect(m_pWidget, "drag-leave", G_CALLBACK(signalDragLeave), this);
}
- return m_xDropTarget.get();
+ return m_xDropTarget;
}
virtual void connect_get_property_tree(const Link<tools::JsonWriter&, void>& /*rLink*/) override
@@ -4067,7 +4064,7 @@ public:
{
if (!m_xWindow.is())
m_xWindow.set(new SalGtkXWindow(this, m_pWidget));
- return css::uno::Reference<css::awt::XWindow>(m_xWindow.get());
+ return m_xWindow;
}
virtual void set_modal(bool bModal) override
diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx b/xmlhelp/source/cxxhelp/provider/content.cxx
index 4ad2c3fa78c8..273c68555c9f 100644
--- a/xmlhelp/source/cxxhelp/provider/content.cxx
+++ b/xmlhelp/source/cxxhelp/provider/content.cxx
@@ -438,7 +438,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
xRow->appendVoid( rProp );
}
- return uno::Reference< sdbc::XRow >( xRow.get() );
+ return xRow;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 1f1a2868c477..335820c21d7e 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -806,7 +806,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const OUString& jar,
rtl::Reference<XInputStream_impl> p(new XInputStream_impl( zipFile ));
if( p->CtorSuccess() )
{
- aArguments[ 0 ] <<= Reference< XInputStream >( p.get() );
+ aArguments[ 0 ] <<= Reference< XInputStream >( p );
}
else
{
diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx
index 6f690da96583..76bd92482e69 100644
--- a/xmlhelp/source/cxxhelp/provider/provider.cxx
+++ b/xmlhelp/source/cxxhelp/provider/provider.cxx
@@ -143,7 +143,7 @@ ContentProvider::queryContent(
// Check, if a content with given id already exists...
uno::Reference< ucb::XContent > xContent
- = queryExistingContent( xCanonicId ).get();
+ = queryExistingContent( xCanonicId );
if ( xContent.is() )
return xContent;