]> git.cworth.org Git - apitrace/commitdiff
Resolve some MS compiler warnings (in picky mode)
authorNigel Stewart <nigels@users.sourceforge.net>
Tue, 2 Jul 2013 22:34:00 +0000 (23:34 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 2 Jul 2013 22:34:41 +0000 (23:34 +0100)
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
common/trace_file_snappy.cpp
common/trace_profiler.cpp

index c5be8a88efb190f904d2af4fd098e77cbfab1093..bd4b06d46c919d94f2f0e2d24002564db2c9c011 100644 (file)
@@ -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);
index f47c89b046c37fe282478a9ca6a014bb108df553..68673c6324ef5e28a9f0b79cf0f4e54f53bdcb63 100644 (file)
@@ -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)));
 }
 
 
index 14edd35477aaac782a9e437a08b0030ccaa58dd3..e9ed707e8ac3c91b3f4a629a1025022a731dd217 100644 (file)
@@ -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);
     }