summaryrefslogtreecommitdiff
path: root/platform/windows/windows_terminal_logger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows/windows_terminal_logger.cpp')
-rw-r--r--platform/windows/windows_terminal_logger.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/platform/windows/windows_terminal_logger.cpp b/platform/windows/windows_terminal_logger.cpp
index 56b620a6d9..8cab7ca521 100644
--- a/platform/windows/windows_terminal_logger.cpp
+++ b/platform/windows/windows_terminal_logger.cpp
@@ -53,7 +53,8 @@ void WindowsTerminalLogger::logv(const char *p_format, va_list p_list, bool p_er
if (wlen < 0)
return;
- wchar_t *wbuf = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
+ wchar_t *wbuf = (wchar_t *)memalloc((len + 1) * sizeof(wchar_t));
+ ERR_FAIL_NULL_MSG(wbuf, "Out of memory.");
MultiByteToWideChar(CP_UTF8, 0, buf, len, wbuf, wlen);
wbuf[wlen] = 0;
@@ -62,7 +63,7 @@ void WindowsTerminalLogger::logv(const char *p_format, va_list p_list, bool p_er
else
wprintf(L"%ls", wbuf);
- free(wbuf);
+ memfree(wbuf);
#ifdef DEBUG_ENABLED
fflush(stdout);
@@ -107,47 +108,47 @@ void WindowsTerminalLogger::log_error(const char *p_function, const char *p_file
SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY);
switch (p_type) {
case ERR_ERROR:
- logf("ERROR:");
+ logf_error("ERROR:");
break;
case ERR_WARNING:
- logf("WARNING:");
+ logf_error("WARNING:");
break;
case ERR_SCRIPT:
- logf("SCRIPT ERROR:");
+ logf_error("SCRIPT ERROR:");
break;
case ERR_SHADER:
- logf("SHADER ERROR:");
+ logf_error("SHADER ERROR:");
break;
}
SetConsoleTextAttribute(hCon, basecol);
if (p_rationale && p_rationale[0]) {
- logf(" %s\n", p_rationale);
+ logf_error(" %s\n", p_rationale);
} else {
- logf(" %s\n", p_code);
+ logf_error(" %s\n", p_code);
}
// `FOREGROUND_INTENSITY` alone results in gray text.
SetConsoleTextAttribute(hCon, FOREGROUND_INTENSITY);
switch (p_type) {
case ERR_ERROR:
- logf(" at: ");
+ logf_error(" at: ");
break;
case ERR_WARNING:
- logf(" at: ");
+ logf_error(" at: ");
break;
case ERR_SCRIPT:
- logf(" at: ");
+ logf_error(" at: ");
break;
case ERR_SHADER:
- logf(" at: ");
+ logf_error(" at: ");
break;
}
if (p_rationale && p_rationale[0]) {
- logf("(%s:%i)\n", p_file, p_line);
+ logf_error("(%s:%i)\n", p_file, p_line);
} else {
- logf("%s (%s:%i)\n", p_function, p_file, p_line);
+ logf_error("%s (%s:%i)\n", p_function, p_file, p_line);
}
SetConsoleTextAttribute(hCon, sbi.wAttributes);