Changeset 93640 in vbox
- Timestamp:
- Feb 7, 2022 2:02:44 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 149785
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/string.h
r93115 r93640 277 277 */ 278 278 RTR3DECL(int) RTStrCurrentCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag); 279 280 /** 281 * Allocates tmp buffer, translates pszString from console codepage to UTF-8. 282 * 283 * @returns iprt status code. 284 * @param ppszString Receives pointer of allocated UTF-8 string. 285 * The returned pointer must be freed using RTStrFree(). 286 * @param pszString Native string to convert. 287 */ 288 #define RTStrConsoleCPToUtf8(ppszString, pszString) RTStrConsoleCPToUtf8Tag((ppszString), (pszString), RTSTR_TAG) 289 290 /** 291 * Allocates tmp buffer, translates pszString from console codepage to UTF-8. 292 * 293 * @returns iprt status code. 294 * @param ppszString Receives pointer of allocated UTF-8 string. 295 * The returned pointer must be freed using RTStrFree(). 296 * @param pszString Native string to convert. 297 * @param pszTag Allocation tag used for statistics and such. 298 */ 299 RTR3DECL(int) RTStrConsoleCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag); 279 300 280 301 #endif /* IN_RING3 */ -
trunk/src/VBox/Runtime/r3/posix/utf8-posix.cpp
r93544 r93640 693 693 } 694 694 695 696 RTR3DECL(int) RTStrConsoleCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag) 697 { 698 return RTStrCurrentCPToUtf8Tag(ppszString, pszString, pszTag); 699 } -
trunk/src/VBox/Runtime/r3/win/utf8-win.cpp
r93115 r93640 117 117 } 118 118 119 120 RTR3DECL(int) RTStrCurrentCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag) 119 static int rtStrCPToUtf8Tag(char **ppszString, const char *pszString, uint32_t uCodePage, const char *pszTag) 121 120 { 122 121 Assert(ppszString); … … 143 142 */ 144 143 int rc; 145 int cwc = MultiByteToWideChar( CP_ACP, 0, pszString, -1, NULL, 0);144 int cwc = MultiByteToWideChar((UINT)uCodePage, 0, pszString, -1, NULL, 0); 146 145 if (cwc > 0) 147 146 { … … 155 154 * Do the translation. 156 155 */ 157 if (MultiByteToWideChar( CP_ACP, 0, pszString, -1, pwszString, cwc) > 0)156 if (MultiByteToWideChar((UINT)uCodePage, 0, pszString, -1, pwszString, cwc) > 0) 158 157 { 159 158 /* … … 183 182 } 184 183 184 185 RTR3DECL(int) RTStrCurrentCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag) 186 { 187 return rtStrCPToUtf8Tag(ppszString, pszString, CP_ACP, pszTag); 188 } 189 190 191 RTR3DECL(int) RTStrConsoleCPToUtf8Tag(char **ppszString, const char *pszString, const char *pszTag) 192 { 193 return rtStrCPToUtf8Tag(ppszString, pszString, GetConsoleCP(), pszTag); 194 }
Note:
See TracChangeset
for help on using the changeset viewer.