Changeset 12812 in vbox for trunk/src/VBox/Additions/common/VBoxGuestLib
- Timestamp:
- Sep 29, 2008 4:27:32 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 37166
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestProp.cpp
r12810 r12812 523 523 * @param ppszFlags Where to store the first flags value on success. 524 524 * Should not be freed. 525 *526 * @todo Make papszPatterns char const * const *, and cPatterns size_t (so we527 * can use RT_ELEMENTS without getting warnings on Windows).528 * Most of the returns should also be made char const * to discourage529 * changes and encourage compiler optimizations.530 525 */ 531 526 VBGLR3DECL(int) VbglR3GuestPropEnum(uint32_t u32ClientId, 532 char **papszPatterns,533 int cPatterns,527 char const * const *papszPatterns, 528 size_t cPatterns, 534 529 PVBGLR3GUESTPROPENUM *ppHandle, 535 char **ppszName,536 char **ppszValue,530 char const **ppszName, 531 char const **ppszValue, 537 532 uint64_t *pu64Timestamp, 538 char **ppszFlags)533 char const **ppszFlags) 539 534 { 540 535 int rc = VINF_SUCCESS; 541 536 RTMemAutoPtr<VBGLR3GUESTPROPENUM, VbglR3GuestPropEnumFree> Handle; 542 Handle = (PVBGLR3GUESTPROPENUM) 537 Handle = (PVBGLR3GUESTPROPENUM)RTMemAllocZ(sizeof(VBGLR3GUESTPROPENUM)); 543 538 if (!Handle) 544 539 rc = VERR_NO_MEMORY; … … 546 541 /* Get the length of the pattern string, including the final terminator. */ 547 542 uint32_t cchPatterns = 1; 548 for ( inti = 0; i < cPatterns; ++i)543 for (unsigned i = 0; i < cPatterns; ++i) 549 544 cchPatterns += strlen(papszPatterns[i]) + 1; 545 550 546 /* Pack the pattern array */ 551 547 RTMemAutoPtr<char> Patterns; 552 Patterns = (char *) 548 Patterns = (char *)RTMemAlloc(cchPatterns); 553 549 size_t iOffs = 0; 554 for ( int i = 0; i < cPatterns; ++i)550 for (size_t i = 0; i < cPatterns; ++i) 555 551 { 556 552 size_t cb = strlen(papszPatterns[i]) + 1; … … 619 615 * set to NULL if there are no more properties to 620 616 * enumerate. This pointer should not be freed. 621 *622 * @todo return char const *.623 617 */ 624 618 VBGLR3DECL(int) VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle, 625 char **ppszName,626 char **ppszValue,619 char const **ppszName, 620 char const **ppszValue, 627 621 uint64_t *pu64Timestamp, 628 char **ppszFlags)622 char const **ppszFlags) 629 623 { 630 624 uint32_t iBuf = pHandle->iBuf; 631 625 char *pszName = pHandle->pchBuf + iBuf; 632 /** @todo replace these with safe memchr's and return an error if needed. */ 626 /** @todo replace these with safe memchr's and return an error if needed. A 627 * PLEASE add a comment about the layout because this is rather 628 * unreadable. */ 633 629 iBuf += strlen(pszName) + 1; 634 630 char *pszValue = pHandle->pchBuf + iBuf; … … 680 676 { 681 677 PVBGLR3GUESTPROPENUM pHandle; 682 char *pszName; 683 char *pszValue; 678 char const *pszName, *pszValue, *pszFlags; 684 679 uint64_t pu64Timestamp; 685 char *pszFlags;686 680 int rc = VbglR3GuestPropEnum(u32ClientId, 687 681 (char **)papszPatterns, /** @todo fix this cast. */
Note:
See TracChangeset
for help on using the changeset viewer.