From 3297ed820e2127e96e53b84277e8012caa6114ed Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Tue, 2 Jul 2013 23:34:00 +0100 Subject: [PATCH] Resolve some MS compiler warnings (in picky mode) warning C4267: 'argument' : conversion from 'size_t' to 'DWORD', possible loss of data warning C4244: 'return' : conversion from 'double' to 'int', possible loss of data --- common/os_win32.cpp | 4 ++-- common/trace_file_snappy.cpp | 2 +- common/trace_profiler.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/os_win32.cpp b/common/os_win32.cpp index c5be8a8..bd4b06d 100644 --- a/common/os_win32.cpp +++ b/common/os_win32.cpp @@ -42,7 +42,7 @@ String getProcessName(void) { String path; - size_t size = MAX_PATH; + DWORD size = MAX_PATH; char *buf = path.buf(size); DWORD nWritten = GetModuleFileNameA(NULL, buf, size); @@ -57,7 +57,7 @@ String getCurrentDir(void) { String path; - size_t size = MAX_PATH; + DWORD size = MAX_PATH; char *buf = path.buf(size); DWORD ret = GetCurrentDirectoryA(size, buf); diff --git a/common/trace_file_snappy.cpp b/common/trace_file_snappy.cpp index f47c89b..68673c6 100644 --- a/common/trace_file_snappy.cpp +++ b/common/trace_file_snappy.cpp @@ -397,7 +397,7 @@ bool SnappyFile::rawSkip(size_t length) int SnappyFile::rawPercentRead() { - return 100 * (double(m_stream.tellg()) / double(m_endPos)); + return int(100 * (double(m_stream.tellg()) / double(m_endPos))); } diff --git a/common/trace_profiler.cpp b/common/trace_profiler.cpp index 14edd35..e9ed707 100644 --- a/common/trace_profiler.cpp +++ b/common/trace_profiler.cpp @@ -228,7 +228,7 @@ void Profiler::parseLine(const char* in, Profile* profile) program.pixelTotal += call.pixels; program.vsizeTotal += call.vsizeDuration; program.rssTotal += call.rssDuration; - program.calls.push_back(profile->calls.size() - 1); + program.calls.push_back((unsigned int)(profile->calls.size() - 1)); } } else if (type.compare("frame_end") == 0) { Profile::Frame frame; @@ -252,7 +252,7 @@ void Profiler::parseLine(const char* in, Profile* profile) frame.cpuDuration = lastCpuTime - frame.cpuStart; frame.vsizeDuration = lastVsizeUsage - frame.vsizeStart; frame.rssDuration = lastRssUsage - frame.rssStart; - frame.calls.end = profile->calls.size() - 1; + frame.calls.end = (unsigned int)(profile->calls.size() - 1); profile->frames.push_back(frame); } -- 2.43.0