Navigation Menu

Skip to content

Commit

Permalink
ii: increase encode buffer size
Browse files Browse the repository at this point in the history
The previous size isn't enough for large data.
  • Loading branch information
kou committed Feb 21, 2018
1 parent d11e55e commit be43625
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ii.c
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit be43625

Please sign in to comment.