Brian Kelley wrote:

I was inserting strings of length 2 which was why it worked for me.
Yours were larger.  It turns out that you can't cross the end boundary
when using modify.  So if you are inserting a string of length 10, you
can't insert it into a string of length 9.  Also, if you are inserting
it into a string of length 12, you can only insert at 0 or 1!

Whoa. Good catch and analysis!

The attached change ought to fix this issue. I'll verify this later, but it'll let you proceed for now (or you can use the Python workaround, of course).

-jcw

Index: viewx.cpp
===================================================================
RCS file: /home/cvs/metakit/src/viewx.cpp,v
retrieving revision 1.11
diff -u -p -u -r1.11 viewx.cpp
--- viewx.cpp   23 Nov 2003 01:42:51 -0000      1.11
+++ viewx.cpp   23 Sep 2004 17:49:15 -0000
@@ -581,21 +581,15 @@ bool c4_BytesRef::Modify(const c4_Bytes&
     c4_Handler& h = _cursor._seq->NthHandler(colNum);
     const int n = buf_.Size();
     const t4_i32 limit = off_ + n; // past changed bytes
-    const t4_i32 overshoot = limit - h.ItemSize(_cursor._index);
-
-    if (diff_ < overshoot)
-      diff_ = overshoot;

+      // get rid of an optimization, it was wrong  (2004-09-23)
     c4_Column* col = h.GetNthMemoCol(_cursor._index, true);
     if (col != 0)
     {
       if (diff_ < 0)
         col->Shrink(limit, - diff_);
       else if (diff_ > 0)
-          // insert bytes in the highest possible spot
-          // if a gap is created, it will contain garbage
-        col->Grow(overshoot > 0 ? col->ColSize() :
-               diff_ > n ? off_ : limit - diff_, diff_);
+        col->Grow(off_, diff_);

       col->StoreBytes(off_, buf_);
     }

_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to