| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COURGETTE_COURGETTE_H_ | 5 #ifndef COURGETTE_COURGETTE_H_ |
| 6 #define COURGETTE_COURGETTE_H_ | 6 #define COURGETTE_COURGETTE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> // Required to define size_t on GCC | 8 #include <stddef.h> // Required to define size_t on GCC |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 Status ApplyEnsemblePatch(const FilePath::CharType* old_file_name, | 80 Status ApplyEnsemblePatch(const FilePath::CharType* old_file_name, |
| 81 const FilePath::CharType* patch_file_name, | 81 const FilePath::CharType* patch_file_name, |
| 82 const FilePath::CharType* new_file_name); | 82 const FilePath::CharType* new_file_name); |
| 83 | 83 |
| 84 // Generates a patch that will transform the bytes in |old| into the bytes in | 84 // Generates a patch that will transform the bytes in |old| into the bytes in |
| 85 // |target|. | 85 // |target|. |
| 86 // Returns C_OK unless something when wrong (unexpected). | 86 // Returns C_OK unless something when wrong (unexpected). |
| 87 Status GenerateEnsemblePatch(SourceStream* old, SourceStream* target, | 87 Status GenerateEnsemblePatch(SourceStream* old, SourceStream* target, |
| 88 SinkStream* patch); | 88 SinkStream* patch); |
| 89 | 89 |
| 90 // Detects the type of an executable, and returns UNKNOWN if it cannot | 90 // Detects the type of an executable file, and it's length. The length |
| 91 // be parsed. | 91 // may be slightly smaller than some executables (like ELF), but will include |
| 92 ExecutableType DetectExecutableType(const void* buffer, size_t length); | 92 // all bytes the courgette algorithm has special benefit for. |
| 93 // On sucess: |
| 94 // Fill in type and detected_length, and return C_OK. |
| 95 // On failure: |
| 96 // Fill in type with UNKNOWN, detected_length with 0, and |
| 97 // return C_INPUT_NOT_RECOGNIZED |
| 98 Status DetectExecutableType(const void* buffer, size_t length, |
| 99 ExecutableType* type, |
| 100 size_t* detected_length); |
| 93 | 101 |
| 94 // Attempts to detect the type of executable, and parse it with the | 102 // Attempts to detect the type of executable, and parse it with the |
| 95 // appropriate tools, storing the pointer to the AssemblyProgram in |*output|. | 103 // appropriate tools, storing the pointer to the AssemblyProgram in |*output|. |
| 96 // Returns C_OK if successful, otherwise returns an error status and sets | 104 // Returns C_OK if successful, otherwise returns an error status and sets |
| 97 // |*output| to NULL. | 105 // |*output| to NULL. |
| 98 Status ParseDetectedExecutable(const void* buffer, size_t length, | 106 Status ParseDetectedExecutable(const void* buffer, size_t length, |
| 99 AssemblyProgram** output); | 107 AssemblyProgram** output); |
| 100 | 108 |
| 101 // Converts |program| into encoded form, returning it as |*output|. | 109 // Converts |program| into encoded form, returning it as |*output|. |
| 102 // Returns C_OK if succeeded, otherwise returns an error status and | 110 // Returns C_OK if succeeded, otherwise returns an error status and |
| (...skipping 20 matching lines...) Expand all Loading... |
| 123 | 131 |
| 124 // Used to free an EncodedProgram returned by other APIs. | 132 // Used to free an EncodedProgram returned by other APIs. |
| 125 void DeleteEncodedProgram(EncodedProgram* encoded); | 133 void DeleteEncodedProgram(EncodedProgram* encoded); |
| 126 | 134 |
| 127 // Adjusts |program| to look more like |model|. | 135 // Adjusts |program| to look more like |model|. |
| 128 // | 136 // |
| 129 Status Adjust(const AssemblyProgram& model, AssemblyProgram *program); | 137 Status Adjust(const AssemblyProgram& model, AssemblyProgram *program); |
| 130 | 138 |
| 131 } // namespace courgette | 139 } // namespace courgette |
| 132 #endif // COURGETTE_COURGETTE_H_ | 140 #endif // COURGETTE_COURGETTE_H_ |
| OLD | NEW |