~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/ctype-utf8.cc

  • Committer: Andrew Hutchings
  • Date: 2011-03-29 20:45:43 UTC
  • mfrom: (2257 drizzle)
  • mto: (2257.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: andrew@linuxjedi.co.uk-20110329204543-ssex0nuo8knncgwx
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
namespace drizzled
43
43
{
44
44
 
45
 
void my_hash_sort_utf8mb4(const CHARSET_INFO * const cs,
 
45
void my_hash_sort_utf8mb4(const charset_info_st * const cs,
46
46
                          const unsigned char *s, size_t slen,
47
47
                          uint32_t *n1, uint32_t *n2);
48
48
 
1725
1725
    @retval  1 if matched with wildcard.
1726
1726
*/
1727
1727
 
1728
 
int my_wildcmp_unicode(const CHARSET_INFO * const cs,
 
1728
int my_wildcmp_unicode(const charset_info_st * const cs,
1729
1729
                       const char *str,const char *str_end,
1730
1730
                       const char *wildstr,const char *wildend,
1731
1731
                       int escape, int w_one, int w_many,
1880
1880
}
1881
1881
 
1882
1882
 
1883
 
int make_escape_code(const CHARSET_INFO * const cs, const char *escape)
 
1883
int make_escape_code(const charset_info_st * const cs, const char *escape)
1884
1884
{
1885
1885
  my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc;
1886
1886
  my_wc_t escape_wc;
1972
1972
 
1973
1973
 
1974
1974
int
1975
 
my_mb_wc_utf8mb4(const CHARSET_INFO * const,
 
1975
my_mb_wc_utf8mb4(const charset_info_st * const,
1976
1976
                 my_wc_t * pwc, const unsigned char *s, const unsigned char *e)
1977
1977
{
1978
1978
  unsigned char c;
2038
2038
  for example, for a null-terminated string
2039
2039
*/
2040
2040
static int
2041
 
my_mb_wc_utf8mb4_no_range(const CHARSET_INFO * const,
 
2041
my_mb_wc_utf8mb4_no_range(const charset_info_st * const,
2042
2042
                          my_wc_t *pwc, const unsigned char *s)
2043
2043
{
2044
2044
  unsigned char c;
2092
2092
 
2093
2093
 
2094
2094
int
2095
 
my_wc_mb_utf8mb4(const CHARSET_INFO * const,
 
2095
my_wc_mb_utf8mb4(const charset_info_st * const,
2096
2096
                 my_wc_t wc, unsigned char *r, unsigned char *e)
2097
2097
{
2098
2098
  int count;
2128
2128
  The same as above, but without range check.
2129
2129
*/
2130
2130
static int
2131
 
my_wc_mb_utf8mb4_no_range(const CHARSET_INFO * const,
 
2131
my_wc_mb_utf8mb4_no_range(const charset_info_st * const,
2132
2132
                          my_wc_t wc, unsigned char *r)
2133
2133
{
2134
2134
  int count;
2194
2194
 
2195
2195
 
2196
2196
size_t
2197
 
my_caseup_utf8mb4(const CHARSET_INFO * const cs, char *src, size_t srclen,
 
2197
my_caseup_utf8mb4(const charset_info_st * const cs, char *src, size_t srclen,
2198
2198
                  char *dst, size_t dstlen)
2199
2199
{
2200
2200
  my_wc_t wc;
2225
2225
}
2226
2226
 
2227
2227
 
2228
 
void my_hash_sort_utf8mb4(const CHARSET_INFO * const cs,
 
2228
void my_hash_sort_utf8mb4(const charset_info_st * const cs,
2229
2229
                          const unsigned char *s, size_t slen,
2230
2230
                          uint32_t *n1, uint32_t *n2)
2231
2231
{
2263
2263
 
2264
2264
 
2265
2265
size_t
2266
 
my_caseup_str_utf8mb4(const CHARSET_INFO * const cs, char *src)
 
2266
my_caseup_str_utf8mb4(const charset_info_st * const cs, char *src)
2267
2267
{
2268
2268
  my_wc_t wc;
2269
2269
  int srcres, dstres;
2286
2286
 
2287
2287
 
2288
2288
size_t
2289
 
my_casedn_utf8mb4(const CHARSET_INFO * const cs,
 
2289
my_casedn_utf8mb4(const charset_info_st * const cs,
2290
2290
                  char *src, size_t srclen,
2291
2291
                  char *dst, size_t dstlen)
2292
2292
{
2311
2311
 
2312
2312
 
2313
2313
size_t
2314
 
my_casedn_str_utf8mb4(const CHARSET_INFO * const cs, char *src)
 
2314
my_casedn_str_utf8mb4(const charset_info_st * const cs, char *src)
2315
2315
{
2316
2316
  my_wc_t wc;
2317
2317
  int srcres, dstres;
2350
2350
 
2351
2351
 
2352
2352
int
2353
 
my_strnncoll_utf8mb4(const CHARSET_INFO * const cs,
 
2353
my_strnncoll_utf8mb4(const charset_info_st * const cs,
2354
2354
                     const unsigned char *s, size_t slen,
2355
2355
                     const unsigned char *t, size_t tlen,
2356
2356
                     bool t_is_prefix)
2415
2415
*/
2416
2416
 
2417
2417
int
2418
 
my_strnncollsp_utf8mb4(const CHARSET_INFO * const cs,
 
2418
my_strnncollsp_utf8mb4(const charset_info_st * const cs,
2419
2419
                       const unsigned char *s, size_t slen,
2420
2420
                       const unsigned char *t, size_t tlen,
2421
2421
                       bool diff_if_only_endspace_difference)
2503
2503
    @retval 0 is the strings are equal
2504
2504
*/
2505
2505
 
2506
 
int my_strcasecmp_utf8mb4(const CHARSET_INFO * const cs,
 
2506
int my_strcasecmp_utf8mb4(const charset_info_st * const cs,
2507
2507
                          const char *s, const char *t)
2508
2508
{
2509
2509
  MY_UNICASE_INFO **uni_plane= cs->caseinfo;
2564
2564
 
2565
2565
 
2566
2566
int
2567
 
my_wildcmp_utf8mb4(const CHARSET_INFO * const cs,
 
2567
my_wildcmp_utf8mb4(const charset_info_st * const cs,
2568
2568
                   const char *str, const char *strend,
2569
2569
                   const char *wildstr, const char *wildend,
2570
2570
                   int escape, int w_one, int w_many)
2575
2575
 
2576
2576
 
2577
2577
size_t
2578
 
my_strnxfrmlen_utf8mb4(const CHARSET_INFO * const, size_t len)
 
2578
my_strnxfrmlen_utf8mb4(const charset_info_st * const, size_t len)
2579
2579
{
2580
2580
  /* TODO: fix when working on WL "Unicode new version" */
2581
2581
  return (len * 2 + 2) / 4;
2583
2583
 
2584
2584
 
2585
2585
size_t
2586
 
my_strnxfrm_utf8mb4(const CHARSET_INFO * const cs,
 
2586
my_strnxfrm_utf8mb4(const charset_info_st * const cs,
2587
2587
                    unsigned char *dst, size_t dstlen, uint32_t nweights,
2588
2588
                    const unsigned char *src, size_t srclen, uint32_t flags)
2589
2589
{
2627
2627
}
2628
2628
 
2629
2629
 
2630
 
unsigned int my_ismbchar_utf8mb4(const CHARSET_INFO * const cs,
 
2630
unsigned int my_ismbchar_utf8mb4(const charset_info_st * const cs,
2631
2631
                                 const char *b, const char *e)
2632
2632
{
2633
2633
  my_wc_t wc;
2636
2636
}
2637
2637
 
2638
2638
 
2639
 
unsigned int my_mbcharlen_utf8mb4(const CHARSET_INFO * const, uint32_t c)
 
2639
unsigned int my_mbcharlen_utf8mb4(const charset_info_st * const, uint32_t c)
2640
2640
{
2641
2641
  if (c < 0x80)
2642
2642
    return 1;
2717
2717
 
2718
2718
 
2719
2719
 
2720
 
DRIZZLED_API CHARSET_INFO my_charset_utf8mb4_general_ci=
 
2720
DRIZZLED_API charset_info_st my_charset_utf8mb4_general_ci=
2721
2721
{
2722
2722
  45,0,0,              /* number       */
2723
2723
  MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE,  /* state  */
2752
2752
};
2753
2753
 
2754
2754
 
2755
 
DRIZZLED_API CHARSET_INFO my_charset_utf8mb4_bin=
 
2755
DRIZZLED_API charset_info_st my_charset_utf8mb4_bin=
2756
2756
{
2757
2757
  46,0,0,             /* number       */
2758
2758
  MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE, /* state  */
2826
2826
#ifdef MY_TEST_UTF8
2827
2827
#include <stdio.h>
2828
2828
 
2829
 
static void test_mb(CHARSET_INFO *cs, unsigned char *s)
 
2829
static void test_mb(charset_info_st *cs, unsigned char *s)
2830
2830
{
2831
2831
  while(*s)
2832
2832
  {
2851
2851
int main()
2852
2852
{
2853
2853
  char str[1024]=" utf8 test проба ПЕРА по-РУССКИ";
2854
 
  CHARSET_INFO *cs;
 
2854
  charset_info_st *cs;
2855
2855
 
2856
2856
  test_mb(cs,(unsigned char*)str);
2857
2857