[Groonga-commit] groonga/groonga [master] Fixed a bug causing cursor exceed the range in grn_pat_cursor_open_by_id()

Back to archive index

null+****@clear***** null+****@clear*****
2011年 7月 13日 (水) 12:19:58 JST


Daijiro MORI	2011-07-13 03:19:58 +0000 (Wed, 13 Jul 2011)

  New Revision: 7d77fc4fc065e7ff8f7c62a43a99858582eb0f88

  Log:
    Fixed a bug causing cursor exceed the range in grn_pat_cursor_open_by_id()

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+5 -1)
===================================================================
--- lib/pat.c    2011-06-30 11:11:17 +0000 (1e2495a)
+++ lib/pat.c    2011-07-13 03:19:58 +0000 (f979afc)
@@ -2015,7 +2015,11 @@ grn_pat_cursor_open_by_id(grn_ctx *ctx, grn_pat *pat,
       }
     }
   } else {
-    c->curr_rec += dir * offset;
+    if ((dir * (c->tail - c->curr_rec)) < offset) {
+      c->curr_rec = c->tail;
+    } else {
+      c->curr_rec += dir * offset;
+    }
   }
   c->rest = (limit < 0) ? GRN_ID_MAX : limit;
 exit :




Groonga-commit メーリングリストの案内
Back to archive index