Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CCPAssert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CCPAssertDialogThread*>( p );

Expand Down
12 changes: 6 additions & 6 deletions CCPLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] " };
Expand All @@ -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 );
Expand All @@ -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 );

Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -240,15 +240,15 @@ 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 );
LogFunc_v( type, userData, format, args );
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 );
}
Expand Down
6 changes: 3 additions & 3 deletions CcpTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions include/CCPLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions include/CcpTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions tests/CCPLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
struct LogEntry
{
CCP::LogType type;
unsigned long userData;
uint32_t userData;
char message[1024];
};

std::stack<LogEntry> 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<decltype(entry.message)>);
Expand Down
2 changes: 1 addition & 1 deletion tests/CcpMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void TestAlignedRealloc()

std::vector<std::pair<CCP::LogType, std::string>> 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 ) ) );
}
Expand Down