Skip to content

Commit a33caaa

Browse files
authored
Merge pull request wolfpld#36 from graydon/warning-fixes
Warning fixes
2 parents c529368 + 28a29d0 commit a33caaa

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎client/TracyProfiler.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ struct ThreadHandleWrapper
173173
#if defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64
174174
static inline void CpuId( uint32_t* regs, uint32_t leaf )
175175
{
176+
memset(regs, 0, sizeof(uint32_t) * 4);
176177
#if defined _WIN32 || defined __CYGWIN__
177178
__cpuidex( (int*)regs, leaf, 0 );
178179
#else

‎client/TracySysTime.cpp‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ void SysTime::ReadTimes()
4747
FILE* f = fopen( "/proc/stat", "r" );
4848
if( f )
4949
{
50-
fscanf( f, "cpu %" PRIu64 " %" PRIu64 " %" PRIu64" %" PRIu64, &user, &nice, &system, &idle );
50+
int read = fscanf( f, "cpu %" PRIu64 " %" PRIu64 " %" PRIu64" %" PRIu64, &user, &nice, &system, &idle );
5151
fclose( f );
52-
used = user + nice + system;
52+
if (read == 4)
53+
{
54+
used = user + nice + system;
55+
}
5356
}
5457
}
5558

0 commit comments

Comments
 (0)