diff options
author | unknown <monty@mashka.mysql.fi> | 2003-01-10 01:55:05 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-01-10 01:55:05 +0200 |
commit | da1ff072c28eb58197892ba28c281e6ad0487c17 (patch) | |
tree | 32ebd679eacd38dead4f046faa80fac1acd2b7f7 /sql/item_cmpfunc.cc | |
parent | afbd3fc503ece8cfcccb5bda04ce85d249234948 (diff) | |
download | mariadb-git-da1ff072c28eb58197892ba28c281e6ad0487c17.tar.gz |
Fixed core dump bug in str LIKE "%other_str%" where strings contained characters >= 128.
Fixed problem with replication LOAD DATA INFILE when using --old-rpl-compat.
When executing on master LOAD DATA and InnoDB failed with 'table full' error the binary log was corrupted.
sql/item_cmpfunc.cc:
Fixed core dump bug in str LIKE "%other_str%" where strings contained characters >= 128.
sql/log_event.cc:
Fixed problem with replication LOAD DATA INFILE when using --old-rpl-compat
sql/sql_load.cc:
When executing on master LOAD DATA and InnoDB failed with 'table full' error the binary log was corrupted.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index a36c96ffea4..2a363164656 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1538,12 +1538,12 @@ Item_func_regex::~Item_func_regex() Precomputation dependent only on pattern_len. **********************************************************************/ -void Item_func_like::turboBM_compute_suffixes(int* suff) +void Item_func_like::turboBM_compute_suffixes(int *suff) { const int plm1 = pattern_len - 1; int f = 0; int g = plm1; - int* const splm1 = suff + plm1; + int *const splm1 = suff + plm1; *splm1 = pattern_len; @@ -1579,7 +1579,8 @@ void Item_func_like::turboBM_compute_suffixes(int* suff) if (i < g) g = i; // g = min(i, g) f = i; - while (g >= 0 && likeconv(pattern[g]) == likeconv(pattern[g + plm1 - f])) + while (g >= 0 && + likeconv(pattern[g]) == likeconv(pattern[g + plm1 - f])) g--; suff[i] = f - g; } @@ -1593,12 +1594,12 @@ void Item_func_like::turboBM_compute_suffixes(int* suff) Precomputation dependent only on pattern_len. **********************************************************************/ -void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff) +void Item_func_like::turboBM_compute_good_suffix_shifts(int *suff) { turboBM_compute_suffixes(suff); - int* end = bmGs + pattern_len; - int* k; + int *end = bmGs + pattern_len; + int *k; for (k = bmGs; k < end; k++) *k = pattern_len; @@ -1612,14 +1613,14 @@ void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff) { for (tmp = plm1 - i; j < tmp; j++) { - int* tmp2 = bmGs + j; + int *tmp2 = bmGs + j; if (*tmp2 == pattern_len) *tmp2 = tmp; } } } - int* tmp2; + int *tmp2; for (tmp = plm1 - i; j < tmp; j++) { tmp2 = bmGs + j; @@ -1640,19 +1641,23 @@ void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff) void Item_func_like::turboBM_compute_bad_character_shifts() { - int* i; - int* end = bmBc + alphabet_size; + int *i; + int *end = bmBc + alphabet_size; for (i = bmBc; i < end; i++) *i = pattern_len; int j; const int plm1 = pattern_len - 1; if (binary) + { for (j = 0; j < plm1; j++) - bmBc[pattern[j]] = plm1 - j; + bmBc[(uint) (uchar) pattern[j]] = plm1 - j; + } else + { for (j = 0; j < plm1; j++) - bmBc[likeconv(pattern[j])] = plm1 - j; + bmBc[(uint) likeconv(pattern[j])] = plm1 - j; + } } @@ -1669,27 +1674,27 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const int j = 0; int u = 0; - const int plm1 = pattern_len - 1; - const int tlmpl = text_len - pattern_len; + const int plm1= pattern_len - 1; + const int tlmpl= text_len - pattern_len; /* Searching */ if (binary) { while (j <= tlmpl) { - register int i = plm1; + register int i= plm1; while (i >= 0 && pattern[i] == text[i + j]) { i--; if (i == plm1 - shift) - i -= u; + i-= u; } if (i < 0) return 1; register const int v = plm1 - i; turboShift = u - v; - bcShift = bmBc[text[i + j]] - plm1 + i; + bcShift = bmBc[(uint) (uchar) text[i + j]] - plm1 + i; shift = max(turboShift, bcShift); shift = max(shift, bmGs[i]); if (shift == bmGs[i]) @@ -1700,7 +1705,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const shift = max(shift, u + 1); u = 0; } - j += shift; + j+= shift; } return 0; } @@ -1713,14 +1718,14 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const { i--; if (i == plm1 - shift) - i -= u; + i-= u; } if (i < 0) return 1; register const int v = plm1 - i; turboShift = u - v; - bcShift = bmBc[likeconv(text[i + j])] - plm1 + i; + bcShift = bmBc[(uint) likeconv(text[i + j])] - plm1 + i; shift = max(turboShift, bcShift); shift = max(shift, bmGs[i]); if (shift == bmGs[i]) @@ -1731,7 +1736,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const shift = max(shift, u + 1); u = 0; } - j += shift; + j+= shift; } return 0; } |