def calculateDiff(self, base_chunk, new_chunk): result, patch = xdelta3.xd3_encode_memory(new_chunk.get(), base_chunk.get(), self.MAX_SIZE) if result: raise DiffException("Error: '{}'".format(os.strerror(result))) return patch
def Encode(self, ignore1, ignore2, ignore3): r1, encoded = xdelta3.xd3_encode_memory(self.target_data, None, 1000000, 1 << 10) if r1 != 0: raise CommandError('memory', 'encode failed: %s' % r1) #end self.encoded = encoded
def diff_data(source_data, modi_data, buf_len): if len(source_data) == 0 or len(modi_data) == 0: raise IOError("[Error] Not valid data length: %d, %d" % (len(source_data), len(modi_data))) result, patch = xdelta3.xd3_encode_memory(modi_data, source_data, buf_len, xdelta3.XD3_COMPLEVEL_9) if result != 0: msg = "Error while xdelta3: %d" % result raise IOError(msg) return patch '''
def Encode(self, ignore1, ignore2, ignore3): r1, encoded = xdelta3.xd3_encode_memory(self.target_data, None, 1000000, 1<<10) if r1 != 0: raise CommandError('memory', 'encode failed: %s' % r1) #end self.encoded = encoded
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import xdelta3 # the test data section is expected to be len('target') source = 'source source input0 source source' target = 'source source target source source' # # print 'encode: basic ...' result, patch = xdelta3.xd3_encode_memory(target, source, 50) assert result == 0 assert len(patch) < len(source) print 'encode: adler32 ...' result, patch_adler32 = xdelta3.xd3_encode_memory(target, source, 50, xdelta3.XD3_ADLER32) assert result == 0 assert len(patch_adler32) < len(source) assert len(patch_adler32) > len(patch) print 'encode: secondary ...' result, patch_djw = xdelta3.xd3_encode_memory(target, source, 50, xdelta3.XD3_SEC_DJW)
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import xdelta3 # the test data section is expected to be len('target') source = 'source source input0 source source' target = 'source source target source source' # # print 'encode: basic ...' result, patch = xdelta3.xd3_encode_memory(target, source, 50) assert result == 0 assert len(patch) < len(source) print 'encode: adler32 ...' result, patch_adler32 = xdelta3.xd3_encode_memory(target, source, 50, xdelta3.XD3_ADLER32) assert result == 0 assert len(patch_adler32) < len(source) assert len(patch_adler32) > len(patch) print 'encode: secondary ...' result, patch_djw = xdelta3.xd3_encode_memory(target, source, 50, xdelta3.XD3_SEC_DJW)