Home
Highly Reusable Software By activity User Interface Text Strings Math Processing
Stored Data
Communications
Hard World File System
|
#License - #Source code - #Example Use -
#include <librock/target/types.c> #include <librock/zlibh.h> librock_z_uLong librock_z_adler32(librock_z_uLong adler, const librock_z_Bytef *buf, librock_z_uInt len);
librock_z_uLong adler = librock_z_adler32(0L, librock_z_Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { adler = librock_z_adler32(adler, buffer, length); } if (adler != original_adler) error();
librock_z_uLong librock_z_crc32(librock_z_uLong crc, const librock_z_Bytef *buf, librock_z_uInt len);
buf[0..len-1]
and return the updated
crc. If buf
is NULL, this function returns the required initial value
for the crc. Pre- and post-conditioning (one's complement) is performed
within this function so it shouldn't be done by the application. This
means that the required initial value is 0, but the code below has
the recommended initialization.
Note that librock already includes a function librock_CRC32, with a very similar implementation. Since the API is slightly different, they are not replacement compatible.
Usage example:
librock_z_uLong crc = librock_z_crc32(0L, librock_Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { crc = librock_z_crc32(crc, buffer, length); } if (crc != original_crc) error();
Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler Licensed under BSD-ish license, NO WARRANTY. Copies must retain this block. License text in <librock/license/zlib.txt> librock_LIDESC_HC=d49ece91d0f3402f1ca405bc4ae7b2a989a56ab2
Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)
Want to help? We welcome comments, patches. -- Need help? Request paid support.