Kouhei Sutou
null+****@clear*****
Mon Nov 2 17:55:08 JST 2015
Kouhei Sutou 2015-11-02 17:55:08 +0900 (Mon, 02 Nov 2015) New Revision: 8783592e8ae96833964233793d25a2e85127127a https://github.com/groonga/groonga/commit/8783592e8ae96833964233793d25a2e85127127a Message: pat: add a code to handle initial curr_key value (-1) I want to reduce the condition... Modified files: lib/pat.c Modified: lib/pat.c (+3 -2) =================================================================== --- lib/pat.c 2015-11-02 17:52:52 +0900 (0368309) +++ lib/pat.c 2015-11-02 17:55:08 +0900 (896d813) @@ -37,7 +37,7 @@ #define GRN_PAT_BIN_KEY 0x70000 -#define GRN_PAT_MAX_TOTAL_KEY_SIZE UINT32_MAX +#define GRN_PAT_MAX_TOTAL_KEY_SIZE (UINT32_MAX - 1) typedef struct { grn_id lr[2]; @@ -214,7 +214,8 @@ key_put(grn_ctx *ctx, grn_pat *pat, const uint8_t *key, uint32_t len) uint32_t res, ts; // if (len >= GRN_PAT_SEGMENT_SIZE) { return 0; /* error */ } res = pat->header->curr_key; - if (len > GRN_PAT_MAX_TOTAL_KEY_SIZE - res) { + if (res < GRN_PAT_MAX_TOTAL_KEY_SIZE && + len > GRN_PAT_MAX_TOTAL_KEY_SIZE - res) { char name[GRN_TABLE_MAX_KEY_SIZE]; int name_size; name_size = grn_pat_name(ctx, pat, name, GRN_TABLE_MAX_KEY_SIZE); -------------- next part -------------- HTML����������������������������...Download