Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
e66dfd18
Commit
e66dfd18
authored
Apr 08, 2002
by
Martin Pool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doc and indent only.
parent
bf2daeaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
23 deletions
+30
-23
generator.c
generator.c
+30
-23
No files found.
generator.c
View file @
e66dfd18
...
...
@@ -157,56 +157,63 @@ static BOOL disable_deltas_p(void)
}
/*
generate a stream of signatures/checksums that describe a buffer
generate approximately one checksum every n bytes
*/
static
struct
sum_struct
*
generate_sums
(
struct
map_struct
*
buf
,
OFF_T
len
,
int
n
)
/**
* Generate a stream of signatures/checksums that describe a buffer.
*
* Generate approximately one checksum every @p n bytes.
*
* @return Newly-allocated sum_struct
**/
static
struct
sum_struct
*
generate_sums
(
struct
map_struct
*
buf
,
OFF_T
len
,
int
n
)
{
int
i
;
struct
sum_struct
*
s
;
int
count
;
int
block_len
=
n
;
int
remainder
=
(
len
%
block_len
);
int
remainder
=
(
len
%
block_len
);
OFF_T
offset
=
0
;
count
=
(
len
+
(
block_len
-
1
))
/
block_len
;
count
=
(
len
+
(
block_len
-
1
))
/
block_len
;
s
=
(
struct
sum_struct
*
)
malloc
(
sizeof
(
*
s
));
if
(
!
s
)
out_of_memory
(
"generate_sums"
);
s
=
(
struct
sum_struct
*
)
malloc
(
sizeof
(
*
s
));
if
(
!
s
)
out_of_memory
(
"generate_sums"
);
s
->
count
=
count
;
s
->
remainder
=
remainder
;
s
->
n
=
n
;
s
->
flength
=
len
;
if
(
count
==
0
)
{
if
(
count
==
0
)
{
s
->
sums
=
NULL
;
return
s
;
}
if
(
verbose
>
3
)
rprintf
(
FINFO
,
"count=%d rem=%d n=%d flength=%.0f
\n
"
,
s
->
count
,
s
->
remainder
,
s
->
n
,(
double
)
s
->
flength
);
rprintf
(
FINFO
,
"count=%d rem=%d n=%d flength=%.0f
\n
"
,
s
->
count
,
s
->
remainder
,
s
->
n
,
(
double
)
s
->
flength
);
s
->
sums
=
(
struct
sum_buf
*
)
malloc
(
sizeof
(
s
->
sums
[
0
])
*
s
->
count
);
if
(
!
s
->
sums
)
out_of_memory
(
"generate_sums"
);
s
->
sums
=
(
struct
sum_buf
*
)
malloc
(
sizeof
(
s
->
sums
[
0
])
*
s
->
count
);
if
(
!
s
->
sums
)
out_of_memory
(
"generate_sums"
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
int
n1
=
MIN
(
len
,
n
);
char
*
map
=
map_ptr
(
buf
,
offset
,
n1
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
int
n1
=
MIN
(
len
,
n
);
char
*
map
=
map_ptr
(
buf
,
offset
,
n1
);
s
->
sums
[
i
].
sum1
=
get_checksum1
(
map
,
n1
);
get_checksum2
(
map
,
n1
,
s
->
sums
[
i
].
sum2
);
s
->
sums
[
i
].
sum1
=
get_checksum1
(
map
,
n1
);
get_checksum2
(
map
,
n1
,
s
->
sums
[
i
].
sum2
);
s
->
sums
[
i
].
offset
=
offset
;
s
->
sums
[
i
].
len
=
n1
;
s
->
sums
[
i
].
i
=
i
;
if
(
verbose
>
3
)
rprintf
(
FINFO
,
"chunk[%d] offset=%.0f len=%d sum1=%08x
\n
"
,
i
,(
double
)
s
->
sums
[
i
].
offset
,
s
->
sums
[
i
].
len
,
s
->
sums
[
i
].
sum1
);
rprintf
(
FINFO
,
"chunk[%d] offset=%.0f len=%d sum1=%08x
\n
"
,
i
,
(
double
)
s
->
sums
[
i
].
offset
,
s
->
sums
[
i
].
len
,
s
->
sums
[
i
].
sum1
);
len
-=
n1
;
offset
+=
n1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment