VS2015 compilation fixes

This commit is contained in:
kaetemi 2016-01-15 11:34:23 +01:00
parent 1c30bd835f
commit 6abf73a61d
21 changed files with 90 additions and 55 deletions

View file

@ -525,7 +525,13 @@ MACRO(NL_SETUP_BUILD)
# Ignore default include paths # Ignore default include paths
ADD_PLATFORM_FLAGS("/X") ADD_PLATFORM_FLAGS("/X")
IF(MSVC12) IF(MSVC14)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2015, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC12)
ADD_PLATFORM_FLAGS("/Gy- /MP") ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2013, but custom optimizations don't exist # /Ox is working with VC++ 2013, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
@ -557,7 +563,7 @@ MACRO(NL_SETUP_BUILD)
SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}") SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
ELSE(MSVC12) ELSE(MSVC12)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC12) ENDIF(MSVC14)
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250") ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250")

View file

@ -354,7 +354,7 @@ public:
} }
else else
{ {
nlerror ("CEntityId looped (max was %"NL_I64"d", MaxEntityId); nlerror ("CEntityId looped (max was %" NL_I64 "d", MaxEntityId);
} }
return *this; return *this;
} }
@ -487,7 +487,7 @@ public:
uint creatorId; uint creatorId;
uint dynamicId; uint dynamicId;
if (sscanf(str, "(%"NL_I64"x:%x:%x:%x)", &id, &type, &creatorId, &dynamicId) != 4) if (sscanf(str, "(%" NL_I64 "x:%x:%x:%x)", &id, &type, &creatorId, &dynamicId) != 4)
{ {
*this = Unknown; *this = Unknown;
return; return;

View file

@ -728,7 +728,7 @@ inline void CMemStream::serial(uint64 &b)
} }
else else
{ {
writenumber( b, "%"NL_I64"u", 20 ); writenumber( b, "%" NL_I64 "u", 20 );
} }
} }
else else
@ -748,7 +748,7 @@ inline void CMemStream::serial(sint64 &b)
} }
else else
{ {
writenumber( b, "%"NL_I64"d", 20 ); writenumber( b, "%" NL_I64 "d", 20 );
} }
} }
else else

View file

@ -186,8 +186,8 @@ inline std::string toString(const uint16 &val) { return toString("%hu", val); }
inline std::string toString(const sint16 &val) { return toString("%hd", val); } inline std::string toString(const sint16 &val) { return toString("%hd", val); }
inline std::string toString(const uint32 &val) { return toString("%u", val); } inline std::string toString(const uint32 &val) { return toString("%u", val); }
inline std::string toString(const sint32 &val) { return toString("%d", val); } inline std::string toString(const sint32 &val) { return toString("%d", val); }
inline std::string toString(const uint64 &val) { return toString("%"NL_I64"u", val); } inline std::string toString(const uint64 &val) { return toString("%" NL_I64 "u", val); }
inline std::string toString(const sint64 &val) { return toString("%"NL_I64"d", val); } inline std::string toString(const sint64 &val) { return toString("%" NL_I64 "d", val); }
#ifdef NL_COMP_GCC #ifdef NL_COMP_GCC
# if GCC_VERSION == 40102 # if GCC_VERSION == 40102
@ -206,7 +206,7 @@ inline std::string toString(const long unsigned int &val)
#endif #endif
#if (SIZEOF_SIZE_T) == 8 #if (SIZEOF_SIZE_T) == 8
inline std::string toString(const size_t &val) { return toString("%"NL_I64"u", val); } inline std::string toString(const size_t &val) { return toString("%" NL_I64 "u", val); }
#else #else
#ifdef NL_OS_MAC #ifdef NL_OS_MAC
inline std::string toString(const size_t &val) { return toString("%u", val); } inline std::string toString(const size_t &val) { return toString("%u", val); }
@ -237,8 +237,8 @@ inline bool fromString(const std::string &str, uint8 &val) { char *end; long v;
inline bool fromString(const std::string &str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint8)v; return true; } } inline bool fromString(const std::string &str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint8)v; return true; } }
inline bool fromString(const std::string &str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint16)v; return true; } } inline bool fromString(const std::string &str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint16)v; return true; } }
inline bool fromString(const std::string &str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint16)v; return true; } } inline bool fromString(const std::string &str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint16)v; return true; } }
inline bool fromString(const std::string &str, uint64 &val) { bool ret = sscanf(str.c_str(), "%"NL_I64"u", &val) == 1; if (!ret) val = 0; return ret; } inline bool fromString(const std::string &str, uint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(str.c_str(), "%"NL_I64"d", &val) == 1; if (!ret) val = 0; return ret; } inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }
@ -286,8 +286,8 @@ inline bool fromString(const char *str, uint8 &val) { char *end; long v; errno =
inline bool fromString(const char *str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str) { val = 0; return false; } else { val = (sint8)v; return true; } } inline bool fromString(const char *str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str) { val = 0; return false; } else { val = (sint8)v; return true; } }
inline bool fromString(const char *str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint16)v; return true; } } inline bool fromString(const char *str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint16)v; return true; } }
inline bool fromString(const char *str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str) { val = 0; return false; } else { val = (sint16)v; return true; } } inline bool fromString(const char *str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str) { val = 0; return false; } else { val = (sint16)v; return true; } }
inline bool fromString(const char *str, uint64 &val) { bool ret = sscanf(str, "%"NL_I64"u", &val) == 1; if (!ret) val = 0; return ret; } inline bool fromString(const char *str, uint64 &val) { bool ret = sscanf(str, "%" NL_I64 "u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const char *str, sint64 &val) { bool ret = sscanf(str, "%"NL_I64"d", &val) == 1; if (!ret) val = 0; return ret; } inline bool fromString(const char *str, sint64 &val) { bool ret = sscanf(str, "%" NL_I64 "d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const char *str, float &val) { bool ret = sscanf(str, "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } inline bool fromString(const char *str, float &val) { bool ret = sscanf(str, "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const char *str, double &val) { bool ret = sscanf(str, "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } inline bool fromString(const char *str, double &val) { bool ret = sscanf(str, "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }

View file

@ -67,7 +67,10 @@
# endif # endif
# ifdef _MSC_VER # ifdef _MSC_VER
# define NL_COMP_VC # define NL_COMP_VC
# if _MSC_VER >= 1800 # if _MSC_VER >= 1900
# define NL_COMP_VC14
# define NL_COMP_VC_VERSION 140
# elif _MSC_VER >= 1800
# define NL_COMP_VC12 # define NL_COMP_VC12
# define NL_COMP_VC_VERSION 120 # define NL_COMP_VC_VERSION 120
# elif _MSC_VER >= 1700 # elif _MSC_VER >= 1700
@ -303,7 +306,7 @@
* Used to display a int64 in a platform independent way with printf like functions. * Used to display a int64 in a platform independent way with printf like functions.
\code \code
sint64 myint64 = SINT64_CONSTANT(0x123456781234); sint64 myint64 = SINT64_CONSTANT(0x123456781234);
printf("This is a 64 bits int: %"NL_I64"u", myint64); printf("This is a 64 bits int: %" NL_I64 "u", myint64);
\endcode \endcode
*/ */

View file

@ -422,7 +422,7 @@ namespace NLGUI
{ {
nlassert(key); nlassert(key);
nlassert(isValid()); nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d"NL_I64"' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename())); if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d" NL_I64 "' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
CLuaStackChecker lsc(_LuaState); CLuaStackChecker lsc(_LuaState);
push(); push();
_LuaState->push(key); _LuaState->push(key);

View file

@ -836,7 +836,7 @@ std::string CBitMemStream::getSerialItem( const TBMSSerialInfo& serialItem )
{ {
uint64 u; uint64 u;
serial( u, serialItem.BitSize ); serial( u, serialItem.BitSize );
s = NLMISC::toString( "%"NL_I64"u", u ); s = NLMISC::toString( "%" NL_I64 "u", u );
break; break;
} }
case TBMSSerialInfo::F: // what about double? case TBMSSerialInfo::F: // what about double?

View file

@ -538,9 +538,9 @@ void CBufFIFO::displayStats (CLog *log)
log->displayNL ("%p BiggestBlock: %d, SmallestBlock: %d", this, _BiggestBlock, _SmallestBlock); log->displayNL ("%p BiggestBlock: %d, SmallestBlock: %d", this, _BiggestBlock, _SmallestBlock);
log->displayNL ("%p BiggestBuffer: %d, SmallestBuffer: %d", this, _BiggestBuffer, _SmallestBuffer); log->displayNL ("%p BiggestBuffer: %d, SmallestBuffer: %d", this, _BiggestBuffer, _SmallestBuffer);
log->displayNL ("%p Pushed: %d, PushedTime: total %"NL_I64"d ticks, mean %f ticks", this, _Pushed, _PushedTime, (_Pushed>0?(double)(sint64)_PushedTime / (double)_Pushed:0.0)); log->displayNL ("%p Pushed: %d, PushedTime: total %" NL_I64 "d ticks, mean %f ticks", this, _Pushed, _PushedTime, (_Pushed>0?(double)(sint64)_PushedTime / (double)_Pushed:0.0));
log->displayNL ("%p Fronted: %d, FrontedTime: total %"NL_I64"d ticks, mean %f ticks", this, _Fronted, _FrontedTime, (_Fronted>0?(double)(sint64)_FrontedTime / (double)_Fronted:0.0)); log->displayNL ("%p Fronted: %d, FrontedTime: total %" NL_I64 "d ticks, mean %f ticks", this, _Fronted, _FrontedTime, (_Fronted>0?(double)(sint64)_FrontedTime / (double)_Fronted:0.0));
log->displayNL ("%p Resized: %d, ResizedTime: total %"NL_I64"d ticks, mean %f ticks", this, _Resized, _ResizedTime, (_Resized>0?(double)(sint64)_ResizedTime / (double)_Resized:0.0)); log->displayNL ("%p Resized: %d, ResizedTime: total %" NL_I64 "d ticks, mean %f ticks", this, _Resized, _ResizedTime, (_Resized>0?(double)(sint64)_ResizedTime / (double)_Resized:0.0));
} }
void CBufFIFO::display () void CBufFIFO::display ()

View file

@ -120,7 +120,7 @@ ICDBNode * CCDBNodeLeaf::getNode (const CTextId& id, bool /* bCreate */)
//----------------------------------------------- //-----------------------------------------------
void CCDBNodeLeaf::write( CTextId& id, FILE * f) void CCDBNodeLeaf::write( CTextId& id, FILE * f)
{ {
fprintf(f,"%"NL_I64"d\t%s\n",_Property,id.toString().c_str()); fprintf(f,"%" NL_I64 "d\t%s\n",_Property,id.toString().c_str());
} // write // } // write //
//----------------------------------------------- //-----------------------------------------------
@ -165,7 +165,7 @@ void CCDBNodeLeaf::readDelta(TGameCycle gc, CBitMemStream & f )
} }
if ( verboseDatabase ) if ( verboseDatabase )
{ {
nlinfo( "CDB: Read value (%u bits) %"NL_I64"d", bits, _Property ); nlinfo( "CDB: Read value (%u bits) %" NL_I64 "d", bits, _Property );
} }
// bkup the date of change // bkup the date of change

View file

@ -380,7 +380,7 @@ string bytesToHumanReadable (uint64 bytes)
div++; div++;
res = newres; res = newres;
} }
return toString ("%"NL_I64"u%s", res, divTable[div]); return toString ("%" NL_I64 "u%s", res, divTable[div]);
} }
uint32 humanReadableToBytes (const string &str) uint32 humanReadableToBytes (const string &str)

View file

@ -49,7 +49,7 @@ bool CCPUTimeStat::getCPUTicks(uint64& user, uint64& nice, uint64& system, uint6
// /proc/stat // /proc/stat
// cpu [user] [nice] [system] [idle] [iowait] [irq] [softirq] // cpu [user] [nice] [system] [idle] [iowait] [irq] [softirq]
if (fscanf(f, "cpu %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u", &user, &nice, &system, &idle, &iowait) != 5) if (fscanf(f, "cpu %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u", &user, &nice, &system, &idle, &iowait) != 5)
nlwarning("Failed to parse /proc/stat"); nlwarning("Failed to parse /proc/stat");
fclose(f); fclose(f);
@ -73,7 +73,7 @@ bool CCPUTimeStat::getPIDTicks(uint64& utime, uint64& stime, uint64& cutime, uin
// /proc/<pid>/stat // /proc/<pid>/stat
// pid com sta ppi pgi ses tty tpg fla mif maf cmi cma [utime] [stime] [cutime] [cstime] ... // pid com sta ppi pgi ses tty tpg fla mif maf cmi cma [utime] [stime] [cutime] [cstime] ...
if (fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u", &utime, &stime, &cutime, &cstime) != 4) if (fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u", &utime, &stime, &cutime, &cstime) != 4)
nlwarning("Failed to parse /proc/<pid>/stat"); nlwarning("Failed to parse /proc/<pid>/stat");
fclose(f); fclose(f);

View file

@ -791,7 +791,7 @@ NLMISC_CATEGORISED_COMMAND(nel, iFileAccessLogDisplay, "Display file access logs
while (atIt!=atItEnd) while (atIt!=atItEnd)
{ {
uint64 delta= (*atIt-IFileAccessLogStartTime); uint64 delta= (*atIt-IFileAccessLogStartTime);
log.display("%"NL_I64"u,",delta); log.display("%" NL_I64 "u,",delta);
++atIt; ++atIt;
} }
log.displayNL(""); log.displayNL("");

View file

@ -327,14 +327,14 @@ void COXml::serial(sint32 &b)
void COXml::serial(uint64 &b) void COXml::serial(uint64 &b)
{ {
writenumber( b, "%"NL_I64"u", 20 ); writenumber( b, "%" NL_I64 "u", 20 );
} }
// *************************************************************************** // ***************************************************************************
void COXml::serial(sint64 &b) void COXml::serial(sint64 &b)
{ {
writenumber( b, "%"NL_I64"d", 20 ); writenumber( b, "%" NL_I64 "d", 20 );
} }
// *************************************************************************** // ***************************************************************************

View file

@ -23,6 +23,32 @@
#include <windows.h> #include <windows.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#ifdef DXGI_STATUS_OCCLUDED
#undef DXGI_STATUS_OCCLUDED
#undef DXGI_STATUS_CLIPPED
#undef DXGI_STATUS_NO_REDIRECTION
#undef DXGI_STATUS_NO_DESKTOP_ACCESS
#undef DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE
#undef DXGI_STATUS_MODE_CHANGED
#undef DXGI_STATUS_MODE_CHANGE_IN_PROGRESS
#endif
#ifdef DXGI_ERROR_INVALID_CALL
#undef DXGI_ERROR_INVALID_CALL
#undef DXGI_ERROR_NOT_FOUND
#undef DXGI_ERROR_MORE_DATA
#undef DXGI_ERROR_UNSUPPORTED
#undef DXGI_ERROR_DEVICE_REMOVED
#undef DXGI_ERROR_DEVICE_HUNG
#undef DXGI_ERROR_DEVICE_RESET
#undef DXGI_ERROR_WAS_STILL_DRAWING
#undef DXGI_ERROR_FRAME_STATISTICS_DISJOINT
#undef DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE
#undef DXGI_ERROR_DRIVER_INTERNAL_ERROR
#undef DXGI_ERROR_NONEXCLUSIVE
#undef DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
#undef DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED
#undef DXGI_ERROR_REMOTE_OUTOFMEMORY
#endif
#include <dxgi.h> #include <dxgi.h>
#include <initguid.h> #include <initguid.h>
#include <CGuid.h> #include <CGuid.h>

View file

@ -716,7 +716,7 @@ uint64 CBufServer::newBytesReceived()
{ {
uint64 b = bytesReceived(); uint64 b = bytesReceived();
uint64 nbrecvd = b - _PrevBytesPoppedIn; uint64 nbrecvd = b - _PrevBytesPoppedIn;
//nlinfo( "b: %"NL_I64"u new: %"NL_I64"u", b, nbrecvd ); //nlinfo( "b: %" NL_I64 "u new: %" NL_I64 "u", b, nbrecvd );
_PrevBytesPoppedIn = b; _PrevBytesPoppedIn = b;
return nbrecvd; return nbrecvd;
} }
@ -728,7 +728,7 @@ uint64 CBufServer::newBytesSent()
{ {
uint64 b = bytesSent(); uint64 b = bytesSent();
uint64 nbsent = b - _PrevBytesPushedOut; uint64 nbsent = b - _PrevBytesPushedOut;
//nlinfo( "b: %"NL_I64"u new: %"NL_I64"u", b, nbsent ); //nlinfo( "b: %" NL_I64 "u new: %" NL_I64 "u", b, nbsent );
_PrevBytesPushedOut = b; _PrevBytesPushedOut = b;
return nbsent; return nbsent;
} }

View file

@ -311,7 +311,7 @@ void CCallbackClient::connect( const CInetAddress& addr )
throw ESocketConnectionFailed( addr ); throw ESocketConnectionFailed( addr );
//break; //break;
default : default :
nlwarning( "LNETL3C: No connection event in replay data, at update #%"NL_I64"u", _MR_UpdateCounter ); nlwarning( "LNETL3C: No connection event in replay data, at update #%" NL_I64 "u", _MR_UpdateCounter );
} }
} }
#endif #endif
@ -346,7 +346,7 @@ void CCallbackClient::disconnect( TSockId hostid )
// Read (skip) disconnection in the file // Read (skip) disconnection in the file
if ( ! (_MR_Recorder.checkNextOne( _MR_UpdateCounter ) == Disconnecting) ) if ( ! (_MR_Recorder.checkNextOne( _MR_UpdateCounter ) == Disconnecting) )
{ {
nlwarning( "LNETL3C: No disconnection event in the replay data, at update #%"NL_I64"u", _MR_UpdateCounter ); nlwarning( "LNETL3C: No disconnection event in the replay data, at update #%" NL_I64 "u", _MR_UpdateCounter );
} }
} }
// Record or replay disconnection (because disconnect() in the client does not push a disc. event) // Record or replay disconnection (because disconnect() in the client does not push a disc. event)

View file

@ -301,7 +301,7 @@ TNetworkEvent CMessageRecorder::checkNextOne( sint64 updatecounter )
TMessageRecord record; TMessageRecord record;
if ( getNext( record, updatecounter ) ) if ( getNext( record, updatecounter ) )
{ {
nldebug( "MR: Check next one: %s at update %"NL_I64"u", EventToString(record.Event).c_str(), updatecounter ); nldebug( "MR: Check next one: %s at update %" NL_I64 "u", EventToString(record.Event).c_str(), updatecounter );
return record.Event; return record.Event;
} }
else else
@ -330,7 +330,7 @@ TNetworkEvent CMessageRecorder::replayConnectionAttempt( const CInetAddress& add
{ {
// Found // Found
event = (*ipr).Event; event = (*ipr).Event;
nldebug( "MR: Connection attempt found at update %"NL_I64"u", (*ipr).UpdateCounter ); nldebug( "MR: Connection attempt found at update %" NL_I64 "u", (*ipr).UpdateCounter );
_ConnectionAttempts.erase( ipr ); _ConnectionAttempts.erase( ipr );
return event; return event;
} }
@ -348,7 +348,7 @@ TNetworkEvent CMessageRecorder::replayConnectionAttempt( const CInetAddress& add
if ( stored_addr == addr ) if ( stored_addr == addr )
{ {
// Found // Found
nldebug( "MR: Connection attempt found at update %"NL_I64"u", (*ipr).UpdateCounter ); nldebug( "MR: Connection attempt found at update %" NL_I64 "u", (*ipr).UpdateCounter );
_PreloadedRecords.erase( ipr ); _PreloadedRecords.erase( ipr );
return event; return event;
} }
@ -367,7 +367,7 @@ TNetworkEvent CMessageRecorder::replayConnectionAttempt( const CInetAddress& add
if ( stored_addr == addr ) if ( stored_addr == addr )
{ {
// Found // Found
nldebug( "MR: Connection attempt found at update %"NL_I64"u", rec.UpdateCounter ); nldebug( "MR: Connection attempt found at update %" NL_I64 "u", rec.UpdateCounter );
return rec.Event; return rec.Event;
} }
else else

View file

@ -72,12 +72,12 @@ void CNetLog::output( const char *srchost, uint8 msgnum,
const char *desthost, const char *msgname, uint32 msgsize ) const char *desthost, const char *msgname, uint32 msgsize )
{ {
/*OLD char line [1024]; /*OLD char line [1024];
smprintf( line, 1024, "@@%"NL_I64"d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0), smprintf( line, 1024, "@@%" NL_I64 "d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize ); srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize );
displayRawNL( line ); displayRawNL( line );
*/ */
/* displayRawNL( "@@%"NL_I64"d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0), /* displayRawNL( "@@%" NL_I64 "d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize ); srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize );
*/ */
displayRawNL( "@@0@%s@%hu@%s@%s@%s@%u@", displayRawNL( "@@0@%s@%hu@%s@%s@%s@%u@",
@ -91,11 +91,11 @@ void CNetLog::output( const char *srchost, uint8 msgnum,
void CNetLog::input( const char *srchost, uint8 msgnum, const char *desthost ) void CNetLog::input( const char *srchost, uint8 msgnum, const char *desthost )
{ {
/*OLD char line [1024]; /*OLD char line [1024];
smprintf( line, 1024, "##%"NL_I64"d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0), smprintf( line, 1024, "##%" NL_I64 "d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
srchost, msgnum, _ProcessName.c_str(), desthost ); srchost, msgnum, _ProcessName.c_str(), desthost );
displayRawNL( line ); displayRawNL( line );
*/ */
/* displayRawNL( "##%"NL_I64"d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0), /* displayRawNL( "##%" NL_I64 "d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
srchost, msgnum, _ProcessName.c_str(), desthost ); srchost, msgnum, _ProcessName.c_str(), desthost );
*/ */
displayRawNL( "##0#%s#%hu#%s#%s#", displayRawNL( "##0#%s#%hu#%s#%s#",

View file

@ -251,7 +251,7 @@ void uncbServiceIdentification(CMessage &msgin, TSockId from, CCallbackNetBase &
TServiceId inSid; TServiceId inSid;
if (from->appId () != AppIdDeadConnection) if (from->appId () != AppIdDeadConnection)
AUTOCHECK_DISPLAY ("HNETL5: received a connect ident from an unknown connection 0x%"NL_I64"X", from->appId ()); AUTOCHECK_DISPLAY ("HNETL5: received a connect ident from an unknown connection 0x%" NL_I64 "X", from->appId ());
// recover the service name and id // recover the service name and id
msgin.serial(inSName); msgin.serial(inSName);
@ -362,7 +362,7 @@ void uncbMsgProcessing(CMessage &msgin, TSockId from, CCallbackNetBase &/* netba
if (uc == 0) if (uc == 0)
{ {
nlwarning ("HNETL5: Received a message from a service %hu that is not ready (bad appid? 0x%"NL_I64"X)", sid.get(), from->appId ()); nlwarning ("HNETL5: Received a message from a service %hu that is not ready (bad appid? 0x%" NL_I64 "X)", sid.get(), from->appId ());
return; return;
} }
if((*itcb).second == 0) if((*itcb).second == 0)
@ -1139,7 +1139,7 @@ void CUnifiedNetwork::update(TTime timeout)
if ( remainingTime > prevRemainingTime ) if ( remainingTime > prevRemainingTime )
{ {
// Restart at previousTime // Restart at previousTime
nldebug( "Backward time sync detected (at least -%"NL_I64"d ms)", remainingTime - prevRemainingTime ); nldebug( "Backward time sync detected (at least -%" NL_I64 "d ms)", remainingTime - prevRemainingTime );
remainingTime = prevRemainingTime; remainingTime = prevRemainingTime;
t0 = currentTime - (timeout - remainingTime); t0 = currentTime - (timeout - remainingTime);
} }
@ -1935,7 +1935,7 @@ void CUnifiedNetwork::autoCheck()
for (j = 0; j < _IdCnx[i].Connections.size (); j++) for (j = 0; j < _IdCnx[i].Connections.size (); j++)
{ {
if (_IdCnx[i].Connections[j].valid() && !_IdCnx[i].Connections[j].IsServerConnection && _IdCnx[i].Connections[j].CbNetBase->connected () && _IdCnx[i].Connections[j].getAppId() != i) AUTOCHECK_DISPLAY ("HLNET5: sid %d bad appid %"NL_I64"X", i, _IdCnx[i].Connections[j].getAppId()); if (_IdCnx[i].Connections[j].valid() && !_IdCnx[i].Connections[j].IsServerConnection && _IdCnx[i].Connections[j].CbNetBase->connected () && _IdCnx[i].Connections[j].getAppId() != i) AUTOCHECK_DISPLAY ("HLNET5: sid %d bad appid %" NL_I64 "X", i, _IdCnx[i].Connections[j].getAppId());
} }
for (j = 0; j < _IdCnx[i].NetworkConnectionAssociations.size (); j++) for (j = 0; j < _IdCnx[i].NetworkConnectionAssociations.size (); j++)

View file

@ -44,11 +44,11 @@ void _CUniTime::setUniTime (NLMISC::TTime /* uTime */, NLMISC::TTime /* lTime */
TTime lt = getLocalTime (); TTime lt = getLocalTime ();
TTime delta = uTime - lTime + _SyncLocalTime - _SyncUniTime; TTime delta = uTime - lTime + _SyncLocalTime - _SyncUniTime;
nlinfo ("_CUniTime::setUniTime(%"NL_I64"d, %"NL_I64"d): Resyncing delta %"NL_I64"dms",uTime,lTime,delta); nlinfo ("_CUniTime::setUniTime(%" NL_I64 "d, %" NL_I64 "d): Resyncing delta %" NL_I64 "dms",uTime,lTime,delta);
} }
else else
{ {
nlinfo ("_CUniTime::setUniTime(%"NL_I64"d, %"NL_I64"d)",uTime,lTime); nlinfo ("_CUniTime::setUniTime(%" NL_I64 "d, %" NL_I64 "d)",uTime,lTime);
Sync = true; Sync = true;
} }
_SyncUniTime = uTime; _SyncUniTime = uTime;
@ -191,7 +191,7 @@ void _CUniTime::syncUniTimeFromService (CCallbackNetBase::TRecordingState /* rec
after = CTime::getLocalTime (); after = CTime::getLocalTime ();
delta = after - before; delta = after - before;
nlinfo ("_CUniTime::syncUniTimeFromService(): ping:%"NL_I64"dms, time:%ds, unitime:%"NL_I64"dms", delta, GetUniversalTimeSecondsSince1970, GetUniversalTimeUniTime); nlinfo ("_CUniTime::syncUniTimeFromService(): ping:%" NL_I64 "dms, time:%ds, unitime:%" NL_I64 "dms", delta, GetUniversalTimeSecondsSince1970, GetUniversalTimeUniTime);
// <-- from here to the "-->" comment, the block must be executed in less than one second or an infinite loop occurs // <-- from here to the "-->" comment, the block must be executed in less than one second or an infinite loop occurs
@ -222,11 +222,11 @@ void _CUniTime::syncUniTimeFromService (CCallbackNetBase::TRecordingState /* rec
// adjust the unitime to the current localtime // adjust the unitime to the current localtime
GetUniversalTimeUniTime += deltaAdjust; GetUniversalTimeUniTime += deltaAdjust;
nlinfo ("_CUniTime::syncUniTimeFromService(): rtime:%ds, runitime:%"NL_I64"ds, rlocaltime:%"NL_I64"d, deltaAjust:%"NL_I64"dms", nextsecond, GetUniversalTimeUniTime, lt, deltaAdjust); nlinfo ("_CUniTime::syncUniTimeFromService(): rtime:%ds, runitime:%" NL_I64 "ds, rlocaltime:%" NL_I64 "d, deltaAjust:%" NL_I64 "dms", nextsecond, GetUniversalTimeUniTime, lt, deltaAdjust);
} }
else else
{ {
nlinfo ("_CUniTime::syncUniTimeFromService(): runitime:%"NL_I64"ds, rlocaltime:%"NL_I64"d", GetUniversalTimeUniTime, lt); nlinfo ("_CUniTime::syncUniTimeFromService(): runitime:%" NL_I64 "ds, rlocaltime:%" NL_I64 "d", GetUniversalTimeUniTime, lt);
} }
_CUniTime::setUniTime (GetUniversalTimeUniTime, lt); _CUniTime::setUniTime (GetUniversalTimeUniTime, lt);
@ -256,7 +256,7 @@ static void cbServerAskUniversalTime (CMessage& /* msgin */, TSockId from, CCall
TTime ut = _CUniTime::getUniTime (); TTime ut = _CUniTime::getUniTime ();
// afficher l adresse de celui qui demande // afficher l adresse de celui qui demande
nlinfo("UT: Send the universal time %"NL_I64"d to '%s'", ut, netbase.hostAddress(from).asString().c_str()); nlinfo("UT: Send the universal time %" NL_I64 "d to '%s'", ut, netbase.hostAddress(from).asString().c_str());
CMessage msgout ("GUT"); CMessage msgout ("GUT");
msgout.serial (ut); msgout.serial (ut);
@ -359,7 +359,7 @@ void _CUniTime::syncUniTimeFromServer (CCallbackClient * /* client */)
attempt++; attempt++;
} }
client->disconnect (); client->disconnect ();
nlinfo ("Universal time is %"NL_I64"dms with a mean error of %"NL_I64"dms", _CUniTime::getUniTime(), bestdelta/2); nlinfo ("Universal time is %" NL_I64 "dms with a mean error of %" NL_I64 "dms", _CUniTime::getUniTime(), bestdelta/2);
return; return;
error: error:
nlwarning ("there's no connection or lost or can't synchronize universal time"); nlwarning ("there's no connection or lost or can't synchronize universal time");
@ -377,12 +377,12 @@ NLMISC_CATEGORISED_COMMAND(nel, time, "displays the universal time", "")
if ( _CUniTime::Sync ) if ( _CUniTime::Sync )
{ {
log.displayNL ("CTime::getLocalTime(): %"NL_I64"dms, _CUniTime::getUniTime(): %"NL_I64"dms", CTime::getLocalTime (), _CUniTime::getUniTime ()); log.displayNL ("CTime::getLocalTime(): %" NL_I64 "dms, _CUniTime::getUniTime(): %" NL_I64 "dms", CTime::getLocalTime (), _CUniTime::getUniTime ());
log.displayNL ("_CUniTime::getStringUniTime(): '%s'", _CUniTime::getStringUniTime()); log.displayNL ("_CUniTime::getStringUniTime(): '%s'", _CUniTime::getStringUniTime());
} }
else else
{ {
log.displayNL ("CTime::getLocalTime(): %"NL_I64"dms <Universal time not sync>", CTime::getLocalTime ()); log.displayNL ("CTime::getLocalTime(): %" NL_I64 "dms <Universal time not sync>", CTime::getLocalTime ());
} }
return true; return true;

View file

@ -174,9 +174,9 @@ CRational64 CEdgeCollide::testPointMove(const CVector2f &start, const CVector2f
*/ */
/* /*
if (numerator != numeratorInt) if (numerator != numeratorInt)
nlwarning("numerator(%f) != numeratorInt(%"NL_I64"d)", numerator, numeratorInt); nlwarning("numerator(%f) != numeratorInt(%" NL_I64 "d)", numerator, numeratorInt);
if (denominator != denominatorInt) if (denominator != denominatorInt)
nlwarning("denominator(%f) != denominatorInt(%"NL_I64"d)", denominator, denominatorInt); nlwarning("denominator(%f) != denominatorInt(%" NL_I64 "d)", denominator, denominatorInt);
*/ */
return CRational64(numeratorInt, denominatorInt); return CRational64(numeratorInt, denominatorInt);
} }