diff options
author | Noel Grandin <noel@peralex.com> | 2016-01-15 12:00:55 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-01-15 12:39:46 +0000 |
commit | e15a997b153551a4c0e91964b5cff1b6269a9790 (patch) | |
tree | 93208827148e6df46ff6d24048ba92745124050d /tools | |
parent | 9f62954369a5d77f976f616623495ad27be6b099 (diff) |
loplugin:unusedmethods unused return value in include/tools
Change-Id: I77a6a46ca20cb41ed73050185fb2064a1bbf2009
Reviewed-on: https://gerrit.libreoffice.org/21485
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/fsys/urlobj.cxx | 5 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 25 | ||||
-rw-r--r-- | tools/source/inet/inetmime.cxx | 3 | ||||
-rw-r--r-- | tools/source/inet/inetmsg.cxx | 12 | ||||
-rw-r--r-- | tools/source/memtools/multisel.cxx | 7 | ||||
-rw-r--r-- | tools/source/ref/pstm.cxx | 5 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 16 | ||||
-rw-r--r-- | tools/source/stream/strmunx.cxx | 4 | ||||
-rw-r--r-- | tools/source/stream/strmwnt.cxx | 6 | ||||
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 8 |
10 files changed, 43 insertions, 48 deletions
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 771c3bbce588..361e88d74a77 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 8dc2e21e9947..9b2961e3d501 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 f4bc930e277c..3d7de4442e29 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 ab07afc5b1b2..2967bad38c38 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 dfa9c4f4000c..3fdf5d520934 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 273a14b7c0fe..4e44784f7fba 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 b0976ddf89c0..69e908db81fb 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 53768eb8e27d..16bfd443cdf8 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 954ef05716f5..2967df018977 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 f11f7898ef15..5198a5b26ada 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 ) |