X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fovsdb-data.c;h=8631016ff8c2fe93590b57f7ac81d00f0c062c31;hb=8fb56e55f65c207ef4034cef123a9eea4aeb974b;hp=b89aa57a6fd742055568ff2ed270f9aa87dfc298;hpb=1bc6ff291822a37ac95659f347e8edba125cd09c;p=openvswitch diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c index b89aa57a..8631016f 100644 --- a/lib/ovsdb-data.c +++ b/lib/ovsdb-data.c @@ -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: @@ -808,7 +813,10 @@ ovsdb_datum_to_json(const struct ovsdb_datum *datum, static const char * skip_spaces(const char *p) { - return p + strspn(p, " "); + while (isspace((unsigned char) *p)) { + p++; + } + return p; } static char * @@ -835,8 +843,10 @@ parse_key_value(const char **s, const struct ovsdb_type *type, error = parse_atom_token(s, type->key_type, key); if (!error && type->value_type != OVSDB_TYPE_VOID) { + *s = skip_spaces(*s); if (**s == '=') { (*s)++; + *s = skip_spaces(*s); error = parse_atom_token(s, type->value_type, value); } else { error = xasprintf("%s: syntax error at \"%c\" expecting \"=\"",