~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_checksum.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
/* Calculate a checksum for a row */
17
17
 
18
18
#include "myisam_priv.h"
19
 
#include <zlib.h>
20
19
 
21
20
using namespace drizzled;
22
21
 
23
 
/*
24
 
  Calculate a long checksum for a memoryblock.
25
 
 
26
 
  SYNOPSIS
27
 
    my_checksum()
28
 
      crc       start value for crc
29
 
      pos       pointer to memory block
30
 
      length    length of the block
31
 
*/
32
 
 
33
 
static ha_checksum my_checksum(ha_checksum crc, const unsigned char *pos, size_t length)
34
 
{
35
 
  return ha_checksum(crc32((uint32_t)crc, pos, uInt(length)));
36
 
}
37
 
 
38
 
ha_checksum mi_checksum(MI_INFO *info, const unsigned char *buf)
 
22
internal::ha_checksum mi_checksum(MI_INFO *info, const unsigned char *buf)
39
23
{
40
24
  uint32_t i;
41
 
  ha_checksum crc=0;
 
25
  internal::ha_checksum crc=0;
42
26
  MI_COLUMNDEF *rec=info->s->rec;
43
27
 
44
28
  for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length)
69
53
      pos=buf;
70
54
      break;
71
55
    }
72
 
    crc=my_checksum(crc, pos ? pos : (unsigned char*) "", length);
 
56
    crc=internal::my_checksum(crc, pos ? pos : (unsigned char*) "", length);
73
57
  }
74
58
  return crc;
75
59
}
76
60
 
77
61
 
78
 
ha_checksum mi_static_checksum(MI_INFO *info, const unsigned char *pos)
 
62
internal::ha_checksum mi_static_checksum(MI_INFO *info, const unsigned char *pos)
79
63
{
80
 
  return my_checksum(0, pos, info->s->base.reclength);
 
64
  return internal::my_checksum(0, pos, info->s->base.reclength);
81
65
}