summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-06 19:27:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-06 22:17:16 +0200
commitd6375dcd1db6ce7e1bae8297949801f7d4249e52 (patch)
treebc4df363f8a0d569ba942ad15dcca906d5242832
parent48969e9f578c16ff4142b2911746212044cbce61 (diff)
loplugin:unusedmethods
plugin code needed some updating because it was interacting badly with PCH code in pluginhandler::ignoreLocation Change-Id: I228f94a4e285747bd1d5b8536010f8617118cafa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115212 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--basctl/inc/pch/precompiled_basctl.hxx1
-rw-r--r--chart2/inc/pch/precompiled_chartcontroller.hxx1
-rw-r--r--compilerplugins/clang/unusedmethods.cxx58
-rw-r--r--editeng/source/items/textitem.cxx1
-rw-r--r--forms/inc/pch/precompiled_frm.hxx1
-rw-r--r--include/editeng/blinkitem.hxx2
-rw-r--r--include/unotools/localedatawrapper.hxx1
-rw-r--r--include/unotools/readwritemutexguard.hxx102
-rw-r--r--include/vcl/BitmapInfoAccess.hxx5
-rw-r--r--include/vcl/alpha.hxx1
-rw-r--r--svtools/inc/pch/precompiled_svt.hxx1
-rw-r--r--sw/inc/pch/precompiled_msword.hxx1
-rw-r--r--sw/inc/textboxhelper.hxx14
-rw-r--r--sw/source/core/doc/textboxhelper.cxx29
-rw-r--r--unotools/Library_utl.mk1
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx13
-rw-r--r--unotools/source/i18n/readwritemutexguard.cxx109
-rw-r--r--vcl/source/bitmap/alpha.cxx38
18 files changed, 49 insertions, 330 deletions
diff --git a/basctl/inc/pch/precompiled_basctl.hxx b/basctl/inc/pch/precompiled_basctl.hxx
index 1852dde296f6..8644323b3bf1 100644
--- a/basctl/inc/pch/precompiled_basctl.hxx
+++ b/basctl/inc/pch/precompiled_basctl.hxx
@@ -509,7 +509,6 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/nativenumberwrapper.hxx>
#include <unotools/options.hxx>
-#include <unotools/readwritemutexguard.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <unotools/unotoolsdllapi.h>
diff --git a/chart2/inc/pch/precompiled_chartcontroller.hxx b/chart2/inc/pch/precompiled_chartcontroller.hxx
index 24fbca4b95ff..c46cf92cb06a 100644
--- a/chart2/inc/pch/precompiled_chartcontroller.hxx
+++ b/chart2/inc/pch/precompiled_chartcontroller.hxx
@@ -426,7 +426,6 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/nativenumberwrapper.hxx>
#include <unotools/options.hxx>
-#include <unotools/readwritemutexguard.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <unotools/unotoolsdllapi.h>
diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index b854238d2688..818c0b645a48 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -82,6 +82,11 @@ public:
virtual void run() override
{
+ StringRef fn(handler.getMainFileName());
+ // ignore external code, makes this run faster
+ if (fn.contains("UnpackedTarball"))
+ return;
+
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
// dump all our output in one write call - this is to try and limit IO "crosstalk" between multiple processes
@@ -90,10 +95,8 @@ public:
std::string output;
for (const MyFuncInfo & s : definitionSet)
{
- // ignore external code
- if (s.sourceLocation.rfind("external/", 0) != 0)
- output += "definition:\t" + s.access + "\t" + s.returnType + "\t" + s.nameAndParams
- + "\t" + s.sourceLocation + "\t" + s.virtualness + "\n";
+ output += "definition:\t" + s.access + "\t" + s.returnType + "\t" + s.nameAndParams
+ + "\t" + s.sourceLocation + "\t" + s.virtualness + "\n";
}
// for the "unused method" analysis
for (const MyFuncInfo & s : callSet)
@@ -128,6 +131,9 @@ private:
MyFuncInfo niceName(const FunctionDecl* functionDecl);
std::string toString(SourceLocation loc);
void functionTouchedFromExpr( const FunctionDecl* calleeFunctionDecl, const Expr* expr );
+ bool ignoreLocation(SourceLocation loc);
+ bool checkIgnoreLocation(SourceLocation loc);
+
CXXRecordDecl const * currentCxxRecordDecl = nullptr;
FunctionDecl const * currentFunctionDecl = nullptr;
};
@@ -193,6 +199,40 @@ MyFuncInfo UnusedMethods::niceName(const FunctionDecl* functionDecl)
return aInfo;
}
+/**
+ * Our need to see everything conflicts with the PCH code in pluginhandler::ignoreLocation,
+ * so we have to do this ourselves.
+ */
+bool UnusedMethods::ignoreLocation(SourceLocation loc)
+{
+ static std::unordered_map<SourceLocation, bool> checkedMap;
+ auto it = checkedMap.find(loc);
+ if (it != checkedMap.end())
+ return it->second;
+ bool ignore = checkIgnoreLocation(loc);
+ checkedMap.emplace(loc, ignore);
+ return ignore;
+}
+
+bool UnusedMethods::checkIgnoreLocation(SourceLocation loc)
+{
+ // simplified form of the code in PluginHandler::checkIgnoreLocation
+ SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( loc );
+ if( compiler.getSourceManager().isInSystemHeader( expansionLoc ))
+ return true;
+ PresumedLoc presumedLoc = compiler.getSourceManager().getPresumedLoc( expansionLoc );
+ if( presumedLoc.isInvalid())
+ return true;
+ const char* bufferName = presumedLoc.getFilename();
+ if (bufferName == NULL
+ || loplugin::hasPathnamePrefix(bufferName, SRCDIR "/external/"))
+ return true;
+ if( loplugin::hasPathnamePrefix(bufferName, BUILDDIR "/")
+ || loplugin::hasPathnamePrefix(bufferName, SRCDIR "/") )
+ return false; // ok
+ return true;
+}
+
std::string UnusedMethods::toString(SourceLocation loc)
{
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( loc );
@@ -221,7 +261,7 @@ void UnusedMethods::logCallToRootMethods(const FunctionDecl* functionDecl, std::
{
while (functionDecl->getTemplateInstantiationPattern())
functionDecl = functionDecl->getTemplateInstantiationPattern();
- if (functionDecl->getLocation().isValid() && !ignoreLocation( functionDecl )
+ if (functionDecl->getLocation().isValid() && !ignoreLocation( compat::getBeginLoc(functionDecl) )
&& !functionDecl->isExternC())
funcSet.insert(niceName(functionDecl));
}
@@ -266,7 +306,7 @@ gotfunc:
{
const FunctionDecl* parentFunctionOfCallSite = getParentFunctionDecl(expr);
if (parentFunctionOfCallSite != calleeFunctionDecl) {
- if (!parentFunctionOfCallSite || !ignoreLocation(parentFunctionOfCallSite)) {
+ if (!parentFunctionOfCallSite || !ignoreLocation(compat::getBeginLoc(parentFunctionOfCallSite))) {
calledFromOutsideSet.insert(niceName(calleeFunctionDecl));
}
}
@@ -306,7 +346,7 @@ bool UnusedMethods::VisitCXXConstructExpr( const CXXConstructExpr* constructExpr
const CXXConstructorDecl* constructorDecl = constructExpr->getConstructor();
constructorDecl = constructorDecl->getCanonicalDecl();
- if (!constructorDecl->getLocation().isValid() || ignoreLocation(constructorDecl)) {
+ if (!constructorDecl->getLocation().isValid() || ignoreLocation(compat::getBeginLoc(constructorDecl))) {
return true;
}
@@ -337,7 +377,7 @@ bool UnusedMethods::VisitFunctionDecl( const FunctionDecl* functionDecl )
{
return true;
}
- if (!canonicalFunctionDecl->getLocation().isValid() || ignoreLocation(canonicalFunctionDecl)) {
+ if (!canonicalFunctionDecl->getLocation().isValid() || ignoreLocation(compat::getBeginLoc(canonicalFunctionDecl))) {
return true;
}
// ignore method overrides, since the call will show up as being directed to the root method
@@ -367,7 +407,7 @@ bool UnusedMethods::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
{
const FunctionDecl* parentFunctionOfCallSite = getParentFunctionDecl(declRefExpr);
if (parentFunctionOfCallSite != functionDecl) {
- if (!parentFunctionOfCallSite || !ignoreLocation(parentFunctionOfCallSite)) {
+ if (!parentFunctionOfCallSite || !ignoreLocation(compat::getBeginLoc(parentFunctionOfCallSite))) {
calledFromOutsideSet.insert(niceName(functionDecl));
}
}
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 051c1418d4fc..ed4806159a04 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -98,7 +98,6 @@ SfxPoolItem* SvxKerningItem::CreateDefault() {return new SvxKerningItem(0, 0);}
SfxPoolItem* SvxCaseMapItem::CreateDefault() {return new SvxCaseMapItem(SvxCaseMap::NotMapped, 0);}
SfxPoolItem* SvxEscapementItem::CreateDefault() {return new SvxEscapementItem(0);}
SfxPoolItem* SvxLanguageItem::CreateDefault() {return new SvxLanguageItem(LANGUAGE_GERMAN, 0);}
-SfxPoolItem* SvxBlinkItem::CreateDefault() {return new SvxBlinkItem(false, 0);}
SfxPoolItem* SvxEmphasisMarkItem::CreateDefault() {return new SvxEmphasisMarkItem(FontEmphasisMark::NONE, 0);}
SfxPoolItem* SvxCharRotateItem::CreateDefault() {return new SvxCharRotateItem(0_deg10, false, 0);}
SfxPoolItem* SvxCharScaleWidthItem::CreateDefault() {return new SvxCharScaleWidthItem(100, 0);}
diff --git a/forms/inc/pch/precompiled_frm.hxx b/forms/inc/pch/precompiled_frm.hxx
index 723584b6d009..12877c840daa 100644
--- a/forms/inc/pch/precompiled_frm.hxx
+++ b/forms/inc/pch/precompiled_frm.hxx
@@ -252,7 +252,6 @@
#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
#include <unotools/localedatawrapper.hxx>
-#include <unotools/readwritemutexguard.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/ucbstreamhelper.hxx>
diff --git a/include/editeng/blinkitem.hxx b/include/editeng/blinkitem.hxx
index 54f6da995e87..4a4af0e6217f 100644
--- a/include/editeng/blinkitem.hxx
+++ b/include/editeng/blinkitem.hxx
@@ -33,8 +33,6 @@
class EDITENG_DLLPUBLIC SvxBlinkItem final : public SfxBoolItem
{
public:
- static SfxPoolItem* CreateDefault();
-
SvxBlinkItem( const bool bBlink /*= false*/, const sal_uInt16 nId );
// "pure virtual Methods" from SfxPoolItem
diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx
index 29e9815935c2..1ec554a38b90 100644
--- a/include/unotools/localedatawrapper.hxx
+++ b/include/unotools/localedatawrapper.hxx
@@ -149,7 +149,6 @@ public:
css::uno::Sequence< css::i18n::Currency2 > getAllCurrencies() const;
css::uno::Sequence< css::i18n::FormatElement > getAllFormats() const;
css::i18n::ForbiddenCharacters getForbiddenCharacters() const;
- css::uno::Sequence< OUString > getReservedWord() const;
css::uno::Sequence< css::lang::Locale > getAllInstalledLocaleNames() const;
css::uno::Sequence< OUString > getDateAcceptancePatterns() const;
diff --git a/include/unotools/readwritemutexguard.hxx b/include/unotools/readwritemutexguard.hxx
deleted file mode 100644
index a7c6d5799ae4..000000000000
--- a/include/unotools/readwritemutexguard.hxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_UNOTOOLS_READWRITEMUTEXGUARD_HXX
-#define INCLUDED_UNOTOOLS_READWRITEMUTEXGUARD_HXX
-
-#include <osl/mutex.hxx>
-#include <o3tl/typed_flags_set.hxx>
-
-enum class ReadWriteGuardMode {
- ReadOnly = 0x00,
- Write = 0x01,
- CriticalChange = 0x02 | Write,
- BlockCritical = 0x04, // only a block, not a read, exclusive flag!
-};
-namespace o3tl {
- template<> struct typed_flags<ReadWriteGuardMode> : is_typed_flags<ReadWriteGuardMode, 0x7> {};
-}
-
-namespace utl {
-
-class ReadWriteMutex
-{
- friend class ReadWriteGuard;
-
- sal_uInt32 nReadCount;
- sal_uInt32 nBlockCriticalCount;
- ::osl::Mutex maMutex;
- ::osl::Mutex maWriteMutex;
-
-public:
- ReadWriteMutex()
- : nReadCount(0)
- , nBlockCriticalCount(0)
- {}
-};
-
-/** Enable multiple threads to read simultaneously, but a write blocks all
- other reads and writes, and a read blocks any write.
- Used in I18N wrappers to be able to maintain a single instance of a wrapper
- for the standard Office locale.
- NEVER construct a writing guard if there is already a reading guard in the
- same context, the following will dead lock EVEN IN THE SAME THREAD!
- void foo()
- {
- ReadWriteGuard aGuard1( aMutex );
- bar();
- }
- void bar()
- {
- // waits forever for aGuard1
- ReadWriteGuard aGuard2( aMutex, ReadWriteGuardMode::nWrite );
- }
- */
-class ReadWriteGuard
-{
- ReadWriteMutex& rMutex;
- ReadWriteGuardMode nMode;
-public:
- ReadWriteGuard(
- ReadWriteMutex& rMutex,
- ReadWriteGuardMode nRequestMode = ReadWriteGuardMode::ReadOnly // read only
- );
- ~ReadWriteGuard();
-
- /** Be careful with this, it does wait for ANY read to complete.
- The following will dead lock EVEN IN THE SAME THREAD!
- void foo()
- {
- ReadWriteGuard aGuard1( aMutex );
- bar();
- }
- void bar()
- {
- ReadWriteGuard aGuard2( aMutex );
- aGuard2.changeReadToWrite(); // waits forever for aGuard1
- }
- */
- void changeReadToWrite();
-};
-
-} // namespace utl
-
-#endif // INCLUDED_UNOTOOLS_READWRITEMUTEXGUARD_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/BitmapInfoAccess.hxx b/include/vcl/BitmapInfoAccess.hxx
index 7fc8d1bce28a..86c4ada2ae16 100644
--- a/include/vcl/BitmapInfoAccess.hxx
+++ b/include/vcl/BitmapInfoAccess.hxx
@@ -114,11 +114,6 @@ public:
return mpBuffer->maPalette[nColor];
}
- const BitmapColor& GetBestPaletteColor(const BitmapColor& rBitmapColor) const
- {
- return GetPaletteColor(GetBestPaletteIndex(rBitmapColor));
- }
-
sal_uInt16 GetBestPaletteIndex(const BitmapColor& rBitmapColor) const;
ColorMask& GetColorMask() const
diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index 611450660f82..07d4997ee5a0 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -49,7 +49,6 @@ public:
Bitmap const & GetBitmap() const;
void Erase( sal_uInt8 cTransparency );
- void Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency );
void BlendWith(const Bitmap& rOther);
BitmapReadAccess* AcquireAlphaReadAccess() { return Bitmap::AcquireReadAccess(); }
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index cf1abf0a96e1..6632d92d88fd 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -308,7 +308,6 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/nativenumberwrapper.hxx>
#include <unotools/options.hxx>
-#include <unotools/readwritemutexguard.hxx>
#include <unotools/streamwrap.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/transliterationwrapper.hxx>
diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx
index e7285cfe2611..b1295d07512e 100644
--- a/sw/inc/pch/precompiled_msword.hxx
+++ b/sw/inc/pch/precompiled_msword.hxx
@@ -502,7 +502,6 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/nativenumberwrapper.hxx>
#include <unotools/options.hxx>
-#include <unotools/readwritemutexguard.hxx>
#include <unotools/streamwrap.hxx>
#include <unotools/syslocale.hxx>
#include <unotools/transliterationwrapper.hxx>
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index d4d1e0153383..d9c2b1ac9429 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -92,26 +92,14 @@ public:
/// not to interfere with the layout. Returns true on success.
static bool setWrapThrough(SwFrameFormat* pShape);
- /// Sets the surround to through for the textframe of the given shape,
- /// not to interfere with the layout. Returns true on success.
- static bool setWrapThrough(css::uno::Reference<css::drawing::XShape> xShape);
-
/// Sets the anchor of the associated textframe of the given shape, and
/// returns true on success.
static bool changeAnchor(SwFrameFormat* pShape);
- /// Sets the anchor of the associated textframe of the given shape, and
- /// returns true on success.
- static bool changeAnchor(css::uno::Reference<css::drawing::XShape> xShape);
-
/// Does the positioning for the associated textframe of the shape, and
/// returns true on success.
static bool doTextBoxPositioning(SwFrameFormat* pShape);
- /// Does the positioning for the associated textframe of the shape, and
- /// returns true on success.
- static bool doTextBoxPositioning(css::uno::Reference<css::drawing::XShape> xShape);
-
/// Returns true if the anchor different for the given shape, and the
/// associated textframe of the given shape.
/// Note: In case of AS_CHAR anchor the anchor type must be different,
@@ -121,8 +109,6 @@ public:
/// Returns true if the given shape has a valid textframe.
static bool isTextBoxShapeHasValidTextFrame(SwFrameFormat* pShape);
- /// Returns true if the given shape has a valid textframe.
- static bool isTextBoxShapeHasValidTextFrame(css::uno::Reference<css::drawing::XShape> xShape);
/**
* If we have an associated TextFrame, then return that.
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index f093b2370a22..72676dcf777f 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -1100,13 +1100,6 @@ bool SwTextBoxHelper::setWrapThrough(SwFrameFormat* pShape)
return false;
}
-bool SwTextBoxHelper::setWrapThrough(uno::Reference<drawing::XShape> xShape)
-{
- if (auto pShape = getShapeFormat(xShape))
- return setWrapThrough(pShape);
- return false;
-}
-
bool SwTextBoxHelper::changeAnchor(SwFrameFormat* pShape)
{
if (isTextBoxShapeHasValidTextFrame(pShape))
@@ -1198,13 +1191,6 @@ bool SwTextBoxHelper::changeAnchor(SwFrameFormat* pShape)
return false;
}
-bool SwTextBoxHelper::changeAnchor(uno::Reference<drawing::XShape> xShape)
-{
- if (auto pShape = getShapeFormat(xShape))
- return changeAnchor(pShape);
- return false;
-}
-
bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape)
{
if (isTextBoxShapeHasValidTextFrame(pShape))
@@ -1254,13 +1240,6 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape)
return false;
}
-bool SwTextBoxHelper::doTextBoxPositioning(uno::Reference<drawing::XShape> xShape)
-{
- if (auto pShape = getShapeFormat(xShape))
- return doTextBoxPositioning(pShape);
- return false;
-}
-
std::optional<bool> SwTextBoxHelper::isAnchorTypeDifferent(SwFrameFormat* pShape)
{
std::optional<bool> bRet;
@@ -1296,12 +1275,4 @@ bool SwTextBoxHelper::isTextBoxShapeHasValidTextFrame(SwFrameFormat* pShape)
return false;
}
-bool SwTextBoxHelper::isTextBoxShapeHasValidTextFrame(uno::Reference<drawing::XShape> xShape)
-{
- if (auto pShape = getShapeFormat(xShape))
- return isTextBoxShapeHasValidTextFrame(pShape);
-
- return false;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk
index e0059567baa4..66c08480db69 100644
--- a/unotools/Library_utl.mk
+++ b/unotools/Library_utl.mk
@@ -90,7 +90,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\
unotools/source/i18n/intlwrapper \
unotools/source/i18n/localedatawrapper \
unotools/source/i18n/nativenumberwrapper \
- unotools/source/i18n/readwritemutexguard \
unotools/source/i18n/textsearch \
unotools/source/i18n/transliterationwrapper \
unotools/source/misc/closeveto \
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index e0e91bbbac79..39e01f563392 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -277,19 +277,6 @@ css::i18n::ForbiddenCharacters LocaleDataWrapper::getForbiddenCharacters() const
return css::i18n::ForbiddenCharacters();
}
-css::uno::Sequence< OUString > LocaleDataWrapper::getReservedWord() const
-{
- try
- {
- return xLD->getReservedWord( getMyLocale() );
- }
- catch ( const Exception& )
- {
- TOOLS_WARN_EXCEPTION( "unotools.i18n", "getReservedWord" );
- }
- return css::uno::Sequence< OUString >(0);
-}
-
css::uno::Sequence< css::lang::Locale > LocaleDataWrapper::getAllInstalledLocaleNames() const
{
uno::Sequence< lang::Locale > &rInstalledLocales = InstalledLocales::get();
diff --git a/unotools/source/i18n/readwritemutexguard.cxx b/unotools/source/i18n/readwritemutexguard.cxx
deleted file mode 100644
index 48da011b7537..000000000000
--- a/unotools/source/i18n/readwritemutexguard.cxx
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <unotools/readwritemutexguard.hxx>
-#include <tools/debug.hxx>
-
-namespace utl {
-
-ReadWriteGuard::ReadWriteGuard( ReadWriteMutex& rMutexP,
- ReadWriteGuardMode nRequestMode )
- : rMutex( rMutexP )
-{
- // don't do anything until a pending write completed (or another
- // ReadWriteGuard leaves the ctor phase)
- ::osl::MutexGuard aGuard( rMutex.maWriteMutex );
- nMode = nRequestMode;
- if ( nMode & ReadWriteGuardMode::Write )
- {
- rMutex.maWriteMutex.acquire();
- // wait for any read to complete
-// TODO: set up a waiting thread instead of a loop
- bool bWait = true;
- do
- {
- rMutex.maMutex.acquire();
- bWait = (rMutex.nReadCount != 0);
- if ( nMode & ReadWriteGuardMode::CriticalChange )
- bWait |= (rMutex.nBlockCriticalCount != 0);
- rMutex.maMutex.release();
- } while ( bWait );
- }
- else if ( nMode & ReadWriteGuardMode::BlockCritical )
- {
- rMutex.maMutex.acquire();
- ++rMutex.nBlockCriticalCount;
- rMutex.maMutex.release();
- }
- else
- {
- rMutex.maMutex.acquire();
- ++rMutex.nReadCount;
- rMutex.maMutex.release();
- }
-}
-
-ReadWriteGuard::~ReadWriteGuard()
-{
- if ( nMode & ReadWriteGuardMode::Write )
- rMutex.maWriteMutex.release();
- else if ( nMode & ReadWriteGuardMode::BlockCritical )
- {
- rMutex.maMutex.acquire();
- --rMutex.nBlockCriticalCount;
- rMutex.maMutex.release();
- }
- else
- {
- rMutex.maMutex.acquire();
- --rMutex.nReadCount;
- rMutex.maMutex.release();
- }
-}
-
-void ReadWriteGuard::changeReadToWrite()
-{
- bool bOk = !(nMode & (ReadWriteGuardMode::Write | ReadWriteGuardMode::BlockCritical));
- DBG_ASSERT( bOk, "ReadWriteGuard::changeReadToWrite: can't" );
- if ( !bOk )
- return;
-
- // MUST release read before acquiring write mutex or dead lock would
- // occur if there was a write in another thread waiting for this read
- // to complete.
- rMutex.maMutex.acquire();
- --rMutex.nReadCount;
- rMutex.maMutex.release();
-
- rMutex.maWriteMutex.acquire();
- nMode |= ReadWriteGuardMode::Write;
- // wait for any other read to complete
-// TODO: set up a waiting thread instead of a loop
- bool bWait = true;
- do
- {
- rMutex.maMutex.acquire();
- bWait = (rMutex.nReadCount != 0);
- rMutex.maMutex.release();
- } while ( bWait );
-}
-
-} // namespace utl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/bitmap/alpha.cxx b/vcl/source/bitmap/alpha.cxx
index 0f0547166a3b..deeba1280c74 100644
--- a/vcl/source/bitmap/alpha.cxx
+++ b/vcl/source/bitmap/alpha.cxx
@@ -80,44 +80,6 @@ void AlphaMask::Erase( sal_uInt8 cTransparency )
Bitmap::Erase( Color( cTransparency, cTransparency, cTransparency ) );
}
-void AlphaMask::Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency )
-{
- AlphaScopedWriteAccess pAcc(*this);
-
- if( !(pAcc && pAcc->GetBitCount() == 8) )
- return;
-
- const tools::Long nWidth = pAcc->Width(), nHeight = pAcc->Height();
-
- if( pAcc->GetScanlineFormat() == ScanlineFormat::N8BitPal )
- {
- for( tools::Long nY = 0; nY < nHeight; nY++ )
- {
- Scanline pScan = pAcc->GetScanline( nY );
-
- for( tools::Long nX = 0; nX < nWidth; nX++, pScan++ )
- {
- if( *pScan == cSearchTransparency )
- *pScan = cReplaceTransparency;
- }
- }
- }
- else
- {
- BitmapColor aReplace( cReplaceTransparency );
-
- for( tools::Long nY = 0; nY < nHeight; nY++ )
- {
- Scanline pScanline = pAcc->GetScanline(nY);
- for( tools::Long nX = 0; nX < nWidth; nX++ )
- {
- if( pAcc->GetIndexFromData( pScanline, nX ) == cSearchTransparency )
- pAcc->SetPixelOnData( pScanline, nX, aReplace );
- }
- }
- }
-}
-
void AlphaMask::BlendWith(const Bitmap& rOther)
{
std::shared_ptr<SalBitmap> xImpBmp(ImplGetSVData()->mpDefInst->CreateSalBitmap());