diff options
author | Alexander Barkov <bar@mariadb.com> | 2020-01-26 20:27:13 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2020-01-28 12:29:23 +0400 |
commit | f1e13fdc8d9e78f4529aa60b6a9b49c6ff063c66 (patch) | |
tree | ce84da1deeea573be5be7db7d739a4c9ba9b40f8 /sql/strfunc.cc | |
parent | dd68ba74f357aca074609cbd77491ed4ba390369 (diff) | |
download | mariadb-git-f1e13fdc8d9e78f4529aa60b6a9b49c6ff063c66.tar.gz |
MDEV-21581 Helper functions and methods for CHARSET_INFO
Diffstat (limited to 'sql/strfunc.cc')
-rw-r--r-- | sql/strfunc.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sql/strfunc.cc b/sql/strfunc.cc index 61f6078c875..c488ab1afbb 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -1,4 +1,5 @@ /* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2009, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +51,7 @@ ulonglong find_set(const TYPELIB *lib, char **err_pos, uint *err_len, bool *set_warning) { CHARSET_INFO *strip= cs ? cs : &my_charset_latin1; - const char *end= str + strip->cset->lengthsp(strip, str, length); + const char *end= str + strip->lengthsp(str, length); ulonglong found= 0; *err_pos= 0; // No error yet *err_len= 0; @@ -68,8 +69,8 @@ ulonglong find_set(const TYPELIB *lib, for ( ; pos < end; pos+= mblen) { my_wc_t wc; - if ((mblen= cs->cset->mb_wc(cs, &wc, (const uchar *) pos, - (const uchar *) end)) < 1) + if ((mblen= cs->mb_wc(&wc, (const uchar *) pos, + (const uchar *) end)) < 1) mblen= 1; // Not to hang on a wrong multibyte sequence if (wc == (my_wc_t) field_separator) break; @@ -170,8 +171,8 @@ uint find_type2(const TYPELIB *typelib, const char *x, size_t length, for (pos=0 ; (j=typelib->type_names[pos]) ; pos++) { - if (!my_strnncoll(cs, (const uchar*) x, length, - (const uchar*) j, typelib->type_lengths[pos])) + if (!cs->strnncoll(x, length, + j, typelib->type_lengths[pos])) DBUG_RETURN(pos+1); } DBUG_PRINT("exit",("Couldn't find type")); @@ -338,8 +339,8 @@ int find_string_in_array(LEX_CSTRING * const haystack, LEX_CSTRING * const needl { const LEX_CSTRING *pos; for (pos= haystack; pos->str; pos++) - if (!cs->coll->strnncollsp(cs, (uchar *) pos->str, pos->length, - (uchar *) needle->str, needle->length)) + if (!cs->strnncollsp(pos->str, pos->length, + needle->str, needle->length)) { return (int)(pos - haystack); } |