[sms] Fix the length of the of the outgoing data...
The returned length should be right now. The test case is passing.
This commit is contained in:
parent
77217de8a5
commit
0d4df32044
|
@ -49,8 +49,9 @@ u_int8_t *gsm_7bit_encode(const char *data, u_int8_t *out_length)
|
|||
int i;
|
||||
u_int8_t d_off = 0, b_off = 0;
|
||||
const int length = strlen(data);
|
||||
char *result = malloc(length + 1);
|
||||
memset(result, 0, length + 1);
|
||||
*out_length = (length * 8)/7;
|
||||
u_int8_t *result = malloc(*out_length);
|
||||
memset(result, 0, *out_length);
|
||||
|
||||
for (i = 0; i < length; ++i) {
|
||||
u_int8_t first = (data[i] & 0x7f) << b_off;
|
||||
|
@ -68,7 +69,5 @@ u_int8_t *gsm_7bit_encode(const char *data, u_int8_t *out_length)
|
|||
}
|
||||
}
|
||||
|
||||
*out_length = d_off + 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue