[Libreoffice-commits] core.git: include/registry registry/source stoc/source unoidl/source

Noel Grandin noel at peralex.com
Thu Mar 17 11:22:26 UTC 2016


 include/registry/reader.hxx                   |   16 ++--------------
 include/registry/registry.hxx                 |    7 ++-----
 registry/source/reflread.cxx                  |    5 ++---
 registry/source/reflread.hxx                  |    6 +-----
 registry/source/reflwrit.cxx                  |    8 +++-----
 registry/source/reflwrit.hxx                  |    7 +------
 registry/source/regimpl.cxx                   |   11 ++++-------
 stoc/source/simpleregistry/simpleregistry.cxx |    2 +-
 unoidl/source/legacyprovider.cxx              |    2 +-
 9 files changed, 17 insertions(+), 47 deletions(-)

New commits:
commit 0ed7ec1b44edd88037b7b822a49042c4af299491
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Mar 17 11:34:22 2016 +0200

    loplugin:constantparam in registry
    
    Change-Id: Ic3c60325a722422912d06fe21d072c5f5c4bccb1
    Reviewed-on: https://gerrit.libreoffice.org/23322
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/registry/reader.hxx b/include/registry/reader.hxx
index 0e2da07..6d3deb8 100644
--- a/include/registry/reader.hxx
+++ b/include/registry/reader.hxx
@@ -59,23 +59,11 @@ public:
 
        @param length the size in bytes of the binary blob representing the type
 
-       @param copy if true, the type reader creates an internal copy of the
-       given buffer, and the given buffer is not accessed after this constructor
-       returns; if false, the type reader works directly on the given buffer,
-       which must remain available unmodified until the underlying type reader
-       is destroyed (note that the lifetime of the underlying type reader can be
-       different from the lifetime of this <code>Reader</code> instance)
-
-       @param maxVersion the maximum binary blob version the client is prepared
-       to handle; must not be negative
-
        @exception std::bad_alloc is raised if an out-of-memory condition occurs
      */
-    Reader(
-        void const * buffer, sal_uInt32 length, bool copy,
-        typereg_Version maxVersion)
+    Reader(void const * buffer, sal_uInt32 length)
     {
-        if (!typereg_reader_create(buffer, length, copy, maxVersion, &m_handle))
+        if (!typereg_reader_create(buffer, length, false/*copy*/, TYPEREG_VERSION_1, &m_handle))
         {
             throw std::bad_alloc();
         }
diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx
index e9cbff8..9309e7f 100644
--- a/include/registry/registry.hxx
+++ b/include/registry/registry.hxx
@@ -558,12 +558,10 @@ public:
 
         @param[in]  keyName specifies the name of the key which will be resolved relative to this key.
                         The resolved name will be prefixed with the name of this key.
-        @param[in]  firstLinkOnly ignored
         @param[out] rResolvedName the resolved name.
         @return RegError::NO_ERROR if succeeds else an error code.
      */
     inline RegError getResolvedKeyName(const rtl::OUString& keyName,
-                                       bool firstLinkOnly,
                                            rtl::OUString& rResolvedName) const;
 
     /// returns the name of the registry in which the key is defined.
@@ -994,13 +992,12 @@ inline RegError RegistryKey::getLinkTarget(const rtl::OUString& ,
 
 
 inline RegError RegistryKey::getResolvedKeyName(const rtl::OUString& keyName,
-                                                bool firstLinkOnly,
-                                                       rtl::OUString& rResolvedName) const
+                                                      rtl::OUString& rResolvedName) const
     {
         if (m_registry.isValid())
             return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
                                                          keyName.pData,
-                                                         firstLinkOnly,
+                                                         true,
                                                          &rResolvedName.pData);
         else
             return RegError::INVALID_KEY;
diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx
index 9d7ce59..1df3a63 100644
--- a/registry/source/reflread.cxx
+++ b/registry/source/reflread.cxx
@@ -1723,11 +1723,10 @@ void TYPEREG_CALLTYPE typereg_reader_getSuperTypeName(
 }
 
 RegistryTypeReader::RegistryTypeReader(const sal_uInt8* buffer,
-                                              sal_uInt32 bufferLen,
-                                              bool copyData)
+                                              sal_uInt32 bufferLen)
     : m_hImpl(nullptr)
 {
-    m_hImpl = createEntry(buffer, bufferLen, copyData);
+    m_hImpl = createEntry(buffer, bufferLen, false/*copyData*/);
 }
 
 RegistryTypeReader::~RegistryTypeReader()
diff --git a/registry/source/reflread.hxx b/registry/source/reflread.hxx
index 6912fa8..ab029bd 100644
--- a/registry/source/reflread.hxx
+++ b/registry/source/reflread.hxx
@@ -43,13 +43,9 @@ public:
 
         @param buffer points to the binary data block.
         @param bufferLen specifies the size of the binary data block.
-        @param copyData specifies if the data block should be copied.
-                        The block can be copied to ensure that the data
-                        is valid for the lifetime of this instance.
      */
     RegistryTypeReader(const sal_uInt8* buffer,
-                              sal_uInt32 bufferLen,
-                              bool copyData);
+                              sal_uInt32 bufferLen);
 
     /// Destructor. The Destructor frees the data block if the copyData flag was TRUE.
     ~RegistryTypeReader();
diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx
index eaa1d18..59e712f 100644
--- a/registry/source/reflwrit.cxx
+++ b/registry/source/reflwrit.cxx
@@ -1337,17 +1337,15 @@ static TypeWriterImpl TYPEREG_CALLTYPE createEntry(
 RegistryTypeWriter::RegistryTypeWriter(RTTypeClass               RTTypeClass,
                                               const rtl::OUString&    typeName,
                                               const rtl::OUString&    superTypeName,
-                                              sal_uInt16                fieldCount,
-                                              sal_uInt16                methodCount,
-                                              sal_uInt16                referenceCount)
+                                              sal_uInt16                fieldCount)
     : m_hImpl(nullptr)
 {
     m_hImpl = createEntry(RTTypeClass,
                                   typeName.pData,
                                   superTypeName.pData,
                                   fieldCount,
-                                  methodCount,
-                                  referenceCount);
+                                  0,
+                                  0);
 }
 
 RegistryTypeWriter::~RegistryTypeWriter()
diff --git a/registry/source/reflwrit.hxx b/registry/source/reflwrit.hxx
index dcf2eec..9e47e53 100644
--- a/registry/source/reflwrit.hxx
+++ b/registry/source/reflwrit.hxx
@@ -47,16 +47,11 @@ public:
                              with '/' as separator.
         @param fieldCount specifies the number of fields (eg. number of attrbutes/properties,
                           enum values or constants).
-        @param methodCount specifies the number of methods.
-        @param referenceCount specifies the number of references (eg. number of supported interfaces,
-                              exported services ...)
      */
     RegistryTypeWriter(RTTypeClass               RTTypeClass,
                               const rtl::OUString&    typeName,
                               const rtl::OUString&    superTypeName,
-                              sal_uInt16                fieldCount,
-                              sal_uInt16                methodCount,
-                              sal_uInt16                referenceCount);
+                              sal_uInt16                fieldCount);
 
     /** Destructor. The Destructor frees the internal data block.
 
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 12455b0..e367edb 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -1074,7 +1074,7 @@ RegError ORegistry::checkBlop(OStoreStream& rValue,
                               sal_uInt8* pSrcBuffer,
                               bool bReport)
 {
-    RegistryTypeReader reader(pSrcBuffer, srcValueSize, false);
+    RegistryTypeReader reader(pSrcBuffer, srcValueSize);
 
     if (reader.getTypeClass() == RT_TYPE_INVALID)
     {
@@ -1101,7 +1101,7 @@ RegError ORegistry::checkBlop(OStoreStream& rValue,
             if (!rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, rwBytes) &&
                 (rwBytes == valueSize))
             {
-                RegistryTypeReader reader2(pBuffer, valueSize, false);
+                RegistryTypeReader reader2(pBuffer, valueSize);
 
                 if ((reader.getTypeClass() != reader2.getTypeClass())
                     || reader2.getTypeClass() == RT_TYPE_INVALID)
@@ -1212,9 +1212,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
         RegistryTypeWriter writer(reader.getTypeClass(),
                                   reader.getTypeName(),
                                   reader.getSuperTypeName(),
-                                  (sal_uInt16)count,
-                                  0,
-                                  0);
+                                  (sal_uInt16)count);
 
         for (sal_uInt32 i=0 ; i < reader.getFieldCount(); i++)
         {
@@ -1502,8 +1500,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
                     sal::static_int_cast< unsigned long >(valueSize));
                 fprintf(stdout, "%s       Data = ", indent);
                 dumpType(
-                    typereg::Reader(
-                        pBuffer, valueSize, false, TYPEREG_VERSION_1),
+                    typereg::Reader(pBuffer, valueSize),
                     sIndent + "              ");
             }
             break;
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 5c4f7ab..eeef536 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -975,7 +975,7 @@ OUString Key::getResolvedName(OUString const & aKeyName)
 {
     osl::MutexGuard guard(registry_->mutex_);
     OUString resolved;
-    RegError err = key_.getResolvedKeyName(aKeyName, true, resolved);
+    RegError err = key_.getResolvedKeyName(aKeyName, resolved);
     if (err != RegError::NO_ERROR) {
         throw css::registry::InvalidRegistryException(
             (("com.sun.star.registry.SimpleRegistry key getResolvedName:"
diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx
index 7edcdb6..bf96504 100644
--- a/unoidl/source/legacyprovider.cxx
+++ b/unoidl/source/legacyprovider.cxx
@@ -196,7 +196,7 @@ typereg::Reader getReader(RegistryKey & key, std::vector< char > * buffer) {
             ("legacy format: cannot get binary value of key " + key.getName()
              + ": " + OUString::number(static_cast<int>(e))));
     }
-    typereg::Reader reader(&(*buffer)[0], size, false, TYPEREG_VERSION_1);
+    typereg::Reader reader(&(*buffer)[0], size);
     if (!reader.isValid()) {
         throw FileFormatException(
             key.getRegistryName(),


More information about the Libreoffice-commits mailing list