mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Reduce gettext wide/narrow and string/char* conversions
This commit is contained in:
parent
84c367bb46
commit
9e2a9b55e1
15 changed files with 125 additions and 141 deletions
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <stdlib.h>
|
||||
#include "gettext.h"
|
||||
#include "util/string.h"
|
||||
#include "log.h"
|
||||
|
||||
#if USE_GETTEXT && defined(_MSC_VER)
|
||||
#include <WinNls.h>
|
||||
|
@ -116,9 +117,9 @@ const char* MSVC_LocaleLookup(const char* raw_shortname) {
|
|||
|
||||
/******************************************************************************/
|
||||
#ifdef _MSC_VER
|
||||
void init_gettext(const char *path,std::string configured_language,int argc, char** argv) {
|
||||
void init_gettext(const char *path, const std::string &configured_language, int argc, char** argv) {
|
||||
#else
|
||||
void init_gettext(const char *path,std::string configured_language) {
|
||||
void init_gettext(const char *path, const std::string &configured_language) {
|
||||
#endif
|
||||
#if USE_GETTEXT
|
||||
/** first try to set user override environment **/
|
||||
|
@ -173,15 +174,15 @@ void init_gettext(const char *path,std::string configured_language) {
|
|||
}
|
||||
|
||||
if (!CreateProcess(appname.c_str(),
|
||||
(char*) ptr_parameters,
|
||||
NULL,
|
||||
NULL,
|
||||
false,
|
||||
DETACHED_PROCESS | CREATE_UNICODE_ENVIRONMENT,
|
||||
NULL,
|
||||
NULL,
|
||||
&startupinfo,
|
||||
&processinfo)) {
|
||||
(char*) ptr_parameters,
|
||||
NULL,
|
||||
NULL,
|
||||
false,
|
||||
DETACHED_PROCESS | CREATE_UNICODE_ENVIRONMENT,
|
||||
NULL,
|
||||
NULL,
|
||||
&startupinfo,
|
||||
&processinfo)) {
|
||||
char buffer[1024];
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
|
@ -261,9 +262,6 @@ void init_gettext(const char *path,std::string configured_language) {
|
|||
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
infostream << "Message locale is now set to: "
|
||||
<< setlocale(LC_ALL,0) << std::endl;
|
||||
<< setlocale(LC_ALL, 0) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue