removed char buffer in 'UpdateWindowTitle"

This commit is contained in:
Arthur Ice 2013-05-20 22:13:19 -07:00
parent d41331d948
commit 7b0de551e1

View File

@ -20,7 +20,7 @@
#include "../common/features.h" #include "../common/features.h"
#include <iostream> #include <iostream>
using namespace std; using namespace std;
#include <string.h> #include <string>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
@ -62,6 +62,7 @@ extern volatile bool ZoneLoaded;
#include "../common/patches/patches.h" #include "../common/patches/patches.h"
#include "../common/rulesys.h" #include "../common/rulesys.h"
#include "../common/MiscFunctions.h" #include "../common/MiscFunctions.h"
#include "../common/StringUtil.h"
#include "../common/platform.h" #include "../common/platform.h"
#include "../common/crash.h" #include "../common/crash.h"
#include "../common/ipc_mutex.h" #include "../common/ipc_mutex.h"
@ -608,27 +609,27 @@ void LoadSpells(EQEmu::MemoryMappedFile **mmf) {
void UpdateWindowTitle(char* iNewTitle) { void UpdateWindowTitle(char* iNewTitle) {
#ifdef _WINDOWS #ifdef _WINDOWS
char tmp[500]; std::string newTitle;
if (iNewTitle) { if (iNewTitle) {
snprintf(tmp, sizeof(tmp), "%i: %s", ZoneConfig::get()->ZonePort, iNewTitle); StringFormat(&newTitle, "%i: %s", ZoneConfig::get()->ZonePort, iNewTitle);
} }
else { else {
if (zone) { if (zone) {
#if defined(GOTFRAGS) || defined(_EQDEBUG) #if defined(GOTFRAGS) || defined(_EQDEBUG)
snprintf(tmp, sizeof(tmp), "%i: %s, %i clients, %i", ZoneConfig::get()->ZonePort, zone->GetShortName(), numclients, getpid()); StringFormat(&newTitle, "%i: %s, %i clients, %i", ZoneConfig::get()->ZonePort, zone->GetShortName(), numclients, getpid());
#else #else
snprintf(tmp, sizeof(tmp), "%i: %s, %i clients", ZoneConfig::get()->ZonePort, zone->GetShortName(), numclients); StringFormat(&newTitle, "%i: %s, %i clients", ZoneConfig::get()->ZonePort, zone->GetShortName(), numclients);
#endif #endif
} }
else { else {
#if defined(GOTFRAGS) || defined(_EQDEBUG) #if defined(GOTFRAGS) || defined(_EQDEBUG)
snprintf(tmp, sizeof(tmp), "%i: sleeping, %i", ZoneConfig::get()->ZonePort, getpid()); StringFormat(&newTitle, "%i: sleeping, %i", ZoneConfig::get()->ZonePort, getpid());
#else #else
snprintf(tmp, sizeof(tmp), "%i: sleeping", ZoneConfig::get()->ZonePort); StringFormat(&newTitle, "%i: sleeping", ZoneConfig::get()->ZonePort);
#endif #endif
} }
} }
SetConsoleTitle(tmp); SetConsoleTitle(newTitle.c_str());
#endif #endif
} }