Navigation Menu

Skip to content

Commit

Permalink
clang: suppress warnings
Browse files Browse the repository at this point in the history
Use uint32_t for object type. It should be uint8_t but GRN_B_DEC()
requires uint32_t for result space. So I use uint32_t instead of
uint8_t.

    lib/expr.c:440:18: warning: comparison of
          constant 32 with expression of type 'grn_expr_pack_type' is always false
          [-Wtautological-constant-out-of-range-compare]
        if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) { /* error */ }
            ~~~~~~~~ ^  ~~~~
    lib/expr.c:440:34: warning: comparison of
          constant 72 with expression of type 'grn_expr_pack_type' is always true
          [-Wtautological-constant-out-of-range-compare]
        if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) { /* error */ }
                                ~~~~ ^  ~~~~~~~~~~~~~~~~
    lib/expr.c:467:20: warning: comparison of
          constant 32 with expression of type 'grn_expr_pack_type' is always false
          [-Wtautological-constant-out-of-range-compare]
          if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) {
              ~~~~~~~~ ^  ~~~~
    lib/expr.c:467:36: warning: comparison of
          constant 72 with expression of type 'grn_expr_pack_type' is always true
          [-Wtautological-constant-out-of-range-compare]
          if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) {
                                  ~~~~ ^  ~~~~~~~~~~~~~~~~
  • Loading branch information
kou committed Jun 11, 2013
1 parent 4ab718b commit 4635438
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/expr.c
Expand Up @@ -433,12 +433,13 @@ grn_expr_unpack(grn_ctx *ctx, const uint8_t *p, const uint8_t *pe, grn_obj *expr
grn_expr *e = (grn_expr *)expr;
GRN_B_DEC(n, p);
for (i = 0; i < n; i++) {
uint32_t object_type;
GRN_B_DEC(ns, p);
v = grn_expr_add_var(ctx, expr, ns ? (const char *)p : NULL, ns);
p += ns;
GRN_B_DEC(type, p);
if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) { /* error */ }
p = grn_obj_unpack(ctx, p, pe, type, 0, v);
GRN_B_DEC(object_type, p);
if (GRN_TYPE <= object_type && object_type <= GRN_COLUMN_INDEX) { /* error */ }
p = grn_obj_unpack(ctx, p, pe, object_type, 0, v);
if (pe < p) {
ERR(GRN_INVALID_FORMAT, "benced image is corrupt");
return p;
Expand All @@ -463,16 +464,19 @@ grn_expr_unpack(grn_ctx *ctx, const uint8_t *p, const uint8_t *pe, grn_obj *expr
}
break;
case GRN_EXPR_PACK_TYPE_OTHERS :
GRN_B_DEC(type, p);
if (GRN_TYPE <= type && type <= GRN_COLUMN_INDEX) {
{
uint32_t object_type;
GRN_B_DEC(object_type, p);
if (GRN_TYPE <= object_type && object_type <= GRN_COLUMN_INDEX) {
grn_id id;
GRN_B_DEC(id, p);
code->value = grn_ctx_at(ctx, id);
} else {
if (!(v = const_new(ctx, e))) { return NULL; }
p = grn_obj_unpack(ctx, p, pe, type, GRN_OBJ_EXPRCONST, v);
p = grn_obj_unpack(ctx, p, pe, object_type, GRN_OBJ_EXPRCONST, v);
code->value = v;
}
}
break;
}
if (pe < p) {
Expand Down

0 comments on commit 4635438

Please sign in to comment.