VirtualBox

Changeset 9743 in vbox


Ignore:
Timestamp:
Jun 16, 2008 10:53:02 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
32099
Message:

Made RTUuidCompare grok NULL pointers and behave the same way in both the generic and Windows implementation.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/uuid.h

    r9738 r9743  
    6969 *
    7070 * @returns 0 if eq, < 0 or > 0.
    71  * @param   pUuid1          First value to compare.
    72  * @param   pUuid2          Second value to compare.
     71 * @param   pUuid1          First value to compare. NULL is treated like if RTUuidIsNull() return true.
     72 * @param   pUuid2          Second value to compare. NULL is treated like if RTUuidIsNull() return true.
    7373 */
    7474RTDECL(int)  RTUuidCompare(PCRTUUID pUuid1, PCRTUUID pUuid2);
     
    7878 *
    7979 * @returns 0 if eq, < 0 or > 0.
    80  * @param   pUuid1          First value to compare.
    81  * @param   pszString2      The 2nd UUID in string form.
     80 * @param   pUuid1          First value to compare. NULL is not allowed.
     81 * @param   pszString2      The 2nd UUID in string form. NULL of malformed string is not permitted.
    8282 */
    8383RTDECL(int)  RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString);
  • trunk/src/VBox/Runtime/generic/uuid-generic.cpp

    r9741 r9743  
    6363     * Special cases.
    6464     */
    65     /** @todo This differs in the windows implementation... check out which behavior we really want. */
    6665    if (pUuid1 == pUuid2)
    6766        return 0;
     
    7069    if (!pUuid2)
    7170        return RTUuidIsNull(pUuid1) ? 0 : 1;
    72     AssertPtr(pUuid1);
    73     AssertPtr(pUuid2);
     71    AssertPtrReturn(pUuid1, -1);
     72    AssertPtrReturn(pUuid2, 1);
    7473
    7574    /*
  • trunk/src/VBox/Runtime/r3/win/uuid-win.cpp

    r9742 r9743  
    6363RTDECL(int)  RTUuidCompare(PCRTUUID pUuid1, PCRTUUID pUuid2)
    6464{
    65     /* check params */
    66     /** @todo this isn't working the same way as uuid-generic.cpp. */
     65    /*
     66     * Special cases.
     67     */
     68    if (pUuid1 == pUuid2)
     69        return 0;
     70    if (!pUuid1)
     71        return RTUuidIsNull(pUuid2) ? 0 : -1;
     72    if (!pUuid2)
     73        return RTUuidIsNull(pUuid1) ? 0 : 1;
    6774    AssertPtrReturn(pUuid1, -1);
    68     AssertPtrReturn(pUuid1, 1);
     75    AssertPtrReturn(pUuid2, 1);
    6976
     77    /*
     78     * Hand the rest to the Windows API.
     79     */
    7080    RPC_STATUS status;
    7181    return UuidCompare((UUID *)pUuid1, (UUID *)pUuid2, &status);
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