containers minimum elements, windows memory leaks

This commit is contained in:
2022-04-25 21:43:57 +03:00
parent 90afc369f0
commit 5f8c04a78e
7 changed files with 81 additions and 22 deletions

View File

@@ -64,10 +64,16 @@ void errorClear() {
PIString errorString() {
#ifdef WINDOWS
char * msg;
char * msg = nullptr;
int err = GetLastError();
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&msg, 0, NULL);
return "code " + PIString::fromNumber(err) + " - " + PIString(msg);
PIString ret = PIStringAscii("code ") + PIString::fromNumber(err) + PIStringAscii(" - ");
if (msg) {
ret += PIString::fromSystem(msg).trim();
LocalFree(msg);
} else
ret += '?';
return ret;
#else
int e = errno;
return PIString("code ") + PIString::fromNumber(e) + " - " + PIString(strerror(e));