VirtualBox

Changeset 35585 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jan 17, 2011 2:20:13 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69480
Message:

iprt/string.h: Added RTStrFormatU[8|16|32|64|128] and RTStrFormatR80[|u2]. These replace the unsafe RTStrFormatNumber method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/string.h

    r35464 r35585  
    17191719 *
    17201720 * @returns Length of the formatted number.
    1721  * @param   psz            Pointer to output string buffer of sufficient size.
    1722  * @param   u64Value       Value to format.
    1723  * @param   uiBase         Number representation base.
    1724  * @param   cchWidth       Width.
    1725  * @param   cchPrecision   Precision.
    1726  * @param   fFlags         Flags (NTFS_*).
     1721 * @param   psz             Pointer to output string buffer of sufficient size.
     1722 * @param   u64Value        Value to format.
     1723 * @param   uiBase          Number representation base.
     1724 * @param   cchWidth        Width.
     1725 * @param   cchPrecision    Precision.
     1726 * @param   fFlags          Flags, RTSTR_F_XXX.
    17271727 */
    17281728RTDECL(int) RTStrFormatNumber(char *psz, uint64_t u64Value, unsigned int uiBase, signed int cchWidth, signed int cchPrecision, unsigned int fFlags);
     1729
     1730/**
     1731 * Formats an unsigned 8-bit number.
     1732 *
     1733 * @returns The length of the formatted number or VERR_BUFFER_OVERFLOW.
     1734 * @param   pszBuf          The output buffer.
     1735 * @param   cbBuf           The size of the output buffer.
     1736 * @param   u8Value         The value to format.
     1737 * @param   uiBase          Number representation base.
     1738 * @param   cchWidth        Width.
     1739 * @param   cchPrecision    Precision.
     1740 * @param   fFlags          Flags, RTSTR_F_XXX.
     1741 */
     1742RTDECL(ssize_t) RTStrFormatU8(char *pszBuf, size_t cbBuf, uint8_t u8Value, unsigned int uiBase,
     1743                              signed int cchWidth, signed int cchPrecision, uint32_t fFlags);
     1744
     1745/**
     1746 * Formats an unsigned 16-bit number.
     1747 *
     1748 * @returns The length of the formatted number or VERR_BUFFER_OVERFLOW.
     1749 * @param   pszBuf          The output buffer.
     1750 * @param   cbBuf           The size of the output buffer.
     1751 * @param   u16Value        The value to format.
     1752 * @param   uiBase          Number representation base.
     1753 * @param   cchWidth        Width.
     1754 * @param   cchPrecision    Precision.
     1755 * @param   fFlags          Flags, RTSTR_F_XXX.
     1756 */
     1757RTDECL(ssize_t) RTStrFormatU16(char *pszBuf, size_t cbBuf, uint16_t u16Value, unsigned int uiBase,
     1758                               signed int cchWidth, signed int cchPrecision, uint32_t fFlags);
     1759
     1760/**
     1761 * Formats an unsigned 32-bit number.
     1762 *
     1763 * @returns The length of the formatted number or VERR_BUFFER_OVERFLOW.
     1764 * @param   pszBuf          The output buffer.
     1765 * @param   cbBuf           The size of the output buffer.
     1766 * @param   u32Value        The value to format.
     1767 * @param   uiBase          Number representation base.
     1768 * @param   cchWidth        Width.
     1769 * @param   cchPrecision    Precision.
     1770 * @param   fFlags          Flags, RTSTR_F_XXX.
     1771 */
     1772RTDECL(ssize_t) RTStrFormatU32(char *pszBuf, size_t cbBuf, uint32_t u32Value, unsigned int uiBase,
     1773                               signed int cchWidth, signed int cchPrecision, uint32_t fFlags);
     1774
     1775/**
     1776 * Formats an unsigned 64-bit number.
     1777 *
     1778 * @returns The length of the formatted number or VERR_BUFFER_OVERFLOW.
     1779 * @param   pszBuf          The output buffer.
     1780 * @param   cbBuf           The size of the output buffer.
     1781 * @param   u64Value        The value to format.
     1782 * @param   uiBase          Number representation base.
     1783 * @param   cchWidth        Width.
     1784 * @param   cchPrecision    Precision.
     1785 * @param   fFlags          Flags, RTSTR_F_XXX.
     1786 */
     1787RTDECL(ssize_t) RTStrFormatU64(char *pszBuf, size_t cbBuf, uint64_t u64Value, unsigned int uiBase,
     1788                               signed int cchWidth, signed int cchPrecision, uint32_t fFlags);
     1789
     1790/**
     1791 * Formats an unsigned 128-bit number.
     1792 *
     1793 * @returns The length of the formatted number or VERR_BUFFER_OVERFLOW.
     1794 * @param   pszBuf          The output buffer.
     1795 * @param   cbBuf           The size of the output buffer.
     1796 * @param   pu128Value      The value to format.
     1797 * @param   uiBase          Number representation base.
     1798 * @param   cchWidth        Width.
     1799 * @param   cchPrecision    Precision.
     1800 * @param   fFlags          Flags, RTSTR_F_XXX.
     1801 */
     1802RTDECL(ssize_t) RTStrFormatU128(char *pszBuf, size_t cbBuf, PCRTUINT128U pu128Value, unsigned int uiBase,
     1803                                signed int cchWidth, signed int cchPrecision, uint32_t fFlags);
     1804
     1805/**
     1806 * Formats an 80-bit extended floating point number.
     1807 *
     1808 * @returns The length of the formatted number or VERR_BUFFER_OVERFLOW.
     1809 * @param   pszBuf          The output buffer.
     1810 * @param   cbBuf           The size of the output buffer.
     1811 * @param   pr80Value       The value to format.
     1812 * @param   cchWidth        Width.
     1813 * @param   cchPrecision    Precision.
     1814 * @param   fFlags          Flags, RTSTR_F_XXX.
     1815 */
     1816RTDECL(ssize_t) RTStrFormatR80(char *pszBuf, size_t cbBuf, PCRTFLOAT80U pr80Value, signed int cchWidth,
     1817                               signed int cchPrecision, uint32_t fFlags);
     1818
     1819/**
     1820 * Formats an 80-bit extended floating point number, version 2.
     1821 *
     1822 * @returns The length of the formatted number or VERR_BUFFER_OVERFLOW.
     1823 * @param   pszBuf          The output buffer.
     1824 * @param   cbBuf           The size of the output buffer.
     1825 * @param   pr80Value       The value to format.
     1826 * @param   cchWidth        Width.
     1827 * @param   cchPrecision    Precision.
     1828 * @param   fFlags          Flags, RTSTR_F_XXX.
     1829 */
     1830RTDECL(ssize_t) RTStrFormatR80u2(char *pszBuf, size_t cbBuf, PCRTFLOAT80U2 pr80Value, signed int cchWidth,
     1831                                 signed int cchPrecision, uint32_t fFlags);
     1832
    17291833
    17301834
Note: See TracChangeset for help on using the changeset viewer.

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