Skip to content

Commit 085ebe1

Browse files
committed
Possible tinygettext fix for mac & linux
1 parent 90c8287 commit 085ebe1

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

premake5.lua

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,18 @@ workspace "MTASA"
157157
include "vendor/cegui-0.4.0-custom/WidgetSets/Falagard"
158158
include "vendor/cegui-0.4.0-custom"
159159

160-
group "Vendor"
161-
include "vendor/portaudio"
162-
include "vendor/cef3"
163-
include "vendor/discord-rpc"
164-
include "vendor/freetype"
165-
include "vendor/jpeg-9f"
166-
include "vendor/ksignals"
167-
include "vendor/libpng"
168-
include "vendor/tinygettext"
169-
include "vendor/pthreads"
170-
include "vendor/libspeex"
171-
include "vendor/detours"
172-
include "vendor/lunasvg"
160+
group "Vendor"
161+
include "vendor/portaudio"
162+
include "vendor/cef3"
163+
include "vendor/discord-rpc"
164+
include "vendor/freetype"
165+
include "vendor/jpeg-9f"
166+
include "vendor/ksignals"
167+
include "vendor/libpng"
168+
include "vendor/pthreads"
169+
include "vendor/libspeex"
170+
include "vendor/detours"
171+
include "vendor/lunasvg"
173172
end
174173

175174
filter {}
@@ -196,6 +195,7 @@ workspace "MTASA"
196195
include "vendor/pcre"
197196
include "vendor/pme"
198197
include "vendor/sqlite"
198+
include "vendor/tinygettext"
199199
include "vendor/tinyxml"
200200
include "vendor/unrar"
201201
include "vendor/zip"

vendor/tinygettext/dirent_win32.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
#include <errno.h>
109109
#if defined(_MSC_VER) && _MSC_VER >= 1400
110110
#include <windows.h>
111+
#include <string>
111112
#endif
112113

113114
/* Indicates that d_type field is available in dirent structure */
@@ -779,7 +780,10 @@ dirent_mbstowcs_s(
779780

780781
#if defined(_MSC_VER) && _MSC_VER >= 1400
781782

782-
wcscpy_s(wcstr, sizeInWords, utf8_mbstowcs(mbstr).c_str());
783+
std::wstring wideStr = utf8_mbstowcs(std::string(mbstr));
784+
wcscpy_s(wcstr, sizeInWords, wideStr.c_str());
785+
if (pReturnValue)
786+
*pReturnValue = wideStr.length() + 1;
783787
error = 0;
784788

785789
#else
@@ -829,7 +833,10 @@ dirent_wcstombs_s(
829833

830834
#if defined(_MSC_VER) && _MSC_VER >= 1400
831835

832-
strcpy_s(mbstr, sizeInBytes, utf8_wcstombs(wcstr).c_str());
836+
std::string narrowStr = utf8_wcstombs(wcstr);
837+
strcpy_s(mbstr, sizeInBytes, narrowStr.c_str());
838+
if (pReturnValue)
839+
*pReturnValue = narrowStr.length() + 1;
833840
error = 0;
834841

835842
#else

vendor/tinygettext/premake5.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ project "tinygettext"
2121
}
2222

2323
filter "system:windows"
24-
disablewarnings { "4800", "4309", "4503", "4099", "4503" }
24+
disablewarnings { "4800", "4309", "4503", "4099" }
25+
26+
filter { "system:linux or macosx" }
27+
buildoptions { "-Wno-unused-parameter", "-Wno-unused-variable" }

vendor/tinygettext/unix_file_system.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include <fstream>
2222
#ifdef WIN32
2323
#include <windows.h>
24-
#include <UTF8.h>
24+
#include "../../Shared/sdk/UTF8.h"
2525
#include <dirent_win32.h>
2626
#ifdef TGT_STANDALONE
27-
#include <UTF8.hpp>
27+
#include "../../Shared/sdk/UTF8.hpp"
2828
#endif
2929
#else
3030
#include <dirent.h>

0 commit comments

Comments
 (0)