Changeset 32994 in vbox
- Timestamp:
- Oct 7, 2010 11:11:10 PM (14 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/generic/uuid-generic.cpp
r32988 r32994 257 257 AssertPtrReturn(pszString, VERR_INVALID_PARAMETER); 258 258 259 fHaveBraces = (pszString[0] == '{' && pszString[37] == '}'); 260 if (fHaveBraces) 261 pszString++; 259 fHaveBraces = pszString[0] == '{'; 260 pszString += fHaveBraces; 262 261 263 262 #define MY_CHECK(expr) do { if (RT_UNLIKELY(!(expr))) return VERR_INVALID_UUID_FORMAT; } while (0) … … 299 298 MY_CHECK(MY_ISXDIGIT(pszString[34])); 300 299 MY_CHECK(MY_ISXDIGIT(pszString[35])); 301 MY_CHECK(!pszString[36 + (fHaveBraces ? 1 : 0)]); 300 if (fHaveBraces) 301 MY_CHECK(pszString[36] == '}'); 302 MY_CHECK(!pszString[36 + fHaveBraces]); 302 303 #undef MY_ISXDIGIT 303 304 #undef MY_CHECK -
trunk/src/VBox/Runtime/testcase/tstRTUuid.cpp
r28800 r32994 74 74 rc = RTUuidFromStr(&Uuid2, sz); CHECK_RC(); 75 75 RTTEST_CHECK(hTest, RTUuidCompare(&Uuid, &Uuid2) == 0); 76 77 char *psz = (char *)RTTestGuardedAllocTail(hTest, RTUUID_STR_LENGTH); 78 if (psz) 79 { 80 RTStrPrintf(psz, RTUUID_STR_LENGTH, "%s", sz); 81 RTTESTI_CHECK_RC(RTUuidFromStr(&Uuid2, psz), VINF_SUCCESS); 82 RTTEST_CHECK(hTest, RTUuidCompare(&Uuid, &Uuid2) == 0); 83 for (unsigned off = 1; off < RTUUID_STR_LENGTH; off++) 84 { 85 char *psz2 = psz + off; 86 RTStrPrintf(psz2, RTUUID_STR_LENGTH - off, "%s", sz); 87 RTTESTI_CHECK_RC(RTUuidFromStr(&Uuid2, psz2), VERR_INVALID_UUID_FORMAT); 88 } 89 RTTestGuardedFree(hTest, psz); 90 } 91 92 RTUuidClear(&Uuid2); 93 char sz2[RTUUID_STR_LENGTH + 2]; 94 RTStrPrintf(sz2, sizeof(sz2), "{%s}", sz); 95 rc = RTUuidFromStr(&Uuid2, sz2); CHECK_RC(); 96 RTTEST_CHECK(hTest, RTUuidCompare(&Uuid, &Uuid2) == 0); 97 98 psz = (char *)RTTestGuardedAllocTail(hTest, RTUUID_STR_LENGTH + 2); 99 if (psz) 100 { 101 RTStrPrintf(psz, RTUUID_STR_LENGTH + 2, "{%s}", sz); 102 RTTESTI_CHECK_RC(RTUuidFromStr(&Uuid2, psz), VINF_SUCCESS); 103 RTTEST_CHECK(hTest, RTUuidCompare(&Uuid, &Uuid2) == 0); 104 for (unsigned off = 1; off < RTUUID_STR_LENGTH + 2; off++) 105 { 106 char *psz2 = psz + off; 107 RTStrPrintf(psz2, RTUUID_STR_LENGTH + 2 - off, "{%s}", sz); 108 RTTESTI_CHECK_RC(RTUuidFromStr(&Uuid2, psz2), VERR_INVALID_UUID_FORMAT); 109 } 110 RTTestGuardedFree(hTest, psz); 111 } 76 112 77 113 RTTestSub(hTest, "RTUuidToUtf16");
Note:
See TracChangeset
for help on using the changeset viewer.