summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-19 09:01:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-19 10:02:13 +0000
commitf6572fa96c300be282a410d9e11f0cae7049547f (patch)
tree33e256cd51e0281a5ab62be501fc6e24896e532a /xmlsecurity
parent0415cb335b953b9c10075fa524d7707db4aa55e5 (diff)
tweak to avoid coverity#1371169 Missing move assignment operator
Change-Id: I0d29ce18c19c26a7526dad98d77db4670d0c5303
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx46
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx3
2 files changed, 24 insertions, 25 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
index 5e614631e944..fc0e05e3ff1e 100644
--- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
@@ -58,9 +58,9 @@ namespace {
}
//Methods from XSanExtension
-css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl::getAlternativeNames() throw( css::uno::RuntimeException, std::exception ){
-
- if (!m_Entries.hasElements())
+css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl::getAlternativeNames() throw( css::uno::RuntimeException, std::exception )
+{
+ if (m_Entries.empty())
{
SECItem item;
@@ -73,18 +73,18 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl:
arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
if (!arena)
- return m_Entries;
+ return css::uno::Sequence<css::security::CertAltNameEntry>();
nameList = CERT_DecodeAltNameExtension(arena, &item);
CERTGeneralName* current = nameList;
int size = GetNamesLength(nameList);
- std::vector<CertAltNameEntry> arrCertAltNameEntry(size);
- for(int i = 0; i < size ; i++){
+ m_Entries.resize(size);
+ for(int i = 0; i < size; ++i){
switch (current->type) {
case certOtherName: {
- arrCertAltNameEntry[i].Type = ExtAltNameType_OTHER_NAME;
+ m_Entries[i].Type = ExtAltNameType_OTHER_NAME;
css::beans::PropertyValue otherNameProp;
otherNameProp.Name = OUString::createFromAscii(CERT_GetOidString(&current->name.OthName.oid));
@@ -94,64 +94,62 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl:
otherNameProp.Value <<= otherName;
- arrCertAltNameEntry[i].Value <<= otherNameProp;
+ m_Entries[i].Value <<= otherNameProp;
break;
}
case certRFC822Name:
- arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME;
- arrCertAltNameEntry[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ m_Entries[i].Type = ExtAltNameType_RFC822_NAME;
+ m_Entries[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US);
break;
case certDNSName:
- arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME;
- arrCertAltNameEntry[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ m_Entries[i].Type = ExtAltNameType_DNS_NAME;
+ m_Entries[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US);
break;
case certX400Address: {
// unsupported
- arrCertAltNameEntry[i].Type = ExtAltNameType_X400_ADDRESS;
+ m_Entries[i].Type = ExtAltNameType_X400_ADDRESS;
break;
}
case certDirectoryName: {
// unsupported
- arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME;
+ m_Entries[i].Type = ExtAltNameType_DIRECTORY_NAME;
break;
}
case certEDIPartyName: {
// unsupported
- arrCertAltNameEntry[i].Type = ExtAltNameType_EDI_PARTY_NAME;
+ m_Entries[i].Type = ExtAltNameType_EDI_PARTY_NAME;
break;
}
case certURI:
- arrCertAltNameEntry[i].Type = ExtAltNameType_URL;
- arrCertAltNameEntry[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ m_Entries[i].Type = ExtAltNameType_URL;
+ m_Entries[i].Value <<= OUString(reinterpret_cast<char*>(current->name.other.data), current->name.other.len, RTL_TEXTENCODING_ASCII_US);
break;
case certIPAddress: {
- arrCertAltNameEntry[i].Type = ExtAltNameType_IP_ADDRESS;
+ m_Entries[i].Type = ExtAltNameType_IP_ADDRESS;
Sequence< sal_Int8 > ipAddress( current->name.other.len ) ;
for( unsigned int r = 0; r < current->name.other.len ; r ++ )
ipAddress[r] = *( current->name.other.data + r ) ;
- arrCertAltNameEntry[i].Value <<= ipAddress;
+ m_Entries[i].Value <<= ipAddress;
break;
}
case certRegisterID:
- arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID;
+ m_Entries[i].Type = ExtAltNameType_REGISTERED_ID;
OString nssOid = OString(CERT_GetOidString(&current->name.other));
OString unoOid = removeOIDFromString(nssOid);
- arrCertAltNameEntry[i].Value <<= OStringToOUString( unoOid, RTL_TEXTENCODING_ASCII_US );
+ m_Entries[i].Value <<= OStringToOUString( unoOid, RTL_TEXTENCODING_ASCII_US );
break;
}
current = CERT_GetNextGeneralName(current);
}
- m_Entries = ::comphelper::containerToSequence<css::security::CertAltNameEntry>(arrCertAltNameEntry);
-
PORT_FreeArena(arena, PR_FALSE);
}
- return m_Entries;
+ return comphelper::containerToSequence<css::security::CertAltNameEntry>(m_Entries);
}
OString SanExtensionImpl::removeOIDFromString( const OString &oidString)
diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx
index ca7401884d7f..df81eee47408 100644
--- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx
@@ -30,13 +30,14 @@
#include <com/sun/star/security/XSanExtension.hpp>
#include <com/sun/star/security/CertAltNameEntry.hpp>
#include "certificateextension_certextn.hxx"
+#include <vector>
class SanExtensionImpl : public ::cppu::WeakImplHelper<
css::security::XSanExtension >
{
private:
CertificateExtension_CertExtn m_Extn;
- css::uno::Sequence< css::security::CertAltNameEntry > m_Entries;
+ std::vector<css::security::CertAltNameEntry> m_Entries;
static OString removeOIDFromString( const OString &oid);