[Groonga-commit] groonga/groonga at 0cc43eb [master] Fix a bug that grn_vector_decode() sets wrong offsets in append mode

アーカイブの一覧に戻る

susumu.yata null+****@clear*****
Wed Jul 8 16:08:44 JST 2015


susumu.yata	2015-07-08 16:08:44 +0900 (Wed, 08 Jul 2015)

  New Revision: 0cc43eb3b89a1591bb92e6b628cebac7fab62cc4
  https://github.com/groonga/groonga/commit/0cc43eb3b89a1591bb92e6b628cebac7fab62cc4

  Message:
    Fix a bug that grn_vector_decode() sets wrong offsets in append mode

  Modified files:
    lib/db.c

  Modified: lib/db.c (+4 -5)
===================================================================
--- lib/db.c    2015-07-08 15:47:56 +0900 (e213812)
+++ lib/db.c    2015-07-08 16:08:44 +0900 (0f245d4)
@@ -4634,21 +4634,20 @@ grn_vector_decode(grn_ctx *ctx, grn_obj *v, const char *data, uint32_t data_size
   }
   {
     grn_section *vp;
+    grn_obj *body = grn_vector_body(ctx, v);
+    uint32_t offset = GRN_BULK_VSIZE(body);
     uint32_t o = 0, l, i;
     for (i = n, vp = v->u.v.sections + n0; i; i--, vp++) {
       if (pe <= p) { return GRN_INVALID_ARGUMENT; }
       GRN_B_DEC(l, p);
       vp->length = l;
-      vp->offset = o;
+      vp->offset = offset + o;
       vp->weight = 0;
       vp->domain = 0;
       o += l;
     }
     if (pe < p + o) { return GRN_INVALID_ARGUMENT; }
-    {
-      grn_obj *body = grn_vector_body(ctx, v);
-      grn_bulk_write(ctx, body, (char *)p, o);
-    }
+    grn_bulk_write(ctx, body, (char *)p, o);
     p += o;
     if (p < pe) {
       for (i = n, vp = v->u.v.sections + n0; i; i--, vp++) {
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る