diff system/System.cpp @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents e802e550a1f2
children b14064bd1f97
line wrap: on
line diff
--- a/system/System.cpp	Tue Mar 03 09:33:59 2015 +0000
+++ b/system/System.cpp	Tue Mar 03 15:18:24 2015 +0000
@@ -123,7 +123,7 @@
 #endif
 
 void
-GetRealMemoryMBAvailable(int &available, int &total)
+GetRealMemoryMBAvailable(ssize_t &available, ssize_t &total)
 {
     available = -1;
     total = -1;
@@ -175,11 +175,11 @@
 
     DWORDLONG size = wavail / 1048576;
     if (size > INT_MAX) size = INT_MAX;
-    available = int(size);
+    available = ssize_t(size);
 
     size = wtotal / 1048576;
     if (size > INT_MAX) size = INT_MAX;
-    total = int(size);
+    total = ssize_t(size);
 
     return;
 
@@ -243,7 +243,7 @@
 #endif
 }
 
-int
+ssize_t
 GetDiscSpaceMBAvailable(const char *path)
 {
 #ifdef _WIN32
@@ -252,7 +252,7 @@
 	  __int64 a = available.QuadPart;
         a /= 1048576;
         if (a > INT_MAX) a = INT_MAX;
-        return int(a);
+        return ssize_t(a);
     } else {
         cerr << "WARNING: GetDiskFreeSpaceEx failed: error code "
                   << GetLastError() << endl;
@@ -266,7 +266,7 @@
 //        cerr << "statvfs(" << path << ") says available: " << buf.f_bavail << ", block size: " << buf.f_bsize << endl;
         uint64_t available = ((buf.f_bavail / 1024) * buf.f_bsize) / 1024;
         if (available > INT_MAX) available = INT_MAX;
-        return int(available);
+        return ssize_t(available);
     } else {
         perror("statvfs failed");
         return -1;