Commit 163be5fd authored by Monty's avatar Monty Committed by Sergei Golubchik

Remove compiler warnings regarding signed/unsigned compare in mroonga

parent e42130e9
...@@ -1540,7 +1540,7 @@ GRN_API void grn_ctx_recv_handler_set(grn_ctx *, ...@@ -1540,7 +1540,7 @@ GRN_API void grn_ctx_recv_handler_set(grn_ctx *,
} while (0) } while (0)
#define GRN_BULK_POP(obj, value, type, default) do {\ #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)));\ GRN_BULK_INCR_LEN((obj), -(sizeof(type)));\
value = *(type *)(GRN_BULK_CURR(obj));\ value = *(type *)(GRN_BULK_CURR(obj));\
} else {\ } else {\
......
...@@ -529,7 +529,7 @@ typedef struct { ...@@ -529,7 +529,7 @@ typedef struct {
static grn_expr_dfi * static grn_expr_dfi *
grn_expr_dfi_pop(grn_expr *expr) 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_expr_dfi *dfi;
GRN_BULK_INCR_LEN(&expr->dfi, -((ssize_t)(sizeof(grn_expr_dfi)))); GRN_BULK_INCR_LEN(&expr->dfi, -((ssize_t)(sizeof(grn_expr_dfi))));
dfi = (grn_expr_dfi *)GRN_BULK_CURR(&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) ...@@ -1459,7 +1459,7 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
grn_proc_ctx pctx; grn_proc_ctx pctx;
grn_obj *obj = NULL, **args; grn_obj *obj = NULL, **args;
grn_proc *p = (grn_proc *)proc; 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; GRN_API_ENTER;
if (grn_obj_is_selector_only_proc(ctx, proc)) { if (grn_obj_is_selector_only_proc(ctx, proc)) {
char name[GRN_TABLE_MAX_KEY_SIZE]; char name[GRN_TABLE_MAX_KEY_SIZE];
...@@ -3841,7 +3841,7 @@ grn_expr_get_value(grn_ctx *ctx, grn_obj *expr, int offset) ...@@ -3841,7 +3841,7 @@ grn_expr_get_value(grn_ctx *ctx, grn_obj *expr, int offset)
grn_obj *res = NULL; grn_obj *res = NULL;
grn_expr *e = (grn_expr *)expr; grn_expr *e = (grn_expr *)expr;
GRN_API_ENTER; GRN_API_ENTER;
if (0 <= offset && offset < e->values_size) { if (0 <= offset && (uint) offset < e->values_size) {
res = &e->values[offset]; res = &e->values[offset];
} }
GRN_API_RETURN(res); GRN_API_RETURN(res);
...@@ -5386,7 +5386,7 @@ grn_scan_info_build_simple_and_operations(grn_ctx *ctx, ...@@ -5386,7 +5386,7 @@ grn_scan_info_build_simple_and_operations(grn_ctx *ctx,
int i; int i;
int nth_sis; 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 *target = e->codes + i;
grn_expr_code *constant = e->codes + i + 1; grn_expr_code *constant = e->codes + i + 1;
grn_expr_code *operator = e->codes + i + 2; grn_expr_code *operator = e->codes + i + 2;
...@@ -5454,7 +5454,7 @@ grn_scan_info_build_simple_and_operations(grn_ctx *ctx, ...@@ -5454,7 +5454,7 @@ grn_scan_info_build_simple_and_operations(grn_ctx *ctx,
return NULL; 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 *target = e->codes + i;
grn_expr_code *constant = e->codes + i + 1; grn_expr_code *constant = e->codes + i + 1;
grn_expr_code *operator = e->codes + i + 2; grn_expr_code *operator = e->codes + i + 2;
...@@ -5920,7 +5920,7 @@ grn_table_select_index_equal(grn_ctx *ctx, ...@@ -5920,7 +5920,7 @@ grn_table_select_index_equal(grn_ctx *ctx,
if (si->position.specified) { if (si->position.specified) {
while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) { while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) {
if (posting->pos == si->position.start) { if ((int) posting->pos == si->position.start) {
break; break;
} }
} }
...@@ -6037,7 +6037,7 @@ grn_table_select_index_not_equal(grn_ctx *ctx, ...@@ -6037,7 +6037,7 @@ grn_table_select_index_not_equal(grn_ctx *ctx,
if (si->position.specified) { if (si->position.specified) {
while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) { while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) {
if (posting->pos == si->position.start) { if ((int) posting->pos == si->position.start) {
break; break;
} }
} }
...@@ -6561,7 +6561,7 @@ grn_table_select_index_range_column(grn_ctx *ctx, grn_obj *table, ...@@ -6561,7 +6561,7 @@ grn_table_select_index_range_column(grn_ctx *ctx, grn_obj *table,
if (si->position.specified) { if (si->position.specified) {
while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) { while ((posting = grn_ii_cursor_next_pos(ctx, ii_cursor))) {
if (posting->pos == si->position.start) { if ((int) posting->pos == si->position.start) {
break; break;
} }
} }
...@@ -6849,7 +6849,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr, ...@@ -6849,7 +6849,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
grn_id min_id = GRN_ID_NIL; grn_id min_id = GRN_ID_NIL;
v = grn_expr_get_var_by_offset(ctx, (grn_obj *)e, 0); v = grn_expr_get_var_by_offset(ctx, (grn_obj *)e, 0);
GRN_PTR_INIT(&res_stack, GRN_OBJ_VECTOR, GRN_ID_NIL); 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]; scan_info *si = scanner->sis[i];
if (si->flags & SCAN_POP) { if (si->flags & SCAN_POP) {
grn_obj *res_; grn_obj *res_;
...@@ -6897,7 +6897,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr, ...@@ -6897,7 +6897,7 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
i = 0; i = 0;
if (!res_created) { i++; } 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; grn_obj *stacked_res;
stacked_res = *((grn_obj **)GRN_BULK_HEAD(&res_stack) + i); stacked_res = *((grn_obj **)GRN_BULK_HEAD(&res_stack) + i);
grn_obj_close(ctx, stacked_res); grn_obj_close(ctx, stacked_res);
......
...@@ -64,7 +64,8 @@ typedef struct { ...@@ -64,7 +64,8 @@ typedef struct {
static int static int
compute_diff_bit(uint8_t *geo_key1, uint8_t *geo_key2) 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++) { for (i = 0; i < sizeof(grn_geo_point); i++) {
if (geo_key1[i] != geo_key2[i]) { if (geo_key1[i] != geo_key2[i]) {
......
...@@ -2261,7 +2261,7 @@ grn_hash_lock(grn_ctx *ctx, grn_hash *hash, int timeout) ...@@ -2261,7 +2261,7 @@ grn_hash_lock(grn_ctx *ctx, grn_hash *hash, int timeout)
GRN_ATOMIC_ADD_EX(hash->lock, 1, lock); GRN_ATOMIC_ADD_EX(hash->lock, 1, lock);
if (lock) { if (lock) {
GRN_ATOMIC_ADD_EX(hash->lock, -1, 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 % 1000000) && (_ncolls > _ncalls)) {
if (_ncolls < 0 || _ncalls < 0) { if (_ncolls < 0 || _ncalls < 0) {
_ncolls = 0; _ncalls = 0; _ncolls = 0; _ncalls = 0;
...@@ -3350,7 +3350,7 @@ grn_hash_sort(grn_ctx *ctx, grn_hash *hash, ...@@ -3350,7 +3350,7 @@ grn_hash_sort(grn_ctx *ctx, grn_hash *hash,
return 0; 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; */ /* hash->limit = limit; */
if (optarg) { if (optarg) {
int dir = (optarg->flags & GRN_TABLE_SORT_DESC); int dir = (optarg->flags & GRN_TABLE_SORT_DESC);
......
This diff is collapsed.
...@@ -66,7 +66,8 @@ grn_index_column_build_call_hook(grn_ctx *ctx, grn_obj *obj, ...@@ -66,7 +66,8 @@ grn_index_column_build_call_hook(grn_ctx *ctx, grn_obj *obj,
grn_obj oldvalue; grn_obj oldvalue;
/* todo : grn_proc_ctx_open() */ /* todo : grn_proc_ctx_open() */
grn_obj id_, flags_; 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_TEXT_INIT(&oldvalue, 0);
GRN_UINT32_INIT(&id_, 0); GRN_UINT32_INIT(&id_, 0);
GRN_UINT32_INIT(&flags_, 0); GRN_UINT32_INIT(&flags_, 0);
......
...@@ -526,7 +526,7 @@ grn_io_detect_type(grn_ctx *ctx, const char *path) ...@@ -526,7 +526,7 @@ grn_io_detect_type(grn_ctx *ctx, const char *path)
grn_open(fd, path, O_RDONLY | GRN_OPEN_FLAG_BINARY); grn_open(fd, path, O_RDONLY | GRN_OPEN_FLAG_BINARY);
if (fd != -1) { if (fd != -1) {
struct stat s; 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)) == if (grn_read(fd, &h, sizeof(struct _grn_io_header)) ==
sizeof(struct _grn_io_header)) { sizeof(struct _grn_io_header)) {
if (!memcmp(h.idstr, GRN_IO_IDSTR, GRN_IO_IDSTR_LEN)) { 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) ...@@ -593,7 +593,7 @@ grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode)
grn_close(fd); grn_close(fd);
return NULL; 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, ERR(GRN_INCOMPATIBLE_FILE_FORMAT,
"[io][open] file size is too small: " "[io][open] file size is too small: "
"<%" GRN_FMT_INT64D ">(required: >= %" GRN_FMT_SIZE "): <%s>", "<%" GRN_FMT_INT64D ">(required: >= %" GRN_FMT_SIZE "): <%s>",
...@@ -707,7 +707,7 @@ grn_io_close(grn_ctx *ctx, grn_io *io) ...@@ -707,7 +707,7 @@ grn_io_close(grn_ctx *ctx, grn_io *io)
segment_size = io->header->segment_size; segment_size = io->header->segment_size;
file_size = grn_io_compute_file_size(io->header->version); file_size = grn_io_compute_file_size(io->header->version);
segments_per_file = file_size / segment_size; 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; grn_io_mapinfo *mi;
mi = &(io->maps[i]); mi = &(io->maps[i]);
if (mi->map) { if (mi->map) {
...@@ -726,7 +726,7 @@ grn_io_close(grn_ctx *ctx, grn_io *io) ...@@ -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), GRN_MUNMAP(ctx, &grn_gctx, io, (io->fis ? &io->fis->fmo : NULL),
io->fis, io->header, io->base); io->fis, io->header, io->base);
if (io->fis) { if (io->fis) {
int i; uint i;
for (i = 0; i < max_nfiles; i++) { for (i = 0; i < max_nfiles; i++) {
fileinfo *fi = &(io->fis[i]); fileinfo *fi = &(io->fis[i]);
grn_fileinfo_close(ctx, fi); grn_fileinfo_close(ctx, fi);
...@@ -797,7 +797,7 @@ grn_io_n_files(grn_ctx *ctx, grn_io *io) ...@@ -797,7 +797,7 @@ grn_io_n_files(grn_ctx *ctx, grn_io *io)
grn_rc grn_rc
grn_io_size(grn_ctx *ctx, grn_io *io, uint64_t *size) grn_io_size(grn_ctx *ctx, grn_io *io, uint64_t *size)
{ {
int fno; uint32_t fno;
struct stat s; struct stat s;
uint64_t tsize = 0; uint64_t tsize = 0;
char buffer[PATH_MAX]; 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, ...@@ -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; *value_len = 0;
return GRN_NO_MEMORY_AVAILABLE; return GRN_NO_MEMORY_AVAILABLE;
} }
if (pos + size > file_size) { if ((unsigned long) (pos + size) > file_size) {
rest = pos + size - file_size; rest = pos + size - file_size;
size = file_size - pos; size = file_size - pos;
} }
...@@ -1026,7 +1026,7 @@ grn_io_write_ja(grn_io *io, grn_ctx *ctx, uint32_t key, ...@@ -1026,7 +1026,7 @@ grn_io_write_ja(grn_io *io, grn_ctx *ctx, uint32_t key,
fileinfo *fi = &io->fis[fno]; fileinfo *fi = &io->fis[fno];
off_t base = fno ? 0 : io->base - (uint64_t)segment_size * io->base_seg; 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; 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; rest = pos + size - file_size;
size = file_size - pos; size = file_size - pos;
} }
...@@ -1303,7 +1303,7 @@ grn_io_expire(grn_ctx *ctx, grn_io *io, int count_thresh, uint32_t limit) ...@@ -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; uint32_t nref, nmaps, *pnref = &io->nref;
GRN_ATOMIC_ADD_EX(pnref, 1, 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; uint32_t i = io->header->n_arrays;
grn_io_array_spec *array_specs = (grn_io_array_spec *)io->user_header; 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) ...@@ -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; grn_io_mapinfo *info = io->maps;
for (m = io->max_map_seg; n < limit && m; info++, m--) { 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; uint32_t nmaps, nref, *pnref = &info->nref;
GRN_ATOMIC_ADD_EX(pnref, 1, 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, GRN_MUNMAP(ctx, &grn_gctx, io, &info->fmo, NULL,
info->map, io->header->segment_size); info->map, io->header->segment_size);
GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps); GRN_ATOMIC_ADD_EX(&io->nmaps, -1, nmaps);
...@@ -1395,7 +1395,7 @@ grn_io_lock(grn_ctx *ctx, grn_io *io, int timeout) ...@@ -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(%s) collisions(%d/%d): lock failed %d times",
io->path, _ncolls, _ncalls, count_log_border); 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, GRN_LOG(ctx, GRN_LOG_WARNING,
"[DB Locked] time out(%d): io(%s) collisions(%d/%d)", "[DB Locked] time out(%d): io(%s) collisions(%d/%d)",
timeout, io->path, _ncolls, _ncalls); timeout, io->path, _ncolls, _ncalls);
...@@ -2166,7 +2166,7 @@ inline static grn_rc ...@@ -2166,7 +2166,7 @@ inline static grn_rc
grn_pread(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset) grn_pread(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset)
{ {
ssize_t r = pread(fi->fd, buf, count, offset); ssize_t r = pread(fi->fd, buf, count, offset);
if (r != count) { if (r != (ssize_t) count) {
if (r == -1) { if (r == -1) {
SERR("pread"); SERR("pread");
} else { } else {
...@@ -2184,7 +2184,7 @@ inline static grn_rc ...@@ -2184,7 +2184,7 @@ inline static grn_rc
grn_pwrite(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset) grn_pwrite(grn_ctx *ctx, fileinfo *fi, void *buf, size_t count, off_t offset)
{ {
ssize_t r = pwrite(fi->fd, buf, count, offset); ssize_t r = pwrite(fi->fd, buf, count, offset);
if (r != count) { if (r != (ssize_t) count) {
if (r == -1) { if (r == -1) {
SERR("pwrite"); SERR("pwrite");
} else { } else {
......
...@@ -468,7 +468,8 @@ bracket_close(grn_ctx *ctx, grn_loader *loader) ...@@ -468,7 +468,8 @@ bracket_close(grn_ctx *ctx, grn_loader *loader)
} }
for (i = 0; i < nvalues; i++, value = values_next(ctx, value)) { 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. */ /* Skip _id and _key, because it's already used to get id. */
continue; continue;
} }
...@@ -532,7 +533,7 @@ brace_close(grn_ctx *ctx, grn_loader *loader) ...@@ -532,7 +533,7 @@ brace_close(grn_ctx *ctx, grn_loader *loader)
GRN_ASSERT(value->header.domain == GRN_JSON_LOAD_OPEN_BRACE); GRN_ASSERT(value->header.domain == GRN_JSON_LOAD_OPEN_BRACE);
GRN_UINT32_SET(ctx, value_begin, loader->values_size - begin - 1); GRN_UINT32_SET(ctx, value_begin, loader->values_size - begin - 1);
value_begin++; 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; return;
} }
if (!loader->table) { if (!loader->table) {
......
...@@ -495,9 +495,9 @@ grn_query_log_flags_parse(const char *string, ...@@ -495,9 +495,9 @@ grn_query_log_flags_parse(const char *string,
} }
#define CHECK_FLAG(name) \ #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) && \ (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] == '|') || \
(string[sizeof(#name) - 1] == ' '))) { \ (string[sizeof(#name) - 1] == ' '))) { \
*flags |= GRN_QUERY_LOG_ ## name; \ *flags |= GRN_QUERY_LOG_ ## name; \
......
...@@ -32,9 +32,10 @@ grn_normalizer_register(grn_ctx *ctx, ...@@ -32,9 +32,10 @@ grn_normalizer_register(grn_ctx *ctx,
grn_proc_func *next, grn_proc_func *next,
grn_proc_func *fin) grn_proc_func *fin)
{ {
grn_expr_var vars[] = { grn_expr_var vars[1];
{ NULL, 0 } vars[0].name= 0;
}; vars[0].name_size= 0;
GRN_PTR_INIT(&vars[0].value, 0, GRN_ID_NIL); GRN_PTR_INIT(&vars[0].value, 0, GRN_ID_NIL);
if (name_length < 0) { if (name_length < 0) {
......
...@@ -168,31 +168,31 @@ grn_operator_to_exec_func(grn_operator op) ...@@ -168,31 +168,31 @@ grn_operator_to_exec_func(grn_operator op)
#define DO_EQ_SUB do {\ #define DO_EQ_SUB do {\
switch (y->header.domain) {\ switch (y->header.domain) {\
case GRN_DB_INT8 :\ case GRN_DB_INT8 :\
r = (x_ == GRN_INT8_VALUE(y));\ r = ((unsigned char) x_ == (unsigned char) GRN_INT8_VALUE(y)); \
break;\ break;\
case GRN_DB_UINT8 :\ case GRN_DB_UINT8 :\
r = (x_ == GRN_UINT8_VALUE(y));\ r = (x_ == GRN_UINT8_VALUE(y));\
break;\ break;\
case GRN_DB_INT16 :\ case GRN_DB_INT16 :\
r = (x_ == GRN_INT16_VALUE(y));\ r = ((int) x_ == (int) GRN_INT16_VALUE(y)); \
break;\ break;\
case GRN_DB_UINT16 :\ case GRN_DB_UINT16 :\
r = (x_ == GRN_UINT16_VALUE(y));\ r = (x_ == GRN_UINT16_VALUE(y));\
break;\ break;\
case GRN_DB_INT32 :\ case GRN_DB_INT32 :\
r = (x_ == GRN_INT32_VALUE(y));\ r = ((int) x_ == (int) GRN_INT32_VALUE(y)); \
break;\ break;\
case GRN_DB_UINT32 :\ case GRN_DB_UINT32 :\
r = (x_ == GRN_UINT32_VALUE(y));\ r = ((uint) x_ == GRN_UINT32_VALUE(y)); \
break;\ break;\
case GRN_DB_INT64 :\ case GRN_DB_INT64 :\
r = (x_ == GRN_INT64_VALUE(y));\ r = ((long long) x_ == GRN_INT64_VALUE(y)); \
break;\ break;\
case GRN_DB_TIME :\ case GRN_DB_TIME :\
r = (GRN_TIME_PACK(x_,0) == GRN_INT64_VALUE(y));\ r = (GRN_TIME_PACK(x_,0) == GRN_INT64_VALUE(y));\
break;\ break;\
case GRN_DB_UINT64 :\ case GRN_DB_UINT64 :\
r = (x_ == GRN_UINT64_VALUE(y));\ r = ((unsigned long long) x_ == GRN_UINT64_VALUE(y)); \
break;\ break;\
case GRN_DB_FLOAT :\ case GRN_DB_FLOAT :\
r = ((x_ <= GRN_FLOAT_VALUE(y)) && (x_ >= GRN_FLOAT_VALUE(y)));\ r = ((x_ <= GRN_FLOAT_VALUE(y)) && (x_ >= GRN_FLOAT_VALUE(y)));\
...@@ -203,7 +203,7 @@ grn_operator_to_exec_func(grn_operator op) ...@@ -203,7 +203,7 @@ grn_operator_to_exec_func(grn_operator op)
{\ {\
const char *p_ = GRN_TEXT_VALUE(y);\ const char *p_ = GRN_TEXT_VALUE(y);\
int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\ int i_ = grn_atoi(p_, p_ + GRN_TEXT_LEN(y), NULL);\
r = (x_ == i_);\ r = ((int) x_ == i_); \
}\ }\
break;\ break;\
default :\ default :\
...@@ -271,10 +271,10 @@ grn_operator_to_exec_func(grn_operator op) ...@@ -271,10 +271,10 @@ grn_operator_to_exec_func(grn_operator op)
break;\ break;\
case GRN_DB_INT64 :\ case GRN_DB_INT64 :\
case GRN_DB_TIME :\ case GRN_DB_TIME :\
r = (x_ == GRN_INT64_VALUE(y));\ r = ((long long) x_ == GRN_INT64_VALUE(y)); \
break;\ break;\
case GRN_DB_UINT64 :\ case GRN_DB_UINT64 :\
r = (x_ == GRN_UINT64_VALUE(y));\ r = ((unsigned long long) x_ == GRN_UINT64_VALUE(y)); \
break;\ break;\
case GRN_DB_FLOAT :\ case GRN_DB_FLOAT :\
r = (x_ == GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\ 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) ...@@ -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));\ r = (x_ op (uint8_t)(GRN_BOOL_VALUE(y) ? 1 : 0));\
break;\ break;\
case GRN_DB_INT8 :\ case GRN_DB_INT8 :\
r = (x_ op GRN_INT8_VALUE(y));\ r = ((signed char) x_ op GRN_INT8_VALUE(y)); \
break;\ break;\
case GRN_DB_UINT8 :\ case GRN_DB_UINT8 :\
r = (x_ op GRN_UINT8_VALUE(y));\ r = ((unsigned char) x_ op GRN_UINT8_VALUE(y)); \
break;\ break;\
case GRN_DB_INT16 :\ case GRN_DB_INT16 :\
r = (x_ op GRN_INT16_VALUE(y));\ r = ((short) x_ op GRN_INT16_VALUE(y)); \
break;\ break;\
case GRN_DB_UINT16 :\ case GRN_DB_UINT16 :\
r = (x_ op GRN_UINT16_VALUE(y));\ r = ((unsigned short) x_ op GRN_UINT16_VALUE(y)); \
break;\ break;\
case GRN_DB_INT32 :\ case GRN_DB_INT32 :\
r = (x_ op GRN_INT32_VALUE(y));\ r = ((int) x_ op GRN_INT32_VALUE(y)); \
break;\ break;\
case GRN_DB_UINT32 :\ case GRN_DB_UINT32 :\
r = (x_ op GRN_UINT32_VALUE(y));\ r = ((uint) x_ op GRN_UINT32_VALUE(y)); \
break;\ break;\
case GRN_DB_INT64 :\ case GRN_DB_INT64 :\
r = (x_ op GRN_INT64_VALUE(y));\ r = ((long long) x_ op GRN_INT64_VALUE(y)); \
break;\ break;\
case GRN_DB_TIME :\ case GRN_DB_TIME :\
r = (GRN_TIME_PACK(x_,0) op GRN_INT64_VALUE(y));\ r = (GRN_TIME_PACK(x_,0) op GRN_INT64_VALUE(y));\
break;\ break;\
case GRN_DB_UINT64 :\ case GRN_DB_UINT64 :\
r = (x_ op GRN_UINT64_VALUE(y));\ r = ((unsigned long long) x_ op GRN_UINT64_VALUE(y)); \
break;\ break;\
case GRN_DB_FLOAT :\ case GRN_DB_FLOAT :\
r = (x_ op GRN_FLOAT_VALUE(y));\ 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) ...@@ -552,10 +552,10 @@ grn_operator_exec_not_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y)
break;\ break;\
case GRN_DB_INT64 :\ case GRN_DB_INT64 :\
case GRN_DB_TIME :\ case GRN_DB_TIME :\
r = (x_ op GRN_INT64_VALUE(y));\ r = ((long long) x_ op GRN_INT64_VALUE(y)); \
break;\ break;\
case GRN_DB_UINT64 :\ case GRN_DB_UINT64 :\
r = (x_ op GRN_UINT64_VALUE(y));\ r = ((unsigned long long) x_ op GRN_UINT64_VALUE(y)); \
break;\ break;\
case GRN_DB_FLOAT :\ case GRN_DB_FLOAT :\
r = (x_ op GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\ r = (x_ op GRN_TIME_PACK(GRN_FLOAT_VALUE(y), 0));\
......
...@@ -774,7 +774,7 @@ grn_text_atoj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, ...@@ -774,7 +774,7 @@ grn_text_atoj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
} }
if (a->next) { if (a->next) {
a = 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)); id = *((grn_id *)GRN_BULK_HEAD(&buf));
} else { } else {
id = GRN_ID_NIL; id = GRN_ID_NIL;
......
This diff is collapsed.
...@@ -479,6 +479,12 @@ void ...@@ -479,6 +479,12 @@ void
grn_proc_init_column_rename(grn_ctx *ctx) grn_proc_init_column_rename(grn_ctx *ctx)
{ {
grn_expr_var vars[3]; 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[0]), "table", -1);
grn_plugin_expr_var_init(ctx, &(vars[1]), "name", -1); grn_plugin_expr_var_init(ctx, &(vars[1]), "name", -1);
......
...@@ -58,7 +58,7 @@ grn_scanner_close(grn_ctx *ctx, grn_scanner *scanner) ...@@ -58,7 +58,7 @@ grn_scanner_close(grn_ctx *ctx, grn_scanner *scanner)
} }
if (scanner->sis) { if (scanner->sis) {
int i; uint i;
for (i = 0; i < scanner->n_sis; i++) { for (i = 0; i < scanner->n_sis; i++) {
grn_scan_info_close(ctx, scanner->sis[i]); grn_scan_info_close(ctx, scanner->sis[i]);
} }
......
...@@ -756,7 +756,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id, ...@@ -756,7 +756,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id,
if (SEGMENTS_AT(ja, i)) { if (SEGMENTS_AT(ja, i)) {
j = i; j = i;
} else { } else {
if (i == j + n) { if (i == (uint) (j + n)) {
j++; j++;
addr = grn_io_win_map(ja->io, ctx, iw, j, 0, element_size, grn_io_wronly); addr = grn_io_win_map(ja->io, ctx, iw, j, 0, element_size, grn_io_wronly);
if (!addr) { if (!addr) {
...@@ -764,7 +764,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id, ...@@ -764,7 +764,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id,
return GRN_NO_MEMORY_AVAILABLE; return GRN_NO_MEMORY_AVAILABLE;
} }
EHUGE_ENC(einfo, j, element_size); 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); grn_io_unlock(ja->io);
return GRN_SUCCESS; return GRN_SUCCESS;
} }
...@@ -862,7 +862,7 @@ grn_ja_alloc(grn_ctx *ctx, grn_ja *ja, grn_id id, ...@@ -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]; vp = &ja->header->free_elements[m - JA_W_EINFO];
if (!vp->seg) { if (!vp->seg) {
int i = 0; uint i = 0;
while (SEGMENTS_AT(ja, i)) { while (SEGMENTS_AT(ja, i)) {
if (++i >= JA_N_DSEGMENTS) { if (++i >= JA_N_DSEGMENTS) {
grn_io_unlock(ja->io); grn_io_unlock(ja->io);
......
...@@ -292,11 +292,13 @@ grn_tokenizer_register(grn_ctx *ctx, const char *plugin_name_ptr, ...@@ -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 *init, grn_proc_func *next,
grn_proc_func *fin) grn_proc_func *fin)
{ {
grn_expr_var vars[] = { grn_expr_var vars[3];
{ NULL, 0 }, vars[0].name= NULL;
{ NULL, 0 }, vars[0].name_size= 0;
{ NULL, 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[0].value, 0);
GRN_TEXT_INIT(&vars[1].value, 0); GRN_TEXT_INIT(&vars[1].value, 0);
GRN_UINT32_INIT(&vars[2].value, 0); GRN_UINT32_INIT(&vars[2].value, 0);
......
...@@ -668,7 +668,7 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) ...@@ -668,7 +668,7 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
break; break;
} }
if (n_characters == ngram_unit) { if (n_characters == (uint) ngram_unit) {
break; break;
} }
} }
...@@ -676,7 +676,7 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) ...@@ -676,7 +676,7 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
if (tokenizer->is_overlapping) { if (tokenizer->is_overlapping) {
status |= GRN_TOKEN_OVERLAP; status |= GRN_TOKEN_OVERLAP;
} }
if (n_characters < ngram_unit) { if (n_characters < (uint) ngram_unit) {
status |= GRN_TOKEN_UNMATURED; status |= GRN_TOKEN_UNMATURED;
} }
tokenizer->is_overlapping = (n_characters > 1); tokenizer->is_overlapping = (n_characters > 1);
...@@ -835,11 +835,14 @@ grn_rc ...@@ -835,11 +835,14 @@ grn_rc
grn_db_init_builtin_tokenizers(grn_ctx *ctx) grn_db_init_builtin_tokenizers(grn_ctx *ctx)
{ {
grn_obj *obj; grn_obj *obj;
grn_expr_var vars[] = { grn_expr_var vars[3];
{NULL, 0}, vars[0].name= NULL;
{NULL, 0}, vars[0].name_size= 0;
{NULL, 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[0].value, 0);
GRN_TEXT_INIT(&vars[1].value, 0); GRN_TEXT_INIT(&vars[1].value, 0);
GRN_UINT32_INIT(&vars[2].value, 0); GRN_UINT32_INIT(&vars[2].value, 0);
......
...@@ -1155,7 +1155,7 @@ grn_geo_point_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj) ...@@ -1155,7 +1155,7 @@ grn_geo_point_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
point.latitude = latitude; point.latitude = latitude;
point.longitude = longitude; point.longitude = longitude;
grn_gton(encoded, &point, sizeof(grn_geo_point)); 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) { if (i != 0) {
GRN_TEXT_PUTS(ctx, buf, " "); GRN_TEXT_PUTS(ctx, buf, " ");
} }
......
...@@ -63,7 +63,7 @@ grn_window_next(grn_ctx *ctx, grn_window *window) ...@@ -63,7 +63,7 @@ grn_window_next(grn_ctx *ctx, grn_window *window)
} }
if (window->direction == GRN_WINDOW_DIRECTION_ASCENDING) { 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); GRN_API_RETURN(GRN_ID_NIL);
} }
} else { } else {
...@@ -250,7 +250,7 @@ grn_expr_is_window_function_call(grn_ctx *ctx, ...@@ -250,7 +250,7 @@ grn_expr_is_window_function_call(grn_ctx *ctx,
if (call->op != GRN_OP_CALL) { if (call->op != GRN_OP_CALL) {
return GRN_FALSE; return GRN_FALSE;
} }
if (call->nargs != (expr->codes_curr - 1)) { if ((unsigned int) call->nargs != (expr->codes_curr - 1)) {
return GRN_FALSE; return GRN_FALSE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment