Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
63e78d58
Commit
63e78d58
authored
21 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
New table-driven 16-bit CRC calcution function in crc16.c.
parent
50158370
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sbbs3/sbbs.h
+3
-6
3 additions, 6 deletions
src/sbbs3/sbbs.h
src/sbbs3/str_util.c
+2
-35
2 additions, 35 deletions
src/sbbs3/str_util.c
with
5 additions
and
41 deletions
src/sbbs3/sbbs.h
+
3
−
6
View file @
63e78d58
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
0
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
3
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
...
...
@@ -124,6 +124,8 @@
#include
"cmdshell.h"
#include
"ringbuf.h"
/* RingBuf definition */
#include
"client.h"
/* client_t definition */
#include
"crc16.h"
#include
"crc32.h"
/* Synchronet Node Instance class definition */
#ifdef __cplusplus
...
...
@@ -787,7 +789,6 @@ extern "C" {
DLLEXPORT
char
*
DLLCALL
prep_file_desc
(
char
*
str
);
DLLEXPORT
char
*
DLLCALL
strip_ctrl
(
char
*
str
);
DLLEXPORT
char
*
DLLCALL
net_addr
(
net_t
*
net
);
DLLEXPORT
ushort
DLLCALL
crc16
(
char
*
str
);
DLLEXPORT
BOOL
DLLCALL
validattr
(
char
a
);
DLLEXPORT
size_t
DLLCALL
strip_invalid_attr
(
char
*
str
);
DLLEXPORT
ushort
DLLCALL
subject_crc
(
char
*
subj
);
...
...
@@ -919,9 +920,6 @@ extern "C" {
#endif
/* crc32.c */
ulong
crc32
(
char
*
buf
,
ulong
len
);
/* str_util.c */
int
bstrlen
(
char
*
str
);
void
backslashcolon
(
char
*
str
);
...
...
@@ -931,7 +929,6 @@ char * hexplus(uint num, char *str); /* Hex plus for 3 digits up to 9000 */
uint
hptoi
(
char
*
str
);
int
pstrcmp
(
char
**
str1
,
char
**
str2
);
/* Compares pointers to pointers */
int
strsame
(
char
*
str1
,
char
*
str2
);
/* Compares number of same chars */
void
ucrc16
(
uchar
ch
,
ushort
*
rcrc
);
/* nopen.c */
int
nopen
(
char
*
str
,
int
access
);
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/str_util.c
+
2
−
35
View file @
63e78d58
...
...
@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
0
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
3
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
...
...
@@ -426,39 +426,6 @@ uint hptoi(char *str)
return
(
i
);
}
/****************************************************************************/
/* Updates 16-bit "rcrc" with character 'ch' */
/****************************************************************************/
void
ucrc16
(
uchar
ch
,
ushort
*
rcrc
)
{
ushort
i
,
cy
;
uchar
nch
=
ch
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
cy
=*
rcrc
&
0x8000
;
*
rcrc
<<=
1
;
if
(
nch
&
0x80
)
*
rcrc
|=
1
;
nch
<<=
1
;
if
(
cy
)
*
rcrc
^=
0x1021
;
}
}
/****************************************************************************/
/* Returns CRC-16 of ASCIIZ string (not including terminating NULL) */
/****************************************************************************/
ushort
DLLCALL
crc16
(
char
*
str
)
{
int
i
=
0
;
ushort
crc
=
0
;
ucrc16
(
0
,
&
crc
);
while
(
str
[
i
])
ucrc16
(
str
[
i
++
],
&
crc
);
ucrc16
(
0
,
&
crc
);
ucrc16
(
0
,
&
crc
);
return
(
crc
);
}
/****************************************************************************/
/* Returns 1 if a is a valid ctrl-a code, 0 if it isn't. */
/****************************************************************************/
...
...
@@ -530,5 +497,5 @@ ushort DLLCALL subject_crc(char *subj)
SAFECOPY
(
str
,
subj
);
strlwr
(
str
);
return
(
crc16
(
str
));
return
(
crc16
(
str
,
0
));
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment