Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/lzma_sdk/C/Delta.c

Issue 6730044: Upgrading lzma_sdk to version 9.20. Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/lzma_sdk/C/Delta.h ('k') | third_party/lzma_sdk/C/LzFind.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* Delta.c -- Delta converter
2 2009-05-26 : Igor Pavlov : Public domain */
3
4 #include "Delta.h"
5
6 void Delta_Init(Byte *state)
7 {
8 unsigned i;
9 for (i = 0; i < DELTA_STATE_SIZE; i++)
10 state[i] = 0;
11 }
12
13 static void MyMemCpy(Byte *dest, const Byte *src, unsigned size)
14 {
15 unsigned i;
16 for (i = 0; i < size; i++)
17 dest[i] = src[i];
18 }
19
20 void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size)
21 {
22 Byte buf[DELTA_STATE_SIZE];
23 unsigned j = 0;
24 MyMemCpy(buf, state, delta);
25 {
26 SizeT i;
27 for (i = 0; i < size;)
28 {
29 for (j = 0; j < delta && i < size; i++, j++)
30 {
31 Byte b = data[i];
32 data[i] = (Byte)(b - buf[j]);
33 buf[j] = b;
34 }
35 }
36 }
37 if (j == delta)
38 j = 0;
39 MyMemCpy(state, buf + j, delta - j);
40 MyMemCpy(state + delta - j, buf, j);
41 }
42
43 void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size)
44 {
45 Byte buf[DELTA_STATE_SIZE];
46 unsigned j = 0;
47 MyMemCpy(buf, state, delta);
48 {
49 SizeT i;
50 for (i = 0; i < size;)
51 {
52 for (j = 0; j < delta && i < size; i++, j++)
53 {
54 buf[j] = data[i] = (Byte)(buf[j] + data[i]);
55 }
56 }
57 }
58 if (j == delta)
59 j = 0;
60 MyMemCpy(state, buf + j, delta - j);
61 MyMemCpy(state + delta - j, buf, j);
62 }
OLDNEW
« no previous file with comments | « third_party/lzma_sdk/C/Delta.h ('k') | third_party/lzma_sdk/C/LzFind.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698