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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 27 06:30:04 UTC 2018


 UnoControls/source/inc/OConnectionPointHelper.hxx |    2 +-
 include/tools/multisel.hxx                        |   10 +++++-----
 include/tools/stream.hxx                          |    2 +-
 include/tools/vcompat.hxx                         |    2 +-
 include/tools/zcodec.hxx                          |    4 ++--
 include/ucbhelper/interactionrequest.hxx          |   18 +++++++++---------
 include/ucbhelper/resultsethelper.hxx             |    2 +-
 include/ucbhelper/resultsetmetadata.hxx           |    6 +-----
 tools/source/fsys/urlobj.cxx                      |   20 ++++++++++----------
 tools/source/inet/inetmime.cxx                    |   14 +++++++-------
 tools/source/reversemap/bestreversemap.cxx        |    2 +-
 tools/source/xml/XmlWriter.cxx                    |    2 +-
 ucbhelper/source/client/proxydecider.cxx          |   13 +++++--------
 ucbhelper/source/provider/resultset.cxx           |    6 +++---
 ucbhelper/source/provider/resultsetmetadata.cxx   |    8 ++------
 15 files changed, 50 insertions(+), 61 deletions(-)

New commits:
commit 833c4965fc0941ea997852e3d99dcd7688e58c14
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 26 13:40:27 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Sep 27 08:29:49 2018 +0200

    loplugin:constfields in tools
    
    Change-Id: I83499cfb49f7abdbf0629c60167d09a1352571ee
    Reviewed-on: https://gerrit.libreoffice.org/60987
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/tools/multisel.hxx b/include/tools/multisel.hxx
index 3e06a3dce239..feb96abd2760 100644
--- a/include/tools/multisel.hxx
+++ b/include/tools/multisel.hxx
@@ -77,16 +77,16 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC StringRangeEnumerator
 {
     struct Range
     {
-        sal_Int32   nFirst;
-        sal_Int32   nLast;
+        sal_Int32 const   nFirst;
+        sal_Int32 const   nLast;
 
         Range( sal_Int32 i_nFirst, sal_Int32 i_nLast ) : nFirst( i_nFirst ), nLast( i_nLast ) {}
     };
     std::vector< StringRangeEnumerator::Range >            maSequence;
     sal_Int32                                              mnCount;
-    sal_Int32                                              mnMin;
-    sal_Int32                                              mnMax;
-    sal_Int32                                              mnOffset;
+    sal_Int32 const                                        mnMin;
+    sal_Int32 const                                        mnMax;
+    sal_Int32 const                                        mnOffset;
     bool                                                   mbValidInput;
 
     bool setRange( const OUString& i_rNewRange );
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index ce6db9ac4217..86a29f8093ff 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -100,7 +100,7 @@ enum SvLockBytesStatFlag { SVSTATFLAG_DEFAULT };
 class TOOLS_DLLPUBLIC SvLockBytes: public virtual SvRefBase
 {
     SvStream * m_pStream;
-    bool m_bOwner;
+    bool const m_bOwner;
     bool m_bSync;
 
 protected:
diff --git a/include/tools/vcompat.hxx b/include/tools/vcompat.hxx
index 85e3b1d44240..ba4692f663e2 100644
--- a/include/tools/vcompat.hxx
+++ b/include/tools/vcompat.hxx
@@ -38,7 +38,7 @@ class TOOLS_DLLPUBLIC VersionCompat
     SvStream*       mpRWStm;
     sal_uInt32      mnCompatPos;
     sal_uInt32      mnTotalSize;
-    StreamMode   mnStmMode;
+    StreamMode const mnStmMode;
     sal_uInt16      mnVersion;
 
                     VersionCompat( const VersionCompat& ) = delete;
diff --git a/include/tools/zcodec.hxx b/include/tools/zcodec.hxx
index 57af7c50c2a1..9f26d263adba 100644
--- a/include/tools/zcodec.hxx
+++ b/include/tools/zcodec.hxx
@@ -40,11 +40,11 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC ZCodec
     bool            mbStatus;
     bool            mbFinish;
     sal_uInt8*      mpInBuf;
-    size_t          mnInBufSize;
+    size_t const    mnInBufSize;
     size_t          mnInToRead;
     SvStream*       mpOStm;
     sal_uInt8*      mpOutBuf;
-    size_t          mnOutBufSize;
+    size_t const    mnOutBufSize;
 
     sal_uInt32      mnCRC;
     int             mnCompressLevel;
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index f024fec558bf..6a53e29d9d03 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -290,14 +290,14 @@ struct INetURLObject::SchemeInfo
 {
     sal_Char const * m_pScheme;
     sal_Char const * m_pPrefix;
-    bool m_bAuthority;
-    bool m_bUser;
-    bool m_bAuth;
-    bool m_bPassword;
-    bool m_bHost;
-    bool m_bPort;
-    bool m_bHierarchical;
-    bool m_bQuery;
+    bool const m_bAuthority;
+    bool const m_bUser;
+    bool const m_bAuth;
+    bool const m_bPassword;
+    bool const m_bHost;
+    bool const m_bPort;
+    bool const m_bHierarchical;
+    bool const m_bQuery;
 };
 
 struct INetURLObject::PrefixInfo
@@ -306,8 +306,8 @@ struct INetURLObject::PrefixInfo
 
     sal_Char const * m_pPrefix;
     sal_Char const * m_pTranslatedPrefix;
-    INetProtocol m_eScheme;
-    Kind m_eKind;
+    INetProtocol const m_eScheme;
+    Kind const m_eKind;
 };
 
 // static
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index 1f8cb5196d3e..d2f2f4baec6a 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -309,12 +309,12 @@ void appendISO88591(OUStringBuffer & rText, sal_Char const * pBegin,
 
 struct Parameter
 {
-    OString m_aAttribute;
-    OString m_aCharset;
-    OString m_aLanguage;
-    OString m_aValue;
-    sal_uInt32 m_nSection;
-    bool m_bExtended;
+    OString const m_aAttribute;
+    OString const m_aCharset;
+    OString const m_aLanguage;
+    OString const m_aValue;
+    sal_uInt32 const m_nSection;
+    bool const m_bExtended;
 
     bool operator<(const Parameter& rhs) const // is used by std::list<Parameter>::sort
     {
@@ -800,7 +800,7 @@ bool equalIgnoreCase(const sal_Char * pBegin1,
 struct EncodingEntry
 {
     sal_Char const * m_aName;
-    rtl_TextEncoding m_eEncoding;
+    rtl_TextEncoding const m_eEncoding;
 };
 
 // The source for the following table is <ftp://ftp.iana.org/in-notes/iana/
diff --git a/tools/source/reversemap/bestreversemap.cxx b/tools/source/reversemap/bestreversemap.cxx
index 63fbd2b1cb90..90679654cbbe 100644
--- a/tools/source/reversemap/bestreversemap.cxx
+++ b/tools/source/reversemap/bestreversemap.cxx
@@ -15,7 +15,7 @@
 
 struct Encoder
 {
-    rtl_UnicodeToTextConverter m_aConverter;
+    rtl_UnicodeToTextConverter const m_aConverter;
     bool m_bCapable;
     const char *m_pEncoding;
     Encoder(rtl_TextEncoding nEncoding, const char *pEncoding)
diff --git a/tools/source/xml/XmlWriter.cxx b/tools/source/xml/XmlWriter.cxx
index 8895e92064db..58c4a26f2cb5 100644
--- a/tools/source/xml/XmlWriter.cxx
+++ b/tools/source/xml/XmlWriter.cxx
@@ -39,7 +39,7 @@ struct XmlWriterImpl
     {
     }
 
-    SvStream* mpStream;
+    SvStream* const mpStream;
     xmlTextWriterPtr mpWriter;
 };
 
commit 64035391ebe8810520a214a3ae0aeb4c1b039819
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Sep 26 10:47:52 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Sep 27 08:29:41 2018 +0200

    loplugin:constfields in ucbhelper
    
    Change-Id: Ic9d59b352dcb771191de963c0f6e90c74647c8b8
    Reviewed-on: https://gerrit.libreoffice.org/60983
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/UnoControls/source/inc/OConnectionPointHelper.hxx b/UnoControls/source/inc/OConnectionPointHelper.hxx
index cf87833b29ca..51143fc4c681 100644
--- a/UnoControls/source/inc/OConnectionPointHelper.hxx
+++ b/UnoControls/source/inc/OConnectionPointHelper.hxx
@@ -100,7 +100,7 @@ private:
     css::uno::WeakReference< css::lang::XConnectionPointContainer >   m_oContainerWeakReference;   // Reference to container-class!. Don't use Reference<...>
                                                                                             // It is a ring-reference => and must be a wekreference!
     OConnectionPointContainerHelper*                                  m_pContainerImplementation;
-    css::uno::Type                                                    m_aInterfaceType;
+    css::uno::Type const                                                    m_aInterfaceType;
     css::uno::Reference< css::uno::XInterface >                       m_xLock;
 };
 
diff --git a/include/ucbhelper/interactionrequest.hxx b/include/ucbhelper/interactionrequest.hxx
index 4ee4e93715f8..74df7f1f6c87 100644
--- a/include/ucbhelper/interactionrequest.hxx
+++ b/include/ucbhelper/interactionrequest.hxx
@@ -307,22 +307,22 @@ class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication :
                   public css::lang::XTypeProvider,
                   public css::ucb::XInteractionSupplyAuthentication2
 {
-    css::uno::Sequence< css::ucb::RememberAuthentication >
+    css::uno::Sequence< css::ucb::RememberAuthentication > const
                   m_aRememberPasswordModes;
-    css::uno::Sequence< css::ucb::RememberAuthentication >
+    css::uno::Sequence< css::ucb::RememberAuthentication > const
                   m_aRememberAccountModes;
     OUString m_aRealm;
     OUString m_aUserName;
     OUString m_aPassword;
     OUString m_aAccount;
     css::ucb::RememberAuthentication m_eRememberPasswordMode;
-    css::ucb::RememberAuthentication m_eDefaultRememberPasswordMode;
-    css::ucb::RememberAuthentication m_eDefaultRememberAccountMode;
-    bool m_bCanSetRealm    : 1;
-    bool m_bCanSetUserName : 1;
-    bool m_bCanSetPassword : 1;
-    bool m_bCanSetAccount  : 1;
-    bool m_bCanUseSystemCredentials     : 1;
+    css::ucb::RememberAuthentication const m_eDefaultRememberPasswordMode;
+    css::ucb::RememberAuthentication const m_eDefaultRememberAccountMode;
+    bool const m_bCanSetRealm    : 1;
+    bool const m_bCanSetUserName : 1;
+    bool const m_bCanSetPassword : 1;
+    bool const m_bCanSetAccount  : 1;
+    bool const m_bCanUseSystemCredentials     : 1;
     bool m_bUseSystemCredentials        : 1;
 
 public:
diff --git a/include/ucbhelper/resultsethelper.hxx b/include/ucbhelper/resultsethelper.hxx
index 7c9452b8407b..15c74b4235c1 100644
--- a/include/ucbhelper/resultsethelper.hxx
+++ b/include/ucbhelper/resultsethelper.hxx
@@ -62,7 +62,7 @@ class UCBHELPER_DLLPUBLIC ResultSetImplHelper :
 
 protected:
     osl::Mutex                                                 m_aMutex;
-    css::ucb::OpenCommandArgument2                             m_aCommand;
+    css::ucb::OpenCommandArgument2 const                       m_aCommand;
     css::uno::Reference< css::uno::XComponentContext >         m_xContext;
     // Resultset #1
     css::uno::Reference< css::sdbc::XResultSet >               m_xResultSet1;
diff --git a/include/ucbhelper/resultsetmetadata.hxx b/include/ucbhelper/resultsetmetadata.hxx
index 2e410a88a83a..3a11d8f99468 100644
--- a/include/ucbhelper/resultsetmetadata.hxx
+++ b/include/ucbhelper/resultsetmetadata.hxx
@@ -52,9 +52,6 @@ struct ResultSetColumnData
     /** @see ResultSetMetaData::isCaseSensitive */
     bool        isCaseSensitive;
 
-    /** @see ResultSetMetaData::getColumnDisplaySize */
-    sal_Int32       columnDisplaySize;
-
     inline ResultSetColumnData();
 };
 
@@ -62,8 +59,7 @@ struct ResultSetColumnData
 //       may heavily depend on the behaviour of the default constructor.
 
 ResultSetColumnData::ResultSetColumnData()
-: isCaseSensitive( true ),
-  columnDisplaySize( 16 )
+: isCaseSensitive( true )
 {
 }
 
diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx
index 0f5bd69553b7..31e26055ffcf 100644
--- a/ucbhelper/source/client/proxydecider.cxx
+++ b/ucbhelper/source/client/proxydecider.cxx
@@ -66,7 +66,7 @@ namespace proxydecider_impl
 class WildCard
 {
 private:
-    OString m_aWildString;
+    OString const m_aWildString;
 
 public:
     explicit WildCard( const OUString& rWildCard )
@@ -80,18 +80,13 @@ public:
 
 typedef std::pair< WildCard, WildCard > NoProxyListEntry;
 
-
 class HostnameCache
 {
     typedef std::pair< OUString, OUString > HostListEntry;
 
     std::deque< HostListEntry >    m_aHostList;
-    sal_uInt32                     m_nCapacity;
 
 public:
-    explicit HostnameCache()
-        : m_nCapacity( 256 ) {}
-
     bool get( const OUString & rKey, OUString & rValue ) const
     {
         for (auto const& host : m_aHostList)
@@ -107,8 +102,10 @@ public:
 
     void put( const OUString & rKey, const OUString & rValue )
     {
-        if ( m_aHostList.size() == m_nCapacity )
-            m_aHostList.resize( m_nCapacity / 2 );
+        static constexpr sal_uInt32 nCapacity = 256;
+
+        if ( m_aHostList.size() == nCapacity )
+            m_aHostList.resize( nCapacity / 2 );
 
         m_aHostList.push_front( HostListEntry( rKey, rValue ) );
     }
diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx
index c482332909c4..4ed85d478550 100644
--- a/ucbhelper/source/provider/resultset.cxx
+++ b/ucbhelper/source/provider/resultset.cxx
@@ -42,8 +42,8 @@ namespace ucbhelper_impl
 struct PropertyInfo
 {
     const char* pName;
-    sal_Int32   nHandle;
-    sal_Int16   nAttributes;
+    sal_Int32 const   nHandle;
+    sal_Int16 const   nAttributes;
     const uno::Type& (*pGetCppuType)();
 };
 
@@ -143,7 +143,7 @@ struct ResultSet_Impl
     uno::Reference< css::ucb::XCommandEnvironment > m_xEnv;
     uno::Reference< beans::XPropertySetInfo >       m_xPropSetInfo;
     uno::Reference< sdbc::XResultSetMetaData >      m_xMetaData;
-    uno::Sequence< beans::Property >                m_aProperties;
+    uno::Sequence< beans::Property > const          m_aProperties;
     rtl::Reference< ResultSetDataSupplier >         m_xDataSupplier;
     osl::Mutex                          m_aMutex;
     std::unique_ptr<cppu::OInterfaceContainerHelper> m_pDisposeEventListeners;
diff --git a/ucbhelper/source/provider/resultsetmetadata.cxx b/ucbhelper/source/provider/resultsetmetadata.cxx
index 4f99af2cae39..3666fa802f9b 100644
--- a/ucbhelper/source/provider/resultsetmetadata.cxx
+++ b/ucbhelper/source/provider/resultsetmetadata.cxx
@@ -198,16 +198,12 @@ sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 /*column*/ )
 
 
 // virtual
-sal_Int32 SAL_CALL ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnDisplaySize( sal_Int32 /*column*/ )
 {
     /*
         Gets the normal maximum width in characters for column.
      */
-
-    if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
-        return 16;
-
-    return m_pImpl->m_aColumnData[ column - 1 ].columnDisplaySize;
+    return 16;
 }
 
 


More information about the Libreoffice-commits mailing list