22 lines
1.2 KiB
C
22 lines
1.2 KiB
C
#pragma once
|
|
|
|
/**
|
|
* Creates a binary diff patch file between two input files using the BSDIFF43 format and bzip2 compression.
|
|
*
|
|
* @param inputFilename1 The path to the original (old) input file.
|
|
* @param inputFilename2 The path to the new input file to compare against.
|
|
* @param outputFilename The path to the output file where the diff patch will be written.
|
|
* @param compressMethod 0:Not compress 1: bzip 2:zstd
|
|
* @return true if the diff file is created successfully; false otherwise.
|
|
*
|
|
* The function performs the following steps:
|
|
* 1. Validates input and output file names.
|
|
* 2. Reads both input files into memory buffers.
|
|
* 3. Opens the output file for writing and writes the BSDIFF43 header and the new file size.
|
|
* 4. Initializes bzip2 compression for the output file.
|
|
* 5. Uses the bsdiff algorithm to generate the binary diff between the two buffers, writing the result through a bzip2 stream.
|
|
* 6. Finalizes the bzip2 stream and closes all files and buffers.
|
|
* 7. Returns true on success, or false if any error occurs during processing.
|
|
*/
|
|
bool createDiff(const char* inputFilename, const char* inputFilename2, const char* outputFilename, int32_t compressMethod);
|