~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_checksum.cc

  • Committer: Monty Taylor
  • Date: 2010-10-15 17:18:02 UTC
  • mto: (1859.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1860.
  • Revision ID: mordred@inaugust.com-20101015171802-qhk6zyfhrkvprr1n
Added support for registering regular sys_var instances via module::Context.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
16
/* Calculate a checksum for a row */
17
17
 
18
 
#include "myisamdef.h"
19
 
 
20
 
ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
 
18
#include "myisam_priv.h"
 
19
 
 
20
using namespace drizzled;
 
21
 
 
22
internal::ha_checksum mi_checksum(MI_INFO *info, const unsigned char *buf)
21
23
{
22
 
  uint i;
23
 
  ha_checksum crc=0;
 
24
  uint32_t i;
 
25
  internal::ha_checksum crc=0;
24
26
  MI_COLUMNDEF *rec=info->s->rec;
25
27
 
26
28
  for (i=info->s->base.fields ; i-- ; buf+=(rec++)->length)
27
29
  {
28
 
    const uchar *pos;
 
30
    const unsigned char *pos;
29
31
    ulong length;
30
32
    switch (rec->type) {
31
33
    case FIELD_BLOB:
38
40
    }
39
41
    case FIELD_VARCHAR:
40
42
    {
41
 
      uint pack_length= HA_VARCHAR_PACKLENGTH(rec->length-1);
 
43
      uint32_t pack_length= HA_VARCHAR_PACKLENGTH(rec->length-1);
42
44
      if (pack_length == 1)
43
 
        length= (ulong) *(uchar*) buf;
 
45
        length= (ulong) *(unsigned char*) buf;
44
46
      else
45
47
        length= uint2korr(buf);
46
48
      pos= buf+pack_length;
51
53
      pos=buf;
52
54
      break;
53
55
    }
54
 
    crc=my_checksum(crc, pos ? pos : (uchar*) "", length);
 
56
    crc=internal::my_checksum(crc, pos ? pos : (unsigned char*) "", length);
55
57
  }
56
58
  return crc;
57
59
}
58
60
 
59
61
 
60
 
ha_checksum mi_static_checksum(MI_INFO *info, const uchar *pos)
 
62
internal::ha_checksum mi_static_checksum(MI_INFO *info, const unsigned char *pos)
61
63
{
62
 
  return my_checksum(0, pos, info->s->base.reclength);
 
64
  return internal::my_checksum(0, pos, info->s->base.reclength);
63
65
}