mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 23:40:26 +00:00
crypt/crc: Remove unused functions
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user