| OLD | NEW |
| 1 /*- | 1 /*- |
| 2 * Copyright 2003,2004 Colin Percival | 2 * Copyright 2003,2004 Colin Percival |
| 3 * All rights reserved | 3 * All rights reserved |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted providing that the following conditions | 6 * modification, are permitted providing that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 * 2009-03-31 - Change to use Streams. Move CRC code to crc.{h,cc} | 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. | 31 * Changed status to an enum, removed unused status codes. |
| 32 * --Stephen Adams <sra@chromium.org> | 32 * --Stephen Adams <sra@chromium.org> |
| 33 * 2013-04-10 - Added wrapper to apply a patch directly to files. | 33 * 2013-04-10 - Added wrapper to apply a patch directly to files. |
| 34 * --Joshua Pawlicki <waffles@chromium.org> | 34 * --Joshua Pawlicki <waffles@chromium.org> |
| 35 */ | 35 */ |
| 36 | 36 |
| 37 #ifndef COURGETTE_BSDIFF_H_ | 37 #ifndef COURGETTE_BSDIFF_H_ |
| 38 #define COURGETTE_BSDIFF_H_ | 38 #define COURGETTE_BSDIFF_H_ |
| 39 | 39 |
| 40 #include "base/basictypes.h" | 40 #include <stdint.h> |
| 41 |
| 41 #include "base/files/file_util.h" | 42 #include "base/files/file_util.h" |
| 42 | 43 |
| 43 namespace courgette { | 44 namespace courgette { |
| 44 | 45 |
| 45 enum BSDiffStatus { | 46 enum BSDiffStatus { |
| 46 OK = 0, | 47 OK = 0, |
| 47 MEM_ERROR = 1, | 48 MEM_ERROR = 1, |
| 48 CRC_ERROR = 2, | 49 CRC_ERROR = 2, |
| 49 READ_ERROR = 3, | 50 READ_ERROR = 3, |
| 50 UNEXPECTED_ERROR = 4, | 51 UNEXPECTED_ERROR = 4, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 72 BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_stream, | 73 BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_stream, |
| 73 const base::FilePath& patch_stream, | 74 const base::FilePath& patch_stream, |
| 74 const base::FilePath& new_stream); | 75 const base::FilePath& new_stream); |
| 75 | 76 |
| 76 // The following declarations are common to the patch-creation and | 77 // The following declarations are common to the patch-creation and |
| 77 // patch-application code. | 78 // patch-application code. |
| 78 | 79 |
| 79 // The patch stream starts with a MBSPatchHeader. | 80 // The patch stream starts with a MBSPatchHeader. |
| 80 typedef struct MBSPatchHeader_ { | 81 typedef struct MBSPatchHeader_ { |
| 81 char tag[8]; // Contains MBS_PATCH_HEADER_TAG | 82 char tag[8]; // Contains MBS_PATCH_HEADER_TAG |
| 82 uint32 slen; // Length of the file to be patched. | 83 uint32_t slen; // Length of the file to be patched. |
| 83 uint32 scrc32; // CRC32 of the file to be patched. | 84 uint32_t scrc32; // CRC32 of the file to be patched. |
| 84 uint32 dlen; // Length of the result file. | 85 uint32_t dlen; // Length of the result file. |
| 85 } MBSPatchHeader; | 86 } MBSPatchHeader; |
| 86 | 87 |
| 87 // This is the value for the tag field. Must match length exactly, not counting | 88 // This is the value for the tag field. Must match length exactly, not counting |
| 88 // null at end of string. | 89 // null at end of string. |
| 89 #define MBS_PATCH_HEADER_TAG "GBSDIF42" | 90 #define MBS_PATCH_HEADER_TAG "GBSDIF42" |
| 90 | 91 |
| 91 } // namespace | 92 } // namespace |
| 92 #endif // COURGETTE_BSDIFF_H_ | 93 #endif // COURGETTE_BSDIFF_H_ |
| OLD | NEW |