VirtualBox

Changeset 52536 in vbox for trunk/src


Ignore:
Timestamp:
Aug 31, 2014 7:22:05 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95791
Message:

RTAsn1ObjId_Compare: bugfix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/asn1/asn1-ut-objid.cpp

    r51770 r52536  
    505505RTDECL(int) RTAsn1ObjId_Compare(PCRTASN1OBJID pLeft, PCRTASN1OBJID pRight)
    506506{
    507     if (!RTAsn1ObjId_IsPresent(pLeft) || RTAsn1ObjId_IsPresent(pRight))
    508         return (int)RTAsn1ObjId_IsPresent(pLeft) - (int)RTAsn1ObjId_IsPresent(pRight);
    509 
    510     uint8_t cComponents = RT_MIN(pLeft->cComponents, pRight->cComponents);
    511     for (uint32_t i = 0; i < cComponents; i++)
    512         if (pLeft->pauComponents[i] != pRight->pauComponents[i])
    513             return pLeft->pauComponents[i] < pRight->pauComponents[i] ? -1 : 1;
    514 
    515     if (pLeft->cComponents == pRight->cComponents)
    516         return 0;
    517     return pLeft->cComponents < pRight->cComponents ? -1 : 1;
     507    if (RTAsn1ObjId_IsPresent(pLeft))
     508    {
     509        if (RTAsn1ObjId_IsPresent(pRight))
     510        {
     511            uint8_t cComponents = RT_MIN(pLeft->cComponents, pRight->cComponents);
     512            for (uint32_t i = 0; i < cComponents; i++)
     513                if (pLeft->pauComponents[i] != pRight->pauComponents[i])
     514                    return pLeft->pauComponents[i] < pRight->pauComponents[i] ? -1 : 1;
     515
     516            if (pLeft->cComponents == pRight->cComponents)
     517                return 0;
     518            return pLeft->cComponents < pRight->cComponents ? -1 : 1;
     519        }
     520        return 1;
     521    }
     522    return 0 - (int)RTAsn1ObjId_IsPresent(pRight);
    518523}
    519524
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette