Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wolf3d
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
PocketInsanity
wolf3d
Commits
ef75d7a3
Commit
ef75d7a3
authored
Dec 06, 2003
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CalcFileChecksum now uses a buffer for calculating the checksum.
parent
4320f938
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
wl_main.c
src/wl_main.c
+22
-7
No files found.
src/wl_main.c
View file @
ef75d7a3
...
...
@@ -116,17 +116,32 @@ static void DiskFlopAnim(int x, int y)
static
int32_t
CalcFileChecksum
(
int
fd
,
int
len
)
{
int8_t
buf
[
4096
];
int32_t
cs
;
int
i
;
int8_t
c1
,
c2
;
int
i
,
j
;
int8_t
c1
;
c1
=
ReadInt8
(
fd
);
cs
=
0
;
for
(
i
=
0
;
i
<
len
-
1
;
i
++
)
{
c2
=
ReadInt8
(
fd
);
cs
+=
c1
^
c2
;
c1
=
c2
;
c1
=
ReadInt8
(
fd
);
len
--
;
while
(
len
>
0
)
{
i
=
4096
;
if
(
len
<
i
)
{
i
=
len
;
}
ReadBytes
(
fd
,
buf
,
i
);
for
(
j
=
0
;
j
<
i
;
j
++
)
{
cs
+=
c1
^
buf
[
j
];
c1
=
buf
[
j
];
}
len
-=
4096
;
}
return
cs
;
}
...
...
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