Copy a string, with optional character set conversion, with optional left padding (for binary -> UCS2 conversion) Bad input bytes are replaced to '?'. The string that is written to "to" is always well-formed. @param to The destination string @param to_length Space available in "to" @param to_cs Character set of the "to" string @param from
| 1117 | @returns number of bytes that were written to 'to' |
| 1118 | */ |
| 1119 | uint |
| 1120 | String_copier::well_formed_copy(CHARSET_INFO *to_cs, |
| 1121 | char *to, size_t to_length, |
| 1122 | CHARSET_INFO *from_cs, |
| 1123 | const char *from, size_t from_length, |
| 1124 | size_t nchars) |
| 1125 | { |
| 1126 | if ((to_cs == &my_charset_bin) || |
| 1127 | (from_cs == &my_charset_bin) || |
| 1128 | (to_cs == from_cs) || |
| 1129 | my_charset_same(from_cs, to_cs)) |
| 1130 | { |
| 1131 | m_cannot_convert_error_pos= NULL; |
| 1132 | return (uint) to_cs->copy_fix(to, to_length, from, from_length, |
| 1133 | nchars, this); |
| 1134 | } |
| 1135 | return (uint) my_convert_fix(to_cs, to, to_length, from_cs, from, from_length, |
| 1136 | nchars, this, this); |
| 1137 | } |
| 1138 | |
| 1139 | |
| 1140 | /* |
no test coverage detected