diff options
44 files changed, 390 insertions, 137 deletions
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 35fbbac1d76f..56e46040ac5e 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -169,7 +169,7 @@ int OpenGLRender::InitOpenGL() return 0; } -int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength) +void OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength) { if (m_Line2DPointList.empty()) { @@ -184,7 +184,6 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength) m_Line2DShapePointList.push_back(m_Line2DPointList); m_Line2DPointList.clear(); } - return 0; } int OpenGLRender::RenderLine2FBO() @@ -275,13 +274,12 @@ void OpenGLRender::prepareToRender() m_fZStep = 0; } -int OpenGLRender::MoveModelf(const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale) +void OpenGLRender::MoveModelf(const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale) { glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z)); glm::mat4 aScaleMatrix = glm::scale(glm::vec3(scale.x, scale.y, scale.z)); glm::mat4 aRotationMatrix = glm::eulerAngleYXZ(angle.y, angle.x, angle.z); m_Model = aTranslationMatrix * aRotationMatrix * aScaleMatrix; - return 0; } void OpenGLRender::Release() @@ -392,7 +390,7 @@ int OpenGLRender::Create2DCircle(int detail) return 0; } -int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float directionY) +void OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float directionY) { //check whether to create the circle data if (m_Bubble2DCircle.empty()) @@ -407,7 +405,6 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d aBubble2DPointList.y = y + aBubble2DPointList.yScale / 2; m_Bubble2DShapePointList.push_back(aBubble2DPointList); - return 0; } int OpenGLRender::RenderBubble2FBO() @@ -487,7 +484,7 @@ int OpenGLRender::RenderBubble2FBO() return 0; } -int OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float directionY) +void OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float directionY) { RectanglePointList aRectangle; @@ -505,10 +502,9 @@ int OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float aRectangle.points[11] = m_fZStep; m_RectangleShapePointList.push_back(aRectangle); - return 0; } -int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill) +void OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill) { for (auto const& pointList : m_RectangleShapePointList) { @@ -613,7 +609,6 @@ int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill) CHECK_GL_ERROR(); m_fZStep += Z_STEP; - return 0; } @@ -637,11 +632,12 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Size& OpenGLHelper::ConvertBitmapExToRGBATextureBuffer(rBitmapEx, bitmapBuf.get()); - return CreateTextTexture(bitmapBuf, rBitmapEx.GetSizePixel(), + CreateTextTexture(bitmapBuf, rBitmapEx.GetSizePixel(), aSize, rotation, rTrans); + return 0; } -int OpenGLRender::CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixels, +void OpenGLRender::CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixels, const ::Size &aPixelSize, const awt::Size& aSize, long rotation, @@ -688,10 +684,9 @@ int OpenGLRender::CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixel glBindTexture(GL_TEXTURE_2D, 0); CHECK_GL_ERROR(); m_TextInfoVector.push_back(aTextInfo); - return 0; } -int OpenGLRender::RenderTextShape() +void OpenGLRender::RenderTextShape() { CHECK_GL_ERROR(); for (auto const& textInfo : m_TextInfoVector) @@ -753,10 +748,9 @@ int OpenGLRender::RenderTextShape() m_TextInfoVector.clear(); CHECK_GL_ERROR(); m_fZStep += Z_STEP; - return 0; } -int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength) +void OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength) { if (m_Area2DPointList.empty()) { @@ -771,7 +765,6 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength) m_Area2DShapePointList.push_back(m_Area2DPointList); m_Area2DPointList.clear(); } - return 0; } namespace { @@ -799,7 +792,7 @@ bool checkCCW(const PointList& rPoints) } -int OpenGLRender::RenderArea2DShape() +void OpenGLRender::RenderArea2DShape() { CHECK_GL_ERROR(); @@ -847,8 +840,6 @@ int OpenGLRender::RenderArea2DShape() m_fZStep += Z_STEP; CHECK_GL_ERROR(); - - return 0; } void OpenGLRender::SetBackGroundColor(::Color color1, ::Color color2, css::drawing::FillStyle fillStyle) @@ -932,7 +923,7 @@ void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadiu m_PieSegment2DShapePointList.push_back(aPointList); } -int OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY) +void OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY) { int listNum = m_PieSegment2DShapePointList.size(); PosVecf3 const trans = {fPosX, fPosY, 0.0f}; @@ -975,10 +966,9 @@ int OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY) m_fZStep += Z_STEP; CHECK_GL_ERROR(); - return 0; } -int OpenGLRender::RenderSymbol2DShape(float x, float y, sal_Int32 nSymbol) +void OpenGLRender::RenderSymbol2DShape(float x, float y, sal_Int32 nSymbol) { CHECK_GL_ERROR(); @@ -1028,7 +1018,6 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, sal_Int32 nSymbol) m_fZStep += Z_STEP; CHECK_GL_ERROR(); - return 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index b222a40f6647..3b9d8700c3ce 100644 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -67,24 +67,24 @@ public: OpenGLRender(); ~OpenGLRender(); int InitOpenGL(); - int MoveModelf(const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale); + void MoveModelf(const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale); void SetSize(int width, int height); void SetSizePixel(int width, int height); void Release(); int RenderLine2FBO(); - int SetLine2DShapePoint(float x, float y, int listLength); + void SetLine2DShapePoint(float x, float y, int listLength); void SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uInt8 nAlpha); void SetLine2DWidth(int width); void SetColor(sal_uInt32 color, sal_uInt8 nAlpha); - int Bubble2DShapePoint(float x, float y, float directionX, float directionY); + void Bubble2DShapePoint(float x, float y, float directionX, float directionY); int RenderBubble2FBO(); void prepareToRender(); - int RenderRectangleShape(bool bBorder, bool bFill); - int RectangleShapePoint(float x, float y, float directionX, float directionY); + void RenderRectangleShape(bool bBorder, bool bFill); + void RectangleShapePoint(float x, float y, float directionX, float directionY); - int CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixels, + void CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixels, const ::Size &aPixelSize, const css::awt::Size& aSize, long rotation, @@ -92,16 +92,16 @@ public: int CreateTextTexture(const BitmapEx& rBitmapEx, const css::awt::Size& aSize, long rotation, const css::drawing::HomogenMatrix3& rTrans); - int RenderTextShape(); + void RenderTextShape(); - int SetArea2DShapePoint(float x, float y, int listLength); - int RenderArea2DShape(); + void SetArea2DShapePoint(float x, float y, int listLength); + void RenderArea2DShape(); void SetChartTransparencyGradient(long transparencyGradient); void GeneratePieSegment2D(double, double, double, double); - int RenderPieSegment2DShape(float, float, float); + void RenderPieSegment2DShape(float, float, float); - int RenderSymbol2DShape(float, float, sal_Int32); + void RenderSymbol2DShape(float, float, sal_Int32); #if DEBUG_POSITIONING void renderDebug(); #endif diff --git a/compilerplugins/clang/shouldreturnbool.cxx b/compilerplugins/clang/shouldreturnbool.cxx new file mode 100644 index 000000000000..d993bf25f21e --- /dev/null +++ b/compilerplugins/clang/shouldreturnbool.cxx @@ -0,0 +1,250 @@ +/* -*- 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/. + */ + +#include <string> +#include <set> +#include <iostream> + +#include "check.hxx" +#include "plugin.hxx" +#include "functionaddress.hxx" + +/* + Look for functions that only return 1 and/or 0, which sometimes indicates that the + function should be returning bool. + + Note that is partly a question of taste and code style, which is why this plugin is off by default. +*/ + +namespace +{ +class ShouldReturnBool : public loplugin::FunctionAddress<ShouldReturnBool> +{ +public: + explicit ShouldReturnBool(loplugin::InstantiationData const& data) + : loplugin::FunctionAddress<ShouldReturnBool>(data) + { + } + + virtual void run() override + { + if (!compiler.getLangOpts().CPlusPlus) + return; + StringRef fn(compiler.getSourceManager() + .getFileEntryForID(compiler.getSourceManager().getMainFileID()) + ->getName()); + // functions used as function pointers + if (loplugin::isSamePathname(fn, SRCDIR "/sal/rtl/alloc_cache.cxx")) + return; + // false +, slightly odd usage, but not wrong + if (loplugin::isSamePathname(fn, SRCDIR "/libreofficekit/qa/tilebench/tilebench.cxx") + || loplugin::isSamePathname(fn, SRCDIR "/smoketest/libtest.cxx")) + return; + // uses the Unix convention of "non-zero return indicates error" + if (loplugin::isSamePathname(fn, SRCDIR "/idlc/source/idlcproduce.cxx")) + return; + // template magic + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/gdi/bmpfast.cxx")) + return; + // fine + if (loplugin::isSamePathname(fn, SRCDIR "/svl/unx/source/svdde/ddedummy.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/opengl/OpenGLHelper.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/svtools/source/misc/imap2.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/svx/source/dialog/docrecovery.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/hwpfilter/source/lexer.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/hwpfilter/source/grammar.cxx")) + return; + if (loplugin::isSamePathname( + fn, SRCDIR "/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/dbaccess/source/ui/browser/dsEntriesNoExp.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/lotuswordpro/source/filter/explode.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/filter/source/graphicfilter/ipict/ipict.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/core/data/dptabsrc.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/docshell/docsh3.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/ui/dlg/masterlayoutdlg.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/sd/source/filter/ppt/pptinanimations.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/vcl/unx/generic/app/i18n_im.cxx")) + return; + + // callback + if (loplugin::isSamePathname(fn, SRCDIR "/sax/source/expatwrap/sax_expat.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/xmlsecurity/source/xmlsec/xmlstreamio.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/ww8/ww8par.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/ww8/ww8par2.cxx")) + return; + if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/ww8/ww8par5.cxx")) + return; + // SaxWriterHelper::writeSequence a little weird + if (loplugin::isSamePathname(fn, SRCDIR "/sax/source/expatwrap/saxwriter.cxx")) + return; + // main function + if (loplugin::isSamePathname(fn, SRCDIR "/xmlsecurity/workben/pdfverify.cxx")) + return; + + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + + for (auto functionDecl : problemFunctions) + { + auto canonicalDecl = functionDecl->getCanonicalDecl(); + if (getFunctionsWithAddressTaken().find(canonicalDecl) + != getFunctionsWithAddressTaken().end()) + continue; + report(DiagnosticsEngine::Warning, + "only returning one or zero is an indication you want to return bool", + functionDecl->getLocStart()) + << functionDecl->getSourceRange(); + if (canonicalDecl->getLocation() != functionDecl->getLocation()) + { + report(DiagnosticsEngine::Note, "canonical function declaration here", + canonicalDecl->getLocStart()) + << canonicalDecl->getSourceRange(); + } + } + } + + bool TraverseFunctionDecl(FunctionDecl*); + bool TraverseCXXMethodDecl(CXXMethodDecl*); + bool VisitReturnStmt(ReturnStmt const*); + +private: + bool mbInsideFunction = false; + bool mbFunctionOnlyReturningOneOrZero = false; + std::unordered_set<FunctionDecl const*> problemFunctions; + + bool IsInteresting(FunctionDecl const*); + void Report(FunctionDecl const*) const; + bool isExprOneOrZero(Expr const*) const; +}; + +bool ShouldReturnBool::TraverseFunctionDecl(FunctionDecl* functionDecl) +{ + bool ret; + if (IsInteresting(functionDecl)) + { + mbInsideFunction = true; + mbFunctionOnlyReturningOneOrZero = true; + ret = loplugin::FunctionAddress<ShouldReturnBool>::TraverseFunctionDecl(functionDecl); + mbInsideFunction = false; + if (mbFunctionOnlyReturningOneOrZero) + problemFunctions.insert(functionDecl); + } + else + ret = loplugin::FunctionAddress<ShouldReturnBool>::TraverseFunctionDecl(functionDecl); + return ret; +} + +bool ShouldReturnBool::TraverseCXXMethodDecl(CXXMethodDecl* methodDecl) +{ + bool ret; + if (IsInteresting(methodDecl)) + { + mbInsideFunction = true; + mbFunctionOnlyReturningOneOrZero = true; + ret = loplugin::FunctionAddress<ShouldReturnBool>::TraverseCXXMethodDecl(methodDecl); + mbInsideFunction = false; + if (mbFunctionOnlyReturningOneOrZero) + problemFunctions.insert(methodDecl); + } + else + ret = loplugin::FunctionAddress<ShouldReturnBool>::TraverseCXXMethodDecl(methodDecl); + return ret; +} + +bool ShouldReturnBool::IsInteresting(FunctionDecl const* functionDecl) +{ + if (ignoreLocation(functionDecl)) + return false; + // ignore stuff that forms part of the stable URE interface + if (isInUnoIncludeFile(functionDecl)) + return false; + if (functionDecl->getTemplatedKind() != FunctionDecl::TK_NonTemplate) + return false; + if (!functionDecl->isThisDeclarationADefinition()) + return false; + if (functionDecl->isMain()) + return false; + if (functionDecl->isExternC() || functionDecl->isInExternCContext()) + return false; + auto methodDecl = dyn_cast<CXXMethodDecl>(functionDecl); + if (methodDecl && methodDecl->isVirtual()) + return false; + auto tc = loplugin::TypeCheck(functionDecl->getReturnType()); + if (tc.AnyBoolean() || tc.Void()) + return false; + auto returnType = functionDecl->getReturnType(); + if (returnType->isEnumeralType() || !returnType->getUnqualifiedDesugaredType()->isIntegerType()) + return false; + // Ignore functions that contains #ifdef-ery + if (containsPreprocessingConditionalInclusion(functionDecl->getSourceRange())) + return false; + + // not sure what basegfx is doing here + StringRef fileName{ compiler.getSourceManager().getFilename(functionDecl->getLocation()) }; + if (loplugin::isSamePathname(fileName, SRCDIR "/include/basegfx/range/basicrange.hxx")) + return false; + // false + + if (loplugin::isSamePathname(fileName, SRCDIR "/include/svl/macitem.hxx")) + return false; + if (loplugin::isSamePathname(fileName, SRCDIR "/lotuswordpro/source/filter/lwpcharsetmgr.hxx")) + return false; + if (loplugin::isSamePathname(fileName, SRCDIR "/sc/inc/dptabsrc.hxx")) + return false; + + return true; +} + +bool ShouldReturnBool::VisitReturnStmt(const ReturnStmt* returnStmt) +{ + if (!mbInsideFunction) + return true; + if (!returnStmt->getRetValue()) + return true; + if (loplugin::TypeCheck(returnStmt->getRetValue()->getType()).AnyBoolean()) + return true; + if (!isExprOneOrZero(returnStmt->getRetValue())) + mbFunctionOnlyReturningOneOrZero = false; + return true; +} + +bool ShouldReturnBool::isExprOneOrZero(const Expr* arg) const +{ + arg = arg->IgnoreParenCasts(); + // ignore this, it seems to trigger an infinite recursion + if (isa<UnaryExprOrTypeTraitExpr>(arg)) + { + return false; + } + APSInt x1; + if (arg->EvaluateAsInt(x1, compiler.getASTContext())) + { + return x1 == 1 || x1 == 0; + } + return false; +} + +loplugin::Plugin::Registration<ShouldReturnBool> X("shouldreturnbool", false); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/test/shouldreturnbool.cxx b/compilerplugins/clang/test/shouldreturnbool.cxx new file mode 100644 index 000000000000..03a698e30ed4 --- /dev/null +++ b/compilerplugins/clang/test/shouldreturnbool.cxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +int foo1(char ch) +{ + // expected-error@-2 {{only returning one or zero is an indication you want to return bool [loplugin:shouldreturnbool]}} + if (ch == 'x') + return 1; + return 0; +} + +long foo2() +{ + // expected-error@-2 {{only returning one or zero is an indication you want to return bool [loplugin:shouldreturnbool]}} + return 1; +} + +enum Enum1 +{ + NONE +}; + +Enum1 foo3() { return Enum1::NONE; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index 345438a23cb3..6d87a95f73a5 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -564,11 +564,12 @@ IMPL_LINK( SvxMacroTabPage_, AssignDeleteHdl_Impl, Button*, pBtn, void ) IMPL_LINK_NOARG( SvxMacroTabPage_, DoubleClickHdl_Impl, SvTreeListBox*, bool) { - return GenericHandler_Impl( this, nullptr ); + GenericHandler_Impl( this, nullptr ); + return false; } // handler for double click on the listbox, and for the assign/delete buttons -long SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* pBtn ) +void SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* pBtn ) { SvxMacroTabPage_Impl* pImpl = pThis->mpImpl; SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); @@ -576,7 +577,7 @@ long SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* if( !pE || LISTBOX_ENTRY_NOTFOUND == rListBox.GetModel()->GetAbsPos( pE ) ) { DBG_ASSERT( pE, "Where does the empty entry come from?" ); - return 0; + return; } const bool bAssEnabled = pBtn != pImpl->pDeletePB && pImpl->pAssignPB->IsEnabled(); @@ -675,7 +676,6 @@ long SvxMacroTabPage_::GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* rListBox.SetUpdateMode( true ); pThis->EnableButtons(); - return 0; } // pass in the XNameReplace. diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx index 2020c3e4f0bf..040fcc7838d2 100644 --- a/cui/source/inc/macropg.hxx +++ b/cui/source/inc/macropg.hxx @@ -61,7 +61,7 @@ class SvxMacroTabPage_ : public SfxTabPage DECL_LINK( AssignDeleteHdl_Impl, Button *, void ); DECL_LINK( DoubleClickHdl_Impl, SvTreeListBox*, bool ); - static long GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* pBtn ); + static void GenericHandler_Impl( SvxMacroTabPage_* pThis, PushButton* pBtn ); css::uno::Reference< css::container::XNameReplace > m_xAppEvents; protected: diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 56ff504827b7..741fa77b3da0 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -657,7 +657,7 @@ private: EditPaM ReadHTML( SvStream& rInput, const OUString& rBaseURL, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs ); ErrCode WriteText( SvStream& rOutput, EditSelection aSel ); ErrCode WriteRTF( SvStream& rOutput, EditSelection aSel ); - sal_uInt32 WriteXML(SvStream& rOutput, const EditSelection& rSel); + void WriteXML(SvStream& rOutput, const EditSelection& rSel); void WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, std::vector<SvxFontItem*>& rFontTable, SvxColorList& rColorList ); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 8fcf39508d33..a19876928bb4 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -268,13 +268,11 @@ static void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_Int32 } } -sal_uInt32 ImpEditEngine::WriteXML(SvStream& rOutput, const EditSelection& rSel) +void ImpEditEngine::WriteXML(SvStream& rOutput, const EditSelection& rSel) { ESelection aESel = CreateESel(rSel); SvxWriteXML( *GetEditEnginePtr(), rOutput, aESel ); - - return 0; } ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 42222d14119f..82c3da7f4d96 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -371,7 +371,7 @@ void OutlinerView::ImpToggleExpand( Paragraph const * pPara ) pEditView->ShowCursor(); } -sal_Int32 OutlinerView::Select( Paragraph const * pParagraph, bool bSelect ) +void OutlinerView::Select( Paragraph const * pParagraph, bool bSelect ) { sal_Int32 nPara = pOwner->pParaList->GetAbsPos( pParagraph ); sal_Int32 nEnd = 0; @@ -380,7 +380,6 @@ sal_Int32 OutlinerView::Select( Paragraph const * pParagraph, bool bSelect ) ESelection aSel( nPara, 0, nPara, nEnd ); pEditView->SetSelection( aSel ); - return 1; } diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index b5691b93c38a..b27546e1343f 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -102,7 +102,8 @@ namespace XSLT on_close(void * context) { Reader * tmp = static_cast<Reader*> (context); - return tmp->closeOutput(); + tmp->closeOutput(); + return 0; } }; /** @@ -251,7 +252,7 @@ namespace XSLT return len; } - int + void Reader::closeOutput() { css::uno::Reference<XOutputStream> xos = m_transformer->getOutputStream(); @@ -261,7 +262,6 @@ namespace XSLT xos.get()->closeOutput(); } m_transformer->done(); - return 0; } void diff --git a/filter/source/xsltfilter/LibXSLTTransformer.hxx b/filter/source/xsltfilter/LibXSLTTransformer.hxx index 2e434033f93c..7261978ed6ed 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.hxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.hxx @@ -61,7 +61,7 @@ namespace XSLT int read(char * buffer, int len); int write(const char * buffer, int len); void forceStateStopped(); - int closeOutput(); + void closeOutput(); private: virtual ~Reader() override; diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx index 9059870ebdd5..52c0a0b6b707 100644 --- a/forms/source/richtext/richtextimplcontrol.cxx +++ b/forms/source/richtext/richtextimplcontrol.cxx @@ -552,7 +552,7 @@ namespace frm } } - long RichTextControlImpl::HandleCommand( const CommandEvent& _rEvent ) + bool RichTextControlImpl::HandleCommand( const CommandEvent& _rEvent ) { if ( ( _rEvent.GetCommand() == CommandEventId::Wheel ) || ( _rEvent.GetCommand() == CommandEventId::StartAutoScroll ) @@ -560,9 +560,9 @@ namespace frm ) { m_pAntiImpl->HandleScrollCommand( _rEvent, m_pHScroll, m_pVScroll ); - return 1; + return true; } - return 0; + return false; } diff --git a/forms/source/richtext/richtextimplcontrol.hxx b/forms/source/richtext/richtextimplcontrol.hxx index cac441a1ed83..635799baeb40 100644 --- a/forms/source/richtext/richtextimplcontrol.hxx +++ b/forms/source/richtext/richtextimplcontrol.hxx @@ -145,7 +145,7 @@ namespace frm void Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize ); /// handles command events arrived at the anti-impl control - long HandleCommand( const CommandEvent& _rEvent ); + bool HandleCommand( const CommandEvent& _rEvent ); private: // updates the cache with the state provided by the given attribute handler diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 6ccb634bf73f..ac43ea6ebe5d 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -1799,10 +1799,10 @@ void SvtFileDialog::EnableControl( Control* _pControl, bool _bEnable ) } -short SvtFileDialog::PrepareExecute() +bool SvtFileDialog::PrepareExecute() { if (comphelper::LibreOfficeKit::isActive()) - return 0; + return false; OUString aEnvValue; if ( getEnvironmentValue( "WorkDirMustContainRemovableMedia", aEnvValue ) && aEnvValue == "1" ) @@ -1839,7 +1839,7 @@ short SvtFileDialog::PrepareExecute() VclMessageType::Warning, VclButtonsType::Ok, FpsResId(STR_SVT_NOREMOVABLEDEVICE))); xBox->run(); - return 0; + return false; } } } @@ -1939,7 +1939,7 @@ short SvtFileDialog::PrepareExecute() OUString aFilter; if ( !IsolateFilterFromPath_Impl( _aPath, aFilter ) ) - return 0; + return false; AdjustFilterFlags nNewFilterFlags = adjustFilter( aFilter ); if ( nNewFilterFlags & ( AdjustFilterFlags::NonEmpty | AdjustFilterFlags::UserFilter ) ) @@ -1979,7 +1979,7 @@ short SvtFileDialog::PrepareExecute() // if applicable read and set size from ini InitSize(); - return 1; + return true; } diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx index 55d7270e09da..3cb4f631e307 100644 --- a/fpicker/source/office/iodlg.hxx +++ b/fpicker/source/office/iodlg.hxx @@ -165,7 +165,7 @@ private: <member>EnableUI</member> for details. */ void EnableControl( Control* _pControl, bool _bEnable ); - short PrepareExecute(); + bool PrepareExecute(); public: SvtFileDialog( vcl::Window* _pParent, PickerFlags nBits ); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index e8925e9de098..a2a1df0c8e90 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -903,7 +903,7 @@ bool ToolbarLayoutManager::dockAllToolbars() return bResult; } -long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent const * pEvent ) +void ToolbarLayoutManager::childWindowEvent( VclSimpleEvent const * pEvent ) { // To enable toolbar controllers to change their image when a sub-toolbar function // is activated, we need this mechanism. We have NO connection between these toolbars @@ -982,8 +982,6 @@ long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent const * pEvent ) } } } - - return 1; } void ToolbarLayoutManager::resetDockingArea() diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx index def4ea56fedd..12dfffe46e50 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx @@ -125,7 +125,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper< css::awt::XDockableW css::uno::Sequence< css::uno::Reference< css::ui::XUIElement > > getToolbars(); // child window notifications - long childWindowEvent( VclSimpleEvent const * pEvent ); + void childWindowEvent( VclSimpleEvent const * pEvent ); // XInterface diff --git a/hwpfilter/source/solver.cxx b/hwpfilter/source/solver.cxx index f297160159f1..d1c76b8cd916 100644 --- a/hwpfilter/source/solver.cxx +++ b/hwpfilter/source/solver.cxx @@ -62,18 +62,18 @@ double* mgcLinearSystemD::NewVector (int N) return B; } -int mgcLinearSystemD::Solve (int n, double** a, double* b) +bool mgcLinearSystemD::Solve (int n, double** a, double* b) { std::unique_ptr<int[]> indxc( new int[n] ); if ( !indxc ) - return 0; + return false; std::unique_ptr<int[]> indxr( new int[n] ); if ( !indxr ) { - return 0; + return false; } std::unique_ptr<int[]> ipiv( new int[n] ); if ( !ipiv ) { - return 0; + return false; } int i, j, k; @@ -104,7 +104,7 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b) } else if ( ipiv[k] > 1 ) { - return 0; + return false; } } } @@ -126,7 +126,7 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b) indxc[i] = icol; if ( a[icol][icol] == 0 ) { - return 0; + return false; } double pivinv = 1/a[icol][icol]; @@ -161,7 +161,7 @@ int mgcLinearSystemD::Solve (int n, double** a, double* b) } } - return 1; + return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/hwpfilter/source/solver.h b/hwpfilter/source/solver.h index 54daf1542653..ea3295bad9d4 100644 --- a/hwpfilter/source/solver.h +++ b/hwpfilter/source/solver.h @@ -27,7 +27,7 @@ public: static void DeleteMatrix (int N, double** A); static double* NewVector (int N); - static int Solve (int N, double** A, double* b); + static bool Solve (int N, double** A, double* b); // Input: // A[N][N] coefficient matrix, entries are A[row][col] // b[N] vector, entries are b[row] diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 6ad87b3385e5..3c0126f3b31b 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -248,8 +248,7 @@ public: void CreateSelectionList (std::vector<Paragraph*> &aSelList) ; - // Returns the number of selected paragraphs - sal_Int32 Select( Paragraph const * pParagraph, bool bSelect = true); + void Select( Paragraph const * pParagraph, bool bSelect = true); OUString GetSelected() const; void SelectRange( sal_Int32 nFirst, sal_Int32 nCount ); diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx index 94944c105845..1cd06615d1a3 100644 --- a/sal/rtl/alloc_arena.cxx +++ b/sal/rtl/alloc_arena.cxx @@ -73,14 +73,12 @@ void rtl_machdep_free( sal_Size rtl_machdep_pagesize(); -int rtl_arena_segment_constructor(void * obj) +void rtl_arena_segment_constructor(void * obj) { rtl_arena_segment_type * segment = static_cast<rtl_arena_segment_type*>(obj); QUEUE_START_NAMED(segment, s); QUEUE_START_NAMED(segment, f); - - return 1; } void rtl_arena_segment_destructor(void * obj) @@ -425,7 +423,7 @@ dequeue_and_leave: @precond arena->m_lock acquired @precond (*ppSegment == 0) */ -int rtl_arena_segment_create( +bool rtl_arena_segment_create( rtl_arena_type * arena, sal_Size size, rtl_arena_segment_type ** ppSegment @@ -463,14 +461,14 @@ int rtl_arena_segment_create( QUEUE_INSERT_HEAD_NAMED(span, (*ppSegment), s); /* report success */ - return 1; + return true; } rtl_arena_segment_put (arena, &span); } rtl_arena_segment_put (arena, ppSegment); } } - return 0; + return false; // failure } /** diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 84ee1cc30798..314a6a8eb696 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1215,9 +1215,9 @@ public: size_t GetWindowSize() const { return mpDVR->GetRefRowSize(); } - size_t GetStartFixed() const { return bIsStartFixed; } + bool GetStartFixed() const { return bIsStartFixed; } - size_t GetEndFixed() const { return bIsEndFixed; } + bool GetEndFixed() const { return bIsEndFixed; } protected: bool bIsStartFixed, bIsEndFixed; diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index f97fb9c31f75..db6e7f23a3e2 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -45,6 +45,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/salcall \ compilerplugins/clang/test/sallogareas \ compilerplugins/clang/test/salunicodeliteral \ + compilerplugins/clang/test/shouldreturnbool \ compilerplugins/clang/test/simplifybool \ compilerplugins/clang/test/simplifydynamiccast \ compilerplugins/clang/test/stringconstant \ diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 1a34da60d420..fad48695797d 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -396,13 +396,12 @@ OStorePageBIOS::Ace::~Ace() m_prev->m_next = m_next; } -int +void SAL_CALL OStorePageBIOS::Ace::constructor ( void * obj, SAL_UNUSED_PARAMETER void * /* arg */) { Ace * ace = static_cast<Ace*>(obj); ace->m_next = ace->m_prev = ace; - return 1; } OStorePageBIOS::Ace * diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index 8c2abd54f5a7..fafb54e79fed 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -141,7 +141,7 @@ public: Ace(); ~Ace(); - static int SAL_CALL constructor (void * obj, void * arg); + static void SAL_CALL constructor (void * obj, void * arg); static Ace * find (Ace * head, sal_uInt32 addr); static void insert (Ace * head, Ace * entry); diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 42a542ff3502..07308fa4db3d 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -202,7 +202,7 @@ public: Copy all selections to the document. */ bool CopySelToDoc( SwDoc* pInsDoc ); - long SplitNode( bool bAutoFormat = false, bool bCheckTableStart = true ); + void SplitNode( bool bAutoFormat = false, bool bCheckTableStart = true ); bool AppendTextNode(); void AutoFormatBySplitNode(); diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index a3eddaedf991..cb32b2180a32 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -279,12 +279,12 @@ class SW_DLLPUBLIC SwView: public SfxViewShell SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips& rOff) const; // scrollbar movements - SAL_DLLPRIVATE long PageUp(); - SAL_DLLPRIVATE long PageDown(); + SAL_DLLPRIVATE bool PageUp(); + SAL_DLLPRIVATE bool PageDown(); SAL_DLLPRIVATE bool PageUpCursor(bool bSelect); SAL_DLLPRIVATE bool PageDownCursor(bool bSelect); - SAL_DLLPRIVATE long PhyPageUp(); - SAL_DLLPRIVATE long PhyPageDown(); + SAL_DLLPRIVATE void PhyPageUp(); + SAL_DLLPRIVATE void PhyPageDown(); SAL_DLLPRIVATE void CreateScrollbar( bool bHori ); DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar*, void ); @@ -472,10 +472,10 @@ public: void EnableHScrollbar(bool bEnable); void EnableVScrollbar(bool bEnable); - int CreateVRuler(); - int KillVRuler(); - int CreateTab(); - int KillTab(); + void CreateVRuler(); + void KillVRuler(); + void CreateTab(); + void KillTab(); bool StatVRuler() const { return m_pVRuler->IsVisible(); } void ChangeVRulerMetric(FieldUnit eUnit); diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index e3f443b25eec..1971989d93eb 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -184,7 +184,7 @@ void SwEditShell::Overwrite(const OUString &rStr) EndAllAction(); } -long SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart ) +void SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart ) { StartAllAction(); GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr); @@ -204,7 +204,6 @@ long SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart ) ClearTableBoxContent(); EndAllAction(); - return 1; } bool SwEditShell::AppendTextNode() diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 8b93fb6545be..12720302f0e5 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -691,10 +691,10 @@ bool SwGlossaryHdl::CopyToClipboard(SwWrtShell& rSh, const OUString& rShortName) rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rSh ); - int nRet = pTransfer->CopyGlossary( *pGlossary, rShortName ); + bool bRet = pTransfer->CopyGlossary( *pGlossary, rShortName ); if( !pCurGrp ) delete pGlossary; - return 0 != nRet; + return bRet; } bool SwGlossaryHdl::ImportGlossaries( const OUString& rName ) diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 996632519910..10ab121d348e 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1029,10 +1029,10 @@ void SwTransferable::CalculateAndCopy() CopyToClipboard( &m_pWrtShell->GetView().GetEditWin() ); } -int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr ) +bool SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr ) { if(!m_pWrtShell) - return 0; + return false; SwWait aWait( *m_pWrtShell->GetView().GetDocShell(), true ); m_pClpDocFac = new SwDocFac; @@ -1073,7 +1073,7 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr CopyToClipboard( &m_pWrtShell->GetView().GetEditWin() ); - return 1; + return true; } static inline uno::Reference < XTransferable > * lcl_getTransferPointer ( uno::Reference < XTransferable > &xRef ) diff --git a/sw/source/uibase/inc/langhelper.hxx b/sw/source/uibase/inc/langhelper.hxx index 2c7a979fd670..8c93d29d3c36 100644 --- a/sw/source/uibase/inc/langhelper.hxx +++ b/sw/source/uibase/inc/langhelper.hxx @@ -35,7 +35,7 @@ enum class SvtScriptType; namespace SwLangHelper { - extern sal_uInt16 GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ); + extern void GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ); extern bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh ); extern void SetLanguage( SwWrtShell &rWrtSh, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx index e15e4a5664c9..58990e80f943 100644 --- a/sw/source/uibase/inc/swdtflvr.hxx +++ b/sw/source/uibase/inc/swdtflvr.hxx @@ -166,7 +166,7 @@ public: int Copy( bool bIsCut = false ); int PrepareForCopy( bool bIsCut = false ); void CalculateAndCopy(); // special for Calculator - int CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr ); + bool CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr ); // remove the DDE-Link format promise void RemoveDDELinkFormat( const vcl::Window& rWin ); diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index f87d113b80ab..6fbbb38d3d7e 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -188,7 +188,7 @@ public: // #i32329# Enhanced selection void SelSentence (const Point *); void SelPara (const Point *); - long SelAll(); + void SelAll(); // basecursortravelling typedef bool (SwWrtShell:: *FNSimpleMove)(); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index c24d82199a79..ea1810fbc485 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -610,7 +610,8 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) { case SID_LANGUAGE_STATUS://20412: { - nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet); + SwLangHelper::GetLanguageStatus(pOLV,rSet); + nSlotId = 0; break; } diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 33bdcce561df..07b626ad5bb5 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -57,7 +57,7 @@ using namespace ::com::sun::star; namespace SwLangHelper { - sal_uInt16 GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ) + void GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ) { ESelection aSelection = pOLV->GetSelection(); EditView& rEditView=pOLV->GetEditView(); @@ -95,7 +95,6 @@ namespace SwLangHelper SfxStringListItem aItem( SID_LANGUAGE_STATUS ); aItem.SetStringList( aSeq ); rSet.Put( aItem ); - return 0; } bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh ) diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx index f64127c45069..3ecf385bd9f3 100644 --- a/sw/source/uibase/shells/txtcrsr.cxx +++ b/sw/source/uibase/shells/txtcrsr.cxx @@ -155,7 +155,8 @@ void SwTextShell::ExecMove(SfxRequest &rReq) bRet = rSh.SelNearestWrd(); break; case SID_SELECTALL: - bRet = 0 != rSh.SelAll(); + rSh.SelAll(); + bRet = true; break; default: OSL_FAIL("wrong dispatcher"); diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 2944568079a1..5038bae46bf8 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -486,20 +486,18 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void ) delete pbNext; } -int SwView::CreateTab() +void SwView::CreateTab() { m_pHRuler->SetActive(GetFrame() && IsActive()); m_pHRuler->Show(); InvalidateBorder(); - return 1; } -int SwView::KillTab() +void SwView::KillTab() { m_pHRuler->Hide(); InvalidateBorder(); - return 1; } void SwView::ChangeTabMetric( FieldUnit eUnit ) @@ -530,22 +528,20 @@ void SwView::GetHRulerMetric(FieldUnit& eToFill) const eToFill = m_pHRuler->GetUnit(); } -int SwView::CreateVRuler() +void SwView::CreateVRuler() { m_pHRuler->SetBorderPos( m_pVRuler->GetSizePixel().Width()-1 ); m_pVRuler->SetActive(GetFrame() && IsActive()); m_pVRuler->Show(); InvalidateBorder(); - return 1; } -int SwView::KillVRuler() +void SwView::KillVRuler() { m_pVRuler->Hide(); m_pHRuler->SetBorderPos(); InvalidateBorder(); - return 1; } IMPL_LINK( SwView, ExecRulerClick, Ruler *, pRuler, void ) diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 96ae9c630c60..2896dbd653cd 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -576,30 +576,30 @@ bool SwView::GetPageScrollDownOffset( SwTwips &rOff ) const } // Scroll page by page -long SwView::PageUp() +bool SwView::PageUp() { if (!m_aVisArea.GetHeight()) - return 0; + return false; Point aPos(m_aVisArea.TopLeft()); aPos.AdjustY( -(m_aVisArea.GetHeight() - (GetYScroll() / 2)) ); aPos.setY( std::max(0L, aPos.Y()) ); SetVisArea( aPos ); - return 1; + return true; } -long SwView::PageDown() +bool SwView::PageDown() { if ( !m_aVisArea.GetHeight() ) - return 0; + return false; Point aPos( m_aVisArea.TopLeft() ); aPos.AdjustY(m_aVisArea.GetHeight() - (GetYScroll() / 2) ); aPos.setY( SetVScrollMax( aPos.Y() ) ); SetVisArea( aPos ); - return 1; + return true; } -long SwView::PhyPageUp() +void SwView::PhyPageUp() { // Check for the currently visible page, do not format sal_uInt16 nActPage = m_pWrtShell->GetNextPrevPageNum( false ); @@ -615,10 +615,9 @@ long SwView::PhyPageUp() aAlPt.AdjustY(3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height() ); SetVisArea( aAlPt ); } - return 1; } -long SwView::PhyPageDown() +void SwView::PhyPageDown() { // Check for the currently visible page, do not format sal_uInt16 nActPage = m_pWrtShell->GetNextPrevPageNum(); @@ -634,7 +633,6 @@ long SwView::PhyPageDown() aAlPt.AdjustY(3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height() ); SetVisArea( aAlPt ); } - return 1; } bool SwView::PageUpCursor( bool bSelect ) diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 105e1caf7d67..839a95572d2f 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -120,7 +120,7 @@ void SwWrtShell::SelPara(const Point *pPt ) m_bSelWrd = false; // disable SelWord, otherwise no SelLine goes on } -long SwWrtShell::SelAll() +void SwWrtShell::SelAll() { const bool bLockedView = IsViewLocked(); LockView( true ); @@ -205,7 +205,6 @@ long SwWrtShell::SelAll() } EndSelect(); LockView( bLockedView ); - return 1; } // Description: Text search diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx index e4c8b918c09b..3e8dbf152d29 100644 --- a/vcl/inc/salobj.hxx +++ b/vcl/inc/salobj.hxx @@ -26,6 +26,8 @@ struct SystemEnvData; +typedef void (*SALOBJECTPROC)( void* pInst, SalObjEvent nEvent ); + class VCL_PLUGIN_PUBLIC SalObject { void* m_pInst; diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index 29cbaf00c3a6..4f7c2f6a186f 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -221,8 +221,6 @@ enum class SalObjEvent { ToTop = 3 }; -typedef long (*SALOBJECTPROC)( void* pInst, SalObjEvent nEvent ); - struct SalFrameState { WindowStateMask mnMask; diff --git a/vcl/inc/unx/i18n_ic.hxx b/vcl/inc/unx/i18n_ic.hxx index 2da9e8bbc072..c07bc6f3a3fb 100644 --- a/vcl/inc/unx/i18n_ic.hxx +++ b/vcl/inc/unx/i18n_ic.hxx @@ -52,7 +52,7 @@ private: bool SupportInputMethodStyle( XIMStyles const *pIMStyles ); static unsigned int GetWeightingOfIMStyle( XIMStyle n_style ); - Bool IsSupportedIMStyle( XIMStyle n_style ) const; + bool IsSupportedIMStyle( XIMStyle n_style ) const; public: diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 9b36ab44bf43..b96123ddc637 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -42,7 +42,7 @@ using namespace ::com::sun::star; -long ImplSysChildProc( void* pInst, SalObjEvent nEvent ) +void ImplSysChildProc( void* pInst, SalObjEvent nEvent ) { VclPtr<SystemChildWindow> pWindow = static_cast<SystemChildWindow*>(pInst); @@ -92,8 +92,6 @@ long ImplSysChildProc( void* pInst, SalObjEvent nEvent ) default: break; } - - return 0; } void SystemChildWindow::ImplInitSysChild( vcl::Window* pParent, WinBits nStyle, SystemWindowData *pData, bool bShow ) diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 64ad7fc190ff..5dc4f6c435b3 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -465,15 +465,15 @@ SalI18N_InputContext::GetWeightingOfIMStyle( XIMStyle nStyle ) return nWeight; } -Bool +bool SalI18N_InputContext::IsSupportedIMStyle( XIMStyle nStyle ) const { if ( (nStyle & mnSupportedPreeditStyle) && (nStyle & g_nSupportedStatusStyle) ) { - return True; + return true; } - return False; + return false; } bool |