ovsdb-data: Make string parsing of negative 0 match JSON parsing.
authorBen Pfaff <blp@nicira.com>
Wed, 27 Jan 2010 23:38:29 +0000 (15:38 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 28 Jan 2010 22:22:39 +0000 (14:22 -0800)
lib/ovsdb-data.c

index b89aa57a6fd742055568ff2ed270f9aa87dfc298..70e290b0889bf268713511f3952248e700c834ce 100644 (file)
@@ -396,6 +396,11 @@ ovsdb_atom_from_string(union ovsdb_atom *atom, enum ovsdb_atomic_type type,
         if (!str_to_double(s, &atom->real)) {
             return xasprintf("\"%s\" is not a valid real number", s);
         }
+        /* Our JSON input routines map negative zero to zero, so do that here
+         * too for consistency. */
+        if (atom->real == 0.0) {
+            atom->real = 0.0;
+        }
         break;
 
     case OVSDB_TYPE_BOOLEAN: