Drizzled Public API Documentation

checksum.cc

00001 /* Copyright (C) 2000 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 
00017 #include <config.h>
00018 #include <drizzled/internal/my_sys.h>
00019 
00020 #include <zlib.h>
00021 
00022 namespace drizzled
00023 {
00024 namespace internal
00025 {
00026 
00027 /*
00028   Calculate a long checksum for a memoryblock.
00029 
00030   SYNOPSIS
00031     my_checksum()
00032       crc       start value for crc
00033       pos       pointer to memory block
00034       length    length of the block
00035 */
00036 
00037 ha_checksum my_checksum(ha_checksum crc, const unsigned char *pos, size_t length)
00038 {
00039   return ha_checksum(crc32((uint32_t)crc, pos, uInt(length)));
00040 }
00041 
00042 } /* namespace internal */
00043 } /* namespace drizzled */