diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-08-21 16:56:02 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2018-08-21 17:00:21 +0200 |
commit | 4ef3623e6396d5e592410b0ce136a9acf559542d (patch) | |
tree | 06b5cfa41b76fd95170ba4b38bc4cc9d024d375b | |
parent | 63420884581852dda21f40ff88f81c49bae7680c (diff) |
shared-qmi: refactor parse_as_utf16_url()
Let it return a GArray directly. We don't expect this method to ever
fail, as it's converting from UTF-8 to UTF-16.
-rw-r--r-- | src/mm-shared-qmi.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mm-shared-qmi.c b/src/mm-shared-qmi.c index 6fa5aa45..25fc29a1 100644 --- a/src/mm-shared-qmi.c +++ b/src/mm-shared-qmi.c @@ -142,21 +142,20 @@ out: return valid; } -static gboolean -parse_as_utf16_url (const gchar *supl, - GArray **out_url) +static GArray * +parse_as_utf16_url (const gchar *supl) { - gchar *utf16; - gsize utf16_len; + GArray *url; + gchar *utf16; + gsize utf16_len; utf16 = g_convert (supl, -1, "UTF-16BE", "UTF-8", NULL, &utf16_len, NULL); - *out_url = g_array_append_vals (g_array_sized_new (FALSE, FALSE, sizeof (guint8), utf16_len), - utf16, utf16_len); + url = g_array_append_vals (g_array_sized_new (FALSE, FALSE, sizeof (guint8), utf16_len), + utf16, utf16_len); g_free (utf16); - return TRUE; + return url; } - gboolean mm_shared_qmi_location_set_supl_server_finish (MMIfaceModemLocation *self, GAsyncResult *res, @@ -213,11 +212,11 @@ pds_set_supl_server (GTask *task) if (parse_as_ip_port (ctx->supl, &ip, &port)) qmi_message_pds_set_agps_config_input_set_location_server_address (input, ip, port, NULL); - else if (parse_as_utf16_url (ctx->supl, &url)) { + else { + url = parse_as_utf16_url (ctx->supl); qmi_message_pds_set_agps_config_input_set_location_server_url (input, url, NULL); g_array_unref (url); - } else - g_assert_not_reached (); + } qmi_client_pds_set_agps_config ( QMI_CLIENT_PDS (ctx->client), |