Kouhei Sutou
null+****@clear*****
Sat Apr 23 22:06:52 JST 2016
Kouhei Sutou 2016-04-23 22:06:52 +0900 (Sat, 23 Apr 2016) New Revision: ad998f18b1e09672d8184257b463cead9b64475c https://github.com/groonga/groonga/commit/ad998f18b1e09672d8184257b463cead9b64475c Message: highlight_html: fix a bug that duplicated text is returned It's occurred when highlighted keyword is occurred 1024 or more times. Modified files: lib/proc/proc_highlight.c Modified: lib/proc/proc_highlight.c (+5 -2) =================================================================== --- lib/proc/proc_highlight.c 2016-04-23 14:28:19 +0900 (589b729) +++ lib/proc/proc_highlight.c 2016-04-23 22:06:52 +0900 (46231d3) @@ -48,6 +48,7 @@ grn_pat_tag_keys(grn_ctx *ctx, grn_obj *keywords, const char *rest; unsigned int i, n_hits; unsigned int previous = 0; + size_t chunk_length; n_hits = grn_pat_scan(ctx, (grn_pat *)keywords, string, string_length, @@ -73,14 +74,16 @@ grn_pat_tag_keys(grn_ctx *ctx, grn_obj *keywords, close_tags[nth_tag], close_tag_lengths[nth_tag]); previous = hits[i].offset + hits[i].length; } - if (string_length - previous > 0) { + + chunk_length = rest - string; + if (chunk_length - previous > 0) { grn_pat_tag_keys_put_original_text(ctx, highlighted, string + previous, string_length - previous, use_html_escape); } - string_length -= rest - string; + string_length -= chunk_length; string = rest; #undef MAX_N_HITS } -------------- next part -------------- HTML����������������������������... 다운로드