Fixed incorrect identities/features ordering when building capabilities hash.

git-svn-id: http://yate.null.ro/svn/yate/trunk@4751 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2011-12-12 11:37:06 +00:00
parent 885a2d2b1f
commit a9d2c66492
2 changed files with 6 additions and 5 deletions

View File

@ -676,9 +676,9 @@ void XMPPFeatureList::updateEntityCaps()
JIDIdentity* crt = static_cast<JIDIdentity*>(oi->get());
#define CMP_IDENT(a,b) { \
int res = XMPPUtils::cmpBytes(a,b); \
if (res == -1) \
if (res < 0) \
break; \
if (res == 1) \
if (res > 0) \
continue; \
}
CMP_IDENT(id->m_category,crt->m_category)
@ -702,7 +702,7 @@ void XMPPFeatureList::updateEntityCaps()
ObjList* of = f.skipNull();
for (; of; of = of->skipNext()) {
String* crt = static_cast<String*>(of->get());
if (XMPPUtils::cmpBytes(*feature,*crt) == -1)
if (XMPPUtils::cmpBytes(*feature,*crt) < 0)
break;
}
if (of)
@ -1593,7 +1593,7 @@ XmlElement* XMPPUtils::getChatXml(NamedList& list, const char* param,
return xml;
}
// Compare 2 Strings. Return -1 if s1<s2, 1 if s1>s2 or 0
// Compare 2 Strings. Return negative if s1<s2, positive if s1>s2 or 0
int XMPPUtils::cmpBytes(const String& s1, const String& s2)
{
if (s1 && s2) {

View File

@ -1902,7 +1902,8 @@ public:
* Byte compare 2 strings.
* @param s1 The first string
* @param s2 The second string
* @return Return -1 if s1 < s2, 1 if s1 > s2 or 0 if the 2 strings are equal
* @return Return less then 0 if s1 < s2, greater then 0 if s1 > s2 or
* 0 if the 2 strings are equal
*/
static int cmpBytes(const String& s1, const String& s2);