mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Merge pull request #72 from FinnHornhoover/msys-mingw-compile-fix
Warnings and compile errors for MSYS2 MinGW64
This commit is contained in:
commit
29e53117e7
8
Makefile
8
Makefile
@ -15,7 +15,9 @@ PROTOCOL_VERSION?=104
|
|||||||
WIN_CC=x86_64-w64-mingw32-gcc
|
WIN_CC=x86_64-w64-mingw32-gcc
|
||||||
WIN_CXX=x86_64-w64-mingw32-g++
|
WIN_CXX=x86_64-w64-mingw32-g++
|
||||||
WIN_CFLAGS=-O3 #-g3 -fsanitize=address
|
WIN_CFLAGS=-O3 #-g3 -fsanitize=address
|
||||||
WIN_CXXFLAGS=-Wall -Wno-unknown-pragmas -std=c++17 -O3 -fno-tree-dce -fno-inline-small-functions -DPROTOCOL_VERSION=$(PROTOCOL_VERSION) #-g3 -fsanitize=address
|
WIN_CXX_VANILLA_MINGW_OPT_DISABLES=-fno-tree-dce -fno-inline-small-functions
|
||||||
|
WIN_CXX_OPT_DISABLES=-fno-tree-dce -fno-tree-fre -fno-tree-vrp -fno-ipa-sra
|
||||||
|
WIN_CXXFLAGS=-Wall -Wno-unknown-pragmas -std=c++17 -O3 $(WIN_CXX_OPT_DISABLES) -DPROTOCOL_VERSION=$(PROTOCOL_VERSION) #-g3 -fsanitize=address
|
||||||
WIN_LDFLAGS=-static -lws2_32 -lwsock32 #-g3 -fsanitize=address
|
WIN_LDFLAGS=-static -lws2_32 -lwsock32 #-g3 -fsanitize=address
|
||||||
WIN_SERVER=bin/winfusion.exe
|
WIN_SERVER=bin/winfusion.exe
|
||||||
|
|
||||||
@ -100,6 +102,10 @@ windows : CFLAGS=$(WIN_CFLAGS)
|
|||||||
windows : CXXFLAGS=$(WIN_CXXFLAGS)
|
windows : CXXFLAGS=$(WIN_CXXFLAGS)
|
||||||
windows : LDFLAGS=$(WIN_LDFLAGS)
|
windows : LDFLAGS=$(WIN_LDFLAGS)
|
||||||
windows : SERVER=$(WIN_SERVER)
|
windows : SERVER=$(WIN_SERVER)
|
||||||
|
windows :
|
||||||
|
ifneq ($(shell $(WIN_CXX) --version | head -1 | egrep -o [0-9]+ | tail -3 | head -1), 10)
|
||||||
|
WIN_CXX_OPT_DISABLES=$(WIN_CXX_VANILLA_MINGW_OPT_DISABLES)
|
||||||
|
endif
|
||||||
|
|
||||||
.SUFFIX: .o .c .cpp .h .hpp
|
.SUFFIX: .o .c .cpp .h .hpp
|
||||||
|
|
||||||
|
@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
std::string U16toU8(char16_t* src) {
|
std::string U16toU8(char16_t* src) {
|
||||||
try {
|
try {
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
|
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
|
||||||
return convert.to_bytes(src);
|
return convert.to_bytes(src);
|
||||||
} catch(std::exception e) {
|
} catch(const std::exception& e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns number of char16_t that was written at des
|
// returns number of char16_t that was written at des
|
||||||
size_t U8toU16(std::string src, char16_t* des) {
|
size_t U8toU16(std::string src, char16_t* des) {
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
|
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
|
||||||
std::u16string tmp = convert.from_bytes(src);
|
std::u16string tmp = convert.from_bytes(src);
|
||||||
|
|
||||||
// copy utf16 string to buffer
|
// copy utf16 string to buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user