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-sms-part-3gpp.c | |
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-sms-part-3gpp.c')
-rw-r--r-- | src/mm-sms-part-3gpp.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/mm-sms-part-3gpp.c b/src/mm-sms-part-3gpp.c index 8fd255ea..0b59b247 100644 --- a/src/mm-sms-part-3gpp.c +++ b/src/mm-sms-part-3gpp.c @@ -1026,7 +1026,6 @@ gchar ** mm_sms_part_3gpp_util_split_text (const gchar *text, MMSmsEncoding *encoding) { - guint gsm_unsupported = 0; gchar **out; guint n_chunks; guint i; @@ -1058,10 +1057,7 @@ mm_sms_part_3gpp_util_split_text (const gchar *text, */ /* Check if we can do GSM encoding */ - mm_charset_get_encoded_len (text, - MM_MODEM_CHARSET_GSM, - &gsm_unsupported); - if (gsm_unsupported > 0) { + if (!mm_charset_can_convert_to (text, MM_MODEM_CHARSET_GSM)) { /* If cannot do it in GSM encoding, do it in UCS-2 */ GByteArray *array; |