VirtualBox

忽略:
時間撮記:
2014-8-31 下午07:22:05 (11 年 以前)
作者:
vboxsync
svn:sync-xref-src-repo-rev:
95791
訊息:

RTAsn1ObjId_Compare: bugfix.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • 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
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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