~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/key.cc

  • Committer: Stewart Smith
  • Date: 2009-07-02 17:18:18 UTC
  • mfrom: (1085 staging)
  • mto: This revision was merged to the branch mainline in revision 1089.
  • Revision ID: stewart@flamingspork.com-20090702171818-qrp4d403iw8tazlg
mergeĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <string>
25
25
 
 
26
#include <algorithm>
 
27
 
26
28
using namespace std;
27
29
 
28
30
/*
117
119
        key_part->key_part_flag & HA_VAR_LENGTH_PART)
118
120
    {
119
121
      key_length-= HA_KEY_BLOB_LENGTH;
120
 
      length= cmin((uint16_t)key_length, key_part->length);
 
122
      length= min((uint16_t)key_length, key_part->length);
121
123
      key_part->field->get_key_image(to_key, length);
122
124
      to_key+= HA_KEY_BLOB_LENGTH;
123
125
    }
124
126
    else
125
127
    {
126
 
      length= cmin((uint16_t)key_length, key_part->length);
 
128
      length= min((uint16_t)key_length, key_part->length);
127
129
      Field *field= key_part->field;
128
130
      const CHARSET_INFO * const cs= field->charset();
129
131
      uint32_t bytes= field->get_key_image(to_key, length);
209
211
      my_ptrdiff_t ptrdiff= to_record - field->table->record[0];
210
212
      field->move_field_offset(ptrdiff);
211
213
      key_length-= HA_KEY_BLOB_LENGTH;
212
 
      length= cmin(key_length, key_part->length);
 
214
      length= min(key_length, key_part->length);
213
215
      field->set_key_image(from_key, length);
214
216
      from_key+= HA_KEY_BLOB_LENGTH;
215
217
      field->move_field_offset(-ptrdiff);
216
218
    }
217
219
    else
218
220
    {
219
 
      length= cmin(key_length, key_part->length);
 
221
      length= min(key_length, key_part->length);
220
222
      /* skip the byte with 'uneven' bits, if used */
221
223
      memcpy(to_record + key_part->offset, from_key + used_uneven_bits
222
224
             , (size_t) length - used_uneven_bits);
277
279
        return 1;
278
280
      continue;
279
281
    }
280
 
    length= cmin((uint32_t) (key_end-key), store_length);
 
282
    length= min((uint32_t) (key_end-key), store_length);
281
283
    if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+
282
284
                                FIELDFLAG_PACK)))
283
285
    {
360
362
      }
361
363
 
362
364
      if (key_part->length < field->pack_length())
363
 
        tmp.length(cmin(tmp.length(),(uint32_t)key_part->length));
 
365
        tmp.length(min(tmp.length(),(uint32_t)key_part->length));
364
366
      to->append(tmp);
365
367
    }
366
368
    else