summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-24 14:07:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-25 10:56:03 +0200
commit83fd71e041f2c0520c4cc213e238c7f3c674c5a3 (patch)
tree5812c9db1d74548128c27bf2c1c44ec7aa5a79f2
parente46d27a692f43192ba29f03c473f43bb16c1444f (diff)
loplugin:constmethod in tools,sax,UnoControls
Change-Id: Ie05e44e2a4019e2549843961ebfa04fef7b7aeb4 Reviewed-on: https://gerrit.libreoffice.org/43767 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--UnoControls/inc/basecontrol.hxx12
-rw-r--r--include/sax/fshelper.hxx2
-rw-r--r--include/tools/b3dtrans.hxx2
-rw-r--r--include/tools/datetime.hxx2
-rw-r--r--include/tools/poly.hxx2
-rw-r--r--include/tools/stream.hxx4
-rw-r--r--include/tools/urlobj.hxx4
-rw-r--r--include/tools/zcodec.hxx4
-rw-r--r--l10ntools/inc/cfgmerge.hxx4
-rw-r--r--l10ntools/inc/xrmmerge.hxx4
-rw-r--r--sax/inc/xml2utf.hxx2
-rw-r--r--sax/source/fastparser/fastparser.cxx2
-rw-r--r--sax/source/tools/fastserializer.cxx2
-rw-r--r--sax/source/tools/fastserializer.hxx2
-rw-r--r--sax/source/tools/fshelper.cxx2
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFontWork.cxx4
-rw-r--r--tools/source/datetime/datetime.cxx2
-rw-r--r--tools/source/fsys/urlobj.cxx4
-rw-r--r--tools/source/generic/poly.cxx2
-rw-r--r--tools/source/stream/stream.cxx2
-rw-r--r--tools/source/stream/strmunx.cxx2
-rw-r--r--tools/source/zcodec/zcodec.cxx2
22 files changed, 34 insertions, 34 deletions
diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx
index 6967a3ff1085..7f81e13335f2 100644
--- a/UnoControls/inc/basecontrol.hxx
+++ b/UnoControls/inc/basecontrol.hxx
@@ -346,15 +346,15 @@ public:
protected:
using OComponentHelper::disposing;
- const css::uno::Reference< css::uno::XComponentContext >& impl_getComponentContext() { return m_xComponentContext;}
+ const css::uno::Reference< css::uno::XComponentContext >& impl_getComponentContext() const { return m_xComponentContext;}
- const css::uno::Reference< css::awt::XWindow >& impl_getPeerWindow() { return m_xPeerWindow;}
+ const css::uno::Reference< css::awt::XWindow >& impl_getPeerWindow() const { return m_xPeerWindow;}
- const css::uno::Reference< css::awt::XGraphics >& impl_getGraphicsPeer() { return m_xGraphicsPeer;}
+ const css::uno::Reference< css::awt::XGraphics >& impl_getGraphicsPeer() const { return m_xGraphicsPeer;}
- const sal_Int32& impl_getWidth() { return m_nWidth;}
+ sal_Int32 impl_getWidth() const { return m_nWidth;}
- const sal_Int32& impl_getHeight() { return m_nHeight;}
+ sal_Int32 impl_getHeight() const { return m_nHeight;}
virtual css::awt::WindowDescriptor* impl_getWindowDescriptor(
const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer
@@ -366,7 +366,7 @@ protected:
virtual void impl_recalcLayout( const css::awt::WindowEvent& aEvent );
- const css::uno::Reference< css::uno::XInterface >& impl_getDelegator() { return m_xDelegator;}
+ const css::uno::Reference< css::uno::XInterface >& impl_getDelegator() const { return m_xDelegator;}
private:
diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index c393240d212a..6b3dc1e68318 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -211,7 +211,7 @@ public:
FastSerializerHelper* writeId(sal_Int32 tokenId);
- css::uno::Reference< css::io::XOutputStream > getOutputStream();
+ css::uno::Reference< css::io::XOutputStream > getOutputStream() const;
static FastAttributeList *createAttrList();
diff --git a/include/tools/b3dtrans.hxx b/include/tools/b3dtrans.hxx
index 64d273bcbfc0..97b353f0c941 100644
--- a/include/tools/b3dtrans.hxx
+++ b/include/tools/b3dtrans.hxx
@@ -99,7 +99,7 @@ public:
// Texture
// aspect ratio accessors and the defined method of keeping defined aspect ratio
- double GetRatio() { return mfRatio; }
+ double GetRatio() const { return mfRatio; }
void SetRatio(double fNew);
// Parameters of ViewportTransformation
diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx
index fd48e2314c27..02729e6a0e1a 100644
--- a/include/tools/datetime.hxx
+++ b/include/tools/datetime.hxx
@@ -98,7 +98,7 @@ public:
DateTime& operator =( const DateTime& rDateTime );
DateTime& operator =( const css::util::DateTime& rUDateTime );
- void GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper );
+ void GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper ) const;
static DateTime CreateFromWin32FileDateTime( sal_uInt32 rLower, sal_uInt32 rUpper );
/// Creates DateTime given a unix time, which is the number of seconds
diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx
index 044bafe3f3e2..223f2c1e6731 100644
--- a/include/tools/poly.hxx
+++ b/include/tools/poly.hxx
@@ -119,7 +119,7 @@ public:
tools::Rectangle GetBoundRect() const;
bool IsInside( const Point& rPt ) const;
- double CalcDistance( sal_uInt16 nPt1, sal_uInt16 nPt2 );
+ double CalcDistance( sal_uInt16 nPt1, sal_uInt16 nPt2 ) const;
void Clip( const tools::Rectangle& rRect );
void Optimize( PolyOptimizeFlags nOptimizeFlags );
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index b4d1be9517bf..00aa872f53e3 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -193,7 +193,7 @@ protected:
// encrypt and write in blocks
std::size_t CryptAndWriteBuffer( const void* pStart, std::size_t nLen );
- bool EncryptBuffer( void* pStart, std::size_t nLen );
+ bool EncryptBuffer( void* pStart, std::size_t nLen ) const;
public:
SvStream();
@@ -383,7 +383,7 @@ public:
bool IsWritable() const { return m_isWritable; }
StreamMode GetStreamMode() const { return m_eStreamMode; }
- sal_Int32 GetVersion() { return m_nVersion; }
+ sal_Int32 GetVersion() const { return m_nVersion; }
void SetVersion( sal_Int32 n ) { m_nVersion = n; }
friend SvStream& operator<<( SvStream& rStr, SvStrPtr f ); // for Manips
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index cdbede709e29..e5a4e5922ef3 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -441,7 +441,7 @@ public:
{ return decode(m_aHost, eMechanism, eCharset); }
OUString GetHostPort(DecodeMechanism eMechanism = DecodeMechanism::ToIUri,
- rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) const;
sal_uInt32 GetPort() const;
@@ -790,7 +790,7 @@ public:
const;
// Data URLs:
- std::unique_ptr<SvMemoryStream> getData();
+ std::unique_ptr<SvMemoryStream> getData() const;
// Coding:
diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index f12ee4a62830..f5dd99ac7acb 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -73,9 +73,9 @@ public:
long ReadAsynchron( SvStream& rIStm, sal_uInt8* pData, sal_uInt32 nSize );
void SetBreak( size_t );
- size_t GetBreak();
+ size_t GetBreak() const;
void SetCRC( sal_uInt32 nCurrentCRC );
- sal_uInt32 GetCRC() { return mnCRC;}
+ sal_uInt32 GetCRC() const { return mnCRC;}
};
#endif
diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx
index c3eb1cd1cf02..d2ec28475d39 100644
--- a/l10ntools/inc/cfgmerge.hxx
+++ b/l10ntools/inc/cfgmerge.hxx
@@ -54,8 +54,8 @@ public:
: sTagType( rTag ), sIdentifier( rId )
{}
- const OString &GetTagType() { return sTagType; }
- const OString &GetIdentifier() { return sIdentifier; }
+ const OString &GetTagType() const { return sTagType; }
+ const OString &GetIdentifier() const { return sIdentifier; }
};
diff --git a/l10ntools/inc/xrmmerge.hxx b/l10ntools/inc/xrmmerge.hxx
index e599a59fcbe2..0000265cac35 100644
--- a/l10ntools/inc/xrmmerge.hxx
+++ b/l10ntools/inc/xrmmerge.hxx
@@ -56,7 +56,7 @@ protected:
const OString &rCloseTag
)=0;
- const OString& GetGID() { return sGID; }
+ const OString& GetGID() const { return sGID; }
public:
XRMResParser();
@@ -65,7 +65,7 @@ public:
void Execute( int nToken, char * pToken );
void SetError() { bError = true; }
- bool GetError() { return bError; }
+ bool GetError() const { return bError; }
};
diff --git a/sax/inc/xml2utf.hxx b/sax/inc/xml2utf.hxx
index 44e4b461293e..0a26c1f81482 100644
--- a/sax/inc/xml2utf.hxx
+++ b/sax/inc/xml2utf.hxx
@@ -32,7 +32,7 @@ public:
~Text2UnicodeConverter();
css::uno::Sequence < sal_Unicode > convert( const css::uno::Sequence<sal_Int8> & );
- bool canContinue() { return m_bCanContinue; }
+ bool canContinue() const { return m_bCanContinue; }
private:
void init( rtl_TextEncoding encoding );
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index abd78e2d120d..507d40208928 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -332,7 +332,7 @@ public:
void dispose() { mpParser = nullptr; }
/// @throws RuntimeException
- void checkDispose() { if( !mpParser ) throw DisposedException(); }
+ void checkDispose() const { if( !mpParser ) throw DisposedException(); }
//XLocator
virtual sal_Int32 SAL_CALL getColumnNumber() override;
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 7c1e3c77c027..a0ae255b36eb 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -377,7 +377,7 @@ namespace sax_fastparser {
writeBytes(sSlashAndClosingBracket, N_CHARS(sSlashAndClosingBracket));
}
- css::uno::Reference< css::io::XOutputStream > FastSaxSerializer::getOutputStream()
+ css::uno::Reference< css::io::XOutputStream > FastSaxSerializer::getOutputStream() const
{
return maCachedOutputStream.getOutputStream();
}
diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx
index 803eaa0cc991..74e5de223e10 100644
--- a/sax/source/tools/fastserializer.hxx
+++ b/sax/source/tools/fastserializer.hxx
@@ -51,7 +51,7 @@ public:
explicit FastSaxSerializer(const css::uno::Reference< css::io::XOutputStream >& xOutputStream);
~FastSaxSerializer();
- css::uno::Reference< css::io::XOutputStream > getOutputStream();
+ css::uno::Reference< css::io::XOutputStream > getOutputStream() const;
/// called by FSHelper to put data in for writeTokenValueList
TokenValueList& getTokenValueList() { return maTokenValues; }
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index 3875f54df6ca..0b71769a0fed 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -125,7 +125,7 @@ FastSerializerHelper* FastSerializerHelper::writeId(sal_Int32 tokenId)
return this;
}
-css::uno::Reference< css::io::XOutputStream > FastSerializerHelper::getOutputStream()
+css::uno::Reference< css::io::XOutputStream > FastSerializerHelper::getOutputStream() const
{
return mpSerializer->getOutputStream();
}
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index fb34312cae6b..dc5693d0ff71 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -138,7 +138,7 @@ double GetLength( const tools::Polygon& rPolygon )
{
sal_uInt16 nCount = rPolygon.GetSize();
while( --nCount )
- fLength += const_cast<tools::Polygon&>(rPolygon).CalcDistance( nCount, nCount - 1 );
+ fLength += rPolygon.CalcDistance( nCount, nCount - 1 );
}
return fLength;
}
@@ -538,7 +538,7 @@ void CalcDistances( const tools::Polygon& rPoly, std::vector< double >& rDistanc
{
for ( i = 0; i < nCount; i++ )
{
- double fDistance = i ? const_cast<tools::Polygon&>(rPoly).CalcDistance( i, i - 1 ) : 0.0;
+ double fDistance = i ? rPoly.CalcDistance( i, i - 1 ) : 0.0;
rDistances.push_back( fDistance );
}
std::partial_sum( rDistances.begin(), rDistances.end(), rDistances.begin() );
diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx
index 999c98d4fee8..e3faf45fa495 100644
--- a/tools/source/datetime/datetime.cxx
+++ b/tools/source/datetime/datetime.cxx
@@ -223,7 +223,7 @@ double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 )
return double(nDays);
}
-void DateTime::GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper )
+void DateTime::GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper ) const
{
const sal_Int64 a100nPerSecond = SAL_CONST_INT64( 10000000 );
const sal_Int64 a100nPerDay = a100nPerSecond * sal_Int64( 60 * 60 * 24 );
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index ff4914202482..5c8d8be91132 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -589,7 +589,7 @@ std::unique_ptr<SvMemoryStream> memoryStream(
}
-std::unique_ptr<SvMemoryStream> INetURLObject::getData()
+std::unique_ptr<SvMemoryStream> INetURLObject::getData() const
{
if( GetProtocol() != INetProtocol::Data )
{
@@ -3906,7 +3906,7 @@ INetProtocol INetURLObject::CompareProtocolScheme(OUString const &
}
OUString INetURLObject::GetHostPort(DecodeMechanism eMechanism,
- rtl_TextEncoding eCharset)
+ rtl_TextEncoding eCharset) const
{
// Check because PROT_VND_SUN_STAR_HELP, PROT_VND_SUN_STAR_HIER, and
// PROT_VND_SUN_STAR_PKG misuse m_aHost:
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index bd012725e0f6..7564e9f50125 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -902,7 +902,7 @@ void Polygon::Clear()
mpImplPolygon = static_cast<ImplPolygon*>(&aStaticImplPolygon);
}
-double Polygon::CalcDistance( sal_uInt16 nP1, sal_uInt16 nP2 )
+double Polygon::CalcDistance( sal_uInt16 nP1, sal_uInt16 nP2 ) const
{
DBG_ASSERT( nP1 < mpImplPolygon->mnPoints,
"Polygon::CalcDistance(): nPos1 >= nPoints" );
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 6a24a45f5570..4f95afd2c1e8 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1480,7 +1480,7 @@ std::size_t SvStream::CryptAndWriteBuffer( const void* pStart, std::size_t nLen)
return nCount;
}
-bool SvStream::EncryptBuffer(void* pStart, std::size_t nLen)
+bool SvStream::EncryptBuffer(void* pStart, std::size_t nLen) const
{
unsigned char* pTemp = static_cast<unsigned char*>(pStart);
unsigned char nMask = m_nCryptMask;
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index d3f79e6c3712..b9b4b551ff88 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -145,7 +145,7 @@ bool lockFile( sal_uInt64 const nStart, sal_uInt64 const nEnd, SvFileStream* pSt
return true;
}
-void unlockFile( sal_uInt64 const nStart, sal_uInt64 const nEnd, SvFileStream const * pStream )
+void unlockFile( sal_uInt64 const nStart, sal_uInt64 const nEnd, SvFileStream * pStream )
{
osl::MutexGuard aGuard( LockMutex::get() );
std::vector<InternalStreamLock> &rLockList = LockList::get();
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index c935bb8c4562..ca75de1b4c02 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -310,7 +310,7 @@ void ZCodec::SetBreak( size_t nInToRead )
mnInToRead = nInToRead;
}
-size_t ZCodec::GetBreak()
+size_t ZCodec::GetBreak() const
{
return ( mnInToRead + PZSTREAM->avail_in );
}