Changeset 40938 in vbox for trunk/src/VBox/Runtime/common/string
- Timestamp:
- Apr 16, 2012 11:58:26 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 77489
- Location:
- trunk/src/VBox/Runtime/common/string
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/straprintf.cpp
r40934 r40938 132 132 133 133 /* failure */ 134 pArg->psz = (char *)NULL;134 pArg->psz = NULL; 135 135 } 136 136 return 0; … … 153 153 Arg.pszTag = pszTag; 154 154 szBuf[0] = '\0'; 155 int cbRet = (int)RTStrFormatV(strallocoutput, &Arg, (PFNSTRFORMAT)NULL, NULL, pszFormat, args);155 int cbRet = (int)RTStrFormatV(strallocoutput, &Arg, NULL, NULL, pszFormat, args); 156 156 if (Arg.psz) 157 157 { … … 175 175 { 176 176 /* allocation error */ 177 *ppszBuffer = (char *)NULL;177 *ppszBuffer = NULL; 178 178 cbRet = -1; 179 179 -
trunk/src/VBox/Runtime/common/string/strformat.cpp
r40934 r40938 782 782 783 783 /* terminate the output */ 784 pfnOutput(pvArgOutput, (const char *)NULL, 0);784 pfnOutput(pvArgOutput, NULL, 0); 785 785 786 786 return cch; -
trunk/src/VBox/Runtime/common/string/strformatrt.cpp
r40934 r40938 346 346 return pfnOutput(pvArgOutput, s_szFalse, sizeof(s_szFalse) - 1); 347 347 /* invalid boolean value */ 348 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, "!%lld!", u.u64);348 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "!%lld!", u.u64); 349 349 } 350 350 … … 384 384 385 385 case RTSF_IPV4: 386 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,386 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 387 387 "%u.%u.%u.%u", 388 388 u.Ipv4Addr.au8[0], … … 394 394 { 395 395 if (VALID_PTR(u.pIpv6Addr)) 396 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,396 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 397 397 "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", 398 398 u.pIpv6Addr->au8[0], … … 418 418 { 419 419 if (VALID_PTR(u.pMac)) 420 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,420 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 421 421 "%02x:%02x:%02x:%02x:%02x:%02x", 422 422 u.pMac->au8[0], … … 437 437 case RTNETADDRTYPE_IPV4: 438 438 if (u.pNetAddr->uPort == RTNETADDR_PORT_NA) 439 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,439 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 440 440 "%u.%u.%u.%u", 441 441 u.pNetAddr->uAddr.IPv4.au8[0], … … 443 443 u.pNetAddr->uAddr.IPv4.au8[2], 444 444 u.pNetAddr->uAddr.IPv4.au8[3]); 445 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,445 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 446 446 "%u.%u.%u.%u:%u", 447 447 u.pNetAddr->uAddr.IPv4.au8[0], … … 453 453 case RTNETADDRTYPE_IPV6: 454 454 if (u.pNetAddr->uPort == RTNETADDR_PORT_NA) 455 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,455 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 456 456 "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", 457 457 u.pNetAddr->uAddr.IPv6.au8[0], … … 471 471 u.pNetAddr->uAddr.IPv6.au8[14], 472 472 u.pNetAddr->uAddr.IPv6.au8[15]); 473 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,473 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 474 474 "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x %u", 475 475 u.pNetAddr->uAddr.IPv6.au8[0], … … 492 492 493 493 case RTNETADDRTYPE_MAC: 494 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,494 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 495 495 "%02x:%02x:%02x:%02x:%02x:%02x", 496 496 u.pNetAddr->uAddr.Mac.au8[0], … … 502 502 503 503 default: 504 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,504 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 505 505 "unsupported-netaddr-type=%u", u.pNetAddr->enmType); 506 506 … … 515 515 { 516 516 /* cannot call RTUuidToStr because of GC/R0. */ 517 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,517 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 518 518 "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 519 519 u.pUuid->Gen.u32TimeLow, … … 664 664 { 665 665 int i; 666 cch += RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, "%s%0*x %04x:", off ? "\n" : "", sizeof(pu8) * 2, (uintptr_t)pu8, off);666 cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s%0*x %04x:", off ? "\n" : "", sizeof(pu8) * 2, (uintptr_t)pu8, off); 667 667 for (i = 0; i < cchWidth && off + i < cchPrecision ; i++) 668 cch += RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0,668 cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, 669 669 off + i < cchPrecision ? !(i & 7) && i ? "-%02x" : " %02x" : " ", pu8[i]); 670 670 while (i++ < cchWidth) … … 693 693 if (cchPrecision-- > 0) 694 694 { 695 cch = RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, "%02x", *pu8++);695 cch = RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%02x", *pu8++); 696 696 for (; cchPrecision > 0; cchPrecision--, pu8++) 697 cch += RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, " %02x", *pu8);697 cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, " %02x", *pu8); 698 698 return cch; 699 699 } … … 728 728 return pfnOutput(pvArgOutput, pMsg->pszMsgFull,strlen(pMsg->pszMsgFull)); 729 729 case 'a': 730 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, "%s (0x%08X) - %s", pMsg->pszDefine, hrc, pMsg->pszMsgFull);730 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (0x%08X) - %s", pMsg->pszDefine, hrc, pMsg->pszMsgFull); 731 731 default: 732 732 AssertMsgFailed(("Invalid status code format type '%.10s'!\n", pszFormatOrg)); … … 762 762 return pfnOutput(pvArgOutput, pMsg->pszMsgFull, strlen(pMsg->pszMsgFull)); 763 763 case 'a': 764 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, "%s (%d) - %s", pMsg->pszDefine, rc, pMsg->pszMsgFull);764 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (%d) - %s", pMsg->pszDefine, rc, pMsg->pszMsgFull); 765 765 default: 766 766 AssertMsgFailed(("Invalid status code format type '%.10s'!\n", pszFormatOrg)); … … 774 774 case 'f': 775 775 case 'a': 776 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, "%d", rc);776 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%d", rc); 777 777 default: 778 778 AssertMsgFailed(("Invalid status code format type '%.10s'!\n", pszFormatOrg)); … … 801 801 return pfnOutput(pvArgOutput, pMsg->pszMsgFull,strlen(pMsg->pszMsgFull)); 802 802 case 'a': 803 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, "%s (0x%08X) - %s", pMsg->pszDefine, rc, pMsg->pszMsgFull);803 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "%s (0x%08X) - %s", pMsg->pszDefine, rc, pMsg->pszMsgFull); 804 804 # else 805 805 case 'c': 806 806 case 'f': 807 807 case 'a': 808 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, 0, "0x%08X", rc);808 return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "0x%08X", rc); 809 809 # endif 810 810 default: … … 911 911 { 912 912 case RTST_TIMESPEC: 913 return RTStrFormat(pfnOutput, pvArgOutput, (PFNSTRFORMAT)NULL, NULL, "%'lld ns", RTTimeSpecGetNano(u.pTimeSpec));913 return RTStrFormat(pfnOutput, pvArgOutput, NULL, NULL, "%'lld ns", RTTimeSpecGetNano(u.pTimeSpec)); 914 914 915 915 default: -
trunk/src/VBox/Runtime/common/string/stringalloc.cpp
r40934 r40938 71 71 { 72 72 RTMemFree(pszOld); 73 *ppsz = (char *)NULL;73 *ppsz = NULL; 74 74 } 75 75 else if (pszOld) -
trunk/src/VBox/Runtime/common/string/strpbrk.cpp
r40934 r40938 60 60 61 61 } 62 return (char *)NULL;62 return NULL; 63 63 } 64 64 -
trunk/src/VBox/Runtime/common/string/strprintf.cpp
r40934 r40938 100 100 RTDECL(size_t) RTStrPrintfV(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args) 101 101 { 102 return RTStrPrintfExV( (PFNSTRFORMAT)NULL, NULL, pszBuffer, cchBuffer, pszFormat, args);102 return RTStrPrintfExV(NULL, NULL, pszBuffer, cchBuffer, pszFormat, args); 103 103 } 104 104 RT_EXPORT_SYMBOL(RTStrPrintfV); -
trunk/src/VBox/Runtime/common/string/strtonum.cpp
r40934 r40938 261 261 { 262 262 uint64_t u64; 263 int rc = RTStrToUInt64Ex(pszValue, (char **)NULL, 0, &u64);263 int rc = RTStrToUInt64Ex(pszValue, NULL, 0, &u64); 264 264 if (RT_SUCCESS(rc)) 265 265 return u64; … … 348 348 { 349 349 uint32_t u32; 350 int rc = RTStrToUInt32Ex(pszValue, (char **)NULL, 0, &u32);350 int rc = RTStrToUInt32Ex(pszValue, NULL, 0, &u32); 351 351 if (RT_SUCCESS(rc)) 352 352 return u32; … … 435 435 { 436 436 uint16_t u16; 437 int rc = RTStrToUInt16Ex(pszValue, (char **)NULL, 0, &u16);437 int rc = RTStrToUInt16Ex(pszValue, NULL, 0, &u16); 438 438 if (RT_SUCCESS(rc)) 439 439 return u16; … … 522 522 { 523 523 uint8_t u8; 524 int rc = RTStrToUInt8Ex(pszValue, (char **)NULL, 0, &u8);524 int rc = RTStrToUInt8Ex(pszValue, NULL, 0, &u8); 525 525 if (RT_SUCCESS(rc)) 526 526 return u8; … … 701 701 { 702 702 int64_t i64; 703 int rc = RTStrToInt64Ex(pszValue, (char **)NULL, 0, &i64);703 int rc = RTStrToInt64Ex(pszValue, NULL, 0, &i64); 704 704 if (RT_SUCCESS(rc)) 705 705 return i64; … … 788 788 { 789 789 int32_t i32; 790 int rc = RTStrToInt32Ex(pszValue, (char **)NULL, 0, &i32);790 int rc = RTStrToInt32Ex(pszValue, NULL, 0, &i32); 791 791 if (RT_SUCCESS(rc)) 792 792 return i32; … … 875 875 { 876 876 int16_t i16; 877 int rc = RTStrToInt16Ex(pszValue, (char **)NULL, 0, &i16);877 int rc = RTStrToInt16Ex(pszValue, NULL, 0, &i16); 878 878 if (RT_SUCCESS(rc)) 879 879 return i16; … … 962 962 { 963 963 int8_t i8; 964 int rc = RTStrToInt8Ex(pszValue, (char **)NULL, 0, &i8);964 int rc = RTStrToInt8Ex(pszValue, NULL, 0, &i8); 965 965 if (RT_SUCCESS(rc)) 966 966 return i8; -
trunk/src/VBox/Runtime/common/string/utf-16.cpp
r40934 r40938 464 464 Assert(VALID_PTR(ppszString)); 465 465 Assert(VALID_PTR(pwszString)); 466 *ppszString = (char *)NULL;466 *ppszString = NULL; 467 467 468 468 /* … … 529 529 else 530 530 { 531 *ppsz = (char *)NULL;531 *ppsz = NULL; 532 532 fShouldFree = true; 533 533 cch = RT_MAX(cch, cchResult + 1); … … 824 824 Assert(VALID_PTR(ppszString)); 825 825 Assert(VALID_PTR(pwszString)); 826 *ppszString = (char *)NULL;826 *ppszString = NULL; 827 827 828 828 /* … … 889 889 else 890 890 { 891 *ppsz = (char *)NULL;891 *ppsz = NULL; 892 892 fShouldFree = true; 893 893 cch = RT_MAX(cch, cchResult + 1); … … 1003 1003 Assert(VALID_PTR(ppwszString)); 1004 1004 Assert(VALID_PTR(pszString)); 1005 *ppwszString = (PRTUTF16)NULL;1005 *ppwszString = NULL; 1006 1006 1007 1007 /* … … 1071 1071 else 1072 1072 { 1073 *ppwsz = (PRTUTF16)NULL;1073 *ppwsz = NULL; 1074 1074 fShouldFree = true; 1075 1075 cwc = RT_MAX(cwcResult + 1, cwc); -
trunk/src/VBox/Runtime/common/string/utf-8.cpp
r40934 r40938 275 275 { 276 276 size_t cCodePoints; 277 int rc = rtUtf8Length(psz, RTSTR_MAX, &cCodePoints, (size_t *)NULL);277 int rc = rtUtf8Length(psz, RTSTR_MAX, &cCodePoints, NULL); 278 278 return RT_SUCCESS(rc) ? cCodePoints : 0; 279 279 } … … 284 284 { 285 285 size_t cCodePoints; 286 int rc = rtUtf8Length(psz, cch, &cCodePoints, (size_t *)NULL);286 int rc = rtUtf8Length(psz, cch, &cCodePoints, NULL); 287 287 if (pcCps) 288 288 *pcCps = RT_SUCCESS(rc) ? cCodePoints : 0; … … 390 390 Assert(VALID_PTR(pszString)); 391 391 Assert(VALID_PTR(ppaCps)); 392 *ppaCps = (PRTUNICP)NULL;392 *ppaCps = NULL; 393 393 394 394 /* … … 396 396 */ 397 397 size_t cCps; 398 int rc = rtUtf8Length(pszString, RTSTR_MAX, &cCps, (size_t *)NULL);398 int rc = rtUtf8Length(pszString, RTSTR_MAX, &cCps, NULL); 399 399 if (RT_SUCCESS(rc)) 400 400 { … … 437 437 */ 438 438 size_t cCpsResult; 439 int rc = rtUtf8Length(pszString, cchString, &cCpsResult, (size_t *)NULL);439 int rc = rtUtf8Length(pszString, cchString, &cCpsResult, NULL); 440 440 if (RT_SUCCESS(rc)) 441 441 { … … 457 457 else 458 458 { 459 *ppaCps = (PRTUNICP)NULL;459 *ppaCps = NULL; 460 460 fShouldFree = true; 461 461 cCps = RT_MAX(cCpsResult + 1, cCps); … … 711 711 Assert(VALID_PTR(ppwszString)); 712 712 Assert(VALID_PTR(pszString)); 713 *ppwszString = (PRTUTF16)NULL;713 *ppwszString = NULL; 714 714 715 715 /* … … 779 779 else 780 780 { 781 *ppwsz = (PRTUTF16)NULL;781 *ppwsz = NULL; 782 782 fShouldFree = true; 783 783 cwc = RT_MAX(cwcResult + 1, cwc); … … 901 901 Assert(VALID_PTR(ppszString)); 902 902 Assert(VALID_PTR(pszString)); 903 *ppszString = (char *)NULL;903 *ppszString = NULL; 904 904 905 905 /* … … 966 966 else 967 967 { 968 *ppsz = (char *)NULL;968 *ppsz = NULL; 969 969 fShouldFree = true; 970 970 cch = RT_MAX(cch, cchResult + 1); … … 1094 1094 Assert(VALID_PTR(ppszString)); 1095 1095 Assert(VALID_PTR(pszString)); 1096 *ppszString = (char *)NULL;1096 *ppszString = NULL; 1097 1097 1098 1098 /* … … 1162 1162 else 1163 1163 { 1164 *ppsz = (char *)NULL;1164 *ppsz = NULL; 1165 1165 fShouldFree = true; 1166 1166 cch = RT_MAX(cchResult + 1, cch);
Note:
See TracChangeset
for help on using the changeset viewer.