Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 28 matching lines...) Expand all Loading... | |
| 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_util.h" | 47 #include "base/files/file_util.h" |
| 48 | 48 |
| 49 namespace base { | |
|
huangs
2016/12/06 18:23:22
You're not using File pointers, and looks like thi
waffles
2016/12/06 19:18:45
Done.
| |
| 50 class File; | |
| 51 } // namespace base | |
| 52 | |
| 49 namespace courgette { | 53 namespace courgette { |
| 50 class SourceStream; | 54 class SourceStream; |
| 51 class SinkStream; | 55 class SinkStream; |
| 52 } // namespace courgette | 56 } // namespace courgette |
| 53 | 57 |
| 54 namespace bsdiff { | 58 namespace bsdiff { |
| 55 | 59 |
| 56 enum BSDiffStatus { | 60 enum BSDiffStatus { |
| 57 OK = 0, | 61 OK = 0, |
| 58 MEM_ERROR = 1, | 62 MEM_ERROR = 1, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 74 // | 78 // |
| 75 BSDiffStatus ApplyBinaryPatch(courgette::SourceStream* old_stream, | 79 BSDiffStatus ApplyBinaryPatch(courgette::SourceStream* old_stream, |
| 76 courgette::SourceStream* patch_stream, | 80 courgette::SourceStream* patch_stream, |
| 77 courgette::SinkStream* new_stream); | 81 courgette::SinkStream* new_stream); |
| 78 | 82 |
| 79 // As above, but simply takes the file paths. | 83 // As above, but simply takes the file paths. |
| 80 BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_stream, | 84 BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_stream, |
| 81 const base::FilePath& patch_stream, | 85 const base::FilePath& patch_stream, |
| 82 const base::FilePath& new_stream); | 86 const base::FilePath& new_stream); |
| 83 | 87 |
| 88 // As above, but simply takes base::Files. | |
|
huangs
2016/12/06 18:10:40
Please move this between the Stream version and Fi
waffles
2016/12/06 19:18:45
Done.
| |
| 89 BSDiffStatus ApplyBinaryPatch(base::File old_stream, | |
| 90 base::File patch_stream, | |
| 91 base::File new_stream); | |
| 92 | |
| 84 // The following declarations are common to the patch-creation and | 93 // The following declarations are common to the patch-creation and |
| 85 // patch-application code. | 94 // patch-application code. |
| 86 | 95 |
| 87 // The patch stream starts with a MBSPatchHeader. | 96 // The patch stream starts with a MBSPatchHeader. |
| 88 typedef struct MBSPatchHeader_ { | 97 typedef struct MBSPatchHeader_ { |
| 89 char tag[8]; // Contains MBS_PATCH_HEADER_TAG. | 98 char tag[8]; // Contains MBS_PATCH_HEADER_TAG. |
| 90 uint32_t slen; // Length of the file to be patched. | 99 uint32_t slen; // Length of the file to be patched. |
| 91 uint32_t scrc32; // CRC32 of the file to be patched. | 100 uint32_t scrc32; // CRC32 of the file to be patched. |
| 92 uint32_t dlen; // Length of the result file. | 101 uint32_t dlen; // Length of the result file. |
| 93 } MBSPatchHeader; | 102 } MBSPatchHeader; |
| 94 | 103 |
| 95 // This is the value for the tag field. Must match length exactly, not counting | 104 // This is the value for the tag field. Must match length exactly, not counting |
| 96 // null at end of string. | 105 // null at end of string. |
| 97 #define MBS_PATCH_HEADER_TAG "GBSDIF42" | 106 #define MBS_PATCH_HEADER_TAG "GBSDIF42" |
| 98 | 107 |
| 99 } // namespace bsdiff | 108 } // namespace bsdiff |
| 100 | 109 |
| 101 #endif // COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_H_ | 110 #endif // COURGETTE_THIRD_PARTY_BSDIFF_BSDIFF_H_ |
| OLD | NEW |