[PATCH 08/11] Add a buffer size parameter to convert_utf8_to_gsm
Denis Kenzior
denkenz at gmail.com
Tue Jun 1 16:50:09 PDT 2010
Hi Andrew,
> This is needed when encoding a string into gsm that needs to fit a
> in a given number of bytes. Just taking the first N bytes of the
> resulting string may leave you with byte 1 of a two-byte character at
> the end of the buffer. As far as I can tell there's no easier way to
> avoid that.
In gsm it is actually pretty easy, the escape character for two-byte sequence
is always 0x1b, so chopping a string up could be done quite easily.
> unsigned char *convert_utf8_to_gsm_with_lang(const char *text, long len,
> long *items_read, long *items_written, unsigned char terminator,
> + long max_size,
> enum gsm_dialect locking_shift_lang,
> enum gsm_dialect single_shift_lang);
If there's still need for this, I'd prefer we reuse long *items_written as an
in/out argument for the max size or add another function entirely, adding yet
another int argument is getting a bit ridiculous.
Regards,
-Denis
More information about the ofono
mailing list