Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: courgette/third_party/bsdiff.h

Issue 115062: Move Courgette... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « courgette/third_party/README.chromium ('k') | courgette/third_party/bsdiff_apply.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*-
2 * Copyright 2003,2004 Colin Percival
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 *
26 * Changelog:
27 * 2005-04-26 - Define the header as a C structure, add a CRC32 checksum to
28 * the header, and make all the types 32-bit.
29 * --Benjamin Smedberg <benjamin@smedbergs.us>
30 * 2009-03-31 - Change to use Streams. Move CRC code to crc.{h,cc}
31 * Changed status to an enum, removed unused status codes.
32 * --Stephen Adams <sra@chromium.org>
33 */
34
35 #ifndef COURGETTE_BSDIFF_H_
36 #define COURGETTE_BSDIFF_H_
37
38 #include "base/basictypes.h"
39
40 namespace courgette {
41
42 enum BSDiffStatus {
43 OK = 0,
44 MEM_ERROR = 1,
45 CRC_ERROR = 2,
46 READ_ERROR = 3,
47 UNEXPECTED_ERROR = 4
48 };
49
50 class SourceStream;
51 class SinkStream;
52
53 // Creates a binary patch.
54 //
55 BSDiffStatus CreateBinaryPatch(SourceStream* old_stream,
56 SourceStream* new_stream,
57 SinkStream* patch_stream);
58
59 // Applies the given patch file to a given source file. This method validates
60 // the CRC of the original file stored in the patch file, before applying the
61 // patch to it.
62 //
63 BSDiffStatus ApplyBinaryPatch(SourceStream* old_stream,
64 SourceStream* patch_stream,
65 SinkStream* new_stream);
66
67
68 // The following declarations are common to the patch-creation and
69 // patch-application code.
70
71 // The patch stream starts with a MBSPatchHeader.
72 typedef struct MBSPatchHeader_ {
73 char tag[8]; // Contains MBS_PATCH_HEADER_TAG
74 uint32 slen; // Length of the file to be patched.
75 uint32 scrc32; // CRC32 of the file to be patched.
76 uint32 dlen; // Length of the result file.
77 uint32 cblen; // Length of the control block in bytes.
78 uint32 difflen; // Length of the diff block in bytes.
79 uint32 extralen; // Length of the extra block in bytes.
80 } MBSPatchHeader;
81
82 // This is the value for the tag field. Must match length exactly, not counting
83 // null at end of string.
84 #define MBS_PATCH_HEADER_TAG "GBSDIF42"
85
86 } // namespace
87 #endif // COURGETTE_BSDIFF_H_
OLDNEW
« no previous file with comments | « courgette/third_party/README.chromium ('k') | courgette/third_party/bsdiff_apply.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698