- Timestamp:
- Aug 24, 2007 10:17:52 AM (17 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/cfgldr.cpp
r4260 r4337 52 52 53 53 #include <VBox/err.h> 54 54 55 #include <iprt/string.h> 55 56 #include <iprt/uuid.h> … … 57 58 #include <iprt/file.h> 58 59 #include <iprt/time.h> 60 #include <iprt/alloc.h> 59 61 60 62 /// @todo (dmik) until RTTimeImplode and friends are done … … 113 115 114 116 #include <VBox/cfgldr.h> 115 #include "cfgldrhlp.h"116 117 117 118 #include <string.h> 118 119 #include <stdio.h> // for sscanf 120 119 121 #ifdef STANDALONE_TEST 120 122 # include <stdlib.h> … … 123 125 124 126 XERCES_CPP_NAMESPACE_USE 127 128 // Helpers 129 //////////////////////////////////////////////////////////////////////////////// 130 131 inline unsigned char fromhex (RTUTF16 hexdigit) 132 { 133 if (hexdigit >= '0' && hexdigit <= '9') 134 return hexdigit - '0'; 135 if (hexdigit >= 'A' && hexdigit <= 'F') 136 return hexdigit - 'A' + 0xA; 137 if (hexdigit >= 'a' && hexdigit <= 'f') 138 return hexdigit - 'a' + 0xa; 139 140 return 0xFF; // error indicator 141 } 142 143 inline RTUTF16 tohex (unsigned char ch) 144 { 145 return (ch < 0xA) ? ch + '0' : ch - 0xA + 'A'; 146 } 147 148 /** 149 * Converts a string of hex digits to memory bytes. 150 * 151 * @param puszValue String of hex digits to convert. 152 * @param pvValue Where to store converted bytes. 153 * @param cbValue Size of the @a pvValue array. 154 * @param pcbValue Where to store the actual number of stored bytes. 155 * 156 * @return IPRT status code. 157 */ 158 int wstr_to_bin (PCRTUTF16 puszValue, void *pvValue, unsigned cbValue, unsigned *pcbValue) 159 { 160 int rc = VINF_SUCCESS; 161 162 unsigned count = 0; 163 unsigned char *dst = (unsigned char *) pvValue; 164 165 while (*puszValue) 166 { 167 unsigned char b = fromhex (*puszValue); 168 169 if (b == 0xFF) 170 { 171 /* it was not a valid hex digit */ 172 rc = VERR_CFG_INVALID_FORMAT; 173 break; 174 } 175 176 if (count < cbValue) 177 { 178 *dst = b; 179 } 180 181 puszValue++; 182 183 if (!*puszValue) 184 { 185 rc = VERR_CFG_INVALID_FORMAT; 186 break; 187 } 188 189 b = fromhex (*puszValue++); 190 191 if (b == 0xFF) 192 { 193 /* it was not a valid hex digit */ 194 rc = VERR_CFG_INVALID_FORMAT; 195 break; 196 } 197 198 if (count < cbValue) 199 { 200 *dst = ((*dst) << 4) + b; 201 dst++; 202 } 203 204 count++; 205 } 206 207 *pcbValue = count; 208 209 return rc; 210 } 211 212 /** 213 * Converts memory bytes to a null-terminated string of hex values. 214 * 215 * @param pvValue Memory array to convert. 216 * @param cbValue Number of bytes in the @a pvValue array. 217 * @param puszValue Where to store the pointer to the resulting string. 218 * On success, this string should be freed using RTUtf16Free(). 219 * 220 * @return IPRT status code. 221 */ 222 static int bin_to_wstr (const void *pvValue, unsigned cbValue, PRTUTF16 *puszValue) 223 { 224 int rc = VINF_SUCCESS; 225 226 /* each byte will produce two hex digits and there will be nul 227 * terminator */ 228 *puszValue = (PRTUTF16) RTMemTmpAlloc (sizeof (RTUTF16) * (cbValue * 2 + 1)); 229 230 if (!*puszValue) 231 { 232 rc = VERR_NO_MEMORY; 233 } 234 else 235 { 236 unsigned i = 0; 237 unsigned char *src = (unsigned char *) pvValue; 238 PRTUTF16 dst = *puszValue; 239 240 for (; i < cbValue; i++, src++) 241 { 242 *dst++ = tohex ((*src) >> 4); 243 *dst++ = tohex ((*src) & 0xF); 244 } 245 246 *dst = '\0'; 247 } 248 249 return rc; 250 } 251 252 // CfgNode 253 //////////////////////////////////////////////////////////////////////////////// 125 254 126 255 class CfgNode … … 139 268 int resolve (DOMNode *root, const char *pszName, unsigned uIndex, unsigned flags); 140 269 141 int queryValueString (const char *pszName, PRTUTF16 *ppwszValue);270 int getValueString (const char *pszName, PRTUTF16 *ppwszValue); 142 271 int setValueString (const char *pszName, PRTUTF16 pwszValue); 143 272 … … 163 292 164 293 int QueryUInt32 (const char *pszName, uint32_t *pulValue); 165 int SetUInt32 (const char *pszName, uint32_t ulValue );294 int SetUInt32 (const char *pszName, uint32_t ulValue, unsigned int uiBase = 0); 166 295 int QueryUInt64 (const char *pszName, uint64_t *pullValue); 167 int SetUInt64 (const char *pszName, uint64_t ullValue );168 169 int QueryInt32 (const char *pszName, int32_t *p int32Value);170 int SetInt32 (const char *pszName, int32_t int32Value);171 int QueryInt64 (const char *pszName, int64_t *p int64Value);172 int SetInt64 (const char *pszName, int64_t int64Value);173 174 int QueryUInt16 (const char *pszName, uint16_t *pu 16Value);175 int SetUInt16 (const char *pszName, uint16_t u 16Value);296 int SetUInt64 (const char *pszName, uint64_t ullValue, unsigned int uiBase = 0); 297 298 int QueryInt32 (const char *pszName, int32_t *plValue); 299 int SetInt32 (const char *pszName, int32_t lValue, unsigned int uiBase = 0); 300 int QueryInt64 (const char *pszName, int64_t *pllValue); 301 int SetInt64 (const char *pszName, int64_t llValue, unsigned int uiBase = 0); 302 303 int QueryUInt16 (const char *pszName, uint16_t *puhValue); 304 int SetUInt16 (const char *pszName, uint16_t uhValue, unsigned int uiBase = 0); 176 305 177 306 int QueryBin (const char *pszName, void *pvValue, unsigned cbValue, unsigned *pcbValue); … … 185 314 int DeleteAttribute (const char *pszName); 186 315 }; 316 317 // CfgLoader 318 //////////////////////////////////////////////////////////////////////////////// 187 319 188 320 class CfgLoader … … 229 361 int GetNode (const char *pszName, unsigned uIndex, CfgNode **ppnode); 230 362 }; 363 364 // VBoxWriterFilter 365 //////////////////////////////////////////////////////////////////////////////// 231 366 232 367 #ifdef VBOX_XML_WRITER_FILTER … … 1595 1730 } 1596 1731 1597 int CfgNode::queryValueString (const char *pszName, PRTUTF16 *ppwszValue) 1732 /** 1733 * Gets the value of the given attribute as a UTF-16 string. 1734 * The returned string is owned by CfgNode, the caller must not free it. 1735 * 1736 * @param pszName Attribute name. 1737 * @param ppwszValue Where to store a pointer to the attribute value. 1738 * 1739 * @return IPRT status code. 1740 */ 1741 int CfgNode::getValueString (const char *pszName, PRTUTF16 *ppwszValue) 1598 1742 { 1599 1743 int rc = VINF_SUCCESS; … … 1712 1856 PRTUTF16 pwszValue = NULL; 1713 1857 1714 rc = queryValueString (pszName, &pwszValue); 1715 1858 rc = getValueString (pszName, &pwszValue); 1716 1859 if (VBOX_SUCCESS(rc)) 1717 1860 { 1718 1861 uint32_t value = 0; 1719 1720 rc = cfgldrhlp_strtouint32 (pwszValue, &value); 1721 1722 if (VBOX_SUCCESS(rc)) 1723 { 1724 *pulValue = value; 1725 } 1726 } 1727 1728 return rc; 1729 } 1730 int CfgNode::SetUInt32 (const char *pszName, uint32_t ulValue) 1862 char *pszValue = NULL; 1863 1864 rc = RTUtf16ToUtf8 (pwszValue, &pszValue); 1865 if (VBOX_SUCCESS (rc)) 1866 { 1867 rc = RTStrToUInt32Ex (pszValue, NULL, 0, &value); 1868 if (VBOX_SUCCESS(rc)) 1869 { 1870 *pulValue = value; 1871 } 1872 1873 RTStrFree (pszValue); 1874 } 1875 } 1876 1877 return rc; 1878 } 1879 1880 int CfgNode::SetUInt32 (const char *pszName, uint32_t ulValue, unsigned int uiBase) 1731 1881 { 1732 1882 int rc = VINF_SUCCESS; 1733 1883 1734 char szValue [64];1735 1736 rc = cfgldrhlp_uint32tostr (ulValue, szValue);1737 1884 char szValue [64]; 1885 1886 rc = RTStrFormatNumber (szValue, (uint64_t) ulValue, uiBase, 0, 0, 1887 RTSTR_F_32BIT | RTSTR_F_SPECIAL); 1738 1888 if (VBOX_SUCCESS (rc)) 1739 1889 { … … 1741 1891 1742 1892 rc = RTStrToUtf16 (szValue, &pwszValue); 1743 1744 1893 if (VBOX_SUCCESS (rc)) 1745 1894 { 1746 1895 rc = setValueString (pszName, pwszValue); 1747 1748 1896 RTUtf16Free (pwszValue); 1749 1897 } … … 1752 1900 return rc; 1753 1901 } 1902 1754 1903 int CfgNode::QueryUInt64 (const char *pszName, uint64_t *pullValue) 1755 1904 { … … 1758 1907 PRTUTF16 pwszValue = NULL; 1759 1908 1760 rc = queryValueString (pszName, &pwszValue); 1761 1909 rc = getValueString (pszName, &pwszValue); 1762 1910 if (VBOX_SUCCESS(rc)) 1763 1911 { 1764 1912 uint64_t value = 0; 1765 1766 rc = cfgldrhlp_strtouint64 (pwszValue, &value); 1767 1768 if (VBOX_SUCCESS(rc)) 1769 { 1770 *pullValue = value; 1771 } 1772 } 1773 1774 return rc; 1775 } 1776 int CfgNode::SetUInt64 (const char *pszName, uint64_t ullValue) 1913 char *pszValue = NULL; 1914 1915 rc = RTUtf16ToUtf8 (pwszValue, &pszValue); 1916 if (VBOX_SUCCESS (rc)) 1917 { 1918 rc = RTStrToUInt64Ex (pszValue, NULL, 0, &value); 1919 if (VBOX_SUCCESS(rc)) 1920 { 1921 *pullValue = value; 1922 } 1923 1924 RTStrFree (pszValue); 1925 } 1926 } 1927 1928 return rc; 1929 } 1930 1931 int CfgNode::SetUInt64 (const char *pszName, uint64_t ullValue, unsigned int uiBase) 1777 1932 { 1778 1933 int rc = VINF_SUCCESS; 1779 1934 1780 char szValue [64];1781 1782 rc = cfgldrhlp_uint64tostr (ullValue, szValue);1783 1935 char szValue [64]; 1936 1937 rc = RTStrFormatNumber (szValue, ullValue, uiBase, 0, 0, 1938 RTSTR_F_64BIT | RTSTR_F_SPECIAL); 1784 1939 if (VBOX_SUCCESS (rc)) 1785 1940 { … … 1787 1942 1788 1943 rc = RTStrToUtf16 (szValue, &pwszValue); 1789 1790 1944 if (VBOX_SUCCESS (rc)) 1791 1945 { 1792 1946 rc = setValueString (pszName, pwszValue); 1793 1794 1947 RTUtf16Free (pwszValue); 1795 1948 } … … 1799 1952 } 1800 1953 1801 int CfgNode::QueryInt32 (const char *pszName, int32_t *pint32Value) 1802 { 1954 int CfgNode::QueryInt32 (const char *pszName, int32_t *plValue) 1955 { 1956 int rc = VINF_SUCCESS; 1957 1803 1958 PRTUTF16 pwszValue = NULL; 1804 1959 1805 int rc = queryValueString (pszName, &pwszValue); 1806 1960 rc = getValueString (pszName, &pwszValue); 1807 1961 if (VBOX_SUCCESS(rc)) 1808 1962 { 1809 rc = cfgldrhlp_ustr_to_integer<int32_t, uint32_t> (pwszValue, pint32Value); 1810 } 1811 1812 return rc; 1813 } 1814 1815 int CfgNode::SetInt32 (const char *pszName, int32_t int32Value) 1816 { 1963 int32_t value = 0; 1964 char *pszValue = NULL; 1965 1966 rc = RTUtf16ToUtf8 (pwszValue, &pszValue); 1967 if (VBOX_SUCCESS (rc)) 1968 { 1969 rc = RTStrToInt32Ex (pszValue, NULL, 0, &value); 1970 if (VBOX_SUCCESS(rc)) 1971 { 1972 *plValue = value; 1973 } 1974 1975 RTStrFree (pszValue); 1976 } 1977 } 1978 1979 return rc; 1980 } 1981 1982 int CfgNode::SetInt32 (const char *pszName, int32_t lValue, unsigned int uiBase) 1983 { 1984 int rc = VINF_SUCCESS; 1985 1986 char szValue [64]; 1987 1988 rc = RTStrFormatNumber (szValue, (uint64_t) lValue, uiBase, 0, 0, 1989 RTSTR_F_32BIT | RTSTR_F_VALSIGNED | RTSTR_F_SPECIAL); 1990 if (VBOX_SUCCESS (rc)) 1991 { 1992 PRTUTF16 pwszValue = NULL; 1993 1994 rc = RTStrToUtf16 (szValue, &pwszValue); 1995 if (VBOX_SUCCESS (rc)) 1996 { 1997 rc = setValueString (pszName, pwszValue); 1998 RTUtf16Free (pwszValue); 1999 } 2000 } 2001 2002 return rc; 2003 } 2004 2005 int CfgNode::QueryInt64 (const char *pszName, int64_t *pllValue) 2006 { 2007 int rc = VINF_SUCCESS; 2008 1817 2009 PRTUTF16 pwszValue = NULL; 1818 2010 1819 int rc = cfgldrhlp_integer_to_ustr<int32_t, uint32_t> (int32Value, &pwszValue); 1820 2011 rc = getValueString (pszName, &pwszValue); 1821 2012 if (VBOX_SUCCESS(rc)) 1822 2013 { 2014 int64_t value = 0; 2015 char *pszValue = NULL; 2016 2017 rc = RTUtf16ToUtf8 (pwszValue, &pszValue); 2018 if (VBOX_SUCCESS (rc)) 2019 { 2020 rc = RTStrToInt64Ex (pszValue, NULL, 0, &value); 2021 if (VBOX_SUCCESS(rc)) 2022 { 2023 *pllValue = value; 2024 } 2025 2026 RTStrFree (pszValue); 2027 } 2028 } 2029 2030 return rc; 2031 } 2032 2033 int CfgNode::SetInt64 (const char *pszName, int64_t llValue, unsigned int uiBase) 2034 { 2035 int rc = VINF_SUCCESS; 2036 2037 char szValue [64]; 2038 2039 rc = RTStrFormatNumber (szValue, (uint64_t) llValue, uiBase, 0, 0, 2040 RTSTR_F_64BIT | RTSTR_F_VALSIGNED | RTSTR_F_SPECIAL); 2041 if (VBOX_SUCCESS (rc)) 2042 { 2043 PRTUTF16 pwszValue = NULL; 2044 2045 rc = RTStrToUtf16 (szValue, &pwszValue); 2046 if (VBOX_SUCCESS (rc)) 2047 { 2048 rc = setValueString (pszName, pwszValue); 2049 RTUtf16Free (pwszValue); 2050 } 2051 } 2052 2053 return rc; 2054 } 2055 2056 int CfgNode::QueryUInt16 (const char *pszName, uint16_t *puhValue) 2057 { 2058 int rc = VINF_SUCCESS; 2059 2060 PRTUTF16 pwszValue = NULL; 2061 2062 rc = getValueString (pszName, &pwszValue); 2063 if (VBOX_SUCCESS(rc)) 2064 { 2065 uint16_t value = 0; 2066 char *pszValue = NULL; 2067 2068 rc = RTUtf16ToUtf8 (pwszValue, &pszValue); 2069 if (VBOX_SUCCESS (rc)) 2070 { 2071 rc = RTStrToUInt16Ex (pszValue, NULL, 0, &value); 2072 if (VBOX_SUCCESS(rc)) 2073 { 2074 *puhValue = value; 2075 } 2076 2077 RTStrFree (pszValue); 2078 } 2079 } 2080 2081 return rc; 2082 } 2083 2084 int CfgNode::SetUInt16 (const char *pszName, uint16_t uhValue, unsigned int uiBase) 2085 { 2086 int rc = VINF_SUCCESS; 2087 2088 char szValue [64]; 2089 2090 rc = RTStrFormatNumber (szValue, (uint64_t) uhValue, uiBase, 0, 0, 2091 RTSTR_F_16BIT | RTSTR_F_SPECIAL); 2092 if (VBOX_SUCCESS (rc)) 2093 { 2094 PRTUTF16 pwszValue = NULL; 2095 2096 rc = RTStrToUtf16 (szValue, &pwszValue); 2097 if (VBOX_SUCCESS (rc)) 2098 { 2099 rc = setValueString (pszName, pwszValue); 2100 RTUtf16Free (pwszValue); 2101 } 2102 } 2103 2104 return rc; 2105 } 2106 2107 int CfgNode::QueryBin (const char *pszName, void *pvValue, unsigned cbValue, unsigned *pcbValue) 2108 { 2109 int rc = VINF_SUCCESS; 2110 2111 PRTUTF16 pwszValue = NULL; 2112 2113 rc = getValueString (pszName, &pwszValue); 2114 if (VBOX_SUCCESS(rc)) 2115 { 2116 if ( (XMLString::stringLen (pwszValue) / 2) > cbValue) 2117 { 2118 rc = VERR_BUFFER_OVERFLOW; 2119 } 2120 else if (!pvValue) 2121 { 2122 rc = VERR_INVALID_POINTER; 2123 } 2124 else 2125 { 2126 rc = wstr_to_bin (pwszValue, pvValue, cbValue, pcbValue); 2127 } 2128 } 2129 2130 return rc; 2131 } 2132 2133 int CfgNode::SetBin (const char *pszName, const void *pvValue, unsigned cbValue) 2134 { 2135 int rc = VINF_SUCCESS; 2136 2137 PRTUTF16 pwszValue = NULL; 2138 2139 rc = bin_to_wstr (pvValue, cbValue, &pwszValue); 2140 if (VBOX_SUCCESS (rc)) 2141 { 1823 2142 rc = setValueString (pszName, pwszValue); 1824 1825 cfgldrhlp_release_ustr (pwszValue); 1826 } 1827 1828 return rc; 1829 } 1830 1831 int CfgNode::QueryInt64 (const char *pszName, int64_t *pint64Value) 1832 { 1833 PRTUTF16 pwszValue = NULL; 1834 1835 int rc = queryValueString (pszName, &pwszValue); 1836 1837 if (VBOX_SUCCESS(rc)) 1838 { 1839 rc = cfgldrhlp_ustr_to_integer<int64_t, uint64_t> (pwszValue, pint64Value); 1840 } 1841 1842 return rc; 1843 } 1844 1845 int CfgNode::SetInt64 (const char *pszName, int64_t int64Value) 1846 { 1847 PRTUTF16 pwszValue = NULL; 1848 1849 int rc = cfgldrhlp_integer_to_ustr<int64_t, uint64_t> (int64Value, &pwszValue); 1850 1851 if (VBOX_SUCCESS(rc)) 1852 { 1853 rc = setValueString (pszName, pwszValue); 1854 1855 cfgldrhlp_release_ustr (pwszValue); 1856 } 1857 1858 return rc; 1859 } 1860 1861 int CfgNode::QueryUInt16 (const char *pszName, uint16_t *pu16Value) 1862 { 1863 PRTUTF16 pwszValue = NULL; 1864 1865 int rc = queryValueString (pszName, &pwszValue); 1866 1867 if (VBOX_SUCCESS(rc)) 1868 { 1869 rc = cfgldrhlp_ustr_to_uinteger<uint16_t> (pwszValue, pu16Value); 1870 } 1871 1872 return rc; 1873 } 1874 1875 int CfgNode::SetUInt16 (const char *pszName, uint16_t u16Value) 1876 { 1877 PRTUTF16 pwszValue = NULL; 1878 1879 int rc = cfgldrhlp_uinteger_to_ustr<uint16_t> (u16Value, &pwszValue); 1880 1881 if (VBOX_SUCCESS(rc)) 1882 { 1883 rc = setValueString (pszName, pwszValue); 1884 1885 cfgldrhlp_release_ustr (pwszValue); 1886 } 1887 1888 return rc; 1889 } 1890 1891 int CfgNode::QueryBin (const char *pszName, void *pvValue, unsigned cbValue, unsigned *pcbValue) 1892 { 1893 int rc = VINF_SUCCESS; 1894 1895 PRTUTF16 pwszValue = NULL; 1896 1897 rc = queryValueString (pszName, &pwszValue); 1898 1899 if (VBOX_SUCCESS(rc)) 1900 { 1901 if ( (XMLString::stringLen (pwszValue) / 2) > cbValue) 1902 { 1903 rc = VERR_BUFFER_OVERFLOW; 1904 } 1905 else if (!pvValue) 1906 { 1907 rc = VERR_INVALID_POINTER; 1908 } 1909 else 1910 { 1911 rc = cfgldrhlp_strtobin (pwszValue, pvValue, cbValue, pcbValue); 1912 } 1913 } 1914 1915 return rc; 1916 } 1917 int CfgNode::SetBin (const char *pszName, const void *pvValue, unsigned cbValue) 1918 { 1919 int rc = VINF_SUCCESS; 1920 1921 char *pszValue = NULL; 1922 1923 rc = cfgldrhlp_bintostr (pvValue, cbValue, &pszValue); 1924 1925 if (VBOX_SUCCESS (rc)) 1926 { 1927 PRTUTF16 pwszValue = NULL; 1928 1929 rc = RTStrToUtf16 (pszValue, &pwszValue); 1930 1931 if (VBOX_SUCCESS (rc)) 1932 { 1933 rc = setValueString (pszName, pwszValue); 1934 1935 RTUtf16Free (pwszValue); 1936 } 1937 1938 cfgldrhlp_releasestr (pszValue); 1939 } 1940 1941 return rc; 1942 } 2143 RTUtf16Free (pwszValue); 2144 } 2145 2146 return rc; 2147 } 2148 1943 2149 int CfgNode::QueryString (const char *pszName, void **pValue, unsigned cbValue, unsigned *pcbValue, bool returnUtf16) 1944 2150 { … … 1951 2157 *pcbValue = 0; 1952 2158 1953 rc = queryValueString (pszName, &pwszValue);2159 rc = getValueString (pszName, &pwszValue); 1954 2160 1955 2161 if (VBOX_SUCCESS(rc)) … … 2018 2224 2019 2225 PRTUTF16 pwszValue = NULL; 2020 rc = queryValueString (pszName, &pwszValue);2226 rc = getValueString (pszName, &pwszValue); 2021 2227 if (VBOX_SUCCESS (rc)) 2022 2228 { … … 2304 2510 } 2305 2511 2512 CFGLDRR3DECL(int) CFGLDRSetUInt32Ex(CFGNODE hnode, const char *pszName, uint32_t ulValue, unsigned int uiBase) 2513 { 2514 if (!hnode) 2515 { 2516 return VERR_INVALID_HANDLE; 2517 } 2518 return hnode->SetUInt32 (pszName, ulValue, uiBase); 2519 } 2520 2306 2521 CFGLDRR3DECL(int) CFGLDRQueryUInt64(CFGNODE hnode, const char *pszName, uint64_t *pullValue) 2307 2522 { … … 2326 2541 } 2327 2542 2328 CFGLDRR3DECL(int) CFGLDR QueryInt32(CFGNODE hnode, const char *pszName, int32_t *pint32Value)2543 CFGLDRR3DECL(int) CFGLDRSetUInt64Ex(CFGNODE hnode, const char *pszName, uint64_t ullValue, unsigned int uiBase) 2329 2544 { 2330 2545 if (!hnode) … … 2332 2547 return VERR_INVALID_HANDLE; 2333 2548 } 2334 return hnode-> QueryInt32 (pszName, pint32Value);2335 } 2336 2337 CFGLDRR3DECL(int) CFGLDR SetInt32(CFGNODE hnode, const char *pszName, int32_t int32Value)2549 return hnode->SetUInt64 (pszName, ullValue, uiBase); 2550 } 2551 2552 CFGLDRR3DECL(int) CFGLDRQueryInt32(CFGNODE hnode, const char *pszName, int32_t *plValue) 2338 2553 { 2339 2554 if (!hnode) … … 2341 2556 return VERR_INVALID_HANDLE; 2342 2557 } 2343 return hnode-> SetInt32 (pszName, int32Value);2344 } 2345 2346 CFGLDRR3DECL(int) CFGLDR QueryInt64(CFGNODE hnode, const char *pszName, int64_t *pint64Value)2558 return hnode->QueryInt32 (pszName, plValue); 2559 } 2560 2561 CFGLDRR3DECL(int) CFGLDRSetInt32(CFGNODE hnode, const char *pszName, int32_t lValue) 2347 2562 { 2348 2563 if (!hnode) … … 2350 2565 return VERR_INVALID_HANDLE; 2351 2566 } 2352 return hnode-> QueryInt64 (pszName, pint64Value);2353 } 2354 2355 CFGLDRR3DECL(int) CFGLDRSetInt 64(CFGNODE hnode, const char *pszName, int64_t int64Value)2567 return hnode->SetInt32 (pszName, lValue); 2568 } 2569 2570 CFGLDRR3DECL(int) CFGLDRSetInt32Ex(CFGNODE hnode, const char *pszName, int32_t lValue, unsigned int uiBase) 2356 2571 { 2357 2572 if (!hnode) … … 2359 2574 return VERR_INVALID_HANDLE; 2360 2575 } 2361 return hnode->SetInt 64 (pszName, int64Value);2362 } 2363 2364 CFGLDRR3DECL(int) CFGLDRQuery UInt16(CFGNODE hnode, const char *pszName, uint16_t *pu16Value)2576 return hnode->SetInt32 (pszName, lValue, uiBase); 2577 } 2578 2579 CFGLDRR3DECL(int) CFGLDRQueryInt64(CFGNODE hnode, const char *pszName, int64_t *pllValue) 2365 2580 { 2366 2581 if (!hnode) … … 2368 2583 return VERR_INVALID_HANDLE; 2369 2584 } 2370 if (!pu16Value) 2585 return hnode->QueryInt64 (pszName, pllValue); 2586 } 2587 2588 CFGLDRR3DECL(int) CFGLDRSetInt64(CFGNODE hnode, const char *pszName, int64_t llValue) 2589 { 2590 if (!hnode) 2591 { 2592 return VERR_INVALID_HANDLE; 2593 } 2594 return hnode->SetInt64 (pszName, llValue); 2595 } 2596 2597 CFGLDRR3DECL(int) CFGLDRSetInt64Ex(CFGNODE hnode, const char *pszName, int64_t llValue, unsigned int uiBase) 2598 { 2599 if (!hnode) 2600 { 2601 return VERR_INVALID_HANDLE; 2602 } 2603 return hnode->SetInt64 (pszName, llValue, uiBase); 2604 } 2605 2606 CFGLDRR3DECL(int) CFGLDRQueryUInt16(CFGNODE hnode, const char *pszName, uint16_t *puhValue) 2607 { 2608 if (!hnode) 2609 { 2610 return VERR_INVALID_HANDLE; 2611 } 2612 if (!puhValue) 2371 2613 { 2372 2614 return VERR_INVALID_POINTER; 2373 2615 } 2374 return hnode->QueryUInt16 (pszName, pu 16Value);2375 } 2376 2377 CFGLDRR3DECL(int) CFGLDRSetUInt16(CFGNODE hnode, const char *pszName, uint16_t u 16Value)2616 return hnode->QueryUInt16 (pszName, puhValue); 2617 } 2618 2619 CFGLDRR3DECL(int) CFGLDRSetUInt16(CFGNODE hnode, const char *pszName, uint16_t uhValue) 2378 2620 { 2379 2621 if (!hnode) … … 2381 2623 return VERR_INVALID_HANDLE; 2382 2624 } 2383 return hnode->SetUInt16 (pszName, u16Value); 2625 return hnode->SetUInt16 (pszName, uhValue); 2626 } 2627 2628 CFGLDRR3DECL(int) CFGLDRSetUInt16Ex(CFGNODE hnode, const char *pszName, uint16_t uhValue, unsigned int uiBase) 2629 { 2630 if (!hnode) 2631 { 2632 return VERR_INVALID_HANDLE; 2633 } 2634 return hnode->SetUInt16 (pszName, uhValue, uiBase); 2384 2635 } 2385 2636
Note:
See TracChangeset
for help on using the changeset viewer.