Kaydet (Commit) 0ed7ec1b authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

loplugin:constantparam in registry

Change-Id: Ic3c60325a722422912d06fe21d072c5f5c4bccb1
Reviewed-on: https://gerrit.libreoffice.org/23322Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst db93b92d
......@@ -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();
}
......
......@@ -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;
......
......@@ -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()
......
......@@ -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();
......
......@@ -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()
......
......@@ -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.
......
......@@ -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;
......
......@@ -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:"
......
......@@ -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(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment