charsets: don't allow quoting in byte_array_append()
There's no point in adding a quoting option to this method; if the caller needs the appended string quoted, it should quote it before passing it to this method. It was nowhere used anyway.
This commit is contained in:
@@ -4792,7 +4792,7 @@ ussd_encode (const gchar *command,
|
||||
|
||||
*scheme = MM_MODEM_GSM_USSD_SCHEME_UCS2;
|
||||
array = g_byte_array_sized_new (strlen (command) * 2);
|
||||
if (!mm_modem_charset_byte_array_append (array, command, FALSE, MM_MODEM_CHARSET_UCS2, &inner_error)) {
|
||||
if (!mm_modem_charset_byte_array_append (array, command, MM_MODEM_CHARSET_UCS2, &inner_error)) {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Failed to encode USSD command in UCS2 charset: %s", inner_error->message);
|
||||
return NULL;
|
||||
|
||||
@@ -7257,7 +7257,7 @@ ussd_encode (const gchar *command,
|
||||
}
|
||||
|
||||
barray = g_byte_array_sized_new (command_len * 2);
|
||||
if (!mm_modem_charset_byte_array_append (barray, command, FALSE, MM_MODEM_CHARSET_UCS2, &inner_error)) {
|
||||
if (!mm_modem_charset_byte_array_append (barray, command, MM_MODEM_CHARSET_UCS2, &inner_error)) {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Failed to encode USSD command in UCS2 charset: %s", inner_error->message);
|
||||
return NULL;
|
||||
|
||||
@@ -5890,11 +5890,7 @@ modem_3gpp_ussd_encode (MMIfaceModem3gppUssd *self,
|
||||
|
||||
/* Encode to the current charset (as per AT+CSCS, which is what most modems
|
||||
* (except for Huawei it seems) will ask for. */
|
||||
if (mm_modem_charset_byte_array_append (ussd_command,
|
||||
command,
|
||||
FALSE,
|
||||
broadband->priv->modem_current_charset,
|
||||
NULL)) {
|
||||
if (mm_modem_charset_byte_array_append (ussd_command, command, broadband->priv->modem_current_charset, NULL)) {
|
||||
/* The scheme value does NOT represent the encoding used to encode the string
|
||||
* we're giving. This scheme reflects the encoding that the modem should use when
|
||||
* sending the data out to the network. We're hardcoding this to GSM-7 because
|
||||
|
||||
@@ -105,7 +105,6 @@ charset_iconv_from (MMModemCharset charset)
|
||||
gboolean
|
||||
mm_modem_charset_byte_array_append (GByteArray *array,
|
||||
const gchar *utf8,
|
||||
gboolean quoted,
|
||||
MMModemCharset charset,
|
||||
GError **error)
|
||||
{
|
||||
@@ -126,11 +125,7 @@ mm_modem_charset_byte_array_append (GByteArray *array,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (quoted)
|
||||
g_byte_array_append (array, (const guint8 *) "\"", 1);
|
||||
g_byte_array_append (array, (const guint8 *) converted, written);
|
||||
if (quoted)
|
||||
g_byte_array_append (array, (const guint8 *) "\"", 1);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ MMModemCharset mm_modem_charset_from_string (const gchar *string);
|
||||
*/
|
||||
gboolean mm_modem_charset_byte_array_append (GByteArray *array,
|
||||
const gchar *utf8,
|
||||
gboolean quoted,
|
||||
MMModemCharset charset,
|
||||
GError **error);
|
||||
|
||||
|
||||
@@ -1011,7 +1011,7 @@ mm_sms_part_3gpp_get_submit_pdu (MMSmsPart *part,
|
||||
/* Try to guess a good value for the array */
|
||||
array = g_byte_array_sized_new (strlen (mm_sms_part_get_text (part)) * 2);
|
||||
/* Always assume UTF-16 instead of UCS-2! */
|
||||
if (!mm_modem_charset_byte_array_append (array, mm_sms_part_get_text (part), FALSE, MM_MODEM_CHARSET_UTF16, &inner_error)) {
|
||||
if (!mm_modem_charset_byte_array_append (array, mm_sms_part_get_text (part), MM_MODEM_CHARSET_UTF16, &inner_error)) {
|
||||
g_set_error (error,
|
||||
MM_MESSAGE_ERROR,
|
||||
MM_MESSAGE_ERROR_INVALID_PDU_PARAMETER,
|
||||
|
||||
+2
-10
@@ -1411,11 +1411,7 @@ decide_best_encoding (const gchar *text,
|
||||
/* Check if we can do Latin encoding */
|
||||
if (mm_charset_can_convert_to (text, MM_MODEM_CHARSET_8859_1)) {
|
||||
*out = g_byte_array_sized_new (len);
|
||||
if (!mm_modem_charset_byte_array_append (*out,
|
||||
text,
|
||||
FALSE,
|
||||
MM_MODEM_CHARSET_8859_1,
|
||||
&error))
|
||||
if (!mm_modem_charset_byte_array_append (*out, text, MM_MODEM_CHARSET_8859_1, &error))
|
||||
mm_obj_warn (log_object, "failed to convert to latin encoding: %s", error->message);
|
||||
*num_fields = (*out)->len;
|
||||
*num_bits_per_field = 8;
|
||||
@@ -1425,11 +1421,7 @@ decide_best_encoding (const gchar *text,
|
||||
|
||||
/* If no Latin and no ASCII, default to UTF-16 */
|
||||
*out = g_byte_array_sized_new (len * 2);
|
||||
if (!mm_modem_charset_byte_array_append (*out,
|
||||
text,
|
||||
FALSE,
|
||||
MM_MODEM_CHARSET_UCS2,
|
||||
&error))
|
||||
if (!mm_modem_charset_byte_array_append (*out, text, MM_MODEM_CHARSET_UCS2, &error))
|
||||
mm_obj_warn (log_object, "failed to convert to UTF-16 encoding: %s", error->message);
|
||||
*num_fields = (*out)->len / 2;
|
||||
*num_bits_per_field = 16;
|
||||
|
||||
Reference in New Issue
Block a user