crypt/crc: Remove unused functions

This commit is contained in:
Martin Piatka
2026-02-26 10:57:26 +01:00
parent 7cd99c6a68
commit 1fdf96848e
2 changed files with 0 additions and 54 deletions

View File

@@ -9,7 +9,6 @@
#include <cstdlib>
#include <cinttypes>
#else
#include <stdbool.h>
#include <stdlib.h> /* For size_t */
#include <stdint.h>
#endif
@@ -26,7 +25,6 @@ extern "C" {
^ ((uint8_t)octet)) & 0xff] ^ ((crc) >> 8))
uint32_t updateCRC32(unsigned char ch, uint32_t crc);
bool crc32file(char *name, uint32_t *crc, long *charcnt);
uint32_t crc32buf(const char *buf, size_t len);

View File

@@ -115,40 +115,6 @@ uint32_t updateCRC32(unsigned char ch, uint32_t crc)
return UPDC32(ch, crc);
}
bool crc32file(char *name, uint32_t *crc, long *charcnt)
{
register FILE *fin;
register uint32_t oldcrc32;
register int c;
oldcrc32 = 0xFFFFFFFF; *charcnt = 0;
#ifdef MSDOS
if ((fin=fopen(name, "rb"))==NULL)
#else
if ((fin=fopen(name, "r"))==NULL)
#endif
{
perror(name);
return false;
}
while ((c=getc(fin))!=EOF)
{
++*charcnt;
oldcrc32 = UPDC32(c, oldcrc32);
}
if (ferror(fin))
{
perror(name);
*charcnt = -1;
}
fclose(fin);
*crc = oldcrc32 = ~oldcrc32;
return true;
}
uint32_t crc32buf_with_oldcrc(const char *buf, size_t len, uint32_t old_crc)
{
register uint32_t oldcrc32;
@@ -167,21 +133,3 @@ uint32_t crc32buf(const char *buf, size_t len)
{
return crc32buf_with_oldcrc(buf, len, 0);
}
#ifdef TEST
main(int argc, char *argv[])
{
uint32_t crc;
long charcnt;
register errors = 0;
while(--argc > 0)
{
errors |= crc32file(*++argv, &crc, &charcnt);
printf("%08lX %7ld %s\n", crc, charcnt, *argv);
}
return(errors != 0);
}
#endif /* TEST */