c4_Bytes.Modify() mangling data

<[email protected]>
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.