Changeset 22161 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 11, 2009 12:02:25 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/CFGM.cpp
r19466 r22161 1574 1574 * @param pszName Value name. 1575 1575 * @param pszString The value. 1576 */ 1576 */ 1577 1577 VMMR3DECL(int) CFGMR3InsertString(PCFGMNODE pNode, const char *pszName, const char *pszString) 1578 1578 { … … 1600 1600 pLeaf->Value.String.cch = cchString; 1601 1601 } 1602 else 1603 MMR3HeapFree(pszStringCopy); 1602 1604 } 1603 1605 else … … 1610 1612 } 1611 1613 1614 1615 /** 1616 * Same as CFGMR3InsertString except the string value given in RTStrPrintfV 1617 * fashion. 1618 * 1619 * @returns VBox status code. 1620 * @param pNode Parent node. 1621 * @param pszName Value name. 1622 * @param pszFormat The value given as a format string. 1623 * @param va Argument to pszFormat. 1624 */ 1625 VMMR3DECL(int) CFGMR3InsertStringFV(PCFGMNODE pNode, const char *pszName, const char *pszFormat, va_list va) 1626 { 1627 int rc; 1628 if (pNode) 1629 { 1630 /* 1631 * Allocate string object first. 1632 */ 1633 char *pszString = MMR3HeapAPrintfVU(pNode->pVM->pUVM, MM_TAG_CFGM_STRING, pszFormat, va); 1634 if (pszString) 1635 { 1636 /* 1637 * Create value leaf and set it to string type. 1638 */ 1639 PCFGMLEAF pLeaf; 1640 rc = cfgmR3InsertLeaf(pNode, pszName, &pLeaf); 1641 if (RT_SUCCESS(rc)) 1642 { 1643 pLeaf->enmType = CFGMVALUETYPE_STRING; 1644 pLeaf->Value.String.psz = pszString; 1645 pLeaf->Value.String.cch = strlen(pszString); 1646 } 1647 else 1648 MMR3HeapFree(pszString); 1649 } 1650 else 1651 rc = VERR_NO_MEMORY; 1652 } 1653 else 1654 rc = VERR_CFGM_NO_PARENT; 1655 1656 return rc; 1657 } 1658 1659 1660 /** 1661 * Same as CFGMR3InsertString except the string value given in RTStrPrintf 1662 * fashion. 1663 * 1664 * @returns VBox status code. 1665 * @param pNode Parent node. 1666 * @param pszName Value name. 1667 * @param pszFormat The value given as a format string. 1668 * @param ... Argument to pszFormat. 1669 */ 1670 VMMR3DECL(int) CFGMR3InsertStringF(PCFGMNODE pNode, const char *pszName, const char *pszFormat, ...) 1671 { 1672 va_list va; 1673 va_start(va, pszFormat); 1674 int rc = CFGMR3InsertStringFV(pNode, pszName, pszFormat, va); 1675 va_end(va); 1676 return rc; 1677 } 1678 1679 1680 /** 1681 * Same as CFGMR3InsertString except the string value given as a UTF-16 string. 1682 * 1683 * @returns VBox status code. 1684 * @param pNode Parent node. 1685 * @param pszName Value name. 1686 * @param pwszValue The string value (UTF-16). 1687 */ 1688 VMMR3DECL(int) CFGMR3InsertStringW(PCFGMNODE pNode, const char *pszName, PCRTUTF16 pwszValue) 1689 { 1690 char *pszValue; 1691 int rc = RTUtf16ToUtf8(pwszValue, &pszValue); 1692 if (RT_SUCCESS(rc)) 1693 { 1694 rc = CFGMR3InsertString(pNode, pszName, pszValue); 1695 RTStrFree(pszValue); 1696 } 1697 return rc; 1698 } 1612 1699 1613 1700
Note:
See TracChangeset
for help on using the changeset viewer.