aboutsummaryrefslogtreecommitdiff
path: root/src/mm-sms-part-3gpp.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-12-21 14:20:13 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-02-23 11:35:11 +0000
commit033e174e445ff7606ea43191a4a5c141413e10e2 (patch)
treeb5f2cdb7cf5f1759ed6c68e5a63b878821ec6417 /src/mm-sms-part-3gpp.c
parent8bfdfb187b9c911366376f1574dc7e45fe4f0767 (diff)
charsets: make charset_gsm_unpacked_to_utf8() private
Use the generic mm_modem_charset_bytearray_to_utf8() instead.
Diffstat (limited to 'src/mm-sms-part-3gpp.c')
-rw-r--r--src/mm-sms-part-3gpp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mm-sms-part-3gpp.c b/src/mm-sms-part-3gpp.c
index f467c97b..29b49a68 100644
--- a/src/mm-sms-part-3gpp.c
+++ b/src/mm-sms-part-3gpp.c
@@ -133,11 +133,13 @@ sms_decode_address (const guint8 *address,
address++;
if (addrtype == SMS_NUMBER_TYPE_ALPHA) {
- g_autofree guint8 *unpacked = NULL;
- guint32 unpacked_len;
+ g_autoptr(GByteArray) unpacked_array = NULL;
+ guint8 *unpacked = NULL;
+ guint32 unpacked_len;
unpacked = mm_charset_gsm_unpack (address, (len * 4) / 7, 0, &unpacked_len);
- utf8 = (gchar *) mm_charset_gsm_unpacked_to_utf8 (unpacked, unpacked_len, FALSE, error);
+ unpacked_array = g_byte_array_new_take (unpacked, unpacked_len);
+ utf8 = mm_modem_charset_bytearray_to_utf8 (unpacked_array, MM_MODEM_CHARSET_GSM, FALSE, error);
} else if (addrtype == SMS_NUMBER_TYPE_INTL &&
addrplan == SMS_NUMBER_PLAN_TELEPHONE) {
/* International telphone number, format as "+1234567890" */
@@ -249,12 +251,14 @@ sms_decode_text (const guint8 *text,
GError **error)
{
if (encoding == MM_SMS_ENCODING_GSM7) {
- g_autofree guint8 *unpacked = NULL;
- guint32 unpacked_len;
- gchar *utf8;
+ g_autoptr(GByteArray) unpacked_array = NULL;
+ guint8 *unpacked = NULL;
+ guint32 unpacked_len;
+ gchar *utf8;
unpacked = mm_charset_gsm_unpack ((const guint8 *) text, len, bit_offset, &unpacked_len);
- utf8 = (gchar *) mm_charset_gsm_unpacked_to_utf8 (unpacked, unpacked_len, FALSE, error);
+ unpacked_array = g_byte_array_new_take (unpacked, unpacked_len);
+ utf8 = mm_modem_charset_bytearray_to_utf8 (unpacked_array, MM_MODEM_CHARSET_GSM, FALSE, error);
if (utf8)
mm_obj_dbg (log_object, "converted SMS part text from GSM-7 to UTF-8: %s", utf8);
return utf8;