~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_checksum.c

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "myisamdef.h"
19
19
 
20
 
ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
 
20
ha_checksum mi_checksum(MI_INFO *info, const unsigned char *buf)
21
21
{
22
 
  uint i;
 
22
  uint32_t i;
23
23
  ha_checksum crc=0;
24
24
  MI_COLUMNDEF *rec=info->s->rec;
25
25
 
26
26
  for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length)
27
27
  {
28
 
    const uchar *pos;
 
28
    const unsigned char *pos;
29
29
    ulong length;
30
30
    switch (rec->type) {
31
31
    case FIELD_BLOB:
38
38
    }
39
39
    case FIELD_VARCHAR:
40
40
    {
41
 
      uint pack_length= HA_VARCHAR_PACKLENGTH(rec->length-1);
 
41
      uint32_t pack_length= HA_VARCHAR_PACKLENGTH(rec->length-1);
42
42
      if (pack_length == 1)
43
 
        length= (ulong) *(uchar*) buf;
 
43
        length= (ulong) *(unsigned char*) buf;
44
44
      else
45
45
        length= uint2korr(buf);
46
46
      pos= buf+pack_length;
51
51
      pos=buf;
52
52
      break;
53
53
    }
54
 
    crc=my_checksum(crc, pos ? pos : (uchar*) "", length);
 
54
    crc=my_checksum(crc, pos ? pos : (unsigned char*) "", length);
55
55
  }
56
56
  return crc;
57
57
}
58
58
 
59
59
 
60
 
ha_checksum mi_static_checksum(MI_INFO *info, const uchar *pos)
 
60
ha_checksum mi_static_checksum(MI_INFO *info, const unsigned char *pos)
61
61
{
62
62
  return my_checksum(0, pos, info->s->base.reclength);
63
63
}