Skip to content

Commit 163be5f

Browse files
montywivuvova
authored andcommitted
Remove compiler warnings regarding signed/unsigned compare in mroonga
1 parent e42130e commit 163be5f

File tree

20 files changed

+165
-151
lines changed

20 files changed

+165
-151
lines changed

storage/mroonga/vendor/groonga/include/groonga/groonga.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ GRN_API void grn_ctx_recv_handler_set(grn_ctx *,
15401540
} while (0)
15411541

15421542
#define GRN_BULK_POP(obj, value, type, default) do {\
1543-
if (GRN_BULK_VSIZE(obj) >= sizeof(type)) {\
1543+
if ((size_t) GRN_BULK_VSIZE(obj) >= sizeof(type)) { \
15441544
GRN_BULK_INCR_LEN((obj), -(sizeof(type)));\
15451545
value = *(type *)(GRN_BULK_CURR(obj));\
15461546
} else {\

storage/mroonga/vendor/groonga/lib/expr.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ typedef struct {
529529
static grn_expr_dfi *
530530
grn_expr_dfi_pop(grn_expr *expr)
531531
{
532-
if (GRN_BULK_VSIZE(&expr->dfi) >= sizeof(grn_expr_dfi)) {
532+
if ((size_t) GRN_BULK_VSIZE(&expr->dfi) >= sizeof(grn_expr_dfi)) {
533533
grn_expr_dfi *dfi;
534534
GRN_BULK_INCR_LEN(&expr->dfi, -((ssize_t)(sizeof(grn_expr_dfi))));
535535
dfi = (grn_expr_dfi *)GRN_BULK_CURR(&expr->dfi);
@@ -1459,7 +1459,7 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
14591459
grn_proc_ctx pctx;
14601460
grn_obj *obj = NULL, **args;
14611461
grn_proc *p = (grn_proc *)proc;
1462-
if (nargs > ctx->impl->stack_curr) { return GRN_INVALID_ARGUMENT; }
1462+
if ((uint32_t) nargs > ctx->impl->stack_curr) { return GRN_INVALID_ARGUMENT; }
14631463
GRN_API_ENTER;
14641464
if (grn_obj_is_selector_only_proc(ctx, proc)) {
14651465
char name[GRN_TABLE_MAX_KEY_SIZE];
@@ -3841,7 +3841,7 @@ grn_expr_get_value(grn_ctx *ctx, grn_obj *expr, int offset)
38413841
grn_obj *res = NULL;
38423842
grn_expr *e = (grn_expr *)expr;
38433843
GRN_API_ENTER;
3844-
if (0 <= offset && offset < e->values_size) {
3844+
if (0 <= offset && (uint) offset < e->values_size) {
38453845
res = &e->values[offset];
38463846
}
38473847
GRN_API_RETURN(res);
@@ -5386,7 +5386,7 @@ grn_scan_info_build_simple_and_operations(grn_ctx *ctx,
53865386
int i;
53875387
int nth_sis;
53885388

5389-
for (i = 0, nth_sis = 0; i < e->codes_curr; i += 3, nth_sis++) {
5389+
for (i = 0, nth_sis = 0; (uint) i < e->codes_curr; i += 3, nth_sis++) {
53905390
grn_expr_code *target = e->codes + i;
53915391
grn_expr_code *constant = e->codes + i + 1;
53925392
grn_expr_code *operator = e->codes + i + 2;
@@ -5454,7 +5454,7 @@ grn_scan_info_build_simple_and_operations(grn_ctx *ctx,
54545454
return NULL;
54555455
}
54565456

5457-
for (i = 0, nth_sis = 0; i < e->codes_curr; i += 3, nth_sis++) {
5457+
for (i = 0, nth_sis = 0; (uint) i < e->codes_curr; i += 3, nth_sis++) {
54585458
grn_expr_code *target = e->codes + i;
54595459
grn_expr_code *constant = e->codes + i + 1;
54605460
grn_expr_code *operator = e->codes + i + 2;
@@ -5920,7 +5920,7 @@ grn_table_select_index_equal(grn_ctx *ctx,
59205920

59215921
if (si->position.specified) {
59225922
while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) {
5923-
if (posting->pos == si->position.start) {
5923+
if ((int) posting->pos == si->position.start) {
59245924
break;
59255925
}
59265926
}
@@ -6037,7 +6037,7 @@ grn_table_select_index_not_equal(grn_ctx *ctx,
60376037

60386038
if (si->position.specified) {
60396039
while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) {
6040-
if (posting->pos == si->position.start) {
6040+
if ((int) posting->pos == si->position.start) {
60416041
break;
60426042
}
60436043
}
@@ -6561,7 +6561,7 @@ grn_table_select_index_range_column(grn_ctx *ctx, grn_obj *table,
65616561

65626562
if (si->position.specified) {
65636563
while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) {
6564-
if (posting->pos == si->position.start) {
6564+
if ((int) posting->pos == si->position.start) {
65656565
break;
65666566
}
65676567
}
@@ -6849,7 +6849,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
68496849
grn_id min_id = GRN_ID_NIL;
68506850
v = grn_expr_get_var_by_offset(ctx, (grn_obj *)e, 0);
68516851
GRN_PTR_INIT(&res_stack, GRN_OBJ_VECTOR, GRN_ID_NIL);
6852-
for (i = 0; i < scanner->n_sis; i++) {
6852+
for (i = 0; (uint) i < scanner->n_sis; i++) {
68536853
scan_info *si = scanner->sis[i];
68546854
if (si->flags & SCAN_POP) {
68556855
grn_obj *res_;
@@ -6897,7 +6897,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
68976897

68986898
i = 0;
68996899
if (!res_created) { i++; }
6900-
for (; i < GRN_BULK_VSIZE(&res_stack) / sizeof(grn_obj *); i++) {
6900+
for (; (uint) i < GRN_BULK_VSIZE(&res_stack) / sizeof(grn_obj *); i++) {
69016901
grn_obj *stacked_res;
69026902
stacked_res = *((grn_obj **)GRN_BULK_HEAD(&res_stack) + i);
69036903
grn_obj_close(ctx, stacked_res);

storage/mroonga/vendor/groonga/lib/geo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ typedef struct {
6464
static int
6565
compute_diff_bit(uint8_t *geo_key1, uint8_t *geo_key2)
6666
{
67-
int i, j, diff_bit = 0;
67+
size_t i;
68+
int j, diff_bit = 0;
6869

6970
for (i = 0; i < sizeof(grn_geo_point); i++) {
7071
if (geo_key1[i] != geo_key2[i]) {

storage/mroonga/vendor/groonga/lib/hash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ grn_hash_lock(grn_ctx *ctx, grn_hash *hash, int timeout)
22612261
GRN_ATOMIC_ADD_EX(hash->lock, 1, lock);
22622262
if (lock) {
22632263
GRN_ATOMIC_ADD_EX(hash->lock, -1, lock);
2264-
if (!timeout || (timeout > 0 && timeout == count)) { break; }
2264+
if (!timeout || (timeout > 0 && (uint32_t) timeout == count)) { break; }
22652265
if (!(++_ncolls % 1000000) && (_ncolls > _ncalls)) {
22662266
if (_ncolls < 0 || _ncalls < 0) {
22672267
_ncolls = 0; _ncalls = 0;
@@ -3350,7 +3350,7 @@ grn_hash_sort(grn_ctx *ctx, grn_hash *hash,
33503350
return 0;
33513351
}
33523352
}
3353-
if (limit > *hash->n_entries) { limit = *hash->n_entries; }
3353+
if ((uint) limit > (uint) *hash->n_entries) { limit = *hash->n_entries; }
33543354
/* hash->limit = limit; */
33553355
if (optarg) {
33563356
int dir = (optarg->flags & GRN_TABLE_SORT_DESC);

0 commit comments

Comments
 (0)