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

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

Issue 2534873005: Sandbox the component updater's patcher utility process. (Closed)
Patch Set: Through #18 Created 4 years 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
OLDNEW
1 // Copyright 2003, 2004 Colin Percival 1 // Copyright 2003, 2004 Colin Percival
2 // All rights reserved 2 // All rights reserved
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted providing that the following conditions 5 // modification, are permitted providing that the following conditions
6 // are met: 6 // are met:
7 // 1. Redistributions of source code must retain the above copyright 7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright 9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the 10 // notice, this list of conditions and the following disclaimer in the
(...skipping 26 matching lines...) Expand all
37 37
38 // Copyright 2016 The Chromium Authors. All rights reserved. 38 // Copyright 2016 The Chromium Authors. All rights reserved.
39 // Use of this source code is governed by a BSD-style license that can be 39 // Use of this source code is governed by a BSD-style license that can be
40 // found in the LICENSE file. 40 // found in the LICENSE file.
41 41
42 #ifndef COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_H_ 42 #ifndef COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_H_
43 #define COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_H_ 43 #define COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_H_
44 44
45 #include <stdint.h> 45 #include <stdint.h>
46 46
47 #include "base/files/file.h"
47 #include "base/files/file_util.h" 48 #include "base/files/file_util.h"
48 49
49 namespace courgette { 50 namespace courgette {
50 class SourceStream; 51 class SourceStream;
51 class SinkStream; 52 class SinkStream;
52 } // namespace courgette 53 } // namespace courgette
53 54
54 namespace bsdiff { 55 namespace bsdiff {
55 56
56 enum BSDiffStatus { 57 enum BSDiffStatus {
(...skipping 12 matching lines...) Expand all
69 courgette::SinkStream* patch_stream); 70 courgette::SinkStream* patch_stream);
70 71
71 // Applies the given patch file to a given source file. This method validates 72 // Applies the given patch file to a given source file. This method validates
72 // the CRC of the original file stored in the patch file, before applying the 73 // the CRC of the original file stored in the patch file, before applying the
73 // patch to it. 74 // patch to it.
74 // 75 //
75 BSDiffStatus ApplyBinaryPatch(courgette::SourceStream* old_stream, 76 BSDiffStatus ApplyBinaryPatch(courgette::SourceStream* old_stream,
76 courgette::SourceStream* patch_stream, 77 courgette::SourceStream* patch_stream,
77 courgette::SinkStream* new_stream); 78 courgette::SinkStream* new_stream);
78 79
80 // As above, but simply takes base::Files.
81 BSDiffStatus ApplyBinaryPatch(base::File old_stream,
82 base::File patch_stream,
83 base::File new_stream);
84
79 // As above, but simply takes the file paths. 85 // As above, but simply takes the file paths.
80 BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_stream, 86 BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_stream,
81 const base::FilePath& patch_stream, 87 const base::FilePath& patch_stream,
82 const base::FilePath& new_stream); 88 const base::FilePath& new_stream);
83 89
84 // The following declarations are common to the patch-creation and 90 // The following declarations are common to the patch-creation and
85 // patch-application code. 91 // patch-application code.
86 92
87 // The patch stream starts with a MBSPatchHeader. 93 // The patch stream starts with a MBSPatchHeader.
88 typedef struct MBSPatchHeader_ { 94 typedef struct MBSPatchHeader_ {
89 char tag[8]; // Contains MBS_PATCH_HEADER_TAG. 95 char tag[8]; // Contains MBS_PATCH_HEADER_TAG.
90 uint32_t slen; // Length of the file to be patched. 96 uint32_t slen; // Length of the file to be patched.
91 uint32_t scrc32; // CRC32 of the file to be patched. 97 uint32_t scrc32; // CRC32 of the file to be patched.
92 uint32_t dlen; // Length of the result file. 98 uint32_t dlen; // Length of the result file.
93 } MBSPatchHeader; 99 } MBSPatchHeader;
94 100
95 // This is the value for the tag field. Must match length exactly, not counting 101 // This is the value for the tag field. Must match length exactly, not counting
96 // null at end of string. 102 // null at end of string.
97 #define MBS_PATCH_HEADER_TAG "GBSDIF42" 103 #define MBS_PATCH_HEADER_TAG "GBSDIF42"
98 104
99 } // namespace bsdiff 105 } // namespace bsdiff
100 106
101 #endif // COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_H_ 107 #endif // COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698