VirtualBox

Changeset 25961 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 21, 2010 2:19:12 PM (15 years ago)
Author:
vboxsync
Message:

IPRT: Added RTUuidCompare2Strs; renamed tstUuid to tstRTUuid.

Location:
trunk/src/VBox/Runtime
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/uuid-generic.cpp

    r25000 r25961  
    137137
    138138
    139 RTDECL(int)  RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString)
     139RTDECL(int)  RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString2)
    140140{
    141141    RTUUID Uuid2;
     
    144144    /* check params */
    145145    AssertPtrReturn(pUuid1, -1);
    146     AssertPtrReturn(pszString, 1);
     146    AssertPtrReturn(pszString2, 1);
    147147
    148148    /*
    149149     * Try convert the string to a UUID and then compare the two.
    150150     */
    151     rc = RTUuidFromStr(&Uuid2, pszString);
     151    rc = RTUuidFromStr(&Uuid2, pszString2);
    152152    AssertRCReturn(rc, 1);
    153153
     
    155155}
    156156RT_EXPORT_SYMBOL(RTUuidCompareStr);
     157
     158
     159RTDECL(int)  RTUuidCompare2Strs(const char *pszString1, const char *pszString2)
     160{
     161    RTUUID Uuid1;
     162    RTUUID Uuid2;
     163    int rc;
     164
     165    /* check params */
     166    AssertPtrReturn(pszString1, -1);
     167    AssertPtrReturn(pszString2, 1);
     168
     169    /*
     170     * Try convert the strings to UUIDs and then compare them.
     171     */
     172    rc = RTUuidFromStr(&Uuid1, pszString1);
     173    AssertRCReturn(rc, -1);
     174
     175    rc = RTUuidFromStr(&Uuid2, pszString2);
     176    AssertRCReturn(rc, 1);
     177
     178    return RTUuidCompare(&Uuid1, &Uuid2);
     179}
     180RT_EXPORT_SYMBOL(RTUuidCompare2Strs);
    157181
    158182
  • trunk/src/VBox/Runtime/r3/win/uuid-win.cpp

    r9743 r25961  
    8383
    8484
    85 RTDECL(int)  RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString)
     85RTDECL(int)  RTUuidCompareStr(PCRTUUID pUuid1, const char *pszString2)
    8686{
    8787    /* check params */
    8888    AssertPtrReturn(pUuid1, -1);
    89     AssertPtrReturn(pszString, 1);
     89    AssertPtrReturn(pszString2, 1);
    9090
    9191    /*
     
    9393     */
    9494    RTUUID Uuid2;
    95     int rc = RTUuidFromStr(&Uuid2, pszString);
     95    int rc = RTUuidFromStr(&Uuid2, pszString2);
    9696    AssertRCReturn(rc, 1);
    9797
    9898    return RTUuidCompare(pUuid1, &Uuid2);
     99}
     100
     101
     102RTDECL(int)  RTUuidCompare2Strs(const char *pszString1, const char *pszString2)
     103{
     104    RTUUID Uuid1;
     105    RTUUID Uuid2;
     106    int rc;
     107
     108    /* check params */
     109    AssertPtrReturn(pszString1, -1);
     110    AssertPtrReturn(pszString2, 1);
     111
     112    /*
     113     * Try convert the strings to UUIDs and then compare them.
     114     */
     115    rc = RTUuidFromStr(&Uuid1, pszString1);
     116    AssertRCReturn(rc, -1);
     117
     118    rc = RTUuidFromStr(&Uuid2, pszString2);
     119    AssertRCReturn(rc, 1);
     120
     121    return RTUuidCompare(&Uuid1, &Uuid2);
    99122}
    100123
  • trunk/src/VBox/Runtime/testcase/Makefile.kmk

    r25946 r25961  
    114114        tstTSC \
    115115        tstUtf8 \
    116         tstUuid
     116        tstRTUuid
    117117# tstSems
    118118PROGRAMS.win += \
     
    342342
    343343tstRTPath_TEMPLATE = VBOXR3TSTEXE
    344 tstRTPath_SOURCES  = tstRTPath.cpp
     344tstRTPath_SOURCES = tstRTPath.cpp
    345345
    346346tstPrfRT_SOURCES = tstPrfRT.cpp
     
    421421tstTSC_CXXFLAGS.linux += -O3
    422422
    423 tstUuid_SOURCES = tstUuid.cpp
     423tstRTUuid_TEMPLATE = VBOXR3TSTEXE
     424tstRTUuid_SOURCES = tstRTUuid.cpp
    424425
    425426tstUtf8_SOURCES = tstUtf8.cpp
  • trunk/src/VBox/Runtime/testcase/tstRTUuid.cpp

    r25954 r25961  
    4444{
    4545    RTTEST hTest;
    46     int rc = RTTestInitAndCreate("tstUuid", &hTest);
     46    int rc = RTTestInitAndCreate("tstRTUuid", &hTest);
    4747    if (rc)
    4848        return rc;
     
    8888    RTTEST_CHECK(hTest, RTUuidCompare(&Uuid, &Uuid2) == 0);
    8989
     90    RTTestSub(hTest, "RTUuidCompareStr");
     91    RTTEST_CHECK(hTest, RTUuidCompareStr(&Uuid, sz) == 0);
     92    RTTEST_CHECK(hTest, RTUuidCompareStr(&Uuid, "00000000-0000-0000-0000-000000000000") > 0);
     93    RTTEST_CHECK(hTest, RTUuidCompareStr(&UuidNull, "00000000-0000-0000-0000-000000000000") == 0);
     94
     95    RTTestSub(hTest, "RTUuidCompare2Strs");
     96    RTTEST_CHECK(hTest, RTUuidCompare2Strs(sz, sz) == 0);
     97    RTTEST_CHECK(hTest, RTUuidCompare2Strs(sz, "00000000-0000-0000-0000-000000000000") > 0);
     98    RTTEST_CHECK(hTest, RTUuidCompare2Strs("00000000-0000-0000-0000-000000000000", sz) < 0);
     99    RTTEST_CHECK(hTest, RTUuidCompare2Strs("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000") == 0);
     100    RTTEST_CHECK(hTest, RTUuidCompare2Strs("d95d883b-f91d-4ce5-a5c5-d08bb6a85dec", "a56193c7-3e0b-4c03-9d66-56efb45082f7") > 0);
     101    RTTEST_CHECK(hTest, RTUuidCompare2Strs("a56193c7-3e0b-4c03-9d66-56efb45082f7", "d95d883b-f91d-4ce5-a5c5-d08bb6a85dec") < 0);
    90102
    91103    /*
Note: See TracChangeset for help on using the changeset viewer.

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