#include <patchfile.h>
Public Member Functions | |
Patchfile (void) | |
Patchfile (PointerTo< Buffer > buffer) | |
~Patchfile (void) | |
bool | build (Filename file_orig, Filename file_new, Filename patch_name) |
int | read_header (const Filename &patch_file) |
Opens the patch file for reading, and gets the header information from the file but does not begin to do any real work. | |
int | initiate (const Filename &patch_file, const Filename &file) |
Set up to apply the patch to the file (original file and patch are destroyed in the process). | |
int | run (void) |
Perform one buffer's worth of patching. | |
bool | apply (Filename &patch_file, Filename &file) |
float | get_progress (void) const |
void | set_footprint_length (int length) |
int | get_footprint_length () |
void | reset_footprint_length () |
bool | has_source_hash () const |
Returns true if the MD5 hash for the source file is known. | |
const HashVal & | get_source_hash () const |
Returns the MD5 hash for the source file. | |
const HashVal & | get_result_hash () const |
Returns the MD5 hash for the file after the patch has been applied. | |
Protected Attributes | |
PointerTo< Buffer > | _buffer |
bool | _initiated |
PN_uint16 | _version_number |
HashVal | _MD5_ofSource |
PN_uint32 | _source_file_length |
HashVal | _MD5_ofResult |
PN_uint32 | _result_file_length |
int | _total_bytes_processed |
ifstream | _patch_stream |
ofstream | _write_stream |
ifstream | _origfile_stream |
Filename | _patch_file |
Filename | _orig_file |
Filename | _temp_file |
Static Protected Attributes | |
const PN_uint32 | _v0_magic_number = 0xfeebfaab |
const PN_uint32 | _magic_number = 0xfeebfaac |
const PN_uint16 | _current_version = 2 |
Private Member Functions | |
int | internal_read_header (const Filename &patch_file) |
Reads the header and leaves the patch file open. | |
void | init (PointerTo< Buffer > buffer) |
void | cleanup (void) |
void | build_hash_link_tables (const char *buffer_orig, PN_uint32 length_orig, PN_uint32 *hash_table, PN_uint32 *link_table) |
PN_uint16 | calc_hash (const char *buffer) |
void | find_longest_match (PN_uint32 new_pos, PN_uint32 ©_pos, PN_uint16 ©_length, PN_uint32 *hash_table, PN_uint32 *link_table, const char *buffer_orig, PN_uint32 length_orig, const char *buffer_new, PN_uint32 length_new) |
PN_uint32 | calc_match_length (const char *buf1, const char *buf2, PN_uint32 max_length) |
void | emit_ADD (ofstream &write_stream, PN_uint16 length, const char *buffer, PN_uint32 ADD_pos) |
void | emit_COPY (ofstream &write_stream, PN_uint16 length, PN_uint32 COPY_pos, PN_uint32 last_copy_pos, PN_uint32 ADD_pos) |
Private Attributes | |
PN_uint32 | _footprint_length |
Static Private Attributes | |
const PN_uint32 | _HASHTABLESIZE = PN_uint32(1) << 16 |
const PN_uint32 | _DEFAULT_FOOTPRINT_LENGTH = 9 |
const PN_uint32 | _NULL_VALUE = PN_uint32(0) - 1 |
const PN_uint32 | _MAX_RUN_LENGTH = (PN_uint32(1) << 16) - 1 |
|
Definition at line 114 of file patchfile.cxx. |
|
Definition at line 127 of file patchfile.cxx. References _version_number. |
|
Definition at line 157 of file patchfile.cxx. References _initiated, _origfile_stream, _patch_stream, and _write_stream. |
|
Definition at line 477 of file patchfile.cxx. References _magic_number, _patch_file, _v0_magic_number, and EU_error_file_invalid. |
|
Definition at line 850 of file patchfile.cxx. References _MD5_ofSource, _source_file_length, and PN_uint32. |
|
Definition at line 625 of file patchfile.cxx. |
|
--> TRIED MD5, was not worth it for the execution-time hit on 800Mhz PC Definition at line 575 of file patchfile.cxx. References _footprint_length, _HASHTABLESIZE, _NULL_VALUE, END_PROFILE, PN_uint16, PN_uint32, START_PROFILE, and t. |
|
Definition at line 725 of file patchfile.cxx. |
|
Definition at line 170 of file patchfile.cxx. References _orig_file, _origfile_stream, _temp_file, EU_error_abort, get_write_error(), NULL, Filename::open_read(), and Filename::set_binary(). |
|
Definition at line 791 of file patchfile.cxx. References Filename::open_read(), Filename::set_binary(), and START_PROFILE. |
|
Definition at line 816 of file patchfile.cxx. |
|
Definition at line 743 of file patchfile.cxx. |
|
Definition at line 63 of file patchfile.I. References _DEFAULT_FOOTPRINT_LENGTH, _footprint_length, and INLINE. |
|
Definition at line 32 of file patchfile.I. |
|
Returns the MD5 hash for the file after the patch has been applied.
Definition at line 121 of file patchfile.I. |
|
Returns the MD5 hash for the source file.
Definition at line 105 of file patchfile.I. |
|
Returns true if the MD5 hash for the source file is known. (Some early versions of the patch file did not store this information.) Definition at line 92 of file patchfile.I. References _MD5_ofResult, and INLINE. |
|
Definition at line 139 of file patchfile.cxx. References _initiated. |
|
Set up to apply the patch to the file (original file and patch are destroyed in the process).
Definition at line 211 of file patchfile.cxx. |
|
Reads the header and leaves the patch file open.
Definition at line 500 of file patchfile.cxx. References _MD5_ofSource. |
|
Opens the patch file for reading, and gets the header information from the file but does not begin to do any real work. This can be used to query the data stored in the patch. Definition at line 276 of file patchfile.cxx. References _buffer, _total_bytes_processed, and _write_stream. |
|
Definition at line 75 of file patchfile.I. References _version_number, and INLINE. |
|
Perform one buffer's worth of patching.
Definition at line 298 of file patchfile.cxx. References _buffer, _patch_stream, _write_stream, and PN_uint32. Referenced by Patcher::~Patcher(). |
|
Definition at line 50 of file patchfile.I. References _footprint_length, and INLINE. |
|
Definition at line 114 of file patchfile.h. Referenced by read_header(), and run(). |
|
Definition at line 99 of file patchfile.cxx. |
|
Definition at line 102 of file patchfile.cxx. Referenced by get_footprint_length(). |
|
Definition at line 111 of file patchfile.h. Referenced by calc_hash(), get_footprint_length(), and set_footprint_length(). |
|
Definition at line 101 of file patchfile.cxx. Referenced by calc_hash(). |
|
Definition at line 117 of file patchfile.h. Referenced by init(), and ~Patchfile(). |
|
Definition at line 95 of file patchfile.cxx. Referenced by apply(). |
|
Definition at line 104 of file patchfile.cxx. |
|
Definition at line 124 of file patchfile.h. Referenced by has_source_hash(). |
|
Definition at line 121 of file patchfile.h. Referenced by build(), and internal_read_header(). |
|
Definition at line 103 of file patchfile.cxx. Referenced by calc_hash(). |
|
Definition at line 133 of file patchfile.h. Referenced by cleanup(). |
|
Definition at line 130 of file patchfile.h. Referenced by cleanup(), and ~Patchfile(). |
|
Definition at line 132 of file patchfile.h. Referenced by apply(). |
|
Definition at line 128 of file patchfile.h. Referenced by run(), and ~Patchfile(). |
|
Definition at line 125 of file patchfile.h. |
|
Definition at line 122 of file patchfile.h. Referenced by build(). |
|
Definition at line 134 of file patchfile.h. Referenced by cleanup(). |
|
Definition at line 126 of file patchfile.h. Referenced by read_header(). |
|
Definition at line 94 of file patchfile.cxx. Referenced by apply(). |
|
Definition at line 119 of file patchfile.h. Referenced by Patchfile(), and reset_footprint_length(). |
|
Definition at line 129 of file patchfile.h. Referenced by read_header(), run(), and ~Patchfile(). |