| 139 | } |
| 140 | |
| 141 | wchar_t* SU::CharToWChar(const char * string) { |
| 142 | if (!string) |
| 143 | return NULL; |
| 144 | |
| 145 | int size = 0; |
| 146 | int ret = 0; |
| 147 | |
| 148 | if (string == NULL) |
| 149 | return NULL; |
| 150 | |
| 151 | if (string[0] == 0) { |
| 152 | wchar_t * empty = new wchar_t[1]; |
| 153 | empty[0] = 0; |
| 154 | return empty; |
| 155 | } |
| 156 | |
| 157 | size = ::MultiByteToWideChar(CP_ACP, 0, string, -1, NULL, 0); |
| 158 | if (size == 0) |
| 159 | return NULL; |
| 160 | wchar_t * wstring = new wchar_t[size]; |
| 161 | ret = ::MultiByteToWideChar(CP_ACP, 0, string, -1, wstring, size); |
| 162 | if (ret == 0) { |
| 163 | delete [] wstring; |
| 164 | return NULL; |
| 165 | } |
| 166 | return wstring; |
| 167 | |
| 168 | } |
| 169 | |
| 170 | char* SU::WCharToChar(const wchar_t * wstring) { |
| 171 | int size = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected