[Libreoffice-commits] core.git: comphelper/source connectivity/source cppu/source cui/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Sat Nov 23 22:52:42 UTC 2019


 comphelper/source/compare/AnyCompareFactory.cxx                  |    2 
 connectivity/source/drivers/hsqldb/accesslog.cxx                 |    4 -
 connectivity/source/drivers/macab/MacabAddressBook.cxx           |    6 -
 connectivity/source/drivers/macab/MacabRecord.cxx                |    5 -
 connectivity/source/drivers/macab/MacabRecords.cxx               |   38 +---------
 connectivity/source/drivers/macab/MacabResultSet.cxx             |    4 -
 connectivity/source/drivers/mork/MStatement.cxx                  |    4 -
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |    2 
 cppu/source/typelib/typelib.cxx                                  |    5 -
 cui/source/options/certpath.cxx                                  |    4 -
 cui/source/options/optjsearch.cxx                                |    4 -
 11 files changed, 28 insertions(+), 50 deletions(-)

New commits:
commit 4e1ae2a9a0d2d9185b49677fa4ea2a2b1fe8bab2
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sat Nov 23 20:25:07 2019 +0100
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Sat Nov 23 23:51:35 2019 +0100

    cppcheck: performing init in init list (comphelper/connectivity/cppu/cui)
    
    Change-Id: I786c2c10e8b37b48adf6d619c0fa6a905de1bf7f
    Reviewed-on: https://gerrit.libreoffice.org/83584
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/comphelper/source/compare/AnyCompareFactory.cxx b/comphelper/source/compare/AnyCompareFactory.cxx
index 7a31f10f1f71..40e5f0806a95 100644
--- a/comphelper/source/compare/AnyCompareFactory.cxx
+++ b/comphelper/source/compare/AnyCompareFactory.cxx
@@ -39,8 +39,8 @@ class AnyCompare : public ::cppu::WeakImplHelper< XAnyCompare >
 
 public:
     AnyCompare( Reference< XComponentContext > const & xContext, const Locale& rLocale )
+       : m_xCollator(Collator::create( xContext ))
     {
-        m_xCollator = Collator::create( xContext );
         m_xCollator->loadDefaultCollator( rLocale,
                                           0 ); //???
     }
diff --git a/connectivity/source/drivers/hsqldb/accesslog.cxx b/connectivity/source/drivers/hsqldb/accesslog.cxx
index 880600a71d5a..bc5a2c3de81e 100644
--- a/connectivity/source/drivers/hsqldb/accesslog.cxx
+++ b/connectivity/source/drivers/hsqldb/accesslog.cxx
@@ -39,9 +39,9 @@ namespace connectivity { namespace hsqldb
 
 
     LogFile::LogFile( JNIEnv* env, jstring streamName, const sal_Char* _pAsciiSuffix )
+        : m_sFileName(StorageContainer::jstring2ustring(env,streamName) +
+                 "." + OUString::createFromAscii( _pAsciiSuffix ) )
     {
-        m_sFileName = StorageContainer::jstring2ustring(env,streamName) +
-            "." + OUString::createFromAscii( _pAsciiSuffix );
     }
 
 
diff --git a/connectivity/source/drivers/macab/MacabAddressBook.cxx b/connectivity/source/drivers/macab/MacabAddressBook.cxx
index 46570ef5ff57..09e4892033e8 100644
--- a/connectivity/source/drivers/macab/MacabAddressBook.cxx
+++ b/connectivity/source/drivers/macab/MacabAddressBook.cxx
@@ -78,10 +78,10 @@ void manageDuplicateGroups(std::vector<MacabGroup *> _xGroups)
 }
 
 MacabAddressBook::MacabAddressBook( )
+ : m_aAddressBook(ABGetSharedAddressBook()),
+   m_xMacabRecords(nullptr),
+   m_bRetrievedGroups(false)
 {
-    m_aAddressBook = ABGetSharedAddressBook();
-    m_xMacabRecords = nullptr;
-    m_bRetrievedGroups = false;
 }
 
 
diff --git a/connectivity/source/drivers/macab/MacabRecord.cxx b/connectivity/source/drivers/macab/MacabRecord.cxx
index 5d95e320ef20..b7e270f378f2 100644
--- a/connectivity/source/drivers/macab/MacabRecord.cxx
+++ b/connectivity/source/drivers/macab/MacabRecord.cxx
@@ -33,13 +33,14 @@ using namespace com::sun::star::util;
 using namespace ::dbtools;
 
 
-MacabRecord::MacabRecord()
+MacabRecord::MacabRecord() : size(0)
 {
-    size = 0;
 }
 
 
 MacabRecord::MacabRecord(const sal_Int32 _size)
+   : size(_size),
+     fields(std::make_unique<macabfield *[]>(size))
 {
     size = _size;
     fields = std::make_unique<macabfield *[]>(size);
diff --git a/connectivity/source/drivers/macab/MacabRecords.cxx b/connectivity/source/drivers/macab/MacabRecords.cxx
index 4b7220e56723..0bc27ea0ee6f 100644
--- a/connectivity/source/drivers/macab/MacabRecords.cxx
+++ b/connectivity/source/drivers/macab/MacabRecords.cxx
@@ -73,17 +73,9 @@ void manageDuplicateHeaders(macabfield **_headerNames, const sal_Int32 _length)
 }
 
 MacabRecords::MacabRecords(const ABAddressBookRef _addressBook, MacabHeader *_header, MacabRecord **_records, sal_Int32 _numRecords)
+   : recordsSize(_numRecords), currentRecord(_numRecords), recordType(kABPersonRecordType),
+     header(_header), records(_records), addressBook(_addressBook)
 {
-    /* Variables passed in... */
-    header = _header;
-    recordsSize = _numRecords;
-    currentRecord = _numRecords;
-    records = _records;
-    addressBook = _addressBook;
-
-    /* Default variables... */
-    recordType = kABPersonRecordType;
-
     /* Variables constructed... */
     bootstrap_CF_types();
     bootstrap_requiredProperties();
@@ -99,18 +91,10 @@ MacabRecords::MacabRecords(const ABAddressBookRef _addressBook, MacabHeader *_he
  * header.
  */
 MacabRecords::MacabRecords(const MacabRecords *_copy)
+    : recordsSize(_copy->recordsSize), currentRecord(0), recordType(kABPersonRecordType),
+      header(nullptr), records(new MacabRecord *[recordsSize]), addressBook(_copy->addressBook),
+      m_sName(_copy->m_sName)
 {
-    /* Variables passed in... */
-    recordsSize = _copy->recordsSize;
-    addressBook = _copy->addressBook;
-    m_sName = _copy->m_sName;
-
-    /* Default variables... */
-    currentRecord = 0;
-    header = nullptr;
-    records = new MacabRecord *[recordsSize];
-    recordType = kABPersonRecordType;
-
     /* Variables constructed... */
     bootstrap_CF_types();
     bootstrap_requiredProperties();
@@ -118,17 +102,9 @@ MacabRecords::MacabRecords(const MacabRecords *_copy)
 
 
 MacabRecords::MacabRecords(const ABAddressBookRef _addressBook)
+    : recordsSize(0), currentRecord(0), recordType(kABPersonRecordType),
+      header(nullptr), records(nullptr), addressBook(_addressBook)
 {
-    /* Variables passed in... */
-    addressBook = _addressBook;
-
-    /* Default variables... */
-    recordsSize = 0;
-    currentRecord = 0;
-    records = nullptr;
-    header = nullptr;
-    recordType = kABPersonRecordType;
-
     /* Variables constructed... */
     bootstrap_CF_types();
     bootstrap_requiredProperties();
diff --git a/connectivity/source/drivers/macab/MacabResultSet.cxx b/connectivity/source/drivers/macab/MacabResultSet.cxx
index 149a3123208d..7b0911223d7f 100644
--- a/connectivity/source/drivers/macab/MacabResultSet.cxx
+++ b/connectivity/source/drivers/macab/MacabResultSet.cxx
@@ -53,9 +53,9 @@ MacabResultSet::MacabResultSet(MacabCommonStatement* pStmt)
       m_xStatement(pStmt),
       m_aMacabRecords(),
       m_nRowPos(-1),
-      m_bWasNull(true)
+      m_bWasNull(true),
+      m_sTableName(MacabAddressBook::getDefaultTableName())
 {
-    m_sTableName = MacabAddressBook::getDefaultTableName();
 }
 
 MacabResultSet::~MacabResultSet()
diff --git a/connectivity/source/drivers/mork/MStatement.cxx b/connectivity/source/drivers/mork/MStatement.cxx
index 10bad0a49a40..5df8a0e3a9ec 100644
--- a/connectivity/source/drivers/mork/MStatement.cxx
+++ b/connectivity/source/drivers/mork/MStatement.cxx
@@ -56,13 +56,13 @@ OStatement::OStatement( OConnection* _pConnection) : OCommonStatement( _pConnect
 OCommonStatement::OCommonStatement(OConnection* _pConnection )
     :OCommonStatement_IBASE(m_aMutex)
     ,OPropertySetHelper(OCommonStatement_IBASE::rBHelper)
+    ,m_xDBMetaData (_pConnection->getMetaData())
     ,m_pTable(nullptr)
     ,m_pConnection(_pConnection)
     ,m_aParser( comphelper::getComponentContext(_pConnection->getDriver()->getFactory()) )
     ,m_pSQLIterator( new OSQLParseTreeIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser ) )
+    ,m_pParseTree(nullptr)
 {
-    m_xDBMetaData = _pConnection->getMetaData();
-    m_pParseTree = nullptr;
 }
 
 
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index ddaba5fc9e45..57be21dd6cc5 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -178,8 +178,8 @@ OPreparedResultSet::OPreparedResultSet(OConnection& rConn, OPreparedStatement* p
     , m_aStatement(static_cast<OWeakObject*>(pPrepared))
     , m_pStmt(pStmt)
     , m_encoding(rConn.getConnectionEncoding())
+    , m_nColumnCount(mysql_stmt_field_count(pStmt))
 {
-    m_nColumnCount = mysql_stmt_field_count(pStmt);
     m_pResult = mysql_stmt_result_metadata(m_pStmt);
     if (m_pResult != nullptr)
         mysql_stmt_store_result(m_pStmt);
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index c94ee1a80ec2..02ae4cc6e932 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -909,8 +909,9 @@ private:
     sal_Int32 members;
 };
 
-BaseList::BaseList(typelib_InterfaceTypeDescription const * desc) {
-    members = 0;
+BaseList::BaseList(typelib_InterfaceTypeDescription const * desc)
+   : members(0)
+{
     for (sal_Int32 i = 0; i < desc->nBaseTypes; ++i) {
         Set directBaseSet;
         sal_Int32 directBaseMembers = 0;
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index c5b496c08440..5416a5488eee 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -26,10 +26,10 @@ CertPathDialog::CertPathDialog(weld::Window* pParent)
     , m_xManualButton(m_xBuilder->weld_button("add"))
     , m_xOKButton(m_xBuilder->weld_button("ok"))
     , m_xCertPathList(m_xBuilder->weld_tree_view("paths"))
+    , m_sAddDialogText(m_xBuilder->weld_label("certdir")->get_label())
+    , m_sManualLabel(m_xBuilder->weld_label("manual")->get_label())
 {
     // these are just used to get translated strings
-    m_sAddDialogText = m_xBuilder->weld_label("certdir")->get_label();
-    m_sManualLabel = m_xBuilder->weld_label("manual")->get_label();
 
     m_xCertPathList->set_size_request(m_xCertPathList->get_approximate_digit_width() * 70,
                                       m_xCertPathList->get_height_rows(6));
diff --git a/cui/source/options/optjsearch.cxx b/cui/source/options/optjsearch.cxx
index 46a97e0848b2..4a2c31c49f76 100644
--- a/cui/source/options/optjsearch.cxx
+++ b/cui/source/options/optjsearch.cxx
@@ -46,9 +46,9 @@ SvxJSearchOptionsPage::SvxJSearchOptionsPage(weld::Container* pPage, weld::Dialo
     , m_xIgnorePunctuation(m_xBuilder->weld_check_button("ignorepunctuation"))
     , m_xIgnoreWhitespace(m_xBuilder->weld_check_button("ignorewhitespace"))
     , m_xIgnoreMiddleDot(m_xBuilder->weld_check_button("ignoremiddledot"))
+    , nTransliterationFlags(TransliterationFlags::NONE)
+    , bSaveOptions(true)
 {
-    bSaveOptions = true;
-    nTransliterationFlags = TransliterationFlags::NONE;
 }
 
 SvxJSearchOptionsPage::~SvxJSearchOptionsPage()


More information about the Libreoffice-commits mailing list