diff --git a/storage/mroonga/vendor/groonga/include/groonga/groonga.h b/storage/mroonga/vendor/groonga/include/groonga/groonga.h index b08403676c0..0e465152894 100644 --- a/storage/mroonga/vendor/groonga/include/groonga/groonga.h +++ b/storage/mroonga/vendor/groonga/include/groonga/groonga.h @@ -1540,7 +1540,7 @@ GRN_API void grn_ctx_recv_handler_set(grn_ctx *, } while (0) #define GRN_BULK_POP(obj, value, type, default) do {\ - if (GRN_BULK_VSIZE(obj) >= sizeof(type)) {\ + if ((size_t) GRN_BULK_VSIZE(obj) >= sizeof(type)) { \ GRN_BULK_INCR_LEN((obj), -(sizeof(type)));\ value = *(type *)(GRN_BULK_CURR(obj));\ } else {\ diff --git a/storage/mroonga/vendor/groonga/lib/expr.c b/storage/mroonga/vendor/groonga/lib/expr.c index d190d3e0de4..b4de00b2406 100644 --- a/storage/mroonga/vendor/groonga/lib/expr.c +++ b/storage/mroonga/vendor/groonga/lib/expr.c @@ -529,7 +529,7 @@ typedef struct { static grn_expr_dfi * grn_expr_dfi_pop(grn_expr *expr) { - if (GRN_BULK_VSIZE(&expr->dfi) >= sizeof(grn_expr_dfi)) { + if ((size_t) GRN_BULK_VSIZE(&expr->dfi) >= sizeof(grn_expr_dfi)) { grn_expr_dfi *dfi; GRN_BULK_INCR_LEN(&expr->dfi, -((ssize_t)(sizeof(grn_expr_dfi)))); 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) grn_proc_ctx pctx; grn_obj *obj = NULL, **args; grn_proc *p = (grn_proc *)proc; - if (nargs > ctx->impl->stack_curr) { return GRN_INVALID_ARGUMENT; } + if ((uint32_t) nargs > ctx->impl->stack_curr) { return GRN_INVALID_ARGUMENT; } GRN_API_ENTER; if (grn_obj_is_selector_only_proc(ctx, proc)) { char name[GRN_TABLE_MAX_KEY_SIZE]; @@ -3841,7 +3841,7 @@ grn_expr_get_value(grn_ctx *ctx, grn_obj *expr, int offset) grn_obj *res = NULL; grn_expr *e = (grn_expr *)expr; GRN_API_ENTER; - if (0 <= offset && offset < e->values_size) { + if (0 <= offset && (uint) offset < e->values_size) { res = &e->values[offset]; } GRN_API_RETURN(res); @@ -5386,7 +5386,7 @@ grn_scan_info_build_simple_and_operations(grn_ctx *ctx, int i; int nth_sis; - for (i = 0, nth_sis = 0; i < e->codes_curr; i += 3, nth_sis++) { + for (i = 0, nth_sis = 0; (uint) i < e->codes_curr; i += 3, nth_sis++) { grn_expr_code *target = e->codes + i; grn_expr_code *constant = e->codes + i + 1; grn_expr_code *operator = e->codes + i + 2; @@ -5454,7 +5454,7 @@ grn_scan_info_build_simple_and_operations(grn_ctx *ctx, return NULL; } - for (i = 0, nth_sis = 0; i < e->codes_curr; i += 3, nth_sis++) { + for (i = 0, nth_sis = 0; (uint) i < e->codes_curr; i += 3, nth_sis++) { grn_expr_code *target = e->codes + i; grn_expr_code *constant = e->codes + i + 1; grn_expr_code *operator = e->codes + i + 2; @@ -5920,7 +5920,7 @@ grn_table_select_index_equal(grn_ctx *ctx, if (si->position.specified) { while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) { - if (posting->pos == si->position.start) { + if ((int) posting->pos == si->position.start) { break; } } @@ -6037,7 +6037,7 @@ grn_table_select_index_not_equal(grn_ctx *ctx, if (si->position.specified) { while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) { - if (posting->pos == si->position.start) { + if ((int) posting->pos == si->position.start) { break; } } @@ -6561,7 +6561,7 @@ grn_table_select_index_range_column(grn_ctx *ctx, grn_obj *table, if (si->position.specified) { while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) { - if (posting->pos == si->position.start) { + if ((int) posting->pos == si->position.start) { break; } } @@ -6849,7 +6849,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr, grn_id min_id = GRN_ID_NIL; v = grn_expr_get_var_by_offset(ctx, (grn_obj *)e, 0); GRN_PTR_INIT(&res_stack, GRN_OBJ_VECTOR, GRN_ID_NIL); - for (i = 0; i < scanner->n_sis; i++) { + for (i = 0; (uint) i < scanner->n_sis; i++) { scan_info *si = scanner->sis[i]; if (si->flags & SCAN_POP) { grn_obj *res_; @@ -6897,7 +6897,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr, i = 0; if (!res_created) { i++; } - for (; i < GRN_BULK_VSIZE(&res_stack) / sizeof(grn_obj *); i++) { + for (; (uint) i < GRN_BULK_VSIZE(&res_stack) / sizeof(grn_obj *); i++) { grn_obj *stacked_res; stacked_res = *((grn_obj **)GRN_BULK_HEAD(&res_stack) + i); grn_obj_close(ctx, stacked_res); diff --git a/storage/mroonga/vendor/groonga/lib/geo.c b/storage/mroonga/vendor/groonga/lib/geo.c index 26aca4458ce..ec37985ea76 100644 --- a/storage/mroonga/vendor/groonga/lib/geo.c +++ b/storage/mroonga/vendor/groonga/lib/geo.c @@ -64,7 +64,8 @@ typedef struct { static int compute_diff_bit(uint8_t *geo_key1, uint8_t *geo_key2) { - int i, j, diff_bit = 0; + size_t i; + int j, diff_bit = 0; for (i = 0; i < sizeof(grn_geo_point); i++) { if (geo_key1[i] != geo_key2[i]) { diff --git a/storage/mroonga/vendor/groonga/lib/hash.c b/storage/mroonga/vendor/groonga/lib/hash.c index 3fb372ee222..8cdae7bad5e 100644 --- a/storage/mroonga/vendor/groonga/lib/hash.c +++ b/storage/mroonga/vendor/groonga/lib/hash.c @@ -2261,7 +2261,7 @@ grn_hash_lock(grn_ctx *ctx, grn_hash *hash, int timeout) GRN_ATOMIC_ADD_EX(hash->lock, 1, lock); if (lock) { GRN_ATOMIC_ADD_EX(hash->lock, -1, lock); - if (!timeout || (timeout > 0 && timeout == count)) { break; } + if (!timeout || (timeout > 0 && (uint32_t) timeout == count)) { break; } if (!(++_ncolls % 1000000) && (_ncolls > _ncalls)) { if (_ncolls < 0 || _ncalls < 0) { _ncolls = 0; _ncalls = 0; @@ -3350,7 +3350,7 @@ grn_hash_sort(grn_ctx *ctx, grn_hash *hash, return 0; } } - if (limit > *hash->n_entries) { limit = *hash->n_entries; } + if ((uint) limit > (uint) *hash->n_entries) { limit = *hash->n_entries; } /* hash->limit = limit; */ if (optarg) { int dir = (optarg->flags & GRN_TABLE_SORT_DESC); diff --git a/storage/mroonga/vendor/groonga/lib/ii.c b/storage/mroonga/vendor/groonga/lib/ii.c index 2abd074796c..3e402e15e7e 100644 --- a/storage/mroonga/vendor/groonga/lib/ii.c +++ b/storage/mroonga/vendor/groonga/lib/ii.c @@ -227,10 +227,9 @@ segment_get(grn_ctx *ctx, grn_ii *ii) pseg = ii->header->pnext; #ifndef CUT_OFF_COMPATIBILITY if (!pseg) { - int i; uint32_t pmax = 0; char *used; - uint32_t max_segment = ii->seg->header->max_segment; + uint32_t i, max_segment = ii->seg->header->max_segment; used = GRN_CALLOC(max_segment); if (!used) { return max_segment; } for (i = 0; i < GRN_II_MAX_LSEG && i < max_segment; i++) { @@ -457,8 +456,8 @@ chunk_new(grn_ctx *ctx, grn_ii *ii, uint32_t *res, uint32_t size) } */ if (size > S_CHUNK) { - int i, j; - uint32_t n = (size + S_CHUNK - 1) >> GRN_II_W_CHUNK; + int j; + uint32_t n = (size + S_CHUNK - 1) >> GRN_II_W_CHUNK, i; for (i = 0, j = -1; i < n_chunks; i++) { if (HEADER_CHUNK_AT(ii, i)) { j = i; @@ -466,7 +465,7 @@ chunk_new(grn_ctx *ctx, grn_ii *ii, uint32_t *res, uint32_t size) if (i == j + n) { j++; *res = j << GRN_II_N_CHUNK_VARIATION; - for (; j <= i; j++) { HEADER_CHUNK_ON(ii, j); } + for (; j <= (int) i; j++) { HEADER_CHUNK_ON(ii, j); } return GRN_SUCCESS; } } @@ -538,7 +537,7 @@ chunk_new(grn_ctx *ctx, grn_ii *ii, uint32_t *res, uint32_t size) if (*vp == GRN_II_PSEG_NOT_ASSIGNED) { int i = 0; while (HEADER_CHUNK_AT(ii, i)) { - if (++i >= n_chunks) { + if (++i >= (int) n_chunks) { DEFINE_NAME(ii); MERR("[ii][chunk][new] failed to find a free chunk: " "<%.*s>: " @@ -1757,7 +1756,7 @@ static grn_rc datavec_reset(grn_ctx *ctx, datavec *dv, uint32_t dvlen, size_t unitsize, size_t totalsize) { - int i; + uint32_t i; if (!dv[0].data || dv[dvlen].data < dv[0].data + totalsize) { if (dv[0].data) { GRN_FREE(dv[0].data); } if (!(dv[0].data = GRN_MALLOC(totalsize * sizeof(uint32_t)))) { @@ -1782,7 +1781,7 @@ static grn_rc datavec_init(grn_ctx *ctx, datavec *dv, uint32_t dvlen, size_t unitsize, size_t totalsize) { - int i; + uint32_t i; if (!totalsize) { memset(dv, 0, sizeof(datavec) * (dvlen + 1)); return GRN_SUCCESS; @@ -2951,14 +2950,14 @@ buffer_merge_dump_datavec(grn_ctx *ctx, grn_obj buffer; GRN_TEXT_INIT(&buffer, 0); - for (i = 0; i < ii->n_elements; i++) { + for (i = 0; (uint) i < ii->n_elements; i++) { GRN_LOG(ctx, GRN_LOG_DEBUG, "rdv[%d] data_size=%d, flags=%d", i, rdv[i].data_size, rdv[i].flags); GRN_BULK_REWIND(&buffer); - for (j = 0; j < rdv[i].data_size;) { + for (j = 0; (uint) j < rdv[i].data_size;) { grn_text_printf(ctx, &buffer, " %d", rdv[i].data[j]); j++; - if (!(j % 32) || j == rdv[i].data_size) { + if (!(j % 32) || (uint) j == rdv[i].data_size) { GRN_LOG(ctx, GRN_LOG_DEBUG, "rdv[%d].data[%d]%.*s", i, j, @@ -2969,14 +2968,14 @@ buffer_merge_dump_datavec(grn_ctx *ctx, } } - for (i = 0; i < ii->n_elements; i++) { + for (i = 0; (uint) i < ii->n_elements; i++) { GRN_LOG(ctx, GRN_LOG_DEBUG, "dv[%d] data_size=%d, flags=%d", i, dv[i].data_size, dv[i].flags); GRN_BULK_REWIND(&buffer); - for (j = 0; j < dv[i].data_size;) { + for (j = 0; (uint) j < dv[i].data_size;) { grn_text_printf(ctx, &buffer, " %d", dv[i].data[j]); j++; - if (!(j % 32) || j == dv[i].data_size) { + if (!(j % 32) || (uint) j == dv[i].data_size) { GRN_LOG(ctx, GRN_LOG_DEBUG, "dv[%d].data[%d]%.*s", i, j, @@ -3031,7 +3030,7 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h, uint32_t nvchunks = 0; chunk_info *cinfo = NULL; grn_id crid = GRN_ID_NIL; - docinfo cid = {0, 0, 0, 0, 0}, lid = {0, 0, 0, 0, 0}, bid = {0, 0}; + docinfo cid = {0, 0, 0, 0, 0}, lid = {0, 0, 0, 0, 0}, bid = {0, 0, 0, 0, 0}; uint32_t sdf = 0, snn = 0, ndf; uint32_t *srp = NULL, *ssp = NULL, *stp = NULL, *sop = NULL, *snp = NULL; if (!bt->tid) { @@ -3075,7 +3074,7 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h, } return ctx->rc; } - for (i = 0; i < nchunks; i++) { + for (i = 0; (uint) i < nchunks; i++) { GRN_B_DEC(cinfo[i].segno, scp); GRN_B_DEC(cinfo[i].size, scp); GRN_B_DEC(cinfo[i].dgap, scp); @@ -3247,7 +3246,7 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h, if (nvchunks) { int i; GRN_B_ENC(nvchunks, dcp); - for (i = 0; i < nchunks; i++) { + for (i = 0; (uint) i < nchunks; i++) { if (cinfo[i].size) { GRN_B_ENC(cinfo[i].segno, dcp); GRN_B_ENC(cinfo[i].size, dcp); @@ -3281,7 +3280,7 @@ buffer_merge(grn_ctx *ctx, grn_ii *ii, uint32_t seg, grn_hash *h, nvchunks++; dcp = dcp0; GRN_B_ENC(nvchunks, dcp); - for (i = 0; i <= nchunks; i++) { + for (i = 0; (uint) i <= nchunks; i++) { if (cinfo[i].size) { GRN_B_ENC(cinfo[i].segno, dcp); GRN_B_ENC(cinfo[i].size, dcp); @@ -3522,7 +3521,7 @@ grn_ii_buffer_check(grn_ctx *ctx, grn_ii *ii, uint32_t seg) uint32_t nchunks = 0; chunk_info *cinfo = NULL; grn_id crid = GRN_ID_NIL; - docinfo bid = {0, 0}; + docinfo bid = {0, 0, 0, 0, 0}; uint32_t sdf = 0, snn = 0; uint32_t *srp = NULL, *ssp = NULL, *stp = NULL, *sop = NULL, *snp = NULL; if (!bt->tid && !bt->pos_in_buffer && !bt->size_in_buffer) { @@ -3558,7 +3557,7 @@ grn_ii_buffer_check(grn_ctx *ctx, grn_ii *ii, uint32_t seg) GRN_OBJ_FIN(ctx, &buf); return; } - for (i = 0; i < nchunks; i++) { + for (i = 0; (uint) i < nchunks; i++) { GRN_B_DEC(cinfo[i].segno, scp); GRN_B_DEC(cinfo[i].size, scp); GRN_B_DEC(cinfo[i].dgap, scp); @@ -5070,7 +5069,7 @@ grn_ii_cursor_open(grn_ctx *ctx, grn_ii *ii, grn_id tid, c = NULL; goto exit; } - for (i = 0, crid = GRN_ID_NIL; i < c->nchunks; i++) { + for (i = 0, crid = GRN_ID_NIL; (uint) i < c->nchunks; i++) { GRN_B_DEC(c->cinfo[i].segno, c->cp); GRN_B_DEC(c->cinfo[i].size, c->cp); GRN_B_DEC(c->cinfo[i].dgap, c->cp); @@ -5471,7 +5470,7 @@ grn_ii_cursor_next_pos(grn_ctx *ctx, grn_ii_cursor *c) { uint32_t gap; if ((c->ii->header->flags & GRN_OBJ_WITH_POSITION)) { - if (c->nelements == c->ii->n_elements) { + if (c->nelements == (int) c->ii->n_elements) { if (c->buf) { if (c->post == &c->pc) { if (c->pc.rest) { @@ -6465,7 +6464,7 @@ grn_ii_column_update(grn_ctx *ctx, grn_ii *ii, grn_id rid, unsigned int section, grn_id tid_ = 0, gap, tid, *tpe; grn_table_sort_optarg arg = {GRN_TABLE_SORT_ASC| GRN_TABLE_SORT_AS_NUMBER| - GRN_TABLE_SORT_AS_UNSIGNED, NULL, NULL,0 }; + GRN_TABLE_SORT_AS_UNSIGNED, NULL, NULL, 0, 0}; grn_array *sorted = grn_array_create(ctx, NULL, sizeof(grn_id), 0); grn_hash_sort(ctx, (grn_hash *)new, -1, sorted, &arg); GRN_TEXT_PUT(ctx, posting, ((grn_hash *)new)->n_entries, sizeof(uint32_t)); @@ -7599,7 +7598,7 @@ grn_ii_similar_search(grn_ctx *ctx, grn_ii *ii, grn_hash_cursor_close(ctx, c); } limit = optarg->similarity_threshold - ? (optarg->similarity_threshold > GRN_HASH_SIZE(h) + ? (optarg->similarity_threshold > (int) GRN_HASH_SIZE(h) ? GRN_HASH_SIZE(h) : optarg->similarity_threshold) : (GRN_HASH_SIZE(h) >> 3) + 1; @@ -7613,7 +7612,7 @@ grn_ii_similar_search(grn_ctx *ctx, grn_ii *ii, GRN_TABLE_SORT_DESC|GRN_TABLE_SORT_BY_VALUE|GRN_TABLE_SORT_AS_NUMBER, NULL, NULL, - 0 + 0, 0 }; grn_array *sorted = grn_array_create(ctx, NULL, sizeof(grn_id), 0); if (!sorted) { @@ -7632,7 +7631,7 @@ grn_ii_similar_search(grn_ctx *ctx, grn_ii *ii, } else if (optarg->vector_size) { wvm = optarg->weight_vector ? grn_wv_static : grn_wv_constant; } - for (j = 1; j <= limit; j++) { + for (j = 1; j <= (uint) limit; j++) { grn_array_get_value(ctx, sorted, j, &id); _grn_hash_get_key_value(ctx, h, id, (void **) &tp, (void **) &w1); if (!*tp || !(c = grn_ii_cursor_open(ctx, ii, *tp, GRN_ID_NIL, GRN_ID_MAX, @@ -8056,7 +8055,7 @@ grn_ii_select_cursor_next(grn_ctx *ctx, if (ti->pos == pos) { score += ti->p->weight + ti->cursors->bins[0]->weight; count++; - if (ti->p->pos > end_pos) { + if ((int) ti->p->pos > end_pos) { end_pos = ti->p->pos; } } else { @@ -8065,9 +8064,9 @@ grn_ii_select_cursor_next(grn_ctx *ctx, start_pos = pos = ti->pos; end_pos = ti->p->pos; } - if (count == n_tis) { + if (count == (int) n_tis) { pos++; - if (ti->p->pos > end_pos) { + if ((int) ti->p->pos > end_pos) { end_pos = ti->p->pos; } tf = 1; @@ -8224,7 +8223,7 @@ grn_ii_select_regexp(grn_ctx *ctx, grn_ii *ii, grn_bool have_error = GRN_FALSE; cursors = GRN_CALLOC(sizeof(grn_ii_select_cursor *) * n_parsed_strings); - for (i = 0; i < n_parsed_strings; i++) { + for (i = 0; (uint) i < n_parsed_strings; i++) { const char *parsed_string; unsigned int parsed_string_len; parsed_string_len = grn_vector_get_element(ctx, @@ -8254,7 +8253,7 @@ grn_ii_select_regexp(grn_ctx *ctx, grn_ii *ii, } pos = posting->end_pos; - for (i = 1; i < n_parsed_strings; i++) { + for (i = 1; (uint) i < n_parsed_strings; i++) { grn_ii_select_cursor_posting *posting_i; for (;;) { @@ -8286,14 +8285,14 @@ grn_ii_select_regexp(grn_ctx *ctx, grn_ii *ii, pos = posting_i->end_pos; } - if (i == n_parsed_strings) { + if ((uint) i == n_parsed_strings) { grn_rset_posinfo pi = {posting->rid, posting->sid, pos}; double record_score = 1.0; res_add(ctx, s, &pi, record_score, op); } } - for (i = 0; i < n_parsed_strings; i++) { + for (i = 0; (uint) i < n_parsed_strings; i++) { if (cursors[i]) { grn_ii_select_cursor_close(ctx, cursors[i]); } @@ -8768,7 +8767,7 @@ grn_ii_select(grn_ctx *ctx, grn_ii *ii, record.n_candidates += ti->size; record.n_tokens += ti->ntoken; } - if (count == n) { + if ((uint) count == n) { if (rep) { pi.pos = pos; res_add(ctx, s, &pi, (score + 1) * weight, op); } @@ -9556,7 +9555,7 @@ grn_ii_buffer_flush(grn_ctx *ctx, grn_ii_buffer *ii_buffer) encode_last_tf(ctx, ii_buffer, outbuf); { ssize_t r = grn_write(ii_buffer->tmpfd, outbuf, encsize); - if (r != encsize) { + if (r != (ssize_t) encsize) { ERR(GRN_INPUT_OUTPUT_ERROR, "write returned %" GRN_FMT_LLD " != %" GRN_FMT_LLU, (long long int)r, (unsigned long long int)encsize); @@ -12218,7 +12217,7 @@ grn_ii_builder_set_sid_bits(grn_ctx *ctx, grn_ii_builder *builder) if (!grn_obj_get_value(ctx, builder->srcs[0], rid, &obj)) { continue; } - if (obj.u.v.n_sections > max_elems) { + if (obj.u.v.n_sections > (int) max_elems) { max_elems = obj.u.v.n_sections; } } @@ -12610,7 +12609,7 @@ grn_ii_builder_read_to_chunk(grn_ctx *ctx, grn_ii_builder *builder, /* Read positions or a frequency. */ if (ii_flags & GRN_OBJ_WITH_POSITION) { - uint32_t pos = -1; + uint32_t pos = (uint32_t) -1; freq = 0; for (;;) { rc = grn_ii_builder_read_from_block(ctx, builder, block_id, &value); @@ -12626,7 +12625,7 @@ grn_ii_builder_read_to_chunk(grn_ctx *ctx, grn_ii_builder *builder, return rc; } } - if (pos == -1) { + if (pos == (uint32_t) -1) { chunk->pos_buf[chunk->pos_offset] = value - 1; chunk->pos_sum += value - 1; } else { diff --git a/storage/mroonga/vendor/groonga/lib/index_column.c b/storage/mroonga/vendor/groonga/lib/index_column.c index c4a2a7c6f70..b5d4fde8aa6 100644 --- a/storage/mroonga/vendor/groonga/lib/index_column.c +++ b/storage/mroonga/vendor/groonga/lib/index_column.c @@ -66,7 +66,8 @@ grn_index_column_build_call_hook(grn_ctx *ctx, grn_obj *obj, grn_obj oldvalue; /* todo : grn_proc_ctx_open() */ grn_obj id_, flags_; - grn_proc_ctx pctx = {{0}, hooks->proc, NULL, hooks, hooks, PROC_INIT, 4, 4}; + grn_proc_ctx pctx = {{0}, hooks->proc, NULL, hooks, hooks, PROC_INIT, 4, 4, + {{0}}}; GRN_TEXT_INIT(&oldvalue, 0); GRN_UINT32_INIT(&id_, 0); GRN_UINT32_INIT(&flags_, 0); diff --git a/storage/mroonga/vendor/groonga/lib/io.c b/storage/mroonga/vendor/groonga/lib/io.c index 01359521879..6aecb6e53c4 100644 --- a/storage/mroonga/vendor/groonga/lib/io.c +++ b/storage/mroonga/vendor/groonga/lib/io.c @@ -526,7 +526,7 @@ grn_io_detect_type(grn_ctx *ctx, const char *path) grn_open(fd, path, O_RDONLY | GRN_OPEN_FLAG_BINARY); if (fd != -1) { struct stat s; - if (fstat(fd, &s) != -1 && s.st_size >= sizeof(struct _grn_io_header)) { + if (fstat(fd, &s) != -1 && (size_t) s.st_size >= sizeof(struct _grn_io_header)) { if (grn_read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) { if (!memcmp(h.idstr, GRN_IO_IDSTR, GRN_IO_IDSTR_LEN)) { @@ -593,7 +593,7 @@ grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode) grn_close(fd); return NULL; } - if (s.st_size < sizeof(struct _grn_io_header)) { + if ((size_t) s.st_size < sizeof(struct _grn_io_header)) { ERR(GRN_INCOMPATIBLE_FILE_FORMAT, "[io][open] file size is too small: " "<%" GRN_FMT_INT64D ">(required: >= %" GRN_FMT_SIZE "): <%s>", @@ -707,7 +707,7 @@ grn_io_close(grn_ctx *ctx, grn_io *io) segment_size = io->header->segment_size; file_size = grn_io_compute_file_size(io->header->version); segments_per_file = file_size / segment_size; - for (i = 0; i < max_segment; i++) { + for (i = 0; (uint) i < max_segment; i++) { grn_io_mapinfo *mi; mi = &(io->maps[i]); if (mi->map) { @@ -726,7 +726,7 @@ grn_io_close(grn_ctx *ctx, grn_io *io) GRN_MUNMAP(ctx, &grn_gctx, io, (io->fis ? &io->fis->fmo : NULL), io->fis, io->header, io->base); if (io->fis) { - int i; + uint i; for (i = 0; i < max_nfiles; i++) { fileinfo *fi = &(io->fis[i]); grn_fileinfo_close(ctx, fi); @@ -797,7 +797,7 @@ grn_io_n_files(grn_ctx *ctx, grn_io *io) grn_rc grn_io_size(grn_ctx *ctx, grn_io *io, uint64_t *size) { - int fno; + uint32_t fno; struct stat s; uint64_t tsize = 0; char buffer[PATH_MAX]; @@ -930,7 +930,7 @@ grn_io_read_ja(grn_io *io, grn_ctx *ctx, grn_io_ja_einfo *einfo, uint32_t epos, *value_len = 0; return GRN_NO_MEMORY_AVAILABLE; } - if (pos + size > file_size) { + if ((unsigned long) (pos + size) > file_size) { rest = pos + size - file_size; size = file_size - pos; } @@ -1026,7 +1026,7 @@ grn_io_write_ja(grn_io *io, grn_ctx *ctx, uint32_t key, fileinfo *fi = &io->fis[fno]; off_t base = fno ? 0 : io->base - (uint64_t)segment_size * io->base_seg; off_t pos = (uint64_t)segment_size * (bseg % segments_per_file) + offset + base; - if (pos + size > file_size) { + if ((unsigned long) (pos + size) > file_size) { rest = pos + size - file_size; size = file_size - pos; } @@ -1303,7 +1303,7 @@ grn_io_expire(grn_ctx *ctx, grn_io *io, int count_thresh, uint32_t limit) { uint32_t nref, nmaps, *pnref = &io->nref; GRN_ATOMIC_ADD_EX(pnref, 1, nref); - if (!nref && grn_gtick - io->count > count_thresh) { + if (!nref && grn_gtick - io->count > (uint) count_thresh) { { uint32_t i = io->header->n_arrays; grn_io_array_spec *array_specs = (grn_io_array_spec *)io->user_header; @@ -1341,10 +1341,10 @@ grn_io_expire(grn_ctx *ctx, grn_io *io, int count_thresh, uint32_t limit) { grn_io_mapinfo *info = io->maps; for (m = io->max_map_seg; n < limit && m; info++, m--) { - if (info->map && (grn_gtick - info->count) > count_thresh) { + if (info->map && (grn_gtick - info->count) > (uint) count_thresh) { uint32_t nmaps, nref, *pnref = &info->nref; GRN_ATOMIC_ADD_EX(pnref, 1, nref); - if (!nref && info->map && (grn_gtick - info->count) > count_thresh) { + if (!nref && info->map && (grn_gtick - info->count) > (uint) count_thresh) { GRN_MUNMAP(ctx, &grn_gctx, io, &info->fmo, NULL, info->map, io->header->segment_size); GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps); @@ -1395,7 +1395,7 @@ grn_io_lock(grn_ctx *ctx, grn_io *io, int timeout) "io(%s) collisions(%d/%d): lock failed %d times", io->path, _ncolls, _ncalls, count_log_border); } - if (!timeout || (timeout > 0 && timeout == count)) { + if (!timeout || (timeout > 0 && timeout == (int) count)) { GRN_LOG(ctx, GRN_LOG_WARNING, "[DB Locked] time out(%d): io(%s) collisions(%d/%d)", timeout, io->path, _ncolls, _ncalls); @@ -2166,7 +2166,7 @@ inline static grn_rc grn_pread(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset) { ssize_t r = pread(fi->fd, buf, count, offset); - if (r != count) { + if (r != (ssize_t) count) { if (r == -1) { SERR("pread"); } else { @@ -2184,7 +2184,7 @@ inline static grn_rc grn_pwrite(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset) { ssize_t r = pwrite(fi->fd, buf, count, offset); - if (r != count) { + if (r != (ssize_t) count) { if (r == -1) { SERR("pwrite"); } else { diff --git a/storage/mroonga/vendor/groonga/lib/load.c b/storage/mroonga/vendor/groonga/lib/load.c index b840a0dc8cb..eb77f2b3849 100644 --- a/storage/mroonga/vendor/groonga/lib/load.c +++ b/storage/mroonga/vendor/groonga/lib/load.c @@ -468,7 +468,8 @@ bracket_close(grn_ctx *ctx, grn_loader *loader) } for (i = 0; i < nvalues; i++, value = values_next(ctx, value)) { - if (i == loader->id_offset || i == loader->key_offset) { + if ((uint) i == (uint) loader->id_offset || + (uint) i == (uint) loader->key_offset) { /* Skip _id and _key, because it's already used to get id. */ continue; } @@ -532,7 +533,7 @@ brace_close(grn_ctx *ctx, grn_loader *loader) GRN_ASSERT(value->header.domain == GRN_JSON_LOAD_OPEN_BRACE); GRN_UINT32_SET(ctx, value_begin, loader->values_size - begin - 1); value_begin++; - if (GRN_BULK_VSIZE(&loader->level) > sizeof(uint32_t) * loader->emit_level) { + if ((size_t) GRN_BULK_VSIZE(&loader->level) > sizeof(uint32_t) * loader->emit_level) { return; } if (!loader->table) { diff --git a/storage/mroonga/vendor/groonga/lib/logger.c b/storage/mroonga/vendor/groonga/lib/logger.c index 9c1a2dbd840..da3dd3e7054 100644 --- a/storage/mroonga/vendor/groonga/lib/logger.c +++ b/storage/mroonga/vendor/groonga/lib/logger.c @@ -495,9 +495,9 @@ grn_query_log_flags_parse(const char *string, } #define CHECK_FLAG(name) \ - if (((string_end - string) >= (sizeof(#name) - 1)) && \ + if (((size_t) (string_end - string) >= (sizeof(#name) - 1)) && \ (memcmp(string, #name, sizeof(#name) - 1) == 0) && \ - (((string_end - string) == (sizeof(#name) - 1)) || \ + (((size_t)(string_end - string) == (sizeof(#name) - 1)) || \ (string[sizeof(#name) - 1] == '|') || \ (string[sizeof(#name) - 1] == ' '))) { \ *flags |= GRN_QUERY_LOG_ ## name; \ diff --git a/storage/mroonga/vendor/groonga/lib/normalizer.c b/storage/mroonga/vendor/groonga/lib/normalizer.c index 7e69d68447c..86e72e13c59 100644 --- a/storage/mroonga/vendor/groonga/lib/normalizer.c +++ b/storage/mroonga/vendor/groonga/lib/normalizer.c @@ -32,9 +32,10 @@ grn_normalizer_register(grn_ctx *ctx, grn_proc_func *next, grn_proc_func *fin) { - grn_expr_var vars[] = { - { NULL, 0 } - }; + grn_expr_var vars[1]; + vars[0].name= 0; + vars[0].name_size= 0; + GRN_PTR_INIT(&vars[0].value, 0, GRN_ID_NIL); if (name_length < 0) { diff --git a/storage/mroonga/vendor/groonga/lib/operator.c b/storage/mroonga/vendor/groonga/lib/operator.c index 1d371fe4f85..1e1f2cf7e4d 100644 --- a/storage/mroonga/vendor/groonga/lib/operator.c +++ b/storage/mroonga/vendor/groonga/lib/operator.c @@ -168,31 +168,31 @@ grn_operator_to_exec_func(grn_operator op) #define DO_EQ_SUB do {\ switch (y->header.domain) {\ case GRN_DB_INT8 :\ - r = (x_ == GRN_INT8_VALUE(y));\ + r = ((unsigned char) x_ == (unsigned char) GRN_INT8_VALUE(y)); \ break;\ case GRN_DB_UINT8 :\ r = (x_ == GRN_UINT8_VALUE(y));\ break;\ case GRN_DB_INT16 :\ - r = (x_ == GRN_INT16_VALUE(y));\ + r = ((int) x_ == (int) GRN_INT16_VALUE(y)); \ break;\ case GRN_DB_UINT16 :\ r = (x_ == GRN_UINT16_VALUE(y));\ break;\ case GRN_DB_INT32 :\ - r = (x_ == GRN_INT32_VALUE(y));\ + r = ((int) x_ == (int) GRN_INT32_VALUE(y)); \ break;\ case GRN_DB_UINT32 :\ - r = (x_ == GRN_UINT32_VALUE(y));\ + r = ((uint) x_ == GRN_UINT32_VALUE(y)); \ break;\ case GRN_DB_INT64 :\ - r = (x_ == GRN_INT64_VALUE(y));\ + r = ((long long) x_ == GRN_INT64_VALUE(y)); \ break;\ case GRN_DB_TIME :\ r = (GRN_TIME_PACK(x_,0) == GRN_INT64_VALUE(y));\ break;\ case GRN_DB_UINT64 :\ - r = (x_ == GRN_UINT64_VALUE(y));\ + r = ((unsigned long long) x_ == GRN_UINT64_VALUE(y)); \ break;\ case GRN_DB_FLOAT :\ r = ((x_ <= GRN_FLOAT_VALUE(y)) && (x_ >= GRN_FLOAT_VALUE(y)));\ @@ -203,7 +203,7 @@ grn_operator_to_exec_func(grn_operator op) {\ const char *p_ = GRN_TEXT_VALUE(y);\ int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\ - r = (x_ == i_);\ + r = ((int) x_ == i_); \ }\ break;\ default :\ @@ -271,10 +271,10 @@ grn_operator_to_exec_func(grn_operator op) break;\ case GRN_DB_INT64 :\ case GRN_DB_TIME :\ - r = (x_ == GRN_INT64_VALUE(y));\ + r = ((long long) x_ == GRN_INT64_VALUE(y)); \ break;\ case GRN_DB_UINT64 :\ - r = (x_ == GRN_UINT64_VALUE(y));\ + r = ((unsigned long long) x_ == GRN_UINT64_VALUE(y)); \ break;\ case GRN_DB_FLOAT :\ r = (x_ == GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\ @@ -405,31 +405,31 @@ grn_operator_exec_not_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y) r = (x_ op (uint8_t)(GRN_BOOL_VALUE(y) ? 1 : 0));\ break;\ case GRN_DB_INT8 :\ - r = (x_ op GRN_INT8_VALUE(y));\ + r = ((signed char) x_ op GRN_INT8_VALUE(y)); \ break;\ case GRN_DB_UINT8 :\ - r = (x_ op GRN_UINT8_VALUE(y));\ + r = ((unsigned char) x_ op GRN_UINT8_VALUE(y)); \ break;\ case GRN_DB_INT16 :\ - r = (x_ op GRN_INT16_VALUE(y));\ + r = ((short) x_ op GRN_INT16_VALUE(y)); \ break;\ case GRN_DB_UINT16 :\ - r = (x_ op GRN_UINT16_VALUE(y));\ + r = ((unsigned short) x_ op GRN_UINT16_VALUE(y)); \ break;\ case GRN_DB_INT32 :\ - r = (x_ op GRN_INT32_VALUE(y));\ + r = ((int) x_ op GRN_INT32_VALUE(y)); \ break;\ case GRN_DB_UINT32 :\ - r = (x_ op GRN_UINT32_VALUE(y));\ + r = ((uint) x_ op GRN_UINT32_VALUE(y)); \ break;\ case GRN_DB_INT64 :\ - r = (x_ op GRN_INT64_VALUE(y));\ + r = ((long long) x_ op GRN_INT64_VALUE(y)); \ break;\ case GRN_DB_TIME :\ r = (GRN_TIME_PACK(x_,0) op GRN_INT64_VALUE(y));\ break;\ case GRN_DB_UINT64 :\ - r = (x_ op GRN_UINT64_VALUE(y));\ + r = ((unsigned long long) x_ op GRN_UINT64_VALUE(y)); \ break;\ case GRN_DB_FLOAT :\ r = (x_ op GRN_FLOAT_VALUE(y));\ @@ -552,10 +552,10 @@ grn_operator_exec_not_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y) break;\ case GRN_DB_INT64 :\ case GRN_DB_TIME :\ - r = (x_ op GRN_INT64_VALUE(y));\ + r = ((long long) x_ op GRN_INT64_VALUE(y)); \ break;\ case GRN_DB_UINT64 :\ - r = (x_ op GRN_UINT64_VALUE(y));\ + r = ((unsigned long long) x_ op GRN_UINT64_VALUE(y)); \ break;\ case GRN_DB_FLOAT :\ r = (x_ op GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\ diff --git a/storage/mroonga/vendor/groonga/lib/output.c b/storage/mroonga/vendor/groonga/lib/output.c index 3c1fb21d33b..76b9845a327 100644 --- a/storage/mroonga/vendor/groonga/lib/output.c +++ b/storage/mroonga/vendor/groonga/lib/output.c @@ -774,7 +774,7 @@ grn_text_atoj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, } if (a->next) { a = a->next; - if (GRN_BULK_VSIZE(&buf) >= sizeof(grn_id)) { + if ((size_t) GRN_BULK_VSIZE(&buf) >= sizeof(grn_id)) { id = *((grn_id *)GRN_BULK_HEAD(&buf)); } else { id = GRN_ID_NIL; diff --git a/storage/mroonga/vendor/groonga/lib/pat.c b/storage/mroonga/vendor/groonga/lib/pat.c index 01f6108fbd0..5d3c5ff33d2 100644 --- a/storage/mroonga/vendor/groonga/lib/pat.c +++ b/storage/mroonga/vendor/groonga/lib/pat.c @@ -350,11 +350,11 @@ delinfo_turn_2(grn_ctx *ctx, grn_pat *pat, grn_pat_delinfo *di) return GRN_FILE_CORRUPT; } c = PAT_CHK(rn); - if (c <= c0 || len <= c) { + if ((int) c <= (int) c0 || (int) len <= (int) c) { break; } if (c & 1) { - p0 = (c + 1 < len) ? &rn->lr[1] : &rn->lr[0]; + p0 = (c + 1 < (int) len) ? &rn->lr[1] : &rn->lr[0]; } else { p0 = &rn->lr[nth_bit((uint8_t *)key, c, len)]; } @@ -430,7 +430,7 @@ delinfo_new(grn_ctx *ctx, grn_pat *pat) } pat->header->curr_del2 = (pat->header->curr_del2 + 1) & GRN_PAT_MDELINFOS; } - if (n == pat->header->curr_del3) { + if ((int) n == (int) pat->header->curr_del3) { if (delinfo_turn_3(ctx, pat, &pat->header->delinfos[pat->header->curr_del3])) { GRN_LOG(ctx, GRN_LOG_CRIT, "d3 failed: %d", pat->header->delinfos[pat->header->curr_del3].ld); } @@ -879,7 +879,7 @@ chop(grn_ctx *ctx, grn_pat *pat, const char **key, const char *end, uint32_t *lk #define MAX_FIXED_KEY_SIZE (sizeof(int64_t)) #define KEY_NEEDS_CONVERT(pat,size) \ - (!((pat)->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) && (size) <= MAX_FIXED_KEY_SIZE) + (!((pat)->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) && (size_t) (size) <= MAX_FIXED_KEY_SIZE) #define KEY_ENC(pat,keybuf,key,size) do {\ switch ((pat)->obj.header.flags & GRN_OBJ_KEY_MASK) {\ @@ -1007,7 +1007,7 @@ _grn_pat_get(grn_ctx *ctx, grn_pat *pat, const void *key, uint32_t key_size, voi PAT_AT(pat, r, rn); if (!rn) { break; /* corrupt? */ } c = PAT_CHK(rn); - if (len <= c) { break; } + if ((int) len <= c) { break; } if (c <= c0) { const uint8_t *k = pat_node_get_key(ctx, pat, rn); if (k && key_size == PAT_LEN(rn) && !memcmp(k, key, key_size)) { @@ -1024,7 +1024,7 @@ _grn_pat_get(grn_ctx *ctx, grn_pat *pat, const void *key, uint32_t key_size, voi break; } if (c & 1) { - r = (c + 1 < len) ? rn->lr[1] : rn->lr[0]; + r = (c + 1 < (int) len) ? rn->lr[1] : rn->lr[0]; } else { r = rn->lr[nth_bit((uint8_t *)key, c, len)]; } @@ -1109,9 +1109,9 @@ grn_pat_prefix_search(grn_ctx *ctx, grn_pat *pat, PAT_AT(pat, r, rn); if (!rn) { return GRN_FILE_CORRUPT; } c = PAT_CHK(rn); - if (c0 < c && c < len - 1) { + if (c0 < c && c < (int) len - 1) { if (c & 1) { - r = (c + 1 < len) ? rn->lr[1] : rn->lr[0]; + r = (c + 1 < (int) len) ? rn->lr[1] : rn->lr[0]; } else { r = rn->lr[nth_bit((uint8_t *)key, c, len)]; } @@ -1121,7 +1121,7 @@ grn_pat_prefix_search(grn_ctx *ctx, grn_pat *pat, if (!(k = pat_node_get_key(ctx, pat, rn))) { break; } if (PAT_LEN(rn) < key_size) { break; } if (!memcmp(k, key, key_size)) { - if (c >= len - 1) { + if (c >= (int) len - 1) { get_tc(ctx, pat, h, rn); } else { grn_hash_add(ctx, h, &r, sizeof(grn_id), NULL, NULL); @@ -1204,7 +1204,7 @@ grn_pat_lcp_search(grn_ctx *ctx, grn_pat *pat, const void *key, uint32_t key_siz } break; } - if (len <= c) { break; } + if ((int) len <= c) { break; } if (c & 1) { uint8_t *p; pat_node *rn0; @@ -1214,7 +1214,7 @@ grn_pat_lcp_search(grn_ctx *ctx, grn_pat *pat, const void *key, uint32_t key_siz p = pat_node_get_key(ctx, pat, rn0); if (!p) { break; } if (PAT_LEN(rn0) <= key_size && !memcmp(p, key, PAT_LEN(rn0))) { r2 = r0; } - r = (c + 1 < len) ? rn->lr[1] : rn->lr[0]; + r = (c + 1 < (int) len) ? rn->lr[1] : rn->lr[0]; } else { r = rn->lr[nth_bit((uint8_t *)key, c, len)]; } @@ -1240,9 +1240,9 @@ common_prefix_pat_node_get(grn_ctx *ctx, grn_pat *pat, const void *key, uint32_t PAT_AT(pat, r, rn); if (!rn) { return GRN_ID_NIL; } c = PAT_CHK(rn); - if (c0 < c && c < len - 1) { + if (c0 < c && c < (int) len - 1) { if (c & 1) { - r = (c + 1 < len) ? rn->lr[1] : rn->lr[0]; + r = (c + 1 < (int) len) ? rn->lr[1] : rn->lr[0]; } else { r = rn->lr[nth_bit((uint8_t *)key, c, len)]; } @@ -1542,7 +1542,7 @@ grn_pat_fuzzy_search(grn_ctx *ctx, grn_pat *pat, key, key_size, dists, lx, -1, &last_node, max_distance, flags, heap); GRN_FREE(dists); - for (i = 0; i < heap->n_entries; i++) { + for (i = 0; i < (uint32_t) heap->n_entries; i++) { if (max_expansion > 0 && i >= max_expansion) { break; } @@ -1598,7 +1598,7 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int return GRN_FILE_CORRUPT; } ch = PAT_CHK(rn); - if (len <= ch) { + if ((int) len <= ch) { return GRN_INVALID_ARGUMENT; } if (c >= ch) { @@ -1617,7 +1617,7 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int p0 = p; c = ch; if (c & 1) { - p = (c + 1 < len) ? &rn->lr[1] : &rn->lr[0]; + p = (c + 1 < (int) len) ? &rn->lr[1] : &rn->lr[0]; } else { p = &rn->lr[nth_bit((uint8_t *)key, c, len)]; } @@ -2163,7 +2163,7 @@ grn_pat_scan(grn_ctx *ctx, grn_pat *pat, const char *str, unsigned int str_len, grn_string_get_normalized(ctx, nstr, &sp, &normalized_length_in_bytes, NULL); se = sp + normalized_length_in_bytes; - while (n < sh_size) { + while (n < (int) sh_size) { if ((tid = grn_pat_lcp_search(ctx, pat, sp, se - sp))) { const char *key; uint32_t len; @@ -2231,7 +2231,7 @@ grn_pat_scan(grn_ctx *ctx, grn_pat *pat, const char *str, unsigned int str_len, } else { uint32_t len; const char *sp, *se = str + str_len; - for (sp = str; sp < se && n < sh_size; sp += len) { + for (sp = str; sp < se && n < (int) sh_size; sp += len) { if ((tid = grn_pat_lcp_search(ctx, pat, sp, se - sp))) { _grn_pat_key(ctx, pat, tid, &len); sh[n].id = tid; @@ -2415,9 +2415,9 @@ set_cursor_prefix(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, PAT_AT(pat, id, node); if (!node) { return GRN_FILE_CORRUPT; } ch = PAT_CHK(node); - if (c0 < ch && ch < len - 1) { + if (c0 < ch && ch < (int) len - 1) { if (ch & 1) { - id = (ch + 1 < len) ? node->lr[1] : node->lr[0]; + id = (ch + 1 < (int) len) ? node->lr[1] : node->lr[0]; } else { id = node->lr[nth_bit((uint8_t *)key, ch, len)]; } @@ -2431,13 +2431,13 @@ set_cursor_prefix(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, : !memcmp(k, key, key_size)) { if (c0 < ch) { if (flags & GRN_CURSOR_DESCENDING) { - if ((ch > len - 1) || !(flags & GRN_CURSOR_GT)) { + if ((ch > (int) len - 1) || !(flags & GRN_CURSOR_GT)) { push(c, node->lr[0], ch); } push(c, node->lr[1], ch); } else { push(c, node->lr[1], ch); - if ((ch > len - 1) || !(flags & GRN_CURSOR_GT)) { + if ((ch > (int) len - 1) || !(flags & GRN_CURSOR_GT)) { push(c, node->lr[0], ch); } } @@ -2469,13 +2469,13 @@ set_cursor_near(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, if (!node) { return GRN_FILE_CORRUPT; } ch = PAT_CHK(node); if (ch <= check) { - if (check >= min) { push(c, id, check); } + if (check >= (int) min) { push(c, id, check); } break; } if ((check += 2) < ch) { if (!(k = pat_node_get_key(ctx, pat, node))) { return GRN_FILE_CORRUPT; } if ((r = bitcmp(key, k, check >> 1, (ch - check) >> 1))) { - if (ch >= min) { + if (ch >= (int) min) { push(c, node->lr[1], ch); push(c, node->lr[0], ch); } @@ -2484,10 +2484,10 @@ set_cursor_near(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, } check = ch; if (nth_bit((uint8_t *)key, check, pat->key_size)) { - if (check >= min) { push(c, node->lr[0], check); } + if (check >= (int) min) { push(c, node->lr[0], check); } id = node->lr[1]; } else { - if (check >= min) { push(c, node->lr[1], check); } + if (check >= (int) min) { push(c, node->lr[1], check); } id = node->lr[0]; } } @@ -2521,7 +2521,7 @@ set_cursor_common_prefix(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, break; } check = ch; - if (len <= check) { break; } + if ((int) len <= check) { break; } if (check & 1) { grn_id id0 = node->lr[0]; pat_node *node0; @@ -2577,7 +2577,7 @@ set_cursor_ascend(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, } break; } - c2 = len < ch ? len : ch; + c2 = (int) len < ch ? (int) len : ch; if ((check += 2) < c2) { if (!(k = pat_node_get_key(ctx, pat, node))) { return GRN_FILE_CORRUPT; } if ((r = bitcmp(key, k, check >> 1, ((c2 + 1) >> 1) - (check >> 1)))) { @@ -2589,13 +2589,13 @@ set_cursor_ascend(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, } } check = ch; - if (len <= check) { + if ((int) len <= check) { push(c, node->lr[1], ch); push(c, node->lr[0], ch); break; } if (check & 1) { - if (check + 1 < len) { + if (check + 1 < (int) len) { id = node->lr[1]; } else { push(c, node->lr[1], check); @@ -2645,7 +2645,7 @@ set_cursor_descend(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, } break; } - c2 = len < ch ? len : ch; + c2 = (int) len < ch ? (int) len : ch; if ((check += 2) < c2) { if (!(k = pat_node_get_key(ctx, pat, node))) { return GRN_FILE_CORRUPT; } if ((r = bitcmp(key, k, check >> 1, ((c2 + 1) >> 1) - (check >> 1)))) { @@ -2657,9 +2657,9 @@ set_cursor_descend(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, } } check = ch; - if (len <= check) { break; } + if ((int) len <= check) { break; } if (check & 1) { - if (check + 1 < len) { + if (check + 1 < (int) len) { push(c, node->lr[0], check); id = node->lr[1]; } else { @@ -2750,7 +2750,7 @@ grn_pat_cursor_open_by_id(grn_ctx *ctx, grn_pat *pat, } } } else { - if ((dir * (c->tail - c->curr_rec)) < offset) { + if ((int) (dir * (c->tail - c->curr_rec)) < offset) { c->curr_rec = c->tail; } else { c->curr_rec += dir * offset; @@ -3101,7 +3101,7 @@ grn_pat_inspect_nodes(grn_ctx *ctx, grn_pat *pat, grn_obj *buf) static void grn_pat_cursor_inspect_entries(grn_ctx *ctx, grn_pat_cursor *c, grn_obj *buf) { - int i; + uint i; GRN_TEXT_PUTS(ctx, buf, "["); for (i = 0; i < c->sp; i++) { grn_pat_cursor_entry *e = c->ss + i; @@ -3504,9 +3504,9 @@ sub_search(grn_ctx *ctx, grn_pat *pat, grn_id id, while (pn) { int ch; ch = PAT_CHK(pn); - if (*c0 < ch && ch < len - 1) { + if (*c0 < ch && ch < (int) len - 1) { if (ch & 1) { - id = (ch + 1 < len) ? pn->lr[1] : pn->lr[0]; + id = (ch + 1 < (int) len) ? pn->lr[1] : pn->lr[0]; } else { id = pn->lr[nth_bit(key, ch, len)]; } @@ -3563,11 +3563,11 @@ search_push(grn_ctx *ctx, grn_pat *pat, grn_pat_cursor *c, uint32_t len = key_len * 16; if (c0 < ch) { if (flags & GRN_CURSOR_DESCENDING) { - if ((ch > len - 1) || !(flags & GRN_CURSOR_GT)) { push(c, pn->lr[0], ch); } + if ((ch > (int) len - 1) || !(flags & GRN_CURSOR_GT)) { push(c, pn->lr[0], ch); } push(c, pn->lr[1], ch); } else { push(c, pn->lr[1], ch); - if ((ch > len - 1) || !(flags & GRN_CURSOR_GT)) { push(c, pn->lr[0], ch); } + if ((ch > (int) len - 1) || !(flags & GRN_CURSOR_GT)) { push(c, pn->lr[0], ch); } } } else { if (PAT_LEN(pn) * 16 > len || !(flags & GRN_CURSOR_GT)) { push(c, id, ch); } diff --git a/storage/mroonga/vendor/groonga/lib/proc/proc_column.c b/storage/mroonga/vendor/groonga/lib/proc/proc_column.c index 74d0d7a9e76..ecf527c3600 100644 --- a/storage/mroonga/vendor/groonga/lib/proc/proc_column.c +++ b/storage/mroonga/vendor/groonga/lib/proc/proc_column.c @@ -479,6 +479,12 @@ void grn_proc_init_column_rename(grn_ctx *ctx) { grn_expr_var vars[3]; + vars[0].name= NULL; + vars[0].name_size= 0; + vars[1].name= NULL; + vars[1].name_size= 0; + vars[2].name= NULL; + vars[2].name_size= 0; grn_plugin_expr_var_init(ctx, &(vars[0]), "table", -1); grn_plugin_expr_var_init(ctx, &(vars[1]), "name", -1); diff --git a/storage/mroonga/vendor/groonga/lib/scanner.c b/storage/mroonga/vendor/groonga/lib/scanner.c index 9ac0f164cc2..fa562fa1d3f 100644 --- a/storage/mroonga/vendor/groonga/lib/scanner.c +++ b/storage/mroonga/vendor/groonga/lib/scanner.c @@ -58,7 +58,7 @@ grn_scanner_close(grn_ctx *ctx, grn_scanner *scanner) } if (scanner->sis) { - int i; + uint i; for (i = 0; i < scanner->n_sis; i++) { grn_scan_info_close(ctx, scanner->sis[i]); } diff --git a/storage/mroonga/vendor/groonga/lib/store.c b/storage/mroonga/vendor/groonga/lib/store.c index f579bc9ede6..efa400fa005 100644 --- a/storage/mroonga/vendor/groonga/lib/store.c +++ b/storage/mroonga/vendor/groonga/lib/store.c @@ -756,7 +756,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id, if (SEGMENTS_AT(ja, i)) { j = i; } else { - if (i == j + n) { + if (i == (uint) (j + n)) { j++; addr = grn_io_win_map(ja->io, ctx, iw, j, 0, element_size, grn_io_wronly); if (!addr) { @@ -764,7 +764,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id, return GRN_NO_MEMORY_AVAILABLE; } EHUGE_ENC(einfo, j, element_size); - for (; j <= i; j++) { SEGMENTS_HUGE_ON(ja, j); } + for (; j <= (int) i; j++) { SEGMENTS_HUGE_ON(ja, j); } grn_io_unlock(ja->io); return GRN_SUCCESS; } @@ -862,7 +862,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id, } vp = &ja->header->free_elements[m - JA_W_EINFO]; if (!vp->seg) { - int i = 0; + uint i = 0; while (SEGMENTS_AT(ja, i)) { if (++i >= JA_N_DSEGMENTS) { grn_io_unlock(ja->io); diff --git a/storage/mroonga/vendor/groonga/lib/tokenizer.c b/storage/mroonga/vendor/groonga/lib/tokenizer.c index faf47fd63f0..67cc8744cbf 100644 --- a/storage/mroonga/vendor/groonga/lib/tokenizer.c +++ b/storage/mroonga/vendor/groonga/lib/tokenizer.c @@ -292,11 +292,13 @@ grn_tokenizer_register(grn_ctx *ctx, const char *plugin_name_ptr, grn_proc_func *init, grn_proc_func *next, grn_proc_func *fin) { - grn_expr_var vars[] = { - { NULL, 0 }, - { NULL, 0 }, - { NULL, 0 } - }; + grn_expr_var vars[3]; + vars[0].name= NULL; + vars[0].name_size= 0; + vars[1].name= NULL; + vars[1].name_size= 0; + vars[2].name= NULL; + vars[2].name_size= 0; GRN_TEXT_INIT(&vars[0].value, 0); GRN_TEXT_INIT(&vars[1].value, 0); GRN_UINT32_INIT(&vars[2].value, 0); diff --git a/storage/mroonga/vendor/groonga/lib/tokenizers.c b/storage/mroonga/vendor/groonga/lib/tokenizers.c index 3daacce7ef9..e86ad3435b4 100644 --- a/storage/mroonga/vendor/groonga/lib/tokenizers.c +++ b/storage/mroonga/vendor/groonga/lib/tokenizers.c @@ -668,7 +668,7 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) break; } - if (n_characters == ngram_unit) { + if (n_characters == (uint) ngram_unit) { break; } } @@ -676,7 +676,7 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) if (tokenizer->is_overlapping) { status |= GRN_TOKEN_OVERLAP; } - if (n_characters < ngram_unit) { + if (n_characters < (uint) ngram_unit) { status |= GRN_TOKEN_UNMATURED; } tokenizer->is_overlapping = (n_characters > 1); @@ -835,11 +835,14 @@ grn_rc grn_db_init_builtin_tokenizers(grn_ctx *ctx) { grn_obj *obj; - grn_expr_var vars[] = { - {NULL, 0}, - {NULL, 0}, - {NULL, 0} - }; + grn_expr_var vars[3]; + vars[0].name= NULL; + vars[0].name_size= 0; + vars[1].name= NULL; + vars[1].name_size= 0; + vars[2].name= NULL; + vars[2].name_size= 0; + GRN_TEXT_INIT(&vars[0].value, 0); GRN_TEXT_INIT(&vars[1].value, 0); GRN_UINT32_INIT(&vars[2].value, 0); diff --git a/storage/mroonga/vendor/groonga/lib/util.c b/storage/mroonga/vendor/groonga/lib/util.c index 43066c3f515..2b2c24be65d 100644 --- a/storage/mroonga/vendor/groonga/lib/util.c +++ b/storage/mroonga/vendor/groonga/lib/util.c @@ -1155,7 +1155,7 @@ grn_geo_point_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj) point.latitude = latitude; point.longitude = longitude; grn_gton(encoded, &point, sizeof(grn_geo_point)); - for (i = 0; i < sizeof(grn_geo_point); i++) { + for (i = 0; (uint) i < sizeof(grn_geo_point); i++) { if (i != 0) { GRN_TEXT_PUTS(ctx, buf, " "); } diff --git a/storage/mroonga/vendor/groonga/lib/window_function.c b/storage/mroonga/vendor/groonga/lib/window_function.c index 27e8c9c8581..81aba8daa60 100644 --- a/storage/mroonga/vendor/groonga/lib/window_function.c +++ b/storage/mroonga/vendor/groonga/lib/window_function.c @@ -63,7 +63,7 @@ grn_window_next(grn_ctx *ctx, grn_window *window) } if (window->direction == GRN_WINDOW_DIRECTION_ASCENDING) { - if (window->current_index >= window->n_ids) { + if ((unsigned long) window->current_index >= window->n_ids) { GRN_API_RETURN(GRN_ID_NIL); } } else { @@ -250,7 +250,7 @@ grn_expr_is_window_function_call(grn_ctx *ctx, if (call->op != GRN_OP_CALL) { return GRN_FALSE; } - if (call->nargs != (expr->codes_curr - 1)) { + if ((unsigned int) call->nargs != (expr->codes_curr - 1)) { return GRN_FALSE; }