From 85a7d5ce9ac68b30da2277cc91d4b70358f1880d Mon Sep 17 00:00:00 2001 From: ariel- Date: Mon, 19 Jun 2017 23:20:06 -0300 Subject: Core: ported headers cleanup from master branch --- src/server/worldserver/CommandLine/CliRunnable.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/server/worldserver/CommandLine') diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index d5e03edbd04..8c05a47608d 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -34,10 +34,10 @@ #include #include "Chat.h" -char* command_finder(const char* text, int state) +char* command_finder(char const* text, int state) { static size_t idx, len; - const char* ret; + char const* ret; std::vector const& cmd = ChatHandler::getCommandTable(); if (!state) @@ -61,12 +61,12 @@ char* command_finder(const char* text, int state) return strdup(ret); } - return ((char*)NULL); + return ((char*)nullptr); } -char** cli_completion(const char* text, int start, int /*end*/) +char** cli_completion(char const* text, int start, int /*end*/) { - char** matches = NULL; + char** matches = nullptr; if (start) rl_bind_key('\t', rl_abort); @@ -84,7 +84,7 @@ int cli_hook_func() #endif -void utf8print(void* /*arg*/, const char* str) +void utf8print(void* /*arg*/, char const* str) { #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS wchar_t wtemp_buf[6000]; @@ -92,9 +92,7 @@ void utf8print(void* /*arg*/, const char* str) if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len)) return; - char temp_buf[6000]; - CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len+1); - printf(temp_buf); + wprintf(L"%s", wtemp_buf); #else { printf("%s", str); @@ -119,7 +117,7 @@ int kb_hit_return() tv.tv_usec = 0; FD_ZERO(&fds); FD_SET(STDIN_FILENO, &fds); - select(STDIN_FILENO+1, &fds, NULL, NULL, &tv); + select(STDIN_FILENO+1, &fds, nullptr, nullptr, &tv); return FD_ISSET(STDIN_FILENO, &fds); } #endif @@ -156,7 +154,7 @@ void CliThread() rl_bind_key('\t', rl_complete); #endif - if (command_str != NULL) + if (command_str != nullptr) { for (int x=0; command_str[x]; ++x) if (command_str[x] == '\r' || command_str[x] == '\n') @@ -187,7 +185,7 @@ void CliThread() } fflush(stdout); - sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished)); + sWorld->QueueCliCommand(new CliCommandHolder(nullptr, command.c_str(), &utf8print, &commandFinished)); #if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS add_history(command.c_str()); free(command_str); -- cgit v1.2.3