diff --git a/CCPAssert.cpp b/CCPAssert.cpp index 20f9d71..33f4282 100644 --- a/CCPAssert.cpp +++ b/CCPAssert.cpp @@ -52,7 +52,7 @@ class CCPAssertDialogThread return m_result; } - static unsigned long __stdcall MessageBoxThreadProc( void* p ) + static uint32_t __stdcall MessageBoxThreadProc( void* p ) { CCPAssertDialogThread* pThis = static_cast( p ); diff --git a/CCPLog.cpp b/CCPLog.cpp index 9de4096..9f62d45 100644 --- a/CCPLog.cpp +++ b/CCPLog.cpp @@ -127,7 +127,7 @@ bool IsLogging( LogType threshold ) static CcpLogChannel_t s_logObject = { 1, "carbon-core", "Main", 0 }; -void LogToDebugger( CcpLogChannel_t& logObject, LogType type, unsigned long userData, const char* message ) +void LogToDebugger( CcpLogChannel_t& logObject, LogType type, uint32_t userData, const char* message ) { #if defined( _WIN32 ) static const char* s_logType2string[ CCP::LOGTYPE_COUNT ] = { "[I] ", "[N] ", "[W] ", "[E] " }; @@ -142,7 +142,7 @@ void LogToDebugger( CcpLogChannel_t& logObject, LogType type, unsigned long user #endif } -CARBON_CORE_API void LogFuncChannel( CcpLogChannel_t& logObject, LogType type, unsigned long userData, CCPLOG_PRINTF_FORMAT const char* format, ... ) +CARBON_CORE_API void LogFuncChannel( CcpLogChannel_t& logObject, LogType type, uint32_t userData, CCPLOG_PRINTF_FORMAT const char* format, ... ) { va_list args; va_start( args, format ); @@ -151,7 +151,7 @@ CARBON_CORE_API void LogFuncChannel( CcpLogChannel_t& logObject, LogType type, u } -void LogFuncChannelRaw( CcpLogChannel_t& logObject, LogType type, unsigned long userData, const char* text ) +void LogFuncChannelRaw( CcpLogChannel_t& logObject, LogType type, uint32_t userData, const char* text ) { LogEchoList& callbacks = GetLogEchos( type ); @@ -187,7 +187,7 @@ void LogFuncChannelRaw( CcpLogChannel_t& logObject, LogType type, unsigned long } } -CARBON_CORE_API void LogFuncChannel_v( CcpLogChannel_t& logObject, LogType type, unsigned long userData, const char* format, va_list args ) +CARBON_CORE_API void LogFuncChannel_v( CcpLogChannel_t& logObject, LogType type, uint32_t userData, const char* format, va_list args ) { if( !format ) { @@ -240,7 +240,7 @@ CARBON_CORE_API void LogFuncChannel_v( CcpLogChannel_t& logObject, LogType type, #endif } -void LogFunc( LogType type, unsigned long userData, CCPLOG_PRINTF_FORMAT const char* format, ... ) +void LogFunc( LogType type, uint32_t userData, CCPLOG_PRINTF_FORMAT const char* format, ... ) { va_list args; va_start( args, format ); @@ -248,7 +248,7 @@ void LogFunc( LogType type, unsigned long userData, CCPLOG_PRINTF_FORMAT const c va_end( args ); } -void LogFunc_v( LogType type, unsigned long userData, const char* format, va_list args ) +void LogFunc_v( LogType type, uint32_t userData, const char* format, va_list args ) { LogFuncChannel_v( s_logObject, type, userData, format, args ); } diff --git a/CcpTime.cpp b/CcpTime.cpp index b9dd159..5ed7d99 100644 --- a/CcpTime.cpp +++ b/CcpTime.cpp @@ -206,13 +206,13 @@ CcpTime TimeNow() -long TimeInMs( CcpTime time ) +int32_t TimeInMs( CcpTime time ) { time /= 10000; CCP_ASSERT( time <= LONG_MAX ); - return (long)time; + return (int32_t)time; } @@ -262,7 +262,7 @@ CcpTime TimeFromDouble( double time ) return t; } -CcpTime TimeFromMS( long time ) +CcpTime TimeFromMS( int32_t time ) { CcpTime t = ( CcpTime )( time * 10000 ); return t; diff --git a/include/CCPLog.h b/include/CCPLog.h index 0727cee..24558d5 100644 --- a/include/CCPLog.h +++ b/include/CCPLog.h @@ -32,11 +32,11 @@ extern const char* g_moduleName; typedef short TLOGCHANNELID; -typedef long TLOGSOURCEID; +typedef int32_t TLOGSOURCEID; struct CcpLogChannel_t { - long oktocall; + int32_t oktocall; const char *facility; const char *object; TLOGCHANNELID channel; // index into channel buffer @@ -73,12 +73,12 @@ enum LogType CARBON_CORE_API uint32_t& GetLogCounter( CCP::LogType type ); // Logs to a default channel -CARBON_CORE_API void LogFunc( LogType type, unsigned long userData, CCPLOG_PRINTF_FORMAT const char* format, ... ) CCPLOG_PRINTF_FORMAT_ATTR( 3, 4 ); -CARBON_CORE_API void LogFunc_v( LogType type, unsigned long userData, const char* format, va_list args ); +CARBON_CORE_API void LogFunc( LogType type, uint32_t userData, CCPLOG_PRINTF_FORMAT const char* format, ... ) CCPLOG_PRINTF_FORMAT_ATTR( 3, 4 ); +CARBON_CORE_API void LogFunc_v( LogType type, uint32_t userData, const char* format, va_list args ); // Logs to the given channel -CARBON_CORE_API void LogFuncChannel( CcpLogChannel_t& logObject, LogType type, unsigned long userData, CCPLOG_PRINTF_FORMAT const char* format, ... ) CCPLOG_PRINTF_FORMAT_ATTR( 4, 5 ); -CARBON_CORE_API void LogFuncChannel_v( CcpLogChannel_t& logObject, LogType type, unsigned long userData, const char* format, va_list args ); +CARBON_CORE_API void LogFuncChannel( CcpLogChannel_t& logObject, LogType type, uint32_t userData, CCPLOG_PRINTF_FORMAT const char* format, ... ) CCPLOG_PRINTF_FORMAT_ATTR( 4, 5 ); +CARBON_CORE_API void LogFuncChannel_v( CcpLogChannel_t& logObject, LogType type, uint32_t userData, const char* format, va_list args ); // Only logs from the same thread as this are allowed through, unless // the log functions is tagged as thread safe. @@ -200,7 +200,7 @@ inline void ThrowLastError() throw std::runtime_error( GetLastErrorMessage() ); } -typedef void (*LogEchoFunc)( CcpLogChannel_t& channel, LogType type, unsigned long userData, const char* message ); +typedef void (*LogEchoFunc)( CcpLogChannel_t& channel, LogType type, uint32_t userData, const char* message ); // Register a log echo function. Future logging requests will be passed to this function. Note that // multiple log echo functions can be registered - this adds the function to a list, rather than replacing @@ -217,7 +217,7 @@ CARBON_CORE_API void UnregisterLogEcho( LogEchoFunc cb ); CARBON_CORE_API bool IsLogging( LogType threshold = LOGTYPE_INFO ); // Let's offer a standard callback (for convenience) that can be registered: -CARBON_CORE_API void LogToDebugger( CcpLogChannel_t& logObject, LogType type, unsigned long userData, const char* message ); +CARBON_CORE_API void LogToDebugger( CcpLogChannel_t& logObject, LogType type, uint32_t userData, const char* message ); // Sets info type logs to be privileged and returns the previous value CARBON_CORE_API bool SetLogtypeInfoIsPrivileged(bool privileged); diff --git a/include/CcpTime.h b/include/CcpTime.h index d83811f..0c32760 100644 --- a/include/CcpTime.h +++ b/include/CcpTime.h @@ -35,12 +35,12 @@ struct CcpDateTime }; -CARBON_CORE_API long TimeInMs( CcpTime time ); +CARBON_CORE_API int32_t TimeInMs( CcpTime time ); CARBON_CORE_API double TimeAsDouble( CcpTime time ); CARBON_CORE_API float TimeAsFloat( CcpTime time ); CARBON_CORE_API bool TimeIsUTC( CcpTime time ); CARBON_CORE_API CcpTime TimeFromDouble( double time ); -CARBON_CORE_API CcpTime TimeFromMS( long time ); +CARBON_CORE_API CcpTime TimeFromMS( int32_t time ); CARBON_CORE_API bool TimeAsDateTime( CcpDateTime& dateTime, CcpTime time ); CARBON_CORE_API bool TimeFromDateTime( CcpTime& timeStamp, const CcpDateTime& dateTime ); diff --git a/tests/CCPLog.cpp b/tests/CCPLog.cpp index 4fbfd67..becf9eb 100644 --- a/tests/CCPLog.cpp +++ b/tests/CCPLog.cpp @@ -8,14 +8,14 @@ struct LogEntry { CCP::LogType type; - unsigned long userData; + uint32_t userData; char message[1024]; }; std::stack logstack; -void LogTracker( CcpLogChannel_t& logObject, CCP::LogType type, unsigned long userData, const char* message ) +void LogTracker( CcpLogChannel_t& logObject, CCP::LogType type, uint32_t userData, const char* message ) { LogEntry entry; strncpy(entry.message, message, std::extent_v); diff --git a/tests/CcpMemory.cpp b/tests/CcpMemory.cpp index 183e43b..fc2a375 100644 --- a/tests/CcpMemory.cpp +++ b/tests/CcpMemory.cpp @@ -65,7 +65,7 @@ void TestAlignedRealloc() std::vector> s_logMessages; -void LogCallback( CcpLogChannel_t& channel, CCP::LogType type, unsigned long userData, const char* message ) +void LogCallback( CcpLogChannel_t& channel, CCP::LogType type, uint32_t userData, const char* message ) { s_logMessages.push_back( std::make_pair( type, std::string( message ) ) ); }