ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/uulib/crc32.h
(Generate patch)

Comparing Convert-UUlib/uulib/crc32.h (file contents):
Revision 1.1.2.1 by root, Sun Oct 13 13:10:55 2002 UTC vs.
Revision 1.6 by root, Sat Sep 24 10:55:41 2022 UTC

1#ifndef __CRC32_H__ 1#ifndef __CRC32_H__
2#define __CRC32_H__ 2#define __CRC32_H__
3 3
4#ifndef _ANSI_ARGS_ 4#include "ecb.h"
5#ifdef PROTOTYPES 5#include "uuint.h"
6#define _ANSI_ARGS_(c) c
7#else
8#define _ANSI_ARGS_(c) ()
9#endif
10#endif
11 6
12#ifdef __cplusplus 7#ifdef __cplusplus
13extern "C" { 8extern "C" {
14#endif 9#endif
15 10
16typedef unsigned long crc32_t; 11typedef uint32_t crc32_t;
17#define Z_NULL 0
18 12
19crc32_t crc32 _ANSI_ARGS_((crc32_t crc, const unsigned char *buf, unsigned int len)); 13#define CRC32_INIT ((crc32_t)0)
14
20/* 15/*
21 Update a running crc with the bytes buf[0..len-1] and return the updated 16 * Update a running crc with the bytes buf[0..len-1] and return the updated
22 crc. If buf is NULL, this function returns the required initial value 17 * crc. If buf is NULL, this function returns the required initial value
23 for the crc. Pre- and post-conditioning (one's complement) is performed 18 * for the crc. Pre- and post-conditioning (one's complement) is performed
24 within this function so it shouldn't be done by the application. 19 * within this function so it shouldn't be done by the application.
25 Usage example: 20 * Usage example:
21 *
22 * uLong crc = CRC32_INIT;
23 *
24 * while (read_buffer (buffer, length) != EOF) {
25 * crc = crc32 (crc, buffer, length);
26 * }
27 * if (crc != original_crc) error ();
28 */
29UULIBINT_FUNC crc32_t uu_crc32 (crc32_t prev, const void *data, unsigned int len);
26 30
27 uLong crc = crc32(0L, Z_NULL, 0); 31/*
28 32 * This calculates the crc of a block of data consisting of two
29 while (read_buffer(buffer, length) != EOF) { 33 * parts, using only their CRCs. This is used to quickly combine
30 crc = crc32(crc, buffer, length); 34 * part CRCs into a full file CRC.
31 }
32 if (crc != original_crc) error();
33*/ 35 */
36UULIBINT_FUNC uint32_t uu_crc32_combine (uint32_t crcA, uint32_t crcB, size_t lengthB);
34 37
35#ifdef __cplusplus 38#ifdef __cplusplus
36} 39}
37#endif 40#endif
38#endif 41#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines