Changeset 80764 in vbox for trunk/src/VBox/Runtime/r3/posix
- Timestamp:
- Sep 13, 2019 6:52:50 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 133329
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/utf8-posix.cpp
r76553 r80764 490 490 491 491 492 RTR3DECL(int) RTStr CurrentCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag)492 RTR3DECL(int) RTStrUtf8ToCurrentCPExTag(char **ppszString, const char *pszString, size_t cchString, const char *pszTag) 493 493 { 494 494 Assert(ppszString); … … 497 497 498 498 /* 499 * A ttempt with UTF-8 length of 2x the native length.500 */ 501 size_t cch = strlen(pszString);502 if (cch <= 0)499 * Assume result string length is not longer than UTF-8 string. 500 */ 501 cchString = RTStrNLen(pszString, cchString); 502 if (cchString < 1) 503 503 { 504 504 /* zero length string passed. */ … … 508 508 return VERR_NO_TMP_MEMORY; 509 509 } 510 return rtStrConvertWrapper(pszString, cchString, "UTF-8", ppszString, 0, "", 1, RTSTRICONV_UTF8_TO_LOCALE); 511 } 512 513 514 RTR3DECL(int) RTStrCurrentCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag) 515 { 516 Assert(ppszString); 517 Assert(pszString); 518 *ppszString = NULL; 519 520 /* 521 * Attempt with UTF-8 length of 2x the native length. 522 */ 523 size_t cch = strlen(pszString); 524 if (cch <= 0) 525 { 526 /* zero length string passed. */ 527 *ppszString = (char *)RTMemTmpAllocZTag(sizeof(char), pszTag); 528 if (*ppszString) 529 return VINF_SUCCESS; 530 return VERR_NO_TMP_MEMORY; 531 } 510 532 return rtStrConvertWrapper(pszString, cch, "", ppszString, 0, "UTF-8", 2, RTSTRICONV_LOCALE_TO_UTF8); 511 533 }
Note:
See TracChangeset
for help on using the changeset viewer.