[Metakit] c4_Bytes.Modify() mangling data

artost at yahoo.com artost at yahoo.com
Tue Sep 21 14:19:53 CEST 2004


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


More information about the Metakit mailing list