[Libreoffice-commits] core.git: include/tools tools/source

Noel Grandin noel at peralex.com
Fri Jan 15 04:40:14 PST 2016


 include/tools/inetmime.hxx         |    4 -
 include/tools/inetmsg.hxx          |    4 -
 include/tools/link.hxx             |    1 
 include/tools/multisel.hxx         |    6 --
 include/tools/pstm.hxx             |    2 
 include/tools/rc.hxx               |    4 -
 include/tools/ref.hxx              |    2 
 include/tools/resid.hxx            |    3 -
 include/tools/stream.hxx           |    9 +--
 include/tools/urlobj.hxx           |    5 --
 include/tools/vcompat.hxx          |    1 
 include/tools/vector2d.hxx         |   92 -------------------------------------
 include/tools/zcodec.hxx           |    4 -
 tools/source/fsys/urlobj.cxx       |    5 --
 tools/source/generic/poly.cxx      |   25 +++++++++-
 tools/source/inet/inetmime.cxx     |    3 -
 tools/source/inet/inetmsg.cxx      |   12 +---
 tools/source/memtools/multisel.cxx |    7 --
 tools/source/ref/pstm.cxx          |    5 --
 tools/source/stream/stream.cxx     |   16 +-----
 tools/source/stream/strmunx.cxx    |    4 -
 tools/source/stream/strmwnt.cxx    |    6 --
 tools/source/zcodec/zcodec.cxx     |    8 ---
 23 files changed, 58 insertions(+), 170 deletions(-)

New commits:
commit e15a997b153551a4c0e91964b5cff1b6269a9790
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jan 15 12:00:55 2016 +0200

    loplugin:unusedmethods unused return value in include/tools
    
    Change-Id: I77a6a46ca20cb41ed73050185fb2064a1bbf2009
    Reviewed-on: https://gerrit.libreoffice.org/21485
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx
index 1c86055..1bc2404 100644
--- a/include/tools/inetmime.hxx
+++ b/include/tools/inetmime.hxx
@@ -255,10 +255,8 @@ private:
 
         @param pOctets  A null terminated sequence of octets, must not be
         null.
-
-        @return  The length of pOctets (without the terminating null).
      */
-    sal_Size writeSequence(const sal_Char * pSequence);
+    void writeSequence(const sal_Char * pSequence);
 
     /** Write a sequence of octets.
 
diff --git a/include/tools/inetmsg.hxx b/include/tools/inetmsg.hxx
index 996e334..ae7f23c 100644
--- a/include/tools/inetmsg.hxx
+++ b/include/tools/inetmsg.hxx
@@ -174,8 +174,8 @@ public:
     }
     INetMIMEMessage* GetParent() const { return pParent; }
 
-    bool EnableAttachMultipartFormDataChild();
-    bool AttachChild (
+    void EnableAttachMultipartFormDataChild();
+    void AttachChild (
         INetMIMEMessage& rChildMsg, bool bOwner = true );
 
     const OString& GetMultipartBoundary() const { return m_aBoundary; }
diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index 584f963..3eaea7b 100644
--- a/include/tools/link.hxx
+++ b/include/tools/link.hxx
@@ -101,7 +101,6 @@ public:
     bool operator ==(Link const & other) const
     { return function_ == other.function_ && instance_ == other.instance_; };
 
-    bool operator !=(Link const & other) const { return !operator ==(other); };
     void *GetInstance() const { return instance_; }
 
 private:
diff --git a/include/tools/multisel.hxx b/include/tools/multisel.hxx
index 3b6dafc..633f507 100644
--- a/include/tools/multisel.hxx
+++ b/include/tools/multisel.hxx
@@ -44,7 +44,7 @@ private:
 
     TOOLS_DLLPRIVATE void           ImplClear();
     TOOLS_DLLPRIVATE size_t         ImplFindSubSelection( long nIndex ) const;
-    TOOLS_DLLPRIVATE bool           ImplMergeSubSelections( size_t nPos1, size_t nPos2 );
+    TOOLS_DLLPRIVATE void           ImplMergeSubSelections( size_t nPos1, size_t nPos2 );
     TOOLS_DLLPRIVATE long           ImplFwdUnselected();
 
 public:
@@ -55,10 +55,6 @@ public:
 
     MultiSelection& operator= ( const MultiSelection& rOrig );
     bool            operator== ( MultiSelection& rOrig );
-    bool            operator!= ( MultiSelection& rOrig )
-                        { return !operator==( rOrig ); }
-    bool            operator !() const
-                        { return nSelCount == 0; }
 
     void            SelectAll( bool bSelect = true );
     bool            Select( long nIndex, bool bSelect = true );
diff --git a/include/tools/pstm.hxx b/include/tools/pstm.hxx
index e1e5843..92b5349 100644
--- a/include/tools/pstm.hxx
+++ b/include/tools/pstm.hxx
@@ -145,7 +145,7 @@ class TOOLS_DLLPUBLIC SvPersistStream : public SvStream
 
 protected:
     void                WriteObj( sal_uInt8 nHdr, SvPersistBase * pObj );
-    sal_uInt32          ReadObj( SvPersistBase * & rpObj, bool bRegister );
+    void                ReadObj( SvPersistBase * & rpObj, bool bRegister );
 
 public:
     virtual void        ResetError() override;
diff --git a/include/tools/rc.hxx b/include/tools/rc.hxx
index 6b1e1be..372b70b 100644
--- a/include/tools/rc.hxx
+++ b/include/tools/rc.hxx
@@ -44,8 +44,8 @@ protected:
     { return m_pResMgr->GetClass(); }
 
     // increase the memory pointer gotten by GetClassRes()
-    void* IncrementRes( sal_uInt32 nBytes )
-    { return m_pResMgr->Increment( nBytes ); }
+    void IncrementRes( sal_uInt32 nBytes )
+    { m_pResMgr->Increment( nBytes ); }
 
     // return the memory size of a Resource data block
     static sal_uInt32   GetObjSizeRes( RSHEADER_TYPE * pHT )
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index 2ca5def..a161254 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -196,8 +196,6 @@ public:
                          { return _xHdl.Is() && _xHdl->GetObj(); }
     inline T*            operator -> () const
                          { return _xHdl.Is() ? _xHdl->GetObj() : 0; }
-    inline T*            operator &  () const
-                         { return _xHdl.Is() ? _xHdl->GetObj() : 0; }
     inline operator T* () const
                          { return _xHdl.Is() ? _xHdl->GetObj() : 0; }
 };
diff --git a/include/tools/resid.hxx b/include/tools/resid.hxx
index dd0188d..aa47075 100644
--- a/include/tools/resid.hxx
+++ b/include/tools/resid.hxx
@@ -99,11 +99,10 @@ public:
     }
 
     ResMgr *        GetResMgr() const { return m_pResMgr; }
-    const ResId &   SetResMgr( ResMgr * pMgr ) const
+    void            SetResMgr( ResMgr * pMgr ) const
     {
         m_pResMgr = pMgr;
         OSL_ENSURE( m_pResMgr != nullptr, "invalid ResMgr set on ResId" );
-        return *this;
     }
 
     const ResId &  SetAutoRelease(bool bRelease) const
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 9b7182c..16b46fb 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -361,7 +361,7 @@ public:
     bool            WriteByteStringLine( const OUString& rStr, rtl_TextEncoding eDestCharSet );
 
     /// Switch to no endian swapping and write 0xfeff
-    bool            StartWritingUnicodeText();
+    void            StartWritingUnicodeText();
 
     /** If eReadBomCharSet==RTL_TEXTENCODING_DONTKNOW: read 16bit, if 0xfeff do
         nothing (UTF-16), if 0xfffe switch endian swapping (UTF-16), if 0xefbb
@@ -372,7 +372,7 @@ public:
 
         If eReadBomCharSet!=RTL_TEXTENCODING_DONTKNOW: only read a BOM of that
         encoding and switch endian swapping if UTF-16 and 0xfffe. */
-    bool            StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet );
+    void            StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet );
 
     /** Read a line of Unicode.
 
@@ -621,7 +621,7 @@ private:
     bool LockRange( sal_Size nByteOffset, sal_Size nBytes );
     bool UnlockRange( sal_Size nByteOffset, sal_Size nBytes );
     bool LockFile();
-    bool UnlockFile();
+    void UnlockFile();
 
 protected:
     virtual sal_Size GetData( void* pData, sal_Size nSize ) override;
@@ -695,10 +695,9 @@ public:
     sal_uInt64     GetSize();
     sal_Size        GetEndOfData() const { return nEndOfData; }
     const void*     GetData() { Flush(); return pBuf; }
-    operator const  void*() { Flush(); return pBuf; }
 
     void*           SwitchBuffer( sal_Size nInitSize=512, sal_Size nResize=64 );
-    void*           SetBuffer( void* pBuf, sal_Size nSize,
+    void            SetBuffer( void* pBuf, sal_Size nSize,
                                bool bOwnsData=true, sal_Size nEOF=0 );
 
     void            ObjectOwnsMemory( bool bOwn ) { bOwnsData = bOwn; }
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index 2d2c356..cd5bf23 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -191,9 +191,6 @@ public:
 
     bool operator <(INetURLObject const & rObject) const;
 
-    inline bool operator >(INetURLObject const & rObject) const
-    { return rObject < *this; }
-
     // Strict Parsing:
 
     inline explicit INetURLObject(
@@ -976,7 +973,7 @@ public:
                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     { return appendSegment(rTheSegment, false, eMechanism, eCharset); }
 
-    bool CutLastName();
+    void CutLastName();
 
     // OBSOLETE File URLs:
 
diff --git a/include/tools/vcompat.hxx b/include/tools/vcompat.hxx
index b8dfe7f..149bebd 100644
--- a/include/tools/vcompat.hxx
+++ b/include/tools/vcompat.hxx
@@ -41,7 +41,6 @@ class TOOLS_DLLPUBLIC VersionCompat
                     VersionCompat() {}
                     VersionCompat( const VersionCompat& ) {}
     VersionCompat&  operator=( const VersionCompat& ) { return *this; }
-    bool            operator==( const VersionCompat& ) { return false; }
 
 public:
 
diff --git a/include/tools/vector2d.hxx b/include/tools/vector2d.hxx
deleted file mode 100644
index 7211bdc..0000000
--- a/include/tools/vector2d.hxx
+++ /dev/null
@@ -1,92 +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_TOOLS_VECTOR2D_HXX
-#define INCLUDED_TOOLS_VECTOR2D_HXX
-
-#include <math.h>
-#include <tools/gen.hxx>
-
-class Vector2D
-{
-private:
-    double              mfX;
-    double              mfY;
-
-public:
-    inline Vector2D() : mfX( 0.0 ), mfY( 0.0 ) {}
-    inline Vector2D( double fX, double fY ) : mfX( fX ), mfY( fY ) {}
-    inline Vector2D( const Vector2D& rVec ) : mfX( rVec.mfX ), mfY( rVec.mfY ) {}
-    inline Vector2D( const Pair& rPair ) : mfX( rPair.A() ), mfY( rPair.B() ) {};
-    inline ~Vector2D() {}
-
-    inline const double& operator[] (int nPos) const { return (nPos ? mfY : mfX); }
-    inline double& operator[] (int nPos) { return (nPos ? mfY : mfX); }
-
-    inline double GetLength() const { return hypot( mfX, mfY ); }
-    inline Vector2D& Normalize();
-
-    inline Vector2D&    operator+=( const Vector2D& rVec ) { mfX += rVec.mfX, mfY += rVec.mfY; return *this; }
-    inline Vector2D&    operator-=( const Vector2D& rVec ) { mfX -= rVec.mfX, mfY -= rVec.mfY; return *this; }
-    inline Vector2D     operator+(const Vector2D& rVec) const { Vector2D aSum(*this); aSum += rVec; return aSum; }
-    inline Vector2D     operator-(const Vector2D& rVec) const { Vector2D aSub(*this); aSub -= rVec; return aSub; }
-    inline Vector2D     operator-(void) const { return Vector2D(-mfX, -mfY); }
-
-    inline double       Scalar( const Vector2D& rVec ) const { return( mfX * rVec.mfX + mfY * rVec.mfY ); }
-
-    inline Vector2D&    operator/=( const Vector2D& rVec ) { mfX /= rVec.mfX, mfY /= rVec.mfY; return *this; }
-    inline Vector2D&    operator*=( const Vector2D& rVec ) { mfX *= rVec.mfX, mfY *= rVec.mfY; return *this; }
-    inline Vector2D     operator/(const Vector2D& rVec) const { Vector2D aDiv(*this); aDiv /= rVec; return aDiv; }
-    inline Vector2D     operator*(const Vector2D& rVec) const { Vector2D aMul(*this); aMul *= rVec; return aMul; }
-
-    inline Vector2D&    operator*=(double t) { mfX *= t; mfY *= t; return *this; }
-    inline Vector2D     operator*(double t) const { Vector2D aNew(*this); aNew *= t; return aNew; }
-    inline Vector2D&    operator/=(double t) { mfX /= t; mfY /= t; return *this; }
-    inline Vector2D     operator/(double t) const { Vector2D aNew(*this); aNew /= t; return aNew; }
-
-    inline bool         operator==( const Vector2D& rVec ) const { return( mfX == rVec.mfX && mfY == rVec.mfY ); }
-    inline bool         operator!=( const Vector2D& rVec ) const { return !( *this == rVec ); }
-
-    inline Vector2D&    operator=( const Vector2D& rVec ) { mfX = rVec.mfX, mfY = rVec.mfY; return *this; }
-    inline Vector2D&    operator=( const Pair& rPair ) { mfX = rPair.A(), mfY = rPair.B(); return *this; }
-    inline Vector2D&    operator-=( const Pair& rPair ) { mfX -= rPair.A(), mfY -= rPair.B(); return *this; }
-    inline Vector2D&    operator+=( const Pair& rPair ) { mfX += rPair.A(), mfY += rPair.B(); return *this; }
-    inline Vector2D&    operator*=( const Pair& rPair ) { mfX *= rPair.A(), mfY *= rPair.B(); return *this; }
-    inline Vector2D&    operator/=( const Pair& rPair ) { mfX /= rPair.A(), mfY /= rPair.B(); return *this; }
-
-    inline bool         operator==( const Pair& rPair ) const { return( mfX == rPair.A() && mfY == rPair.B() ); }
-    inline bool         operator!=( const Pair& rPair ) const { return !( *this == rPair ); }
-
-    inline bool         IsPositive( Vector2D& rVec ) const { return( ( mfX * rVec.mfY - mfY * rVec.mfX ) >= 0.0 ); }
-    inline bool         IsNegative( Vector2D& rVec ) const { return !IsPositive( rVec ); }
-};
-
-inline Vector2D& Vector2D::Normalize()
-{
-    double fLen = Scalar( *this );
-
-    if( ( fLen != 0.0 ) && ( fLen != 1.0 ) && ( ( fLen = sqrt( fLen ) ) != 0.0 ) )
-        mfX /= fLen, mfY /= fLen;
-
-    return *this;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index ac389ae..d84b66a 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -65,11 +65,11 @@ public:
     void            BeginCompression( int nCompressLevel = ZCODEC_DEFAULT_COMPRESSION, bool updateCrc = false, bool gzLib = false );
     long            EndCompression();
 
-    long            Compress( SvStream& rIStm, SvStream& rOStm );
+    void            Compress( SvStream& rIStm, SvStream& rOStm );
     long            Decompress( SvStream& rIStm, SvStream& rOStm );
     bool            AttemptDecompression( SvStream& rIStm, SvStream& rOStm, bool updateCrc = false, bool gzLib = false );
 
-    long            Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize );
+    void            Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize );
     long            Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize );
     long            ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize );
 
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 771c3bb..361e88d 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -4937,15 +4937,14 @@ OUString INetURLObject::GetFileExtension(DecodeMechanism eMechanism,
     return getExtension(LAST_SEGMENT, false, eMechanism, eCharset);
 }
 
-bool INetURLObject::CutLastName()
+void INetURLObject::CutLastName()
 {
     INetURLObject aTemp(*this);
     aTemp.clearFragment();
     aTemp.clearQuery();
     if (!aTemp.removeSegment(LAST_SEGMENT, false))
-        return false;
+        return;
     *this = aTemp;
-    return true;
 }
 
 OUString INetURLObject::PathToFileName() const
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 8dc2e21..9b2961e 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -28,7 +28,6 @@
 #include <tools/gen.hxx>
 #include <poly.h>
 #include <tools/line.hxx>
-#include <tools/vector2d.hxx>
 #include <tools/poly.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/point/b2dpoint.hxx>
@@ -1122,6 +1121,30 @@ void Polygon::AdaptiveSubdivide( Polygon& rResult, const double d ) const
     }
 }
 
+class Vector2D
+{
+private:
+    double              mfX;
+    double              mfY;
+public:
+    Vector2D( const Pair& rPair ) : mfX( rPair.A() ), mfY( rPair.B() ) {};
+    double       GetLength() const { return hypot( mfX, mfY ); }
+    Vector2D&    operator-=( const Vector2D& rVec ) { mfX -= rVec.mfX, mfY -= rVec.mfY; return *this; }
+    double       Scalar( const Vector2D& rVec ) const { return mfX * rVec.mfX + mfY * rVec.mfY ; }
+    Vector2D&    Normalize();
+    bool         IsPositive( Vector2D& rVec ) const { return ( mfX * rVec.mfY - mfY * rVec.mfX ) >= 0.0; }
+    bool         IsNegative( Vector2D& rVec ) const { return !IsPositive( rVec ); }
+};
+Vector2D& Vector2D::Normalize()
+{
+    double fLen = Scalar( *this );
+
+    if( ( fLen != 0.0 ) && ( fLen != 1.0 ) && ( ( fLen = sqrt( fLen ) ) != 0.0 ) )
+        mfX /= fLen, mfY /= fLen;
+
+    return *this;
+}
+
 void Polygon::ImplReduceEdges( tools::Polygon& rPoly, const double& rArea, sal_uInt16 nPercent )
 {
     const double    fBound = 2000.0 * ( 100 - nPercent ) * 0.01;
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index f4bc930..3d7de44 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -2736,11 +2736,10 @@ void INetMIMEOutputSink::writeSequence(const sal_Char * pBegin,
     m_aBuffer.append(pBegin, pEnd - pBegin);
 }
 
-sal_Size INetMIMEOutputSink::writeSequence(const sal_Char * pSequence)
+void INetMIMEOutputSink::writeSequence(const sal_Char * pSequence)
 {
     sal_Size nLength = rtl_str_getLength(pSequence);
     writeSequence(pSequence, pSequence + nLength);
-    return nLength;
 }
 
 void INetMIMEOutputSink::writeSequence(const sal_Unicode * pBegin,
diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx
index ab07afc..2967bad 100644
--- a/tools/source/inet/inetmsg.cxx
+++ b/tools/source/inet/inetmsg.cxx
@@ -272,11 +272,11 @@ OUString INetMIMEMessage::GetDefaultContentType()
     return OUString("text/plain; charset=us-ascii");
 }
 
-bool INetMIMEMessage::EnableAttachMultipartFormDataChild()
+void INetMIMEMessage::EnableAttachMultipartFormDataChild()
 {
     // Check context.
     if (IsContainer())
-        return false;
+        return;
 
     // Generate a unique boundary from current time.
     sal_Char sTail[16 + 1];
@@ -294,21 +294,15 @@ bool INetMIMEMessage::EnableAttachMultipartFormDataChild()
     SetContentType(
         OUString::fromUtf8("multipart/form-data; boundary=" + m_aBoundary));
     SetContentTransferEncoding("7bit");
-
-    // Done.
-    return true;
 }
 
-bool INetMIMEMessage::AttachChild(INetMIMEMessage& rChildMsg, bool bOwner)
+void INetMIMEMessage::AttachChild(INetMIMEMessage& rChildMsg, bool bOwner)
 {
     if (IsContainer())
     {
         if (bOwner) rChildMsg.pParent = this;
         aChildren.push_back( &rChildMsg );
-
-        return true;
     }
-    return false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx
index dfa9c4f..3fdf5d5 100644
--- a/tools/source/memtools/multisel.cxx
+++ b/tools/source/memtools/multisel.cxx
@@ -43,11 +43,11 @@ size_t MultiSelection::ImplFindSubSelection( long nIndex ) const
     return n;
 }
 
-bool MultiSelection::ImplMergeSubSelections( size_t nPos1, size_t nPos2 )
+void MultiSelection::ImplMergeSubSelections( size_t nPos1, size_t nPos2 )
 {
     // didn't a sub selection at nPos2 exist?
     if ( nPos2 >= aSels.size() )
-        return false;
+        return;
 
     // did the sub selections touch each other?
     if ( (aSels[ nPos1 ]->Max() + 1) == aSels[ nPos2 ]->Min() )
@@ -58,10 +58,7 @@ bool MultiSelection::ImplMergeSubSelections( size_t nPos1, size_t nPos2 )
         ::std::advance( it, nPos2 );
         delete *it;
         aSels.erase( it );
-        return true;
     }
-
-    return false;
 }
 
 MultiSelection::MultiSelection():
diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx
index 273a14b..4e44784 100644
--- a/tools/source/ref/pstm.cxx
+++ b/tools/source/ref/pstm.cxx
@@ -461,7 +461,7 @@ SvPersistStream& SvPersistStream::WritePointer
     return *this;
 }
 
-sal_uInt32 SvPersistStream::ReadObj
+void SvPersistStream::ReadObj
 (
     SvPersistBase * &   rpObj,
     bool                bRegister
@@ -503,7 +503,7 @@ sal_uInt32 SvPersistStream::ReadObj
                 (void)nObjLen;
 #endif
                 SetError( ERRCODE_IO_NOFACTORY );
-                return 0;
+                return;
             }
             pFunc( &rpObj );
             // Save reference
@@ -539,7 +539,6 @@ sal_uInt32 SvPersistStream::ReadObj
             DBG_ASSERT( rpObj->GetClassId() == nClassId, "class mismatch" );
         }
     }
-    return nId;
 }
 
 SvPersistStream& SvPersistStream::ReadPointer
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index b0976dd..69e908d 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -780,22 +780,21 @@ bool SvStream::WriteUniOrByteChar( sal_Unicode ch, rtl_TextEncoding eDestCharSet
     return m_nError == SVSTREAM_OK;
 }
 
-bool SvStream::StartWritingUnicodeText()
+void SvStream::StartWritingUnicodeText()
 {
     // BOM, Byte Order Mark, U+FEFF, see
     // http://www.unicode.org/faq/utf_bom.html#BOM
     // Upon read: 0xfeff(-257) => no swap; 0xfffe(-2) => swap
     sal_uInt16 v = 0xfeff;
     WRITENUMBER_WITHOUT_SWAP(sal_uInt16, v); // write native format
-    return m_nError == SVSTREAM_OK;
 }
 
-bool SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet )
+void SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet )
 {
     if (!(  eReadBomCharSet == RTL_TEXTENCODING_DONTKNOW ||
             eReadBomCharSet == RTL_TEXTENCODING_UNICODE ||
             eReadBomCharSet == RTL_TEXTENCODING_UTF8))
-        return true;    // nothing to read
+        return;    // nothing to read
 
     bool bTryUtf8 = false;
     sal_uInt16 nFlag(0);
@@ -843,7 +842,6 @@ bool SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet )
     }
     if (nBack)
         SeekRel( -nBack );      // no BOM, pure data
-    return m_nError == SVSTREAM_OK;
 }
 
 sal_uInt64 SvStream::SeekRel(sal_Int64 const nPos)
@@ -1738,20 +1736,16 @@ sal_uInt64 SvMemoryStream::GetSize()
     return nLength;
 }
 
-void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount,
+void SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount,
                                  bool bOwnsDat, sal_Size nEOF )
 {
-    void* pResult;
     SetBufferSize( 0 ); // Buffering in der Basisklasse initialisieren
     Seek( 0 );
     if( bOwnsData )
     {
-        pResult = nullptr;
         if( pNewBuf != pBuf )
             FreeMemory();
     }
-    else
-        pResult = pBuf;
 
     pBuf        = static_cast<sal_uInt8 *>(pNewBuf);
     nPos        = 0;
@@ -1764,8 +1758,6 @@ void* SvMemoryStream::SetBuffer( void* pNewBuf, sal_Size nCount,
     nEndOfData = nEOF;
 
     ResetError();
-
-    return pResult;
 }
 
 sal_Size SvMemoryStream::GetData( void* pData, sal_Size nCount )
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 53768eb..16bfd44 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -451,9 +451,9 @@ bool SvFileStream::LockFile()
   return LockRange( 0UL, 0UL );
 }
 
-bool SvFileStream::UnlockFile()
+void SvFileStream::UnlockFile()
 {
-    return UnlockRange( 0UL, 0UL );
+    UnlockRange( 0UL, 0UL );
 }
 
 void SvFileStream::Open( const OUString& rFilename, StreamMode nOpenMode )
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index 954ef05..2967df0 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -235,9 +235,8 @@ bool SvFileStream::LockFile()
     return bRetVal;
 }
 
-bool SvFileStream::UnlockFile()
+void SvFileStream::UnlockFile()
 {
-    bool bRetVal = false;
     if( nLockCounter > 0)
     {
         if( nLockCounter == 1)
@@ -245,16 +244,13 @@ bool SvFileStream::UnlockFile()
             if( UnlockRange( 0L, LONG_MAX ) )
             {
                 nLockCounter = 0;
-                bRetVal = true;
             }
         }
         else
         {
             nLockCounter--;
-            bRetVal = true;
         }
     }
-    return bRetVal;
 }
 
 /*
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index f11f789..5198a5b 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -112,10 +112,8 @@ long ZCodec::EndCompression()
     return mbStatus ? retvalue : -1;
 }
 
-long ZCodec::Compress( SvStream& rIStm, SvStream& rOStm )
+void ZCodec::Compress( SvStream& rIStm, SvStream& rOStm )
 {
-    long nOldTotal_In = PZSTREAM->total_in;
-
     assert(meState == STATE_INIT);
     mpOStm = &rOStm;
     InitCompress();
@@ -130,7 +128,6 @@ long ZCodec::Compress( SvStream& rIStm, SvStream& rOStm )
             break;
         }
     };
-    return ( mbStatus ) ? (long)(PZSTREAM->total_in - nOldTotal_In) : -1;
 }
 
 long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm )
@@ -170,7 +167,7 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm )
     return ( mbStatus ) ? (long)(PZSTREAM->total_out - nOldTotal_Out) : -1;
 }
 
-long ZCodec::Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize )
+void ZCodec::Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize )
 {
     if (meState == STATE_INIT)
     {
@@ -193,7 +190,6 @@ long ZCodec::Write( SvStream& rOStm, const sal_uInt8* pData, sal_uIntPtr nSize )
             break;
         }
     }
-    return ( mbStatus ) ? (long)nSize : -1;
 }
 
 long ZCodec::Read( SvStream& rIStm, sal_uInt8* pData, sal_uIntPtr nSize )


More information about the Libreoffice-commits mailing list