Fix float/double crash on Firefox with max values.

1) Fix debug printing code from %f (which can overflow a buffer) to %g (which won't).
2) Compile out more debugging code anyway to avoid calling Value.toString() at all.

Review by: jat (desk)

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7205 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/common/Value.h b/common/Value.h
index 4401893..bcea639 100644
--- a/common/Value.h
+++ b/common/Value.h
@@ -301,7 +301,7 @@
   }
 
   std::string toString() const {
-    char buf[30];
+    char buf[64];
     switch (type) {
       case NULL_TYPE:
         return "null";
@@ -326,10 +326,10 @@
             static_cast<long long>(getLong()));
         return std::string(buf);
       case FLOAT:
-        snprintf(buf, sizeof(buf), "float(%f)", getFloat());
+        snprintf(buf, sizeof(buf), "float(%g)", getFloat());
         return std::string(buf);
       case DOUBLE:
-        snprintf(buf, sizeof(buf), "double(%lf)", getDouble());
+        snprintf(buf, sizeof(buf), "double(%g)", getDouble());
         return std::string(buf);
       case STRING:
         snprintf(buf, sizeof(buf), "string(%.20s)", getString().c_str());
@@ -381,7 +381,10 @@
 };
 
 inline Debug::DebugStream& operator<<(Debug::DebugStream& dbg, const Value& val) {
-  return dbg << val.toString();
+  if (dbg.isActive()) {
+    dbg << val.toString();
+  }
+  return dbg;
 }
 
 #endif