MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / _GetErrorStr

Function _GetErrorStr

cpp/src/platform/HttpClient.cpp:186–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186inline std::string _GetErrorStr
187(
188int e
189)
190{
191 std::string ret;
192#ifdef WINRT
193 LPTSTR s = (LPTSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 512);
194 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, e, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), s, 512, NULL );
195 char buffer[1024];
196 wcstombs(buffer, s, sizeof(buffer));
197 HeapFree(GetProcessHeap(), 0, s);
198 ret = buffer;
199#elif _WIN32
200 LPTSTR s;
201 ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, e, 0, (LPTSTR)&s, 0, NULL);
202 if(s)
203 ret = s;
204 ::LocalFree(s);
205#else
206 const char *s = strerror(e);
207 if(s)
208 ret = s;
209#endif
210 return ret;
211}
212
213bool InitNetwork
214(

Callers 5

InitNetworkFunction · 0.85
_ResolveFunction · 0.85
_openSocketFunction · 0.85
SendBytesMethod · 0.85
updateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected