Lines 49-55
Link Here
|
49 |
#define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128 |
49 |
#define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128 |
50 |
#define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128 |
50 |
#define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128 |
51 |
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \ |
51 |
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \ |
52 |
((ulong) ((LL(1) << min(arg, 4) * 8) - LL(1))) |
52 |
((ulong) ((LL(1) << MYSQL_MIN(arg, 4) * 8) - LL(1))) |
53 |
|
53 |
|
54 |
#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))) |
54 |
#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))) |
55 |
#define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index))) |
55 |
#define ASSERT_COLUMN_MARKED_FOR_WRITE DBUG_ASSERT(!table || (!table->write_set || bitmap_is_set(table->write_set, field_index))) |
Lines 1980-1986
Link Here
|
1980 |
tmp_uint=tmp_dec+(uint)(int_digits_end-int_digits_from); |
1980 |
tmp_uint=tmp_dec+(uint)(int_digits_end-int_digits_from); |
1981 |
else if (expo_sign_char == '-') |
1981 |
else if (expo_sign_char == '-') |
1982 |
{ |
1982 |
{ |
1983 |
tmp_uint=min(exponent,(uint)(int_digits_end-int_digits_from)); |
1983 |
tmp_uint=MYSQL_MIN(exponent,(uint)(int_digits_end-int_digits_from)); |
1984 |
frac_digits_added_zeros=exponent-tmp_uint; |
1984 |
frac_digits_added_zeros=exponent-tmp_uint; |
1985 |
int_digits_end -= tmp_uint; |
1985 |
int_digits_end -= tmp_uint; |
1986 |
frac_digits_head_end=int_digits_end+tmp_uint; |
1986 |
frac_digits_head_end=int_digits_end+tmp_uint; |
Lines 1988-1994
Link Here
|
1988 |
} |
1988 |
} |
1989 |
else // (expo_sign_char=='+') |
1989 |
else // (expo_sign_char=='+') |
1990 |
{ |
1990 |
{ |
1991 |
tmp_uint=min(exponent,(uint)(frac_digits_end-frac_digits_from)); |
1991 |
tmp_uint=MYSQL_MIN(exponent,(uint)(frac_digits_end-frac_digits_from)); |
1992 |
int_digits_added_zeros=exponent-tmp_uint; |
1992 |
int_digits_added_zeros=exponent-tmp_uint; |
1993 |
int_digits_tail_from=frac_digits_from; |
1993 |
int_digits_tail_from=frac_digits_from; |
1994 |
frac_digits_from=frac_digits_from+tmp_uint; |
1994 |
frac_digits_from=frac_digits_from+tmp_uint; |
Lines 2876-2882
Link Here
|
2876 |
ASSERT_COLUMN_MARKED_FOR_READ; |
2876 |
ASSERT_COLUMN_MARKED_FOR_READ; |
2877 |
CHARSET_INFO *cs= &my_charset_bin; |
2877 |
CHARSET_INFO *cs= &my_charset_bin; |
2878 |
uint length; |
2878 |
uint length; |
2879 |
uint mlength=max(field_length+1,5*cs->mbmaxlen); |
2879 |
uint mlength=MYSQL_MAX(field_length+1,5*cs->mbmaxlen); |
2880 |
val_buffer->alloc(mlength); |
2880 |
val_buffer->alloc(mlength); |
2881 |
char *to=(char*) val_buffer->ptr(); |
2881 |
char *to=(char*) val_buffer->ptr(); |
2882 |
|
2882 |
|
Lines 3088-3094
Link Here
|
3088 |
ASSERT_COLUMN_MARKED_FOR_READ; |
3088 |
ASSERT_COLUMN_MARKED_FOR_READ; |
3089 |
CHARSET_INFO *cs= &my_charset_bin; |
3089 |
CHARSET_INFO *cs= &my_charset_bin; |
3090 |
uint length; |
3090 |
uint length; |
3091 |
uint mlength=max(field_length+1,7*cs->mbmaxlen); |
3091 |
uint mlength=MYSQL_MAX(field_length+1,7*cs->mbmaxlen); |
3092 |
val_buffer->alloc(mlength); |
3092 |
val_buffer->alloc(mlength); |
3093 |
char *to=(char*) val_buffer->ptr(); |
3093 |
char *to=(char*) val_buffer->ptr(); |
3094 |
short j; |
3094 |
short j; |
Lines 3305-3311
Link Here
|
3305 |
ASSERT_COLUMN_MARKED_FOR_READ; |
3305 |
ASSERT_COLUMN_MARKED_FOR_READ; |
3306 |
CHARSET_INFO *cs= &my_charset_bin; |
3306 |
CHARSET_INFO *cs= &my_charset_bin; |
3307 |
uint length; |
3307 |
uint length; |
3308 |
uint mlength=max(field_length+1,10*cs->mbmaxlen); |
3308 |
uint mlength=MYSQL_MAX(field_length+1,10*cs->mbmaxlen); |
3309 |
val_buffer->alloc(mlength); |
3309 |
val_buffer->alloc(mlength); |
3310 |
char *to=(char*) val_buffer->ptr(); |
3310 |
char *to=(char*) val_buffer->ptr(); |
3311 |
long j= unsigned_flag ? (long) uint3korr(ptr) : sint3korr(ptr); |
3311 |
long j= unsigned_flag ? (long) uint3korr(ptr) : sint3korr(ptr); |
Lines 3524-3530
Link Here
|
3524 |
ASSERT_COLUMN_MARKED_FOR_READ; |
3524 |
ASSERT_COLUMN_MARKED_FOR_READ; |
3525 |
CHARSET_INFO *cs= &my_charset_bin; |
3525 |
CHARSET_INFO *cs= &my_charset_bin; |
3526 |
uint length; |
3526 |
uint length; |
3527 |
uint mlength=max(field_length+1,12*cs->mbmaxlen); |
3527 |
uint mlength=MYSQL_MAX(field_length+1,12*cs->mbmaxlen); |
3528 |
val_buffer->alloc(mlength); |
3528 |
val_buffer->alloc(mlength); |
3529 |
char *to=(char*) val_buffer->ptr(); |
3529 |
char *to=(char*) val_buffer->ptr(); |
3530 |
int32 j; |
3530 |
int32 j; |
Lines 3765-3771
Link Here
|
3765 |
{ |
3765 |
{ |
3766 |
CHARSET_INFO *cs= &my_charset_bin; |
3766 |
CHARSET_INFO *cs= &my_charset_bin; |
3767 |
uint length; |
3767 |
uint length; |
3768 |
uint mlength=max(field_length+1,22*cs->mbmaxlen); |
3768 |
uint mlength=MYSQL_MAX(field_length+1,22*cs->mbmaxlen); |
3769 |
val_buffer->alloc(mlength); |
3769 |
val_buffer->alloc(mlength); |
3770 |
char *to=(char*) val_buffer->ptr(); |
3770 |
char *to=(char*) val_buffer->ptr(); |
3771 |
longlong j; |
3771 |
longlong j; |
Lines 3947-3953
Link Here
|
3947 |
#endif |
3947 |
#endif |
3948 |
memcpy_fixed((uchar*) &nr,ptr,sizeof(nr)); |
3948 |
memcpy_fixed((uchar*) &nr,ptr,sizeof(nr)); |
3949 |
|
3949 |
|
3950 |
uint to_length=max(field_length,70); |
3950 |
uint to_length=MYSQL_MAX(field_length,70); |
3951 |
val_buffer->alloc(to_length); |
3951 |
val_buffer->alloc(to_length); |
3952 |
char *to=(char*) val_buffer->ptr(); |
3952 |
char *to=(char*) val_buffer->ptr(); |
3953 |
|
3953 |
|
Lines 4289-4295
Link Here
|
4289 |
#endif |
4289 |
#endif |
4290 |
doubleget(nr,ptr); |
4290 |
doubleget(nr,ptr); |
4291 |
|
4291 |
|
4292 |
uint to_length=max(field_length, DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE); |
4292 |
uint to_length=MYSQL_MAX(field_length, DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE); |
4293 |
val_buffer->alloc(to_length); |
4293 |
val_buffer->alloc(to_length); |
4294 |
char *to=(char*) val_buffer->ptr(); |
4294 |
char *to=(char*) val_buffer->ptr(); |
4295 |
|
4295 |
|
Lines 6142-6154
Link Here
|
6142 |
double anr= fabs(nr); |
6142 |
double anr= fabs(nr); |
6143 |
int neg= (nr < 0.0) ? 1 : 0; |
6143 |
int neg= (nr < 0.0) ? 1 : 0; |
6144 |
if (local_char_length > 4 && local_char_length < 32 && |
6144 |
if (local_char_length > 4 && local_char_length < 32 && |
6145 |
(anr < 1.0 ? anr > 1/(log_10[max(0,(int) local_char_length-neg-2)]) /* -2 for "0." */ |
6145 |
(anr < 1.0 ? anr > 1/(log_10[MYSQL_MAX(0,(int) local_char_length-neg-2)]) /* -2 for "0." */ |
6146 |
: anr < log_10[local_char_length-neg]-1)) |
6146 |
: anr < log_10[local_char_length-neg]-1)) |
6147 |
use_scientific_notation= FALSE; |
6147 |
use_scientific_notation= FALSE; |
6148 |
|
6148 |
|
6149 |
length= (uint) my_sprintf(buff, (buff, "%-.*g", |
6149 |
length= (uint) my_sprintf(buff, (buff, "%-.*g", |
6150 |
(use_scientific_notation ? |
6150 |
(use_scientific_notation ? |
6151 |
max(0, (int)local_char_length-neg-5) : |
6151 |
MYSQL_MAX(0, (int)local_char_length-neg-5) : |
6152 |
local_char_length), |
6152 |
local_char_length), |
6153 |
nr)); |
6153 |
nr)); |
6154 |
/* |
6154 |
/* |
Lines 6357-6363
Link Here
|
6357 |
|
6357 |
|
6358 |
uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length) |
6358 |
uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length) |
6359 |
{ |
6359 |
{ |
6360 |
uint length= min(field_length,max_length); |
6360 |
uint length= MYSQL_MIN(field_length,max_length); |
6361 |
uint local_char_length= max_length/field_charset->mbmaxlen; |
6361 |
uint local_char_length= max_length/field_charset->mbmaxlen; |
6362 |
if (length > local_char_length) |
6362 |
if (length > local_char_length) |
6363 |
local_char_length= my_charpos(field_charset, from, from+length, |
6363 |
local_char_length= my_charpos(field_charset, from, from+length, |
Lines 7292-7298
Link Here
|
7292 |
from= tmpstr.ptr(); |
7292 |
from= tmpstr.ptr(); |
7293 |
} |
7293 |
} |
7294 |
|
7294 |
|
7295 |
new_length= min(max_data_length(), field_charset->mbmaxlen * length); |
7295 |
new_length= MYSQL_MIN(max_data_length(), field_charset->mbmaxlen * length); |
7296 |
if (value.alloc(new_length)) |
7296 |
if (value.alloc(new_length)) |
7297 |
goto oom_error; |
7297 |
goto oom_error; |
7298 |
|
7298 |
|
Lines 7447-7453
Link Here
|
7447 |
b_length=get_length(b_ptr); |
7447 |
b_length=get_length(b_ptr); |
7448 |
if (b_length > max_length) |
7448 |
if (b_length > max_length) |
7449 |
b_length=max_length; |
7449 |
b_length=max_length; |
7450 |
diff=memcmp(a,b,min(a_length,b_length)); |
7450 |
diff=memcmp(a,b,MYSQL_MIN(a_length,b_length)); |
7451 |
return diff ? diff : (int) (a_length - b_length); |
7451 |
return diff ? diff : (int) (a_length - b_length); |
7452 |
} |
7452 |
} |
7453 |
|
7453 |
|
Lines 8569-8575
Link Here
|
8569 |
{ |
8569 |
{ |
8570 |
ASSERT_COLUMN_MARKED_FOR_READ; |
8570 |
ASSERT_COLUMN_MARKED_FOR_READ; |
8571 |
char buff[sizeof(longlong)]; |
8571 |
char buff[sizeof(longlong)]; |
8572 |
uint length= min(pack_length(), sizeof(longlong)); |
8572 |
uint length= MYSQL_MIN(pack_length(), sizeof(longlong)); |
8573 |
ulonglong bits= val_int(); |
8573 |
ulonglong bits= val_int(); |
8574 |
mi_int8store(buff,bits); |
8574 |
mi_int8store(buff,bits); |
8575 |
|
8575 |
|
Lines 8655-8661
Link Here
|
8655 |
*buff++= bits; |
8655 |
*buff++= bits; |
8656 |
length--; |
8656 |
length--; |
8657 |
} |
8657 |
} |
8658 |
uint data_length = min(length, bytes_in_rec); |
8658 |
uint data_length = MYSQL_MIN(length, bytes_in_rec); |
8659 |
memcpy(buff, ptr, data_length); |
8659 |
memcpy(buff, ptr, data_length); |
8660 |
return data_length + 1; |
8660 |
return data_length + 1; |
8661 |
} |
8661 |
} |
Lines 8698-8704
Link Here
|
8698 |
uchar bits= get_rec_bits(bit_ptr + (from - ptr), bit_ofs, bit_len); |
8698 |
uchar bits= get_rec_bits(bit_ptr + (from - ptr), bit_ofs, bit_len); |
8699 |
*to++= bits; |
8699 |
*to++= bits; |
8700 |
} |
8700 |
} |
8701 |
length= min(bytes_in_rec, max_length - (bit_len > 0)); |
8701 |
length= MYSQL_MIN(bytes_in_rec, max_length - (bit_len > 0)); |
8702 |
memcpy(to, from, length); |
8702 |
memcpy(to, from, length); |
8703 |
return to + length; |
8703 |
return to + length; |
8704 |
} |
8704 |
} |
Lines 9146-9152
Link Here
|
9146 |
and 19 as length of 4.1 compatible representation. |
9146 |
and 19 as length of 4.1 compatible representation. |
9147 |
*/ |
9147 |
*/ |
9148 |
length= ((length+1)/2)*2; /* purecov: inspected */ |
9148 |
length= ((length+1)/2)*2; /* purecov: inspected */ |
9149 |
length= min(length, MAX_DATETIME_COMPRESSED_WIDTH); /* purecov: inspected */ |
9149 |
length= MYSQL_MIN(length, MAX_DATETIME_COMPRESSED_WIDTH); /* purecov: inspected */ |
9150 |
} |
9150 |
} |
9151 |
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG; |
9151 |
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG; |
9152 |
if (fld_default_value) |
9152 |
if (fld_default_value) |