Thu Apr 19 15:15:07 2007  Google Inc. <opensource@google.com>

	* google-gflags: version 0.4
	* Remove is_default from GetCommandLineFlagInfo (csilvers)
	* Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
	* A few doc typo cleanups (csilvers)


git-svn-id: https://gflags.googlecode.com/svn/trunk@13 6586e3c6-dcc4-952a-343f-ff74eb82781d
diff --git a/src/gflags.cc b/src/gflags.cc
index 02c6ffe..55fb6d0 100644
--- a/src/gflags.cc
+++ b/src/gflags.cc
@@ -35,6 +35,7 @@
 // stuff.
 
 #include "config.h"
+#include <stdio.h>     // for snprintf
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
@@ -53,6 +54,19 @@
 #define PATH_SEPARATOR  '/'
 #endif
 
+// Work properly if either strtoll or strtoq is on this system
+#ifdef HAVE_STRTOLL
+# define strtoint64  strtoll
+# define strtouint64  strtoull
+#elif HAVE_STRTOQ
+# define strtoint64  strtoq
+# define strtouint64  strtouq
+#else
+// Neither strtoll nor strtoq are defined.  I hope strtol works!
+# define strtoint64 strtol
+# define strtouint64 strtoul
+#endif
+
 using std::string;
 using std::map;
 using std::vector;
@@ -138,7 +152,7 @@
   else if (strcmp(type, "uint64") == 0)  type_ = FV_UINT64;
   else if (strcmp(type, "double") == 0)  type_ = FV_DOUBLE;
   else if (strcmp(type, "string") == 0)  type_ = FV_STRING;
-  else assert("" == "Unknown typename");
+  else assert(false); // Unknown typename
 }
 
 FlagValue::~FlagValue() {
@@ -185,7 +199,7 @@
 
   switch (type_) {
     case FV_INT32: {
-      const int64 r = strtoq(value, &end, base);
+      const int64 r = strtoint64(value, &end, base);
       if (errno || end != value + strlen(value))  return false;  // bad parse
       if (static_cast<int32>(r) != r)  // worked, but number out of range
         return false;
@@ -193,7 +207,7 @@
       return true;
     }
     case FV_INT64: {
-      const int64 r = strtoq(value, &end, base);
+      const int64 r = strtoint64(value, &end, base);
       if (errno || end != value + strlen(value))  return false;  // bad parse
       SET_VALUE_AS(int64, r);
       return true;
@@ -201,7 +215,7 @@
     case FV_UINT64: {
       while (*value == ' ') value++;
       if (*value == '-') return false;  // negative number
-      const uint64 r = strtouq(value, &end, base);
+      const uint64 r = strtouint64(value, &end, base);
       if (errno || end != value + strlen(value))  return false;  // bad parse
       SET_VALUE_AS(uint64, r);
       return true;
@@ -213,7 +227,7 @@
       return true;
     }
     default: {
-      assert("" == "unknown type");
+      assert(false); // unknown type
       return false;
     }
   }
@@ -239,7 +253,7 @@
     case FV_STRING:
       return VALUE_AS(string);
     default:
-      assert("" == "unknown type"); return "";
+      assert(false); return ""; // unknown type
   }
 }
 
@@ -251,7 +265,7 @@
     case FV_UINT64: return "uint64";
     case FV_DOUBLE: return "double";
     case FV_STRING: return "string";
-    default: assert("" == "unknown type"); return "";
+    default: assert(false); return ""; // unknown type
   }
 }
 
@@ -265,7 +279,7 @@
     case FV_UINT64: return VALUE_AS(uint64) == OTHER_VALUE_AS(x, uint64);
     case FV_DOUBLE: return VALUE_AS(double) == OTHER_VALUE_AS(x, double);
     case FV_STRING: return VALUE_AS(string) == OTHER_VALUE_AS(x, string);
-    default: assert("" == "unknown type"); return false;
+    default: assert(false); return false; // unknown type
   }
 }
 
@@ -277,7 +291,7 @@
     case FV_UINT64: return new FlagValue(new uint64, "uint64");
     case FV_DOUBLE: return new FlagValue(new double, "double");
     case FV_STRING: return new FlagValue(new string, "string");
-    default: assert("" == "unknown type"); return NULL;
+    default: assert(false); return NULL; // assert false
   }
 }
 
@@ -290,7 +304,7 @@
     case FV_UINT64: SET_VALUE_AS(uint64, OTHER_VALUE_AS(x, uint64));  break;
     case FV_DOUBLE: SET_VALUE_AS(double, OTHER_VALUE_AS(x, double));  break;
     case FV_STRING: SET_VALUE_AS(string, OTHER_VALUE_AS(x, string));  break;
-    default: assert("" == "unknown type");
+    default: assert(false); // unknown type
   }
 }
 
@@ -611,7 +625,8 @@
       break;
     }
     default: {
-      assert("" == "unknown set_mode"); return false;
+      // unknown set_mode
+      assert(false); return false;
     }
   }
 
@@ -1155,13 +1170,11 @@
 //    All of these work on the default, global registry.
 //       For GetCommandLineOption, return false if no such flag
 //    is known, true otherwise.  We clear "value" if a suitable
-//    flag is found.  If is_default_value is non-NULL, we set it to
-//    contain whether the value is a default or was explicitly set.
+//    flag is found.
 // --------------------------------------------------------------------
 
 
-bool GetCommandLineOption(const char* name, string* value,
-                          bool *is_default_value) {
+bool GetCommandLineOption(const char* name, string* value) {
   if (NULL == name)
     return false;
   assert(value);
@@ -1174,10 +1187,6 @@
     return false;
   } else {
     *value = flag->current_value();
-    if (is_default_value) {
-      flag->UpdateModifiedBit();
-      *is_default_value = !flag->modified_;
-    }
     registry->Unlock();
     return true;
   }