~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_key.c

Merged uint fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
              set_if_smaller(char_length,length);                           \
31
31
            } while(0)
32
32
 
33
 
static int _mi_put_key_in_record(MI_INFO *info,uint keynr,unsigned char *record);
 
33
static int _mi_put_key_in_record(MI_INFO *info,uint32_t keynr,unsigned char *record);
34
34
 
35
35
/*
36
36
  Make a intern key from a record
47
47
    Length of key
48
48
*/
49
49
 
50
 
uint _mi_make_key(register MI_INFO *info, uint keynr, unsigned char *key,
 
50
uint32_t _mi_make_key(register MI_INFO *info, uint32_t keynr, unsigned char *key,
51
51
                  const unsigned char *record, my_off_t filepos)
52
52
{
53
53
  unsigned char *pos;
58
58
  for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++)
59
59
  {
60
60
    enum ha_base_keytype type=(enum ha_base_keytype) keyseg->type;
61
 
    uint length=keyseg->length;
62
 
    uint char_length;
 
61
    uint32_t length=keyseg->length;
 
62
    uint32_t char_length;
63
63
    const CHARSET_INFO * const cs=keyseg->charset;
64
64
 
65
65
    if (keyseg->null_bit)
110
110
    }
111
111
    if (keyseg->flag & HA_VAR_LENGTH_PART)
112
112
    {
113
 
      uint pack_length= (keyseg->bit_start == 1 ? 1 : 2);
114
 
      uint tmp_length= (pack_length == 1 ? (uint) *(unsigned char*) pos :
 
113
      uint32_t pack_length= (keyseg->bit_start == 1 ? 1 : 2);
 
114
      uint32_t tmp_length= (pack_length == 1 ? (uint) *(unsigned char*) pos :
115
115
                        uint2korr(pos));
116
116
      pos+= pack_length;                        /* Skip VARCHAR length */
117
117
      set_if_smaller(length,tmp_length);
123
123
    }
124
124
    else if (keyseg->flag & HA_BLOB_PART)
125
125
    {
126
 
      uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
 
126
      uint32_t tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
127
127
      memcpy(&pos, pos+keyseg->bit_start, sizeof(char*));
128
128
      set_if_smaller(length,tmp_length);
129
129
      FIX_LENGTH(cs, pos, length, char_length);
183
183
  SYNOPSIS
184
184
    _mi_pack_key()
185
185
    info                MyISAM handler
186
 
    uint keynr          key number
 
186
    uint32_t keynr              key number
187
187
    key                 Store packed key here
188
188
    old                 Not packed key
189
189
    keypart_map         bitmap of used keyparts
195
195
     last_use_keyseg    Store pointer to the keyseg after the last used one
196
196
*/
197
197
 
198
 
uint _mi_pack_key(register MI_INFO *info, uint keynr, unsigned char *key, unsigned char *old,
 
198
uint32_t _mi_pack_key(register MI_INFO *info, uint32_t keynr, unsigned char *key, unsigned char *old,
199
199
                  key_part_map keypart_map, HA_KEYSEG **last_used_keyseg)
200
200
{
201
201
  unsigned char *start_key=key;
208
208
       old+= keyseg->length, keyseg++)
209
209
  {
210
210
    enum ha_base_keytype type= (enum ha_base_keytype) keyseg->type;
211
 
    uint length= keyseg->length;
212
 
    uint char_length;
 
211
    uint32_t length= keyseg->length;
 
212
    uint32_t char_length;
213
213
    unsigned char *pos;
214
214
    const CHARSET_INFO * const cs=keyseg->charset;
215
215
    keypart_map>>= 1;
247
247
    else if (keyseg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART))
248
248
    {
249
249
      /* Length of key-part used with mi_rkey() always 2 */
250
 
      uint tmp_length=uint2korr(pos);
 
250
      uint32_t tmp_length=uint2korr(pos);
251
251
      pos+=2;
252
252
      set_if_smaller(length,tmp_length);        /* Safety */
253
253
      FIX_LENGTH(cs, pos, length, char_length);
297
297
   1   error
298
298
*/
299
299
 
300
 
static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
 
300
static int _mi_put_key_in_record(register MI_INFO *info, uint32_t keynr,
301
301
                                 unsigned char *record)
302
302
{
303
303
  register unsigned char *key;
321
321
    }
322
322
    if (keyseg->type == HA_KEYTYPE_BIT)
323
323
    {
324
 
      uint length= keyseg->length;
 
324
      uint32_t length= keyseg->length;
325
325
 
326
326
      if (keyseg->bit_length)
327
327
      {
341
341
    }
342
342
    if (keyseg->flag & HA_SPACE_PACK)
343
343
    {
344
 
      uint length;
 
344
      uint32_t length;
345
345
      get_key_length(length,key);
346
346
#ifdef CHECK_KEYS
347
347
      if (length > keyseg->length || key+length > key_end)
367
367
 
368
368
    if (keyseg->flag & HA_VAR_LENGTH_PART)
369
369
    {
370
 
      uint length;
 
370
      uint32_t length;
371
371
      get_key_length(length,key);
372
372
#ifdef CHECK_KEYS
373
373
      if (length > keyseg->length || key+length > key_end)
384
384
    }
385
385
    else if (keyseg->flag & HA_BLOB_PART)
386
386
    {
387
 
      uint length;
 
387
      uint32_t length;
388
388
      get_key_length(length,key);
389
389
#ifdef CHECK_KEYS
390
390
      if (length > keyseg->length || key+length > key_end)
474
474
    2   Index condition is not satisfied, end the scan. 
475
475
*/
476
476
 
477
 
int mi_check_index_cond(register MI_INFO *info, uint keynr, unsigned char *record)
 
477
int mi_check_index_cond(register MI_INFO *info, uint32_t keynr, unsigned char *record)
478
478
{
479
479
  if (_mi_put_key_in_record(info, keynr, record))
480
480
  {