charsets: make charset_gsm_unpacked_to_utf8() private

Use the generic mm_modem_charset_bytearray_to_utf8() instead.
This commit is contained in:
Aleksander Morgado
2021-02-23 11:35:11 +00:00
parent 8bfdfb187b
commit 033e174e44
7 changed files with 58 additions and 39 deletions
+10 -5
View File
@@ -2329,10 +2329,11 @@ decode (MMIfaceModem3gppUssd *self,
const gchar *reply,
GError **error)
{
g_autofree guint8 *bin = NULL;
g_autofree guint8 *unpacked = NULL;
gsize bin_len = 0;
guint32 unpacked_len;
g_autofree guint8 *bin = NULL;
gsize bin_len = 0;
g_autofree guint8 *unpacked = NULL;
guint32 unpacked_len;
g_autoptr(GByteArray) unpacked_array = NULL;
bin = mm_utils_hexstr2bin (reply, -1, &bin_len, error);
if (!bin)
@@ -2342,7 +2343,11 @@ decode (MMIfaceModem3gppUssd *self,
/* if the last character in a 7-byte block is padding, then drop it */
if ((bin_len % 7 == 0) && (unpacked[unpacked_len - 1] == 0x0d))
unpacked_len--;
return (gchar *) mm_charset_gsm_unpacked_to_utf8 (unpacked, unpacked_len, FALSE, error);
unpacked_array = g_byte_array_sized_new (unpacked_len);
g_byte_array_append (unpacked_array, unpacked, unpacked_len);
return mm_modem_charset_bytearray_to_utf8 (unpacked_array, MM_MODEM_CHARSET_GSM, FALSE, error);
}
/*****************************************************************************/