[Groonga-commit] groonga/groonga at be43625 [master] ii: increase encode buffer size

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Feb 21 12:04:53 JST 2018


Kouhei Sutou	2018-02-21 12:04:53 +0900 (Wed, 21 Feb 2018)

  New Revision: be43625add91de0055f2b056b6f0a6c91861d145
  https://github.com/groonga/groonga/commit/be43625add91de0055f2b056b6f0a6c91861d145

  Message:
    ii: increase encode buffer size
    
    The previous size isn't enough for large data.

  Modified files:
    lib/ii.c

  Modified: lib/ii.c (+3 -1)
===================================================================
--- lib/ii.c    2018-02-21 11:55:09 +0900 (e56116ff5)
+++ lib/ii.c    2018-02-21 12:04:53 +0900 (520bae2ef)
@@ -2936,6 +2936,7 @@ chunk_merge(grn_ctx *ctx, grn_ii *ii, buffer *sb, buffer_term *bt,
   if (ctx->rc == GRN_SUCCESS) {
     int j = 0;
     uint8_t *enc;
+    uint32_t encsize_probably_enough;
     uint32_t encsize;
     uint32_t np = posp - dv[ii->n_elements - 1].data;
     uint32_t f_s = (ndf < 3) ? 0 : USE_P_ENC;
@@ -2952,7 +2953,8 @@ chunk_merge(grn_ctx *ctx, grn_ii *ii, buffer *sb, buffer_term *bt,
       uint32_t f_p = ((np < 32) || (np <= (spos >> 13))) ? 0 : USE_P_ENC;
       dv[j].data_size = np; dv[j].flags = f_p|ODD;
     }
-    if ((enc = GRN_MALLOC((ndf * 4 + np) * 2))) {
+    encsize_probably_enough = (ndf * 4 + np) * 3;
+    if ((enc = GRN_MALLOC(encsize_probably_enough))) {
       encsize = grn_p_encv(ctx, dv, ii->n_elements, enc);
       chunk_flush(ctx, ii, cinfo, enc, encsize);
       if (ctx->rc == GRN_SUCCESS) {
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180221/7b7ba60f/attachment.htm 



More information about the Groonga-commit mailing list
Back to archive index