Don't hardcode

This commit is contained in:
Denis Kenzior 2009-07-02 12:55:01 -05:00
parent 5ec2e69daf
commit d717908c69
2 changed files with 7 additions and 5 deletions

View File

@ -2737,8 +2737,7 @@ char *cbs_decode_text(GSList *cbs_list, char *iso639_lang)
return NULL;
if (curch == SMS_CHARSET_7BIT) {
/* CBS can have up to 93 chars in 7Bit */
bufsize += 93;
bufsize += CBS_MAX_GSM_CHARS;
if (iso639)
bufsize -= 3;
@ -2783,11 +2782,14 @@ char *cbs_decode_text(GSList *cbs_list, char *iso639_lang)
taken = sms_udh_iter_get_udh_length(&iter) + 1;
if (charset == SMS_CHARSET_7BIT) {
unsigned char unpacked[93];
unsigned char unpacked[CBS_MAX_GSM_CHARS];
long written;
int max_chars = sms_text_capacity_gsm(93, taken);
int max_chars;
int i;
max_chars =
sms_text_capacity_gsm(CBS_MAX_GSM_CHARS, taken);
unpack_7bit_own_buf(ud + taken, 82 - taken,
taken, FALSE, max_chars,
&written, 0, unpacked);

View File

@ -19,7 +19,7 @@
*
*/
#define CBS_PAYLOAD_CHARACTERS 93
#define CBS_MAX_GSM_CHARS 93
enum sms_type {
SMS_TYPE_DELIVER = 0,