I sent this by mail to jcw, but it might be more
appropriate on the mailing list.

It seems that c4_Bytes.Modify() sometimes mangles the
data on insertions. I first encountered the problem
using the C++ API, but it is a bit easier to
demonstrate with a python script:

import Mk4py
import random

s = Mk4py.storage()
v = s.getas("v[b:B]")
p = Mk4py.property("B", "b")
v.append()

pystring = v[0].b = "test"

for i in range(20):
    # Create a random range string
    x = random.randrange(10)
    randstring = str(x)*x

    # insert it at a random position in the text
    pos = random.randrange(len(v[0].b))
    print i, "I", pos, randstring
    v.modify(p, 0, randstring, pos, len(randstring))

    # Keep a matching python string
    pystring = pystring[:pos] + randstring +
pystring[pos:]

    if pystring != v[0].b:
        print "ERROR: string mismatch"
        print v[0].b
        print pystring


I seem to start to get errors in the data within the
first 5-10 tries.

I am using metakit 2.4.9.3

Best Regards,
  Arto Stimms


                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to