Compares two buffers and creates a buffer containing the differences between these two buffers.
This difference buffer contains the differences between the former buffer and the new buffer. It can be applied to the less recent buffer to get the new buffer via diffApply
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.
// Compare two buffers
SourceBuffer is Buffer
EndBuffer is Buffer
// Load the buffers
MyDifferenceBuffer is Buffer
MyDifferenceBuffer = diffCreate(SourceBuffer, EndBuffer, diffBinary)
<Result> = diffCreate(<Former Buffer> , <New Buffer> [, <Options> [, <Percentage>]])
<Result>: Buffer variable
Description of differences between the two buffers. This buffer can be applied to the former buffer to get the new buffer via diffApply.
<Former Buffer>: Buffer variable
Name of buffer containing the less recent data.
<New Buffer>: Buffer variable
Name of buffer containing the more recent data.
<Options>: Optional Integer constant (or combination of constants)
Used to choose the algorithm for calculating differences. The available options are:
|diffBinary||Binary comparison of files.|
|diffFilePCS||Binary comparison of files optimized for the files created by WINDEV, WEBDEV and WINDEV Mobile.|
|diffMaxPercentage||Comparison of files with a maximum percentage of differences. |
This constant can be combined with diffBinary, diffFilePCS or diffText. In this case, <Percentage> must be specified.
Caution: this constant must not be used if the buffers are too small.
|diffText||Text comparison (which means line by line) of files.|
<Percentage>: Optional integer
Maximum percentage of differences allowed for creating the difference buffer.
If this percentage is exceeded, the difference buffer is empty and the ErrorOccurred variable is set to True. By default, the value of this parameter corresponds to 50%.
This parameter is taken into account only if the diffMaxPercentage constant was specified.