[fpc-pascal] Need help to fix a bug

JoshyFun joshyfun at gmail.com
Sun Jan 24 19:04:19 CET 2010


Hello FPC-Pascal,

Sunday, January 24, 2010, 6:18:22 PM, you wrote:

JvdS> On Wed, 2010-01-13 at 16:13 +0100, JoshyFun wrote:
>> I wish to fix this bug http://bugs.freepascal.org/view.php?id=15460
>> but I had found serious problems to understand how data is structured
>> in the TBufIndex and descendant classes, specially the
>> TDoubleLinkedBufIndex.

JvdS> Oohh... nice... Someone to help me. ;)

I'll try, but I can not promise anything :(

JvdS> Too bad you used such a general topic-name, I almost overlooked it.

For sure the "need help to fix a bug" is not a common topic :) but I
understand that a reference to fcl-db should be included.

I'll answer to this email partially before a more in deep read.

JvdS> during the initial allocation for the data for the records. It's also
JvdS> why this merge-sort algorithm is used. It doesn't need any _additional_
JvdS> space.

Yes I understand the fact that the space is preallocated, but the data
flow in the BuildIndex is wrong in my opinion as in the first place it
copies index 0 over index 1, a simple copy, and them start to
mergesort everything in index 1, it it uses index 1 as a temporal
space to itself. I could had overlooked something but Merge Sort needs
a temporal space to drop data to be copied back or sometimes you will
overwrite data that will be moved again in next step. Something like:

2
1
3

Merging this will render in move "index 1" to position 0, and move
"index 0" to position 1, using itself as a temporal space will render
in:

2 (1) 1  1
1  1 (1) 1
3  3  3  3

Index element 0 has dissapear () shows the moved element in each step.

Anyway I'll take an additional look to the code after reading your in
detail explanation. Thank you for the help.

-- 
Best regards,
 JoshyFun




More information about the fpc-pascal mailing list