Add support for SMS national language identifiers
Aki Niemi
aki at protocolpolice.com
Mon Sep 7 04:49:03 PDT 2009
Hi Denis,
2009/9/4 Denis Kenzior <denkenz at gmail.com>:
> Just a couple of minor nitpicks:
> +struct single_shift_table {
> + struct codepoint *table;
> + unsigned int len;
> +};
> +
> +static struct single_shift_table gsm_single_shift[] =
> +{
> + { default_ext_gsm, TABLE_SIZE(default_ext_gsm) },
> + { turkish_ext_gsm, TABLE_SIZE(turkish_ext_gsm) },
> + { spanish_ext_gsm, TABLE_SIZE(spanish_ext_gsm) },
> + { portuguese_ext_gsm, TABLE_SIZE(portuguese_ext_gsm) }
> +};
> +
> +static struct single_shift_table unicode_single_shift[] =
> +{
> + { default_ext_unicode, TABLE_SIZE(default_ext_unicode) },
> + { turkish_ext_unicode, TABLE_SIZE(turkish_ext_unicode) },
> + { spanish_ext_unicode, TABLE_SIZE(spanish_ext_unicode) },
> + { portuguese_ext_unicode, TABLE_SIZE(portuguese_ext_unicode) }
> +};
> +
> +static const unsigned short *gsm_locking_shift[] =
> +{
> + default_gsm,
> + turkish_gsm,
> + default_gsm,
> + portuguese_gsm
> +};
> +
> +static struct codepoint *unicode_locking_shift[] =
> +{
> + default_unicode,
> + turkish_unicode,
> + default_unicode,
> + portuguese_unicode
>
> Can we put all of these into a single table?
Can you give an example of what you mean? I tried doing something like
that, but the initializer turned a bit hairy, so I reckoned in the end
there's not much to gain by doing that.
> +char *convert_gsm_to_utf8_with_lang(const unsigned char *text, long len,
> + long *items_read, long *items_written,
> + unsigned char terminator,
> + unsigned int locking_lang,
> + unsigned int single_lang)
>
> locking_lang & single_lang should be unsigned char or an enum.
Sure.
> +gboolean sms_extract_language_variant(const struct sms *sms, int *locking,
> + int *single);
>
> locking & single should use guint8.
Indeed.
> +enum sms_language {
> + SMS_LANGUAGE_DEFAULT = 0,
> + SMS_LANGUAGE_TURKISH = 1,
> + SMS_LANGUAGE_SPANISH = 2,
> + SMS_LANGUAGE_PORTUGUESE = 3
> +};
> +
>
> This part isn't used anywhere, should we just keep this out for now?
We can leave it out. It'll come in handy if/when we want to add
support on the encoding path.
Cheers,
Aki
More information about the ofono
mailing list