~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/fstring.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
****************************************************************************/
36
36
 
37
37
/* Copy a string and fill with space */
38
 
int Field_string::store(const char *from,uint length, const CHARSET_INFO * const cs)
 
38
int Field_string::store(const char *from,uint32_t length, const CHARSET_INFO * const cs)
39
39
{
40
 
  uint copy_length;
 
40
  uint32_t copy_length;
41
41
  const char *well_formed_error_pos;
42
42
  const char *cannot_convert_error_pos;
43
43
  const char *from_end_pos;
133
133
{
134
134
  /* See the comment for Field_long::store(long long) */
135
135
  assert(table->in_use == current_thd);
136
 
  uint length;
 
136
  uint32_t length;
137
137
 
138
138
  length= field_charset->cset->lengthsp(field_charset, (const char*) ptr, field_length);
139
139
  val_ptr->set((const char*) ptr, length, field_charset);
164
164
 
165
165
int Field_string::cmp(const unsigned char *a_ptr, const unsigned char *b_ptr)
166
166
{
167
 
  uint a_len, b_len;
 
167
  uint32_t a_len, b_len;
168
168
 
169
169
  if (field_charset->mbmaxlen != 1)
170
170
  {
171
 
    uint char_len= field_length/field_charset->mbmaxlen;
 
171
    uint32_t char_len= field_length/field_charset->mbmaxlen;
172
172
    a_len= my_charpos(field_charset, a_ptr, a_ptr + field_length, char_len);
173
173
    b_len= my_charpos(field_charset, b_ptr, b_ptr + field_length, char_len);
174
174
  }
185
185
}
186
186
 
187
187
 
188
 
void Field_string::sort_string(unsigned char *to,uint length)
 
188
void Field_string::sort_string(unsigned char *to,uint32_t length)
189
189
{
190
 
  uint tmp= my_strnxfrm(field_charset,
 
190
  uint32_t tmp= my_strnxfrm(field_charset,
191
191
                                 to, length,
192
192
                                 ptr, field_length);
193
193
  assert(tmp == length);
212
212
 
213
213
 
214
214
unsigned char *Field_string::pack(unsigned char *to, const unsigned char *from,
215
 
                          uint max_length,
 
215
                          uint32_t max_length,
216
216
                          bool low_byte_first __attribute__((unused)))
217
217
{
218
 
  uint length=      cmin(field_length,max_length);
219
 
  uint local_char_length= max_length/field_charset->mbmaxlen;
 
218
  uint32_t length=      cmin(field_length,max_length);
 
219
  uint32_t local_char_length= max_length/field_charset->mbmaxlen;
220
220
  if (length > local_char_length)
221
221
    local_char_length= my_charpos(field_charset, from, from+length,
222
222
                                  local_char_length);
254
254
const unsigned char *
255
255
Field_string::unpack(unsigned char *to,
256
256
                     const unsigned char *from,
257
 
                     uint param_data,
 
257
                     uint32_t param_data,
258
258
                     bool low_byte_first __attribute__((unused)))
259
259
{
260
 
  uint from_length=
 
260
  uint32_t from_length=
261
261
    param_data ? cmin(param_data & 0x00ff, field_length) : field_length;
262
 
  uint length;
 
262
  uint32_t length;
263
263
 
264
264
  if (from_length > 255)
265
265
  {
311
311
    > 0   a > b
312
312
*/
313
313
 
314
 
int Field_string::pack_cmp(const unsigned char *a, const unsigned char *b, uint length,
 
314
int Field_string::pack_cmp(const unsigned char *a, const unsigned char *b, uint32_t length,
315
315
                           bool insert_or_update)
316
316
{
317
 
  uint a_length, b_length;
 
317
  uint32_t a_length, b_length;
318
318
  if (length > 255)
319
319
  {
320
320
    a_length= uint2korr(a);
349
349
    > 0   row > key
350
350
*/
351
351
 
352
 
int Field_string::pack_cmp(const unsigned char *key, uint length,
 
352
int Field_string::pack_cmp(const unsigned char *key, uint32_t length,
353
353
                           bool insert_or_update)
354
354
{
355
 
  uint row_length, local_key_length;
 
355
  uint32_t row_length, local_key_length;
356
356
  unsigned char *end;
357
357
  if (length > 255)
358
358
  {
375
375
}
376
376
 
377
377
 
378
 
uint Field_string::packed_col_length(const unsigned char *data_ptr, uint length)
 
378
uint32_t Field_string::packed_col_length(const unsigned char *data_ptr, uint32_t length)
379
379
{
380
380
  if (length > 255)
381
381
    return uint2korr(data_ptr)+2;
383
383
}
384
384
 
385
385
 
386
 
uint Field_string::max_packed_col_length(uint max_length)
 
386
uint32_t Field_string::max_packed_col_length(uint32_t max_length)
387
387
{
388
388
  return (max_length > 255 ? 2 : 1)+max_length;
389
389
}
390
390
 
391
391
 
392
 
uint Field_string::get_key_image(unsigned char *buff,
393
 
                                 uint length,
 
392
uint32_t Field_string::get_key_image(unsigned char *buff,
 
393
                                 uint32_t length,
394
394
                                 imagetype type_arg __attribute__((unused)))
395
395
{
396
 
  uint bytes = my_charpos(field_charset, (char*) ptr,
 
396
  uint32_t bytes = my_charpos(field_charset, (char*) ptr,
397
397
                          (char*) ptr + field_length,
398
398
                          length / field_charset->mbmaxlen);
399
399
  memcpy(buff, ptr, bytes);