From f4ba3d90584ba8debfbd00c651499f027726b30c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 11 Nov 2002 13:10:39 +0400 Subject: [PATCH] For coding convenuence cs->mbmaxlen is now 1 for 8bit charsets --- mysys/charset.c | 1 + mysys/test_charset.c | 2 +- sql/item_strfunc.cc | 6 ++--- sql/sql_show.cc | 2 +- strings/ctype-bin.c | 2 +- strings/ctype-czech.c | 2 +- strings/ctype-latin1_de.c | 2 +- strings/ctype-tis620.c | 2 +- strings/ctype-win1250ch.c | 2 +- strings/ctype.c | 46 +++++++++++++++++++-------------------- 10 files changed, 34 insertions(+), 33 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index 3ad4b4e8faa..2f22c616325 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -389,6 +389,7 @@ static CHARSET_INFO *add_charset(CHARSET_INFO *cs, myf flags) cs->hash_caseup = my_hash_caseup_simple; cs->hash_sort = my_hash_sort_simple; cs->snprintf = my_snprintf_8bit; + cs->mbmaxlen = 1; set_max_sort_char(cs); create_fromuni(cs); diff --git a/mysys/test_charset.c b/mysys/test_charset.c index 47ed9062c05..d031007a1da 100644 --- a/mysys/test_charset.c +++ b/mysys/test_charset.c @@ -46,7 +46,7 @@ static void _print_csinfo(CHARSET_INFO *cs) cs->strnxfrm, cs->like_range); printf("multi-byte: %3s (%d, %p, %p, %p)\n", - cs->mbmaxlen ? "yes" : "no", + cs->mbmaxlen > 1 ? "yes" : "no", cs->mbmaxlen, cs->ismbchar, cs->ismbhead, diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 6f121ecdc06..83b94ea145b 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1928,7 +1928,7 @@ String *Item_func_conv_charset::val_str(String *str) s=(const uchar*)arg->ptr(); se=s+arg->length(); - dmaxlen=arg->length()*(to->mbmaxlen?to->mbmaxlen:1)+1; + dmaxlen=arg->length()*to->mbmaxlen+1; str->alloc(dmaxlen); d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; @@ -1970,7 +1970,7 @@ outp: void Item_func_conv_charset::fix_length_and_dec() { - max_length = args[0]->max_length*(conv_charset->mbmaxlen?conv_charset->mbmaxlen:1); + max_length = args[0]->max_length*conv_charset->mbmaxlen; set_charset(conv_charset); } @@ -2002,7 +2002,7 @@ String *Item_func_conv_charset3::val_str(String *str) s=(const uchar*)arg->ptr(); se=s+arg->length(); - dmaxlen=arg->length()*(to_charset->mbmaxlen?to_charset->mbmaxlen:1)+1; + dmaxlen=arg->length()*to_charset->mbmaxlen+1; str->alloc(dmaxlen); d0=d=(unsigned char*)str->ptr(); de=d+dmaxlen; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d6fe2f3772a..bd8abda5e87 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1424,7 +1424,7 @@ int mysqld_show_charsets(THD *thd, const char *wild) net_store_data(&packet2,convert,cs[0]->name); net_store_data(&packet2,(uint32) cs[0]->number); net_store_data(&packet2,(uint32) cs[0]->strxfrm_multiply); - net_store_data(&packet2,(uint32) (cs[0]->mbmaxlen ? cs[0]->mbmaxlen : 1)); + net_store_data(&packet2,(uint32) (cs[0]->mbmaxlen)); if (my_net_write(&thd->net, (char*) packet2.ptr(),packet2.length())) goto err; diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index e479053071b..9a22b3f36bf 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -162,7 +162,7 @@ static CHARSET_INFO my_charset_bin_st = my_strnncoll_binary, /* strnncoll */ NULL, /* strxnfrm */ NULL, /* like_rabge */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index 6ce2bf13fce..3ec4491001d 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -610,7 +610,7 @@ CHARSET_INFO my_charset_czech = my_strnncoll_czech, my_strnxfrm_czech, my_like_range_czech, - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ diff --git a/strings/ctype-latin1_de.c b/strings/ctype-latin1_de.c index 574fbf41da3..d829296fd78 100644 --- a/strings/ctype-latin1_de.c +++ b/strings/ctype-latin1_de.c @@ -428,7 +428,7 @@ CHARSET_INFO my_charset_latin1_de = my_strnncoll_latin1_de, my_strnxfrm_latin1_de, my_like_range_latin1_de, - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index de1a0e170fb..44d0dde65f5 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -702,7 +702,7 @@ CHARSET_INFO my_charset_tis620 = my_strnncoll_tis620, my_strnxfrm_tis620, my_like_range_tis620, - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index 64697ce08f3..9c418e2e6f5 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -636,7 +636,7 @@ CHARSET_INFO my_charset_win1250ch = my_strnncoll_win1250ch, my_strnxfrm_win1250ch, my_like_range_win1250ch, - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ diff --git a/strings/ctype.c b/strings/ctype.c index 8fc189f4b7f..96003f8baab 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -2823,7 +2823,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -2860,7 +2860,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -2896,7 +2896,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -2932,7 +2932,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -2969,7 +2969,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3005,7 +3005,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3041,7 +3041,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3077,7 +3077,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3114,7 +3114,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3150,7 +3150,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3186,7 +3186,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3222,7 +3222,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3258,7 +3258,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3294,7 +3294,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3330,7 +3330,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3367,7 +3367,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3403,7 +3403,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3440,7 +3440,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3477,7 +3477,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3513,7 +3513,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3549,7 +3549,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3585,7 +3585,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */ @@ -3621,7 +3621,7 @@ static CHARSET_INFO compiled_charsets[] = { my_strnncoll_simple,/* strnncoll */ NULL, /* strnxfrm */ NULL, /* like_range */ - 0, /* mbmaxlen */ + 1, /* mbmaxlen */ NULL, /* ismbchar */ NULL, /* ismbhead */ NULL, /* mbcharlen */