| 177 | } |
| 178 | |
| 179 | bool charset_conv::convert(const char* fromCharset, const char* toCharset, |
| 180 | const char* in, size_t n, acl::string* out) |
| 181 | { |
| 182 | if (fromCharset == NULL || toCharset == NULL |
| 183 | || in == NULL || n == 0 || out == NULL) { |
| 184 | |
| 185 | m_errmsg = "params invalid"; |
| 186 | return false; |
| 187 | } |
| 188 | |
| 189 | if (!update_begin(fromCharset, toCharset)) { |
| 190 | reset(); |
| 191 | return false; |
| 192 | } |
| 193 | if (!update(in, n, out)) { |
| 194 | reset(); |
| 195 | return false; |
| 196 | } |
| 197 | update_finish(out); |
| 198 | return true; |
| 199 | } |
| 200 | |
| 201 | #define STR acl_vstring_str |
| 202 | #define LEN ACL_VSTRING_LEN |