Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
kervala 8 years ago
commit 4316dfaa98

@ -305,8 +305,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
ENDIF() ENDIF()
IF(MSVC) IF(MSVC)
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) GET_PDB_FILENAME(_PDB_FILE ${_PCH_current_target})
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj") SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${_PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
# Ninja PCH Support # Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html # http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj") SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")

@ -434,6 +434,11 @@ MACRO(NL_SETUP_BUILD)
MESSAGE(STATUS "Generating NMake project") MESSAGE(STATUS "Generating NMake project")
ENDIF() ENDIF()
IF(CMAKE_GENERATOR MATCHES "Ninja")
SET(NINJA ON)
MESSAGE(STATUS "Generating Ninja project")
ENDIF()
# If target and host CPU are the same # If target and host CPU are the same
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING) IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
# x86-compatible CPU # x86-compatible CPU
@ -794,7 +799,7 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF() ENDIF()
IF(TARGET_ARMV7) IF(TARGET_ARMV7)
@ -804,7 +809,7 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF() ENDIF()
IF(TARGET_ARMV6) IF(TARGET_ARMV6)
@ -814,7 +819,7 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF() ENDIF()
ENDIF() ENDIF()
@ -826,7 +831,7 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}") ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}") ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}")
IF(CMAKE_OSX_DEPLOYMENT_TARGET) IF(CMAKE_OSX_DEPLOYMENT_TARGET)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") ADD_PLATFORM_LINKFLAGS("${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF() ENDIF()
ENDIF() ENDIF()
ELSE() ELSE()
@ -835,18 +840,18 @@ MACRO(NL_SETUP_BUILD)
IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.7") IF(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS "10.7")
MESSAGE(FATAL_ERROR "Minimum target for OS X is 10.7 but you're using ${CMAKE_OSX_DEPLOYMENT_TARGET}") MESSAGE(FATAL_ERROR "Minimum target for OS X is 10.7 but you're using ${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF() ENDIF()
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") ADD_PLATFORM_LINKFLAGS("-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF() ENDIF()
ENDIF() ENDIF()
# use libc++ under OX X to be able to use new C++ features (and else it'll use GCC 4.2.1 STL) # use libc++ under OX X to be able to use new C++ features (and else it'll use GCC 4.2.1 STL)
# minimum target is now OS X 10.7 # minimum target is now OS X 10.7
ADD_PLATFORM_FLAGS("-stdlib=libc++") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -stdlib=libc++")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names") ADD_PLATFORM_LINKFLAGS("-Wl,-headerpad_max_install_names")
IF(HAVE_FLAG_SEARCH_PATHS_FIRST) IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-search_paths_first") ADD_PLATFORM_LINKFLAGS("-Wl,-search_paths_first")
ENDIF() ENDIF()
ENDIF() ENDIF()
ELSE() ELSE()
@ -860,7 +865,7 @@ MACRO(NL_SETUP_BUILD)
ENDIF() ENDIF()
# use c++0x standard to use std::unique_ptr and std::shared_ptr # use c++0x standard to use std::unique_ptr and std::shared_ptr
ADD_PLATFORM_FLAGS("-std=c++0x") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -std=c++0x")
ADD_PLATFORM_FLAGS("-D_REENTRANT") ADD_PLATFORM_FLAGS("-D_REENTRANT")
@ -876,12 +881,15 @@ MACRO(NL_SETUP_BUILD)
ENDIF() ENDIF()
IF(WITH_WARNINGS) IF(WITH_WARNINGS)
ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused") ADD_PLATFORM_FLAGS("-Wall -W")
ELSE() ELSE()
# Check wrong formats in printf-like functions # Check wrong formats in printf-like functions
ADD_PLATFORM_FLAGS("-Wformat -Werror=format-security") ADD_PLATFORM_FLAGS("-Wformat -Werror=format-security")
ENDIF() ENDIF()
# never display these warnings because they are minor
ADD_PLATFORM_FLAGS("-Wno-unused-parameter")
IF(ANDROID) IF(ANDROID)
ADD_PLATFORM_FLAGS("--sysroot=${PLATFORM_ROOT}") ADD_PLATFORM_FLAGS("--sysroot=${PLATFORM_ROOT}")
ADD_PLATFORM_FLAGS("-ffunction-sections -funwind-tables") ADD_PLATFORM_FLAGS("-ffunction-sections -funwind-tables")
@ -894,7 +902,7 @@ MACRO(NL_SETUP_BUILD)
IF(TARGET_ARMV7) IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16") ADD_PLATFORM_FLAGS("-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -march=armv7-a -Wl,--fix-cortex-a8") ADD_PLATFORM_LINKFLAGS("-march=armv7-a -Wl,--fix-cortex-a8")
ELSEIF(TARGET_ARMV5) ELSEIF(TARGET_ARMV5)
ADD_PLATFORM_FLAGS("-march=armv5te -mtune=xscale -msoft-float") ADD_PLATFORM_FLAGS("-march=armv5te -mtune=xscale -msoft-float")
ENDIF() ENDIF()
@ -914,8 +922,8 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers") ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers")
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300") SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300")
ENDIF() ENDIF()
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-z,noexecstack") ADD_PLATFORM_LINKFLAGS("-Wl,-z,noexecstack")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -L${PLATFORM_ROOT}/usr/lib") ADD_PLATFORM_LINKFLAGS("-L${PLATFORM_ROOT}/usr/lib")
ENDIF() ENDIF()
IF(APPLE) IF(APPLE)
@ -932,13 +940,21 @@ MACRO(NL_SETUP_BUILD)
# hardening # hardening
ADD_PLATFORM_FLAGS("-fstack-protector --param=ssp-buffer-size=4") ADD_PLATFORM_FLAGS("-fstack-protector --param=ssp-buffer-size=4")
# If -fstack-protector or -fstack-protector-all enabled, enable too new warnings and fix possible link problems
IF(WITH_WARNINGS)
ADD_PLATFORM_FLAGS("-Wstack-protector")
ENDIF()
# Fix undefined reference to `__stack_chk_fail' error
ADD_PLATFORM_LINKFLAGS("-lc")
IF(NOT APPLE) IF(NOT APPLE)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed") ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed")
ENDIF() ENDIF()
IF(NOT APPLE) IF(NOT APPLE)
# hardening # hardening
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now") ADD_PLATFORM_LINKFLAGS("-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now")
ENDIF() ENDIF()
IF(WITH_SYMBOLS) IF(WITH_SYMBOLS)

@ -749,7 +749,7 @@ namespace NLGUI
std::string str; std::string str;
for (;;) for (;;)
{ {
if (expr == '\0') if (*expr == '\0')
{ {
nlwarning("CInterfaceExprValue::evalString : end of buffer encountered in a string"); nlwarning("CInterfaceExprValue::evalString : end of buffer encountered in a string");
return NULL; return NULL;

@ -1493,7 +1493,7 @@ static bool openDocWithExtension (const std::string &document, const std::string
return true; return true;
} }
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
CFURLRef url = CFURLCreateWithBytes(NULL, (const UInt8 *)document, strlen(document), kCFStringEncodingUTF8, NULL); CFURLRef url = CFURLCreateWithBytes(NULL, (const UInt8 *)document.c_str(), document.length(), kCFStringEncodingUTF8, NULL);
if (url) if (url)
{ {
@ -1502,7 +1502,7 @@ static bool openDocWithExtension (const std::string &document, const std::string
if (res != 0) if (res != 0)
{ {
nlwarning("LSOpenCFURLRef %s returned %d", document, (sint)res); nlwarning("LSOpenCFURLRef %s returned %d", document.c_str(), (sint)res);
return false; return false;
} }
@ -1510,7 +1510,7 @@ static bool openDocWithExtension (const std::string &document, const std::string
} }
else else
{ {
nlwarning("Unable to create URL from %s", document); nlwarning("Unable to create URL from %s", document.c_str());
return false; return false;
} }
#else #else

@ -497,9 +497,9 @@ CSock::TSockResult CSock::receive( uint8 *buffer, uint32& len, bool throw_except
if ( _NonBlocking ) if ( _NonBlocking )
{ {
// Receive incoming message (only the received part) // Receive incoming message (only the received part)
TTicks before = CTime::getPerformanceTime(); TTicks before = CTime::getPerformanceTime();
len = ::recv( _Sock, (char*)buffer, len, 0 );
sint retLen = ::recv( _Sock, (char*)buffer, len, 0 );
//nlinfo ("CSock::receive(): NBM Received %d bytes to %d res: %d (%d)", realLen, _Sock, len, ERROR_NUM); //nlinfo ("CSock::receive(): NBM Received %d bytes to %d res: %d (%d)", realLen, _Sock, len, ERROR_NUM);
@ -509,7 +509,8 @@ CSock::TSockResult CSock::receive( uint8 *buffer, uint32& len, bool throw_except
} }
_MaxReceiveTime = max( (uint32)(CTime::ticksToSecond(CTime::getPerformanceTime()-before)*1000.0f), _MaxReceiveTime ); _MaxReceiveTime = max( (uint32)(CTime::ticksToSecond(CTime::getPerformanceTime()-before)*1000.0f), _MaxReceiveTime );
switch ( len )
switch (retLen)
{ {
// Graceful disconnection // Graceful disconnection
case 0 : case 0 :
@ -546,12 +547,14 @@ CSock::TSockResult CSock::receive( uint8 *buffer, uint32& len, bool throw_except
} }
} }
} }
len = (uint32)retLen;
} }
else // Blocking Mode else // Blocking Mode
{ {
// Receive incoming message, waiting until a complete message has arrived // Receive incoming message, waiting until a complete message has arrived
uint total = 0; uint total = 0;
uint brecvd; sint brecvd;
while ( total < len ) while ( total < len )
{ {

@ -34,6 +34,7 @@ class CPatchThread;
class CCheckThread; class CCheckThread;
class CScanDataThread; class CScanDataThread;
class CInstallThread; class CInstallThread;
class CDownloadThread;
// Useful for using an external downloader (BitTorrent) use of interface with CGameDownloader from client_background_rd.exe using as install program // Useful for using an external downloader (BitTorrent) use of interface with CGameDownloader from client_background_rd.exe using as install program

@ -1666,12 +1666,11 @@ namespace RSMGR
sf_shard28 = 1<<28, sf_shard28 = 1<<28,
sf_shard29 = 1<<29, sf_shard29 = 1<<29,
sf_shard30 = 1<<30, sf_shard30 = 1<<30,
sf_shard31 = 1<<31,
invalid_val, invalid_val,
/// Number of enumerated values /// Number of enumerated values
nb_enum_items = 32 nb_enum_items = 31
}; };
@ -1709,7 +1708,6 @@ namespace RSMGR
NL_STRING_CONVERSION_TABLE_ENTRY(sf_shard28) NL_STRING_CONVERSION_TABLE_ENTRY(sf_shard28)
NL_STRING_CONVERSION_TABLE_ENTRY(sf_shard29) NL_STRING_CONVERSION_TABLE_ENTRY(sf_shard29)
NL_STRING_CONVERSION_TABLE_ENTRY(sf_shard30) NL_STRING_CONVERSION_TABLE_ENTRY(sf_shard30)
NL_STRING_CONVERSION_TABLE_ENTRY(sf_shard31)
NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val) NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val)
}; };
static NLMISC::CStringConversion<TValues> static NLMISC::CStringConversion<TValues>

@ -76,7 +76,7 @@ inline ucstring capitalize(const ucstring & s)
#define MACRO_CONCAT2(a,b) CONCAT(a,b) #define MACRO_CONCAT2(a,b) CONCAT(a,b)
#define MACRO_TOTXT(a) #a #define MACRO_TOTXT(a) #a
#define MACRO_TOTXT2(a) TOTXT(a) #define MACRO_TOTXT2(a) TOTXT(a)
#define __FILE_LINE__ __FILE__ ":"TOTXT2(__LINE__)":" #define __FILE_LINE__ __FILE__ ":" TOTXT2(__LINE__) ":"
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------

@ -920,39 +920,7 @@ LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)
void CGeorgesEditApp::gotoURL (LPCTSTR url) void CGeorgesEditApp::gotoURL (LPCTSTR url)
{ {
char key[MAX_PATH + MAX_PATH]; NLMISC::openURL(tStrToUtf8(url));
// First try ShellExecute()
HINSTANCE result = ShellExecute(NULL, "open", url, NULL,NULL, SW_SHOW);
// If it failed, get the .htm regkey and lookup the program
if ((UINT)result <= HINSTANCE_ERROR) {
if (GetRegKey(HKEY_CLASSES_ROOT, ".htm", key) == ERROR_SUCCESS)
{
lstrcat(key, "\\shell\\open\\command");
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
{
char *pos;
pos = strstr(key, "\"%1\"");
if (pos == NULL)
{ // No quotes found
pos = strstr(key, "%1"); // Check for %1, without quotes
if (pos == NULL) // No parameter at all...
pos = key+lstrlen(key)-1;
else
*pos = '\0'; // Remove the parameter
}
else
*pos = '\0'; // Remove the parameter
lstrcat(pos, " ");
lstrcat(pos, url);
result = (HINSTANCE) WinExec(key, SW_SHOW);
}
}
}
} }
void CGeorgesEditApp::WinHelp(DWORD dwData, UINT nCmd) void CGeorgesEditApp::WinHelp(DWORD dwData, UINT nCmd)

Loading…
Cancel
Save