Applies a difference buffer to a specific buffer. The difference buffer was created by
diffCreate.
This function can be useful when updating a file by Internet: all you have to do is send the difference file and apply it when it is received.
MySourceString is string = "abcde"
MyEndString is string = "abcdef"
MyDifferenceBuffer is Buffer
MyDifferenceBuffer = diffCreate(MySourceString, MyEndString, diffText)
MyDecodeBuffer is Buffer
MyDecodeBuffer = diffApply(MySourceString, MyDifferenceBuffer)
// MyDecodeBuffer = MyEndString
SourceBuffer is Buffer
EndBuffer is Buffer
// Load the buffers
// ..
MyDifferenceBuffer is Buffer
MyDifferenceBuffer = diffCreate(SourceBuffer, EndBuffer, diffBinary)
MyDecodeBuffer is Buffer
MyDecodeBuffer = diffApply(SourceBuffer, MyDifferenceBuffer)
Syntax
<Result> = diffApply(<Buffer to process> , <Difference buffer>)
<Result>: Buffer variable
Result once the difference buffer has been applied. This result can correspond to: - the new buffer searched.
- an empty buffer if an error occurred. In this case, the ErrorOccurred variable is set to True.
<Buffer to process>: Buffer variable
Name of buffer to process.
<Difference buffer>: Buffer variable
Name of the difference buffer that must be applied to <Buffer to process>. This buffer was created by diffCreate.
Remarks
Error cases
Applying the difference buffer may fail in the following cases:
- The difference buffer does not use a recognized format.
- <Buffer to process> is not the buffer from which the difference buffer was created.
- The result does not correspond to the buffer that must be found (internal check).
Business / UI classification: Business Logic