diff options
Diffstat (limited to 'src/common/showmsg.c')
-rw-r--r-- | src/common/showmsg.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 956222a7d..23679e762 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -23,11 +23,10 @@ #include "showmsg.h" #include "common/cbasetypes.h" +#include "common/conf.h" #include "common/core.h" //[Ind] - For SERVER_TYPE #include "common/strlib.h" // StringBuf -#include <libconfig/libconfig.h> - #include <stdarg.h> #include <stdio.h> #include <stdlib.h> // atexit @@ -245,13 +244,13 @@ int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr) continue; } else if (*q == ';') { // delimiter - if (numpoint < sizeof(numbers)/sizeof(*numbers)) { + if (numpoint < ARRAYLENGTH(numbers)) { // go to next array position numpoint++; } else { // array is full, so we 'forget' the first value - memmove(numbers,numbers+1,sizeof(numbers)/sizeof(*numbers)-1); - numbers[sizeof(numbers)/sizeof(*numbers)-1]=0; + memmove(numbers, numbers+1, ARRAYLENGTH(numbers)-1); + numbers[ARRAYLENGTH(numbers)-1]=0; } ++q; // and next number @@ -606,9 +605,6 @@ int vShowMessage_(enum msg_type flag, const char *string, va_list ap) { va_list apcopy; char prefix[100]; -#if defined(DEBUGLOGMAP) || defined(DEBUGLOGCHAR) || defined(DEBUGLOGLOGIN) - FILE *fp; -#endif if (!string || *string == '\0') { ShowError("Empty string passed to vShowMessage_().\n"); @@ -703,8 +699,8 @@ int vShowMessage_(enum msg_type flag, const char *string, va_list ap) } #if defined(DEBUGLOGMAP) || defined(DEBUGLOGCHAR) || defined(DEBUGLOGLOGIN) - if(strlen(DEBUGLOGPATH) > 0) { - fp=fopen(DEBUGLOGPATH,"a"); + if (strlen(DEBUGLOGPATH) > 0) { + FILE *fp = fopen(DEBUGLOGPATH,"a"); if (fp == NULL) { FPRINTF(STDERR, CL_RED"[ERROR]"CL_RESET": Could not open '"CL_WHITE"%s"CL_RESET"', access denied.\n", DEBUGLOGPATH); FFLUSH(STDERR); @@ -799,16 +795,20 @@ void showmsg_showWarning(const char *string, ...) vShowMessage_(MSG_WARNING, string, ap); va_end(ap); } -void showmsg_showConfigWarning(config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); -void showmsg_showConfigWarning(config_setting_t *config, const char *string, ...) +void showmsg_showConfigWarning(struct config_setting_t *config, const char *string, ...) __attribute__((format(printf, 2, 3))); +void showmsg_showConfigWarning(struct config_setting_t *config, const char *string, ...) { StringBuf buf; va_list ap; StrBuf->Init(&buf); StrBuf->AppendStr(&buf, string); - StrBuf->Printf(&buf, " (%s:%d)\n", config_setting_source_file(config), config_setting_source_line(config)); + StrBuf->Printf(&buf, " (%s:%u)\n", config_setting_source_file(config), config_setting_source_line(config)); va_start(ap, string); +#ifdef BUILDBOT + vShowMessage_(MSG_ERROR, StrBuf->Value(&buf), ap); +#else // BUILDBOT vShowMessage_(MSG_WARNING, StrBuf->Value(&buf), ap); +#endif // BUILDBOT va_end(ap); StrBuf->Destroy(&buf); } |