# Patchfile

from pandac.PandaModules import Patchfile

Class : Patchfile
Description :

## Inheritance:

Patchfile:

## Methods of Patchfile:

Patchfile (Constructor)
apply
build
getAllowMultifile
getFootprintLength
getProgress
getResultHash
getSourceHash
hasSourceHash
initiate
readHeader
resetFootprintLength
run
setAllowMultifile
setFootprintLength

Patchfile Patchfile::Patchfile(void); Description: Create a patch file and initializes internal data Description: Create patch file with buffer to patch

apply bool Patchfile::apply(Filename &patch_file, Filename &file); Description: Patches the entire file in one call returns true on success and false on error

build bool Patchfile::build(Filename file_orig, Filename file_new, Filename patch_name); Description: This implementation uses the "greedy differencing algorithm" described in the masters thesis "Differential Compression: A Generalized Solution for Binary Files" by Randal C. Burns (p.13). For an original file of size M and a new file of size N, this algorithm is O(M) in space and O(M*N) (worst-case) in time. return false on error

getAllowMultifile bool Patchfile::get_allow_multifile(void); Description:

getFootprintLength int Patchfile::get_footprint_length(void); Description:

getProgress float Patchfile::get_progress(void) const; Filename: patchfile.I Created by: darren, mike (09Jan97) PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. All rights reserved. All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE." #include "config_downloader.h" Description:

getResultHash HashVal const &Patchfile::get_result_hash(void) const; Description: Returns the MD5 hash for the file after the patch has been applied.

getSourceHash HashVal const &Patchfile::get_source_hash(void) const; Description: Returns the MD5 hash for the source file.

hasSourceHash bool Patchfile::has_source_hash(void) const; Description: Returns true if the MD5 hash for the source file is known. (Some early versions of the patch file did not store this information.)

initiate int Patchfile::initiate(Filename const &patch_file, Filename const &file); PATCH FILE APPLY MEMBER FUNCTIONS NOTE: this patch-application functionality unfortunately has to be duplicated in the Installer. It is contained in the file installerApplyPatch.cxx PLEASE MAKE SURE THAT THAT FILE GETS UPDATED IF ANY OF THIS LOGIC CHANGES! (i.e. if the patch file format changes) Description: Set up to apply the patch to the file (original file and patch are destroyed in the process).

readHeader int Patchfile::read_header(Filename const &patch_file); Description: 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.

resetFootprintLength void Patchfile::reset_footprint_length(void); Description:

run int Patchfile::run(void); Description: Perform one buffer's worth of patching Returns EU_ok while patching Returns EU_success when done If error happens will return one of: EU_error_abort : Patching has not been initiated EU_error_file_invalid : file is corrupted EU_error_invalid_checksum : incompatible patch file EU_error_write_file_rename : could not rename file

setAllowMultifile void Patchfile::set_allow_multifile(bool allow_multifile); Description: If this flag is set true, the Patchfile will make a special case for patching Panda Multifiles, if detected, and attempt to patch them on a subfile-by-subfile basis. If this flag is false, the Patchfile will always patch the file on a full-file basis.

setFootprintLength void Patchfile::set_footprint_length(int length); Description: