From a6d214f0055dc773750295a5db7cc5ca14bc5ce7 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Tue, 13 Sep 2011 13:15:48 -0700 Subject: [PATCH] lib: Suppress comparison warnings in ovsdb libraries. This patch fixes compiler warnings like the following: ./lib/ovsdb-types.h:171:5: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits] --- lib/ovsdb-parser.c | 2 +- lib/ovsdb-types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ovsdb-parser.c b/lib/ovsdb-parser.c index e1832a99..c46c237e 100644 --- a/lib/ovsdb-parser.c +++ b/lib/ovsdb-parser.c @@ -80,7 +80,7 @@ ovsdb_parser_member(struct ovsdb_parser *parser, const char *name, return NULL; } - if ((value->type >= 0 && value->type < JSON_N_TYPES + if (((int) value->type >= 0 && value->type < JSON_N_TYPES && types & (1u << value->type)) || (types & OP_ID && value->type == JSON_STRING && ovsdb_parser_is_id(value->u.string))) diff --git a/lib/ovsdb-types.h b/lib/ovsdb-types.h index e852391c..a7b4e208 100644 --- a/lib/ovsdb-types.h +++ b/lib/ovsdb-types.h @@ -168,7 +168,7 @@ struct json *ovsdb_type_to_json(const struct ovsdb_type *); static inline bool ovsdb_atomic_type_is_valid(enum ovsdb_atomic_type atomic_type) { - return atomic_type >= 0 && atomic_type < OVSDB_N_TYPES; + return (int) atomic_type >= 0 && atomic_type < OVSDB_N_TYPES; } static inline bool -- 2.30.2