summaryrefslogtreecommitdiff
path: root/sql/strfunc.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-07-21 16:39:19 +0200
committerSergei Golubchik <sergii@pisem.net>2013-07-21 16:39:19 +0200
commitb7b5f6f1ab49948b0e15b762266d4640b3d6b7fb (patch)
tree7c302c2025184dbd053aa6135f0ff28c8ce6f359 /sql/strfunc.cc
parent5f6380adde2dac3f32b40339b9b702c0135eb7d6 (diff)
parentc1d6a2d7e194225ccc19a68ea5d0f368632620d0 (diff)
downloadmariadb-git-b7b5f6f1ab49948b0e15b762266d4640b3d6b7fb.tar.gz
10.0-monty merge
includes: * remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING" * introduce LOCK_share, now LOCK_ha_data is strictly for engines * rea_create_table() always creates .par file (even in "frm-only" mode) * fix a 5.6 bug, temp file leak on dummy ALTER TABLE
Diffstat (limited to 'sql/strfunc.cc')
-rw-r--r--sql/strfunc.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index 48c77c7c99f..a5a64c065ce 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -265,27 +265,22 @@ uint check_word(TYPELIB *lib, const char *val, const char *end,
*/
-uint strconvert(CHARSET_INFO *from_cs, const char *from,
+uint strconvert(CHARSET_INFO *from_cs, const char *from, uint from_length,
CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors)
{
int cnvres;
my_wc_t wc;
char *to_start= to;
uchar *to_end= (uchar*) to + to_length - 1;
+ const uchar *from_end= (const uchar*) from + from_length;
my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
my_charset_conv_wc_mb wc_mb= to_cs->cset->wc_mb;
uint error_count= 0;
while (1)
{
- /*
- Using 'from + 10' is safe:
- - it is enough to scan a single character in any character set.
- - if remaining string is shorter than 10, then mb_wc will return
- with error because of unexpected '\0' character.
- */
if ((cnvres= (*mb_wc)(from_cs, &wc,
- (uchar*) from, (uchar*) from + 10)) > 0)
+ (uchar*) from, from_end)) > 0)
{
if (!wc)
break;