Update to 1.10.0-beta1

This commit is contained in:
dP
2019-10-31 22:24:28 +03:00
parent b84a475e14
commit 599ccf0c2b
1470 changed files with 354219 additions and 16795 deletions

View File

@@ -23,10 +23,8 @@
#include <time.h>
#if defined(ENABLE_NETWORK)
#include "network/network_admin.h"
SOCKET _debug_socket = INVALID_SOCKET;
#endif /* ENABLE_NETWORK */
#include "safeguards.h"
@@ -111,7 +109,6 @@ char *DumpDebugFacilityNames(char *buf, char *last)
*/
static void debug_print(const char *dbg, const char *buf)
{
#if defined(ENABLE_NETWORK)
if (_debug_socket != INVALID_SOCKET) {
char buf2[1024 + 32];
@@ -121,17 +118,16 @@ static void debug_print(const char *dbg, const char *buf)
send(_debug_socket, buf2, (int)strlen(buf2), 0);
return;
}
#endif /* ENABLE_NETWORK */
if (strcmp(dbg, "desync") == 0) {
static FILE *f = FioFOpenFile("commands-out.log", "wb", AUTOSAVE_DIR);
if (f == NULL) return;
if (f == nullptr) return;
fprintf(f, "%s%s\n", GetLogPrefix(), buf);
fflush(f);
#ifdef RANDOM_DEBUG
} else if (strcmp(dbg, "random") == 0) {
static FILE *f = FioFOpenFile("random-out.log", "wb", AUTOSAVE_DIR);
if (f == NULL) return;
if (f == nullptr) return;
fprintf(f, "%s\n", buf);
fflush(f);
@@ -146,9 +142,7 @@ static void debug_print(const char *dbg, const char *buf)
#else
fputs(buffer, stderr);
#endif
#ifdef ENABLE_NETWORK
NetworkAdminConsole(dbg, buf);
#endif /* ENABLE_NETWORK */
IConsoleDebug(dbg, buf);
}
}
@@ -206,7 +200,7 @@ void SetDebugString(const char *s)
while (*s >= 'a' && *s <= 'z') s++;
/* check debugging levels */
p = NULL;
p = nullptr;
for (i = debug_level; i != endof(debug_level); ++i) {
if (s == t + strlen(i->name) && strncmp(t, i->name, s - t) == 0) {
p = i->level;
@@ -217,7 +211,7 @@ void SetDebugString(const char *s)
if (*s == '=') s++;
v = strtoul(s, &end, 0);
s = end;
if (p != NULL) {
if (p != nullptr) {
*p = v;
} else {
ShowInfoF("Unknown debug level '%.*s'", (int)(s - t), t);
@@ -252,13 +246,13 @@ const char *GetDebugString()
/**
* Get the prefix for logs; if show_date_in_logs is enabled it returns
* the date, otherwise it returns nothing.
* @return the prefix for logs (do not free), never NULL
* @return the prefix for logs (do not free), never nullptr
*/
const char *GetLogPrefix()
{
static char _log_prefix[24];
if (_settings_client.gui.show_date_in_logs) {
time_t cur_time = time(NULL);
time_t cur_time = time(nullptr);
strftime(_log_prefix, sizeof(_log_prefix), "[%Y-%m-%d %H:%M:%S] ", localtime(&cur_time));
} else {
*_log_prefix = '\0';