diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 1f41d35a..bf26292f 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -124,6 +124,7 @@ static int64_t SetupHwTimer() static const char* GetProcessName() { + const char* processName = "unknown"; #if defined _MSC_VER static char buf[_MAX_PATH]; GetModuleFileNameA( nullptr, buf, _MAX_PATH ); @@ -131,17 +132,16 @@ static const char* GetProcessName() while( *ptr != '\0' ) ptr++; while( ptr > buf && *ptr != '\\' && *ptr != '/' ) ptr--; if( ptr > buf ) ptr++; - return ptr; + processName = ptr; #elif defined __ANDROID__ # if __ANDROID_API__ >= 21 auto buf = getprogname(); - if( buf ) return buf; + if( buf ) processName = buf; # endif #elif defined _GNU_SOURCE || defined __CYGWIN__ - return program_invocation_short_name; -#else - return "unknown"; + processName = program_invocation_short_name; #endif + return processName; } enum { QueuePrealloc = 256 * 1024 }; diff --git a/common/TracySocket.cpp b/common/TracySocket.cpp index bb958358..ed14ac08 100644 --- a/common/TracySocket.cpp +++ b/common/TracySocket.cpp @@ -25,6 +25,12 @@ namespace tracy { +#ifdef _MSC_VER +typedef SOCKET socket_t; +#else +typedef int socket_t; +#endif + #ifdef _MSC_VER struct __wsinit { @@ -174,7 +180,7 @@ int Socket::Recv( void* _buf, int len, const timeval* tv ) fd_set fds; FD_ZERO( &fds ); - FD_SET( static_cast(m_sock), &fds ); + FD_SET( static_cast(m_sock), &fds ); #ifndef _WIN32 timeval _tv = *tv; @@ -231,7 +237,7 @@ bool Socket::HasData() fd_set fds; FD_ZERO( &fds ); - FD_SET( static_cast(m_sock), &fds ); + FD_SET( static_cast(m_sock), &fds ); return select( m_sock+1, &fds, nullptr, nullptr, &tv ) > 0; } @@ -287,7 +293,7 @@ Socket* ListenSocket::Accept() fd_set fds; FD_ZERO( &fds ); - FD_SET( static_cast(m_sock), &fds ); + FD_SET( static_cast(m_sock), &fds ); select( m_sock+1, &fds, nullptr, nullptr, &tv ); if( FD_ISSET( m_sock, &fds ) )