Convert a string to 8-bit representation, for use in str_to_time/str_to_date/str_to_date. In the future to_ascii() can be extended to convert non-ASCII digits to ASCII digits (for example, ARABIC-INDIC, DEVANAGARI, BENGALI, and so on) so DATE/TIME/DATETIME values understand digits in the respected scripts. */
| 227 | respected scripts. |
| 228 | */ |
| 229 | static uint |
| 230 | to_ascii(const CHARSET_INFO *cs, |
| 231 | const char *src, uint src_length, |
| 232 | char *dst, uint dst_length) |
| 233 | |
| 234 | { |
| 235 | int cnvres; |
| 236 | my_wc_t wc; |
| 237 | const char *srcend= src + src_length; |
| 238 | char *dst0= dst, *dstend= dst + dst_length - 1; |
| 239 | while (dst < dstend && |
| 240 | (cnvres= (cs->cset->mb_wc)(cs, &wc, |
| 241 | (const uchar*) src, |
| 242 | (const uchar*) srcend)) > 0 && |
| 243 | wc < 128) |
| 244 | { |
| 245 | src+= cnvres; |
| 246 | *dst++= wc; |
| 247 | } |
| 248 | *dst= '\0'; |
| 249 | return dst - dst0; |
| 250 | } |
| 251 | |
| 252 | |
| 253 | /* Character set-aware version of str_to_time() */ |
no outgoing calls
no test coverage detected