Changeset: 84a66f61f8fe for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=84a66f61f8fe
Modified Files:
        gdk/gdk_select.c
Branch: default
Log Message:

fixed off-by-one bug in imprints code:

Other than the scan select code, the imprints select code
had cursor "p" "run ahead", which resulted in an off-by-one
error when calculating the maximum required capacity of the
result BAT.
Fixed by aligning the use of cursor "p" in the imprints
select code with the ways it's used in the scan select
code.


diffs (43 lines):

diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -186,26 +186,26 @@ do {                                                      
                    \
        e = i+limit-pr_off;                                                 \
        if (im[icnt] & mask) {                                              \
                if ((im[icnt] & ~innermask) == 0) {                         \
-                       while (o < e && p <= q) {                           \
+                       while (o < e && p < q) {                            \
                                v = src[o];                                 \
                                ADD;                                        \
                                cnt++;                                      \
+                               p++;                                        \
                                CAND;                                       \
-                               p++;                                        \
                        }                                                   \
                } else {                                                    \
-                       while (o < e && p <= q) {                           \
+                       while (o < e && p < q) {                            \
                                v = src[o];                                 \
                                ADD;                                        \
                                cnt += (TEST);                              \
+                               p++;                                        \
                                CAND;                                       \
-                               p++;                                        \
                        }                                                   \
                }                                                           \
        } else {                                                            \
                while (o < e && p <= q) {                                   \
+                       p++;                                                \
                        CAND;                                               \
-                       p++;                                                \
                }                                                           \
        }                                                                   \
 } while (0)
@@ -222,7 +222,6 @@ do {                                                        
                    \
        cchdc_t *d = (cchdc_t *) imprints->dict->base;                      \
        bte rpp    = ATOMelmshift(IMPS_PAGE >> b->T->shift);                \
        CAND;                                                               \
-       p++;                                                                \
        for (i=0, dcnt=0, icnt=0;                                           \
             (dcnt < imprints->dictcnt) && (i < w+pr_off);                  \
             dcnt++) {                                                      \
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to