~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_checksum.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.2.11) (2.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20120619104649-9ij634mxm4x8pp4l
Tags: 1:7.1.36-stable-1ubuntu1
* Merge from Debian unstable. (LP: #987575)
  Remaining changes:
  - Added upstart script.
* debian/drizzle.upstart: dropped logger since upstart logs job
  output now.

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>
19
20
 
20
21
using namespace drizzled;
21
22
 
22
 
internal::ha_checksum mi_checksum(MI_INFO *info, const unsigned char *buf)
 
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)
23
39
{
24
40
  uint32_t i;
25
 
  internal::ha_checksum crc=0;
 
41
  ha_checksum crc=0;
26
42
  MI_COLUMNDEF *rec=info->s->rec;
27
43
 
28
44
  for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length)
53
69
      pos=buf;
54
70
      break;
55
71
    }
56
 
    crc=internal::my_checksum(crc, pos ? pos : (unsigned char*) "", length);
 
72
    crc=my_checksum(crc, pos ? pos : (unsigned char*) "", length);
57
73
  }
58
74
  return crc;
59
75
}
60
76
 
61
77
 
62
 
internal::ha_checksum mi_static_checksum(MI_INFO *info, const unsigned char *pos)
 
78
ha_checksum mi_static_checksum(MI_INFO *info, const unsigned char *pos)
63
79
{
64
 
  return internal::my_checksum(0, pos, info->s->base.reclength);
 
80
  return my_checksum(0, pos, info->s->base.reclength);
65
81
}