MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / CharToWChar

Method CharToWChar

src/StringUtils.cpp:141–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141wchar_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
170char* SU::WCharToChar(const wchar_t * wstring) {
171 int size = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected