CmiReadSize now returns value in double type
authorGengbin Zheng <gzheng@illinois.edu>
Thu, 23 Feb 2012 23:03:24 +0000 (17:03 -0600)
committerGengbin Zheng <gzheng@illinois.edu>
Thu, 23 Feb 2012 23:03:24 +0000 (17:03 -0600)
src/conv-core/convcore.c
src/conv-core/converse.h

index 77b620de213aa3d031addb949522a6bf55e9f447..c8b8603664ca288e40ca2f7857b5d6927be7bf82 100644 (file)
@@ -3766,23 +3766,25 @@ int CmiMyRank_()
   return CmiMyRank();
 }
 
-CmiInt8 CmiReadSize(char *str)
+double CmiReadSize(const char *str)
 {
-    CmiInt8 val;
-    if (strpbrk(str,"G")) {
-        sscanf(str, "%lldG", &val);
+    double val;
+    if (strpbrk(str,"Gg")) {
+        //sscanf(str, "%llf", &val);
+        //val = strtod(str, &p);
+        val = atof(str);
         val *= 1024ll*1024*1024;
     }
-    else if (strpbrk(str,"M")) {
-        sscanf(str, "%lldM", &val);
+    else if (strpbrk(str,"Mm")) {
+        val = atof(str);
         val *= 1024*1024;
     }
-    else if (strpbrk(str,"K")) {
-        sscanf(str, "%lldK", &val);
+    else if (strpbrk(str,"Kk")) {
+        val = atof(str);
         val *= 1024;
     }
     else {
-        sscanf(str, "%lld", &val);
+        val = atof(str);
     }
     return val;
 }
index b4b1ed4de68bf74800571f55733e7bfce5eb8334..1f812d49a0c2166e408aec0b6dbf1a7fa8b08a6a 100644 (file)
@@ -1819,7 +1819,7 @@ extern int numMemCriticalEntries;
 extern int *memCriticalEntries;
 #endif
 
-CmiInt8 CmiReadSize(char *str);
+double CmiReadSize(const char *str);
 
 #if defined(__cplusplus)
 }                                         /* end of extern "C"  */