|
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <!-- $Revision$ --> |
3 | | -<!-- Generated by xml_proto.php v2.0. Found in /scripts directory of phpdoc. --> |
4 | 3 | <refentry xml:id="function.xdiff-string-rabdiff" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> |
5 | 4 | <refnamediv> |
6 | 5 | <refname>xdiff_string_rabdiff</refname> |
7 | | - <refpurpose>Make binary diff of two strings using the Rabin's polynomial fingerprinting algorithm</refpurpose> |
| 6 | + <refpurpose> |
| 7 | + Make a binary diff of two strings using the Rabin's polynomial fingerprinting algorithm |
| 8 | + </refpurpose> |
8 | 9 | </refnamediv> |
9 | | - |
| 10 | + |
10 | 11 | <refsect1 role="description"> |
11 | 12 | &reftitle.description; |
12 | 13 | <methodsynopsis> |
13 | | - <type>string</type><methodname>xdiff_string_bdiff</methodname> |
| 14 | + <type>string|false</type><methodname>xdiff_string_rabdiff</methodname> |
14 | 15 | <methodparam><type>string</type><parameter>old_data</parameter></methodparam> |
15 | 16 | <methodparam><type>string</type><parameter>new_data</parameter></methodparam> |
16 | 17 | </methodsynopsis> |
17 | 18 | <para> |
18 | | - Makes a binary diff of two strings and returns the result. |
19 | | - The difference between this function and <function>xdiff_string_bdiff</function> is different |
20 | | - algorithm used which should result in faster execution and smaller diff produced. |
21 | | - This function works with both text and binary data. Resulting patch |
22 | | - can be later applied using <function>xdiff_string_bpatch</function>/<function>xdiff_file_bpatch</function>. |
| 19 | + Makes a binary diff of two strings using the Rabin's polynomial fingerprinting algorithm implemented by |
| 20 | + <link xlink:href="&url.xdiff;">libxdiff</link>. Compared to |
| 21 | + <function>xdiff_string_bdiff</function>, this algorithm generally produces smaller diffs and operates faster, |
| 22 | + while remaining fully compatible with <function>xdiff_string_bpatch</function> and |
| 23 | + <function>xdiff_file_bpatch</function> for applying patches. |
| 24 | + </para> |
| 25 | + <para> |
| 26 | + This function can be used with both text and binary data. The resulting diff data can later be |
| 27 | + applied to recreate the new version from the old one. |
23 | 28 | </para> |
24 | 29 | <para> |
25 | | - For more details about differences between algorithm used please check <link xlink:href="&url.xdiff;">libxdiff</link> |
26 | | - website. |
| 30 | + For further information about the algorithm, see the |
| 31 | + <link xlink:href="https://www.xmailserver.org/xdiff-lib.html">libxdiff documentation</link>. |
27 | 32 | </para> |
28 | 33 | </refsect1> |
29 | 34 |
|
|
35 | 40 | <term><parameter>old_data</parameter></term> |
36 | 41 | <listitem> |
37 | 42 | <para> |
38 | | - First string with binary data. It acts as "old" data. |
| 43 | + The first string containing the "old" binary data. |
39 | 44 | </para> |
40 | 45 | </listitem> |
41 | 46 | </varlistentry> |
42 | 47 | <varlistentry> |
43 | 48 | <term><parameter>new_data</parameter></term> |
44 | 49 | <listitem> |
45 | 50 | <para> |
46 | | - Second string with binary data. It acts as "new" data. |
| 51 | + The second string containing the "new" binary data. |
47 | 52 | </para> |
48 | 53 | </listitem> |
49 | 54 | </varlistentry> |
|
54 | 59 | <refsect1 role="returnvalues"> |
55 | 60 | &reftitle.returnvalues; |
56 | 61 | <para> |
57 | | - Returns string with binary diff containing differences between "old" and "new" |
58 | | - data or &false; if an internal error occurred. |
| 62 | + Returns a binary diff string containing the differences between the old and new data,&return.falseforfailure;. |
| 63 | + </para> |
| 64 | + </refsect1> |
| 65 | + |
| 66 | + <refsect1 role="examples"> |
| 67 | + &reftitle.examples; |
| 68 | + <para> |
| 69 | + <example> |
| 70 | + <title>Creation of a binary diff between two strings</title> |
| 71 | + <programlisting role="php"> |
| 72 | + <![CDATA[ |
| 73 | +<?php |
| 74 | +$old = file_get_contents('file_v1.txt'); |
| 75 | +$new = file_get_contents('file_v2.txt'); |
| 76 | +
|
| 77 | +$diff = xdiff_string_rabdiff($old, $new); |
| 78 | +file_put_contents('patch.rdiff', $diff); |
| 79 | +?> |
| 80 | +]]> |
| 81 | + </programlisting> |
| 82 | + </example> |
59 | 83 | </para> |
60 | 84 | </refsect1> |
61 | 85 |
|
62 | 86 | <refsect1 role="seealso"> |
63 | 87 | &reftitle.seealso; |
64 | 88 | <para> |
65 | 89 | <simplelist> |
| 90 | + <member><function>xdiff_string_bdiff</function></member> |
66 | 91 | <member><function>xdiff_string_bpatch</function></member> |
| 92 | + <member><function>xdiff_file_bpatch</function></member> |
67 | 93 | </simplelist> |
68 | 94 | </para> |
69 | 95 | </refsect1> |
70 | 96 |
|
71 | 97 | </refentry> |
72 | | - |
73 | 98 | <!-- Keep this comment at the end of the file |
74 | 99 | Local variables: |
75 | 100 | mode: sgml |
|
0 commit comments