X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=contrib%2Fldapc%2B%2B%2Fsrc%2FLDAPModList.cpp;h=d49d97dca6d58bf4dab1aa193c76206ce5f60381;hb=4d0d12db27b3b44cc36acc089b0e640320480fe7;hp=876b6ddb88ce53c2e6d5cb7386d6bb105afc48ef;hpb=11fbe2a45c64036a08e601270b0d1049f2c57009;p=openldap diff --git a/contrib/ldapc++/src/LDAPModList.cpp b/contrib/ldapc++/src/LDAPModList.cpp index 876b6ddb88..d49d97dca6 100644 --- a/contrib/ldapc++/src/LDAPModList.cpp +++ b/contrib/ldapc++/src/LDAPModList.cpp @@ -1,5 +1,6 @@ +// $OpenLDAP$ /* - * Copyright 2000, OpenLDAP Foundation, All Rights Reserved. + * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -7,6 +8,10 @@ #include "LDAPModList.h" #include "debug.h" +#include + +using namespace std; + LDAPModList::LDAPModList(){ DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPModList::LDAPModList()" << endl); } @@ -23,12 +28,21 @@ void LDAPModList::addModification(const LDAPModification &mod){ LDAPMod** LDAPModList::toLDAPModArray(){ DEBUG(LDAP_DEBUG_TRACE,"LDAPModList::toLDAPModArray()" << endl); - LDAPMod **ret = new LDAPMod*[m_modList.size()+1]; - ret[m_modList.size()]=0; - ModList::const_iterator i; - int j=0; - for (i=m_modList.begin(); i != m_modList.end(); i++ , j++){ - ret[j]=i->toLDAPMod(); - } - return ret; + LDAPMod **ret = (LDAPMod**) malloc( + (m_modList.size()+1) * sizeof(LDAPMod*)); + ret[m_modList.size()]=0; + LDAPModList::ListType::const_iterator i; + int j=0; + for (i=m_modList.begin(); i != m_modList.end(); i++ , j++){ + ret[j]=i->toLDAPMod(); + } + return ret; +} + +bool LDAPModList::empty() const { + return m_modList.empty(); +} + +unsigned int LDAPModList::size() const { + return m_modList.size(); }