~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to mysys/mf_dirname.cc

mergeĀ fromĀ lp

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
size_t dirname_length(const char *name)
22
22
{
23
23
  register const char *pos, *gpos;
24
 
#ifdef BASKSLASH_MBTAIL
25
 
  CHARSET_INFO *fs= fs_character_set();
26
 
#endif
27
24
#ifdef FN_DEVCHAR
28
25
  if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0)
29
26
#endif
32
29
  gpos= pos++;
33
30
  for ( ; *pos ; pos++)                         /* Find last FN_LIBCHAR */
34
31
  {
35
 
#ifdef BASKSLASH_MBTAIL
36
 
    uint32_t l;
37
 
    if (use_mb(fs) && (l= my_ismbchar(fs, pos, pos + 3)))
38
 
    {
39
 
      pos+= l - 1;
40
 
      continue;
41
 
    }
42
 
#endif
43
32
    if (*pos == FN_LIBCHAR || *pos == '/'
44
33
#ifdef FN_C_AFTER_DIR
45
34
        || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2
107
96
char *convert_dirname(char *to, const char *from, const char *from_end)
108
97
{
109
98
  char *to_org=to;
110
 
#ifdef BACKSLASH_MBTAIL
111
 
  CHARSET_INFO *fs= fs_character_set();
112
 
#endif
113
99
 
114
100
  /* We use -2 here, becasue we need place for the last FN_LIBCHAR */
115
101
  if (!from_end || (from_end - from) > FN_REFLEN-2)
129
115
#endif
130
116
      else
131
117
      {
132
 
#ifdef BACKSLASH_MBTAIL
133
 
        uint32_t l;
134
 
        if (use_mb(fs) && (l= my_ismbchar(fs, from, from + 3)))
135
 
        {
136
 
          memmove(to, from, l);
137
 
          to+= l;
138
 
          from+= l - 1;
139
 
          to_org= to; /* Don't look inside mbchar */
140
 
        }
141
 
        else
142
 
#endif
143
 
        {
144
 
          *to++= *from;
145
 
        }
 
118
        *to++= *from;
146
119
      }
147
120
    }
148
121
    *to=0;