diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-08-15 23:21:05 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-08-16 16:27:42 +0200 |
commit | 5a01e5406660bc4f5a3cf68254510e867f89a457 (patch) | |
tree | 584f237f83754ac84c10a569e5dbecdb6e9bb77d /src/mm-charsets.h | |
parent | 1f2bb640284ef75e411658a3ff67f844bea8b260 (diff) |
charsets: simplify check to see if conversion to charset possible
Instead of having a method that returns the expected length after the
conversion and the amount of input UTF-8 characters that couldn't be
converted to the given charset, simplify the logic and just define a
method that returns a boolean specifying whether the conversion is
possible or not.
Also, include unit tests.
Diffstat (limited to 'src/mm-charsets.h')
-rw-r--r-- | src/mm-charsets.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mm-charsets.h b/src/mm-charsets.h index c0b309e3..340ae95b 100644 --- a/src/mm-charsets.h +++ b/src/mm-charsets.h @@ -57,10 +57,9 @@ guint8 *mm_charset_utf8_to_unpacked_gsm (const char *utf8, guint32 *out_len); guint8 *mm_charset_gsm_unpacked_to_utf8 (const guint8 *gsm, guint32 len); -/* Returns the size in bytes required to hold the UTF-8 string in the given charset */ -guint mm_charset_get_encoded_len (const char *utf8, - MMModemCharset charset, - guint *out_unsupported); +/* Checks whether conversion to the given charset may be done without errors */ +gboolean mm_charset_can_convert_to (const char *utf8, + MMModemCharset charset); guint8 *mm_charset_gsm_unpack (const guint8 *gsm, guint32 num_septets, |