| 22 | } |
| 23 | |
| 24 | LPCWSTR StringCharToWChar(LPCSTR sChar, CStringW &sWChar, int iChars/* = -1*/, UINT codepage/* = CP_ACP*/) |
| 25 | { |
| 26 | if (!sChar) |
| 27 | return NULL; |
| 28 | |
| 29 | sWChar.Empty(); |
| 30 | int iLen = MultiByteToWideChar(codepage, 0, sChar, iChars, NULL, 0); |
| 31 | if (iLen > 0) { |
| 32 | LPWSTR sBuf = sWChar.GetBufferSetLength(iLen); |
| 33 | MultiByteToWideChar(codepage, 0, sChar, iChars, sBuf, iLen); |
| 34 | sWChar.ReleaseBufferSetLength(sBuf[iLen - 1] ? iLen : iLen - 1); |
| 35 | return (iLen > 0) ? sWChar.GetString() : NULL; |
| 36 | } |
| 37 | |
| 38 | return (*sChar != 0) ? sWChar.GetString() : NULL; |
| 39 | } |
| 40 | |
| 41 | LPCSTR StringWCharToUTF8(LPCWSTR sWChar, CStringA &sUTF8, int iChars/* = -1*/) |
| 42 | { |
no test coverage detected