OVR_Std.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. /************************************************************************************
  2. PublicHeader: OVR_Kernel.h
  3. Filename : OVR_Std.h
  4. Content : Standard C function interface
  5. Created : September 19, 2012
  6. Notes :
  7. Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
  8. Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
  9. you may not use the Oculus VR Rift SDK except in compliance with the License,
  10. which is provided at the time of installation or download, or which
  11. otherwise accompanies this software in either electronic or hard copy form.
  12. You may obtain a copy of the License at
  13. http://www.oculusvr.com/licenses/LICENSE-3.2
  14. Unless required by applicable law or agreed to in writing, the Oculus VR SDK
  15. distributed under the License is distributed on an "AS IS" BASIS,
  16. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. See the License for the specific language governing permissions and
  18. limitations under the License.
  19. ************************************************************************************/
  20. #ifndef OVR_Std_h
  21. #define OVR_Std_h
  22. #include "OVR_Types.h"
  23. #include <stdarg.h> // for va_list args
  24. #include <string.h>
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <ctype.h>
  28. #if defined(OVR_CC_MSVC) && (OVR_CC_MSVC >= 1400)
  29. #define OVR_MSVC_SAFESTRING
  30. #include <errno.h>
  31. #endif
  32. // Wide-char funcs
  33. #include <wchar.h>
  34. #include <wctype.h>
  35. namespace OVR {
  36. // Has the same behavior as itoa aside from also having a dest size argument.
  37. // Return value: Pointer to the resulting null-terminated string, same as parameter str.
  38. #if defined(OVR_OS_MS)
  39. inline char* OVR_CDECL OVR_itoa(int val, char *dest, size_t destsize, int radix)
  40. {
  41. #if defined(OVR_MSVC_SAFESTRING)
  42. _itoa_s(val, dest, destsize, radix);
  43. return dest;
  44. #else
  45. OVR_UNUSED(destsize);
  46. return itoa(val, dest, radix);
  47. #endif
  48. }
  49. #else // OVR_OS_MS
  50. inline char* OVR_itoa(int val, char* dest, size_t len, int radix)
  51. {
  52. if (val == 0)
  53. {
  54. if (len > 1)
  55. {
  56. dest[0] = '0';
  57. dest[1] = '\0';
  58. }
  59. else if(len > 0)
  60. dest[0] = '\0';
  61. return dest;
  62. }
  63. // FIXME: Fix the following code to avoid memory write overruns when len is in sufficient.
  64. int cur = val;
  65. size_t i = 0;
  66. size_t sign = 0;
  67. if (val < 0)
  68. {
  69. val = -val;
  70. sign = 1;
  71. }
  72. while ((val != 0) && (i < (len - 1 - sign)))
  73. {
  74. cur = val % radix;
  75. val /= radix;
  76. if (radix == 16)
  77. {
  78. switch(cur)
  79. {
  80. case 10:
  81. dest[i] = 'a';
  82. break;
  83. case 11:
  84. dest[i] = 'b';
  85. break;
  86. case 12:
  87. dest[i] = 'c';
  88. break;
  89. case 13:
  90. dest[i] = 'd';
  91. break;
  92. case 14:
  93. dest[i] = 'e';
  94. break;
  95. case 15:
  96. dest[i] = 'f';
  97. break;
  98. default:
  99. dest[i] = (char)('0' + cur);
  100. break;
  101. }
  102. }
  103. else
  104. {
  105. dest[i] = (char)('0' + cur);
  106. }
  107. ++i;
  108. }
  109. if (sign)
  110. {
  111. dest[i++] = '-';
  112. }
  113. for (size_t j = 0; j < i / 2; ++j)
  114. {
  115. char tmp = dest[j];
  116. dest[j] = dest[i - 1 - j];
  117. dest[i - 1 - j] = tmp;
  118. }
  119. dest[i] = '\0';
  120. return dest;
  121. }
  122. #endif
  123. // String functions
  124. inline size_t OVR_CDECL OVR_strlen(const char* str)
  125. {
  126. return strlen(str);
  127. }
  128. inline char* OVR_CDECL OVR_strcpy(char* dest, size_t destsize, const char* src)
  129. {
  130. #if defined(OVR_MSVC_SAFESTRING)
  131. strcpy_s(dest, destsize, src);
  132. return dest;
  133. #else
  134. // FIXME: This should be a safer implementation
  135. OVR_UNUSED(destsize);
  136. return strcpy(dest, src);
  137. #endif
  138. }
  139. // Acts the same as the strlcpy function.
  140. // Copies src to dest, 0-terminating even if it involves truncating the write.
  141. // Returns the required strlen of dest (which is one less than the required size of dest).
  142. // strlcpy is a safer alternative to strcpy and strncpy and provides size information.
  143. // However, it still may result in an incomplete copy.
  144. //
  145. // Example usage:
  146. // char buffer[256];
  147. // if(OVR_strlcpy(buffer, "hello world", sizeof(buffer)) < sizeof(buffer))
  148. // { there was enough space }
  149. // else
  150. // { need a larger buffer }
  151. //
  152. size_t OVR_CDECL OVR_strlcpy(char* dest, const char* src, size_t destsize);
  153. // Acts the same as the strlcat function.
  154. // Appends src to dest, 0-terminating even if it involves an incomplete write.
  155. // Doesn't 0-terminate in the case that destsize is 0.
  156. // Returns the required strlen of dest (which is one less than the required size of dest).
  157. // The terminating 0 char of dest is overwritten by the first
  158. // character of src, and a new 0 char is appended to dest. The required capacity
  159. // of the destination is (strlen(src) + strlen(dest) + 1).
  160. // strlcat is a safer alternative to strcat and provides size information.
  161. // However, it still may result in an incomplete copy.
  162. //
  163. // Example usage:
  164. // char buffer[256] = "hello ";
  165. // if(OVR_strlcat(buffer, "world", sizeof(buffer)) < sizeof(buffer))
  166. // { there was enough space }
  167. // else
  168. // { need a larger buffer }
  169. //
  170. size_t OVR_CDECL OVR_strlcat(char* dest, const char* src, size_t destsize);
  171. inline char* OVR_CDECL OVR_strncpy(char* dest, size_t destsize, const char* src, size_t count)
  172. {
  173. #if defined(OVR_MSVC_SAFESTRING)
  174. strncpy_s(dest, destsize, src, count);
  175. return dest;
  176. #else
  177. // FIXME: This should be a safer implementation
  178. OVR_UNUSED(destsize);
  179. return strncpy(dest, src, count);
  180. #endif
  181. }
  182. inline char * OVR_CDECL OVR_strcat(char* dest, size_t destsize, const char* src)
  183. {
  184. #if defined(OVR_MSVC_SAFESTRING)
  185. strcat_s(dest, destsize, src);
  186. return dest;
  187. #else
  188. // FIXME: This should be a safer implementation
  189. OVR_UNUSED(destsize);
  190. return strcat(dest, src);
  191. #endif
  192. }
  193. inline int OVR_CDECL OVR_strcmp(const char* dest, const char* src)
  194. {
  195. return strcmp(dest, src);
  196. }
  197. inline const char* OVR_CDECL OVR_strchr(const char* str, char c)
  198. {
  199. return strchr(str, c);
  200. }
  201. inline char* OVR_CDECL OVR_strchr(char* str, char c)
  202. {
  203. return strchr(str, c);
  204. }
  205. const char* OVR_CDECL OVR_strrchr(const char* pString, int c);
  206. inline char* OVR_CDECL OVR_strrchr(char* pString, int c)
  207. {
  208. return (char*)OVR_strrchr((const char*)pString, c);
  209. }
  210. inline const uint8_t* OVR_CDECL OVR_memrchr(const uint8_t* str, size_t size, uint8_t c)
  211. {
  212. for (intptr_t i = (intptr_t)size - 1; i >= 0; i--)
  213. {
  214. if (str[i] == c)
  215. return str + i;
  216. }
  217. return 0;
  218. }
  219. double OVR_CDECL OVR_strtod(const char* string, char** tailptr);
  220. inline long OVR_CDECL OVR_strtol(const char* string, char** tailptr, int radix)
  221. {
  222. return strtol(string, tailptr, radix);
  223. }
  224. inline long OVR_CDECL OVR_strtoul(const char* string, char** tailptr, int radix)
  225. {
  226. return strtoul(string, tailptr, radix);
  227. }
  228. inline int OVR_CDECL OVR_strncmp(const char* ws1, const char* ws2, size_t size)
  229. {
  230. return strncmp(ws1, ws2, size);
  231. }
  232. inline uint64_t OVR_CDECL OVR_strtouq(const char *nptr, char **endptr, int base)
  233. {
  234. #if defined(OVR_CC_MSVC)
  235. return _strtoui64(nptr, endptr, base);
  236. #else
  237. return strtoull(nptr, endptr, base);
  238. #endif
  239. }
  240. inline int64_t OVR_CDECL OVR_strtoq(const char *nptr, char **endptr, int base)
  241. {
  242. #if defined(OVR_CC_MSVC)
  243. return _strtoi64(nptr, endptr, base);
  244. #else
  245. return strtoll(nptr, endptr, base);
  246. #endif
  247. }
  248. inline int64_t OVR_CDECL OVR_atoq(const char* string)
  249. {
  250. #if defined(OVR_CC_MSVC)
  251. return _atoi64(string);
  252. #else
  253. return atoll(string);
  254. #endif
  255. }
  256. inline uint64_t OVR_CDECL OVR_atouq(const char* string)
  257. {
  258. return OVR_strtouq(string, NULL, 10);
  259. }
  260. // Implemented in OVR_Std.cpp in platform-specific manner.
  261. int OVR_CDECL OVR_stricmp(const char* dest, const char* src);
  262. int OVR_CDECL OVR_strnicmp(const char* dest, const char* src, size_t count);
  263. // This is like sprintf but with a destination buffer size argument. However, the behavior is different
  264. // from vsnprintf in that the return value semantics are like sprintf (which returns -1 on capacity overflow) and
  265. // not like snprintf (which returns intended strlen on capacity overflow).
  266. inline size_t OVR_CDECL OVR_sprintf(char *dest, size_t destsize, const char* format, ...)
  267. {
  268. va_list argList;
  269. va_start(argList,format);
  270. size_t ret;
  271. #if defined(OVR_CC_MSVC)
  272. #if defined(OVR_MSVC_SAFESTRING)
  273. ret = _vsnprintf_s(dest, destsize, _TRUNCATE, format, argList);
  274. OVR_ASSERT(ret != -1);
  275. #else
  276. OVR_UNUSED(destsize);
  277. ret = _vsnprintf(dest, destsize - 1, format, argList); // -1 for space for the null character
  278. OVR_ASSERT(ret != -1);
  279. dest[destsize-1] = 0;
  280. #endif
  281. #else
  282. OVR_UNUSED(destsize);
  283. ret = vsprintf(dest, format, argList);
  284. OVR_ASSERT(ret < destsize);
  285. #endif
  286. va_end(argList);
  287. return ret;
  288. }
  289. // This is like vsprintf but with a destination buffer size argument. However, the behavior is different
  290. // from vsnprintf in that the return value semantics are like vsprintf (which returns -1 on capacity overflow) and
  291. // not like vsnprintf (which returns intended strlen on capacity overflow).
  292. // Return value:
  293. // On success, the total number of characters written is returned.
  294. // On failure, a negative number is returned.
  295. inline size_t OVR_CDECL OVR_vsprintf(char *dest, size_t destsize, const char * format, va_list argList)
  296. {
  297. size_t ret;
  298. #if defined(OVR_CC_MSVC)
  299. #if defined(OVR_MSVC_SAFESTRING)
  300. dest[0] = '\0';
  301. int rv = vsnprintf_s(dest, destsize, _TRUNCATE, format, argList);
  302. if (rv == -1)
  303. {
  304. dest[destsize - 1] = '\0';
  305. ret = destsize - 1;
  306. }
  307. else
  308. ret = (size_t)rv;
  309. #else
  310. OVR_UNUSED(destsize);
  311. int rv = _vsnprintf(dest, destsize - 1, format, argList);
  312. OVR_ASSERT(rv != -1);
  313. ret = (size_t)rv;
  314. dest[destsize-1] = 0;
  315. #endif
  316. #else
  317. // FIXME: This should be a safer implementation
  318. OVR_UNUSED(destsize);
  319. ret = (size_t)vsprintf(dest, format, argList);
  320. OVR_ASSERT(ret < destsize);
  321. #endif
  322. return ret;
  323. }
  324. // Same behavior as ISO C99 vsnprintf.
  325. // Returns the strlen of the resulting formatted string, or a negative value if the format is invalid.
  326. // destsize specifies the capacity of the input buffer.
  327. //
  328. // Example usage:
  329. // void Log(char *dest, size_t destsize, const char * format, ...)
  330. // {
  331. // char buffer[1024];
  332. // va_list argList;
  333. // va_start(argList,format);
  334. // int result = OVR_vsnprintf(dest, destsize, format, argList);
  335. // assert(result < destsize); // Else we'd have to retry with a dynamically allocated buffer (of size=result+1) and new argList copy.
  336. // va_end(argList);
  337. // }
  338. inline int OVR_CDECL OVR_vsnprintf(char *dest, size_t destsize, const char * format, va_list argList)
  339. {
  340. int ret;
  341. #if defined(OVR_CC_MSVC)
  342. OVR_DISABLE_MSVC_WARNING(4996) // 'vsnprintf': This function or variable may be unsafe.
  343. ret = vsnprintf(dest, destsize, format, argList); // Microsoft vsnprintf is non-conforming; it returns -1 if destsize is insufficient.
  344. if (ret < 0) // If there was a format error or if destsize was insufficient...
  345. {
  346. ret = _vscprintf(format, argList); // Get the expected dest strlen. If the return value is still -1 then there was a format error.
  347. if (destsize) // If we can 0-terminate the output...
  348. {
  349. if (ret < 0)
  350. dest[0] = 0;
  351. else
  352. dest[destsize-1] = 0;
  353. }
  354. }
  355. // Else the string was written OK and ret is its strlen.
  356. OVR_RESTORE_MSVC_WARNING()
  357. #else
  358. ret = vsnprintf(dest, destsize, format, argList);
  359. #endif
  360. return ret;
  361. }
  362. // Same behavior as ISO C99 snprintf.
  363. // Returns the strlen of the resulting formatted string, or a negative value if the format is invalid.
  364. // destsize specifies the capacity of the input buffer.
  365. //
  366. // Example usage:
  367. // char buffer[16];
  368. // int result = OVR_snprintf(buffer, sizeof(buffer), "%d", 37);
  369. // if (result >= sizeof(buffer)) // If there was insufficient capacity...
  370. // {
  371. // char* p = new char[result + 1]; // Or char* p = (char*)OVR_ALLOC(result + 1);
  372. // OVR_snprintf(p, (size_t)result, "%d", 37);
  373. // delete[] p;
  374. // }
  375. //
  376. inline int OVR_CDECL OVR_snprintf(char *dest, size_t destsize, const char * format, ...)
  377. {
  378. va_list argList;
  379. va_start(argList,format);
  380. int ret = OVR_vsnprintf(dest, destsize, format, argList);
  381. va_end(argList);
  382. return ret;
  383. }
  384. // Returns the strlen of the resulting formatted string, or a negative value if the format is invalid.
  385. // Note: If you are planning on printing a string then it's more efficient to just use OVR_vsnprintf and
  386. // look at the return value and handle the uncommon case that there wasn't enough space.
  387. inline int OVR_CDECL OVR_vscprintf(const char * format, va_list argList)
  388. {
  389. int ret;
  390. #if defined(OVR_CC_MSVC)
  391. ret = _vscprintf(format, argList);
  392. #else
  393. ret = vsnprintf(NULL, 0, format, argList);
  394. #endif
  395. return ret;
  396. }
  397. wchar_t* OVR_CDECL OVR_wcscpy(wchar_t* dest, size_t destsize, const wchar_t* src);
  398. wchar_t* OVR_CDECL OVR_wcsncpy(wchar_t* dest, size_t destsize, const wchar_t* src, size_t count);
  399. wchar_t* OVR_CDECL OVR_wcscat(wchar_t* dest, size_t destsize, const wchar_t* src);
  400. size_t OVR_CDECL OVR_wcslen(const wchar_t* str);
  401. int OVR_CDECL OVR_wcscmp(const wchar_t* a, const wchar_t* b);
  402. int OVR_CDECL OVR_wcsicmp(const wchar_t* a, const wchar_t* b);
  403. inline int OVR_CDECL OVR_wcsicoll(const wchar_t* a, const wchar_t* b)
  404. {
  405. #if defined(OVR_OS_MS)
  406. #if defined(OVR_CC_MSVC) && (OVR_CC_MSVC >= 1400)
  407. return ::_wcsicoll(a, b);
  408. #else
  409. return ::wcsicoll(a, b);
  410. #endif
  411. #else
  412. // not supported, use regular wcsicmp
  413. return OVR_wcsicmp(a, b);
  414. #endif
  415. }
  416. inline int OVR_CDECL OVR_wcscoll(const wchar_t* a, const wchar_t* b)
  417. {
  418. #if defined(OVR_OS_MS) || defined(OVR_OS_LINUX)
  419. return wcscoll(a, b);
  420. #else
  421. // not supported, use regular wcscmp
  422. return OVR_wcscmp(a, b);
  423. #endif
  424. }
  425. #ifndef OVR_NO_WCTYPE
  426. inline int OVR_CDECL UnicodeCharIs(const uint16_t* table, wchar_t charCode)
  427. {
  428. unsigned offset = table[charCode >> 8];
  429. if (offset == 0) return 0;
  430. if (offset == 1) return 1;
  431. return (table[offset + ((charCode >> 4) & 15)] & (1 << (charCode & 15))) != 0;
  432. }
  433. extern const uint16_t UnicodeAlnumBits[];
  434. extern const uint16_t UnicodeAlphaBits[];
  435. extern const uint16_t UnicodeDigitBits[];
  436. extern const uint16_t UnicodeSpaceBits[];
  437. extern const uint16_t UnicodeXDigitBits[];
  438. // Uncomment if necessary
  439. //extern const uint16_t UnicodeCntrlBits[];
  440. //extern const uint16_t UnicodeGraphBits[];
  441. //extern const uint16_t UnicodeLowerBits[];
  442. //extern const uint16_t UnicodePrintBits[];
  443. //extern const uint16_t UnicodePunctBits[];
  444. //extern const uint16_t UnicodeUpperBits[];
  445. inline int OVR_CDECL OVR_iswalnum (wchar_t charCode) { return UnicodeCharIs(UnicodeAlnumBits, charCode); }
  446. inline int OVR_CDECL OVR_iswalpha (wchar_t charCode) { return UnicodeCharIs(UnicodeAlphaBits, charCode); }
  447. inline int OVR_CDECL OVR_iswdigit (wchar_t charCode) { return UnicodeCharIs(UnicodeDigitBits, charCode); }
  448. inline int OVR_CDECL OVR_iswspace (wchar_t charCode) { return UnicodeCharIs(UnicodeSpaceBits, charCode); }
  449. inline int OVR_CDECL OVR_iswxdigit(wchar_t charCode) { return UnicodeCharIs(UnicodeXDigitBits, charCode); }
  450. // Uncomment if necessary
  451. //inline int OVR_CDECL OVR_iswcntrl (wchar_t charCode) { return UnicodeCharIs(UnicodeCntrlBits, charCode); }
  452. //inline int OVR_CDECL OVR_iswgraph (wchar_t charCode) { return UnicodeCharIs(UnicodeGraphBits, charCode); }
  453. //inline int OVR_CDECL OVR_iswlower (wchar_t charCode) { return UnicodeCharIs(UnicodeLowerBits, charCode); }
  454. //inline int OVR_CDECL OVR_iswprint (wchar_t charCode) { return UnicodeCharIs(UnicodePrintBits, charCode); }
  455. //inline int OVR_CDECL OVR_iswpunct (wchar_t charCode) { return UnicodeCharIs(UnicodePunctBits, charCode); }
  456. //inline int OVR_CDECL OVR_iswupper (wchar_t charCode) { return UnicodeCharIs(UnicodeUpperBits, charCode); }
  457. int OVR_CDECL OVR_towupper(wchar_t charCode);
  458. int OVR_CDECL OVR_towlower(wchar_t charCode);
  459. #else // OVR_NO_WCTYPE
  460. inline int OVR_CDECL OVR_iswspace(wchar_t c)
  461. {
  462. return iswspace(c);
  463. }
  464. inline int OVR_CDECL OVR_iswdigit(wchar_t c)
  465. {
  466. return iswdigit(c);
  467. }
  468. inline int OVR_CDECL OVR_iswxdigit(wchar_t c)
  469. {
  470. return iswxdigit(c);
  471. }
  472. inline int OVR_CDECL OVR_iswalpha(wchar_t c)
  473. {
  474. return iswalpha(c);
  475. }
  476. inline int OVR_CDECL OVR_iswalnum(wchar_t c)
  477. {
  478. return iswalnum(c);
  479. }
  480. inline wchar_t OVR_CDECL OVR_towlower(wchar_t c)
  481. {
  482. return (wchar_t)towlower(c);
  483. }
  484. inline wchar_t OVR_towupper(wchar_t c)
  485. {
  486. return (wchar_t)towupper(c);
  487. }
  488. #endif // OVR_NO_WCTYPE
  489. // ASCII versions of tolower and toupper. Don't use "char"
  490. inline int OVR_CDECL OVR_tolower(int c)
  491. {
  492. return (c >= 'A' && c <= 'Z') ? c - 'A' + 'a' : c;
  493. }
  494. inline int OVR_CDECL OVR_toupper(int c)
  495. {
  496. return (c >= 'a' && c <= 'z') ? c - 'a' + 'A' : c;
  497. }
  498. inline double OVR_CDECL OVR_wcstod(const wchar_t* string, wchar_t** tailptr)
  499. {
  500. #if defined(OVR_OS_OTHER)
  501. OVR_UNUSED(tailptr);
  502. char buffer[64];
  503. char* tp = NULL;
  504. size_t max = OVR_wcslen(string);
  505. if (max > 63) max = 63;
  506. unsigned char c = 0;
  507. for (size_t i=0; i < max; i++)
  508. {
  509. c = (unsigned char)string[i];
  510. buffer[i] = ((c) < 128 ? (char)c : '!');
  511. }
  512. buffer[max] = 0;
  513. return OVR_strtod(buffer, &tp);
  514. #else
  515. return wcstod(string, tailptr);
  516. #endif
  517. }
  518. inline long OVR_CDECL OVR_wcstol(const wchar_t* string, wchar_t** tailptr, int radix)
  519. {
  520. #if defined(OVR_OS_OTHER)
  521. OVR_UNUSED(tailptr);
  522. char buffer[64];
  523. char* tp = NULL;
  524. size_t max = OVR_wcslen(string);
  525. if (max > 63) max = 63;
  526. unsigned char c = 0;
  527. for (size_t i=0; i < max; i++)
  528. {
  529. c = (unsigned char)string[i];
  530. buffer[i] = ((c) < 128 ? (char)c : '!');
  531. }
  532. buffer[max] = 0;
  533. return strtol(buffer, &tp, radix);
  534. #else
  535. return wcstol(string, tailptr, radix);
  536. #endif
  537. }
  538. } // OVR
  539. #endif // OVR_Std_h