Ticket #1591: libgsmd-sms-unpacking-7bit-return-dest-length.patch

File libgsmd-sms-unpacking-7bit-return-dest-length.patch, 765 bytes (added by stiell, 11 years ago)

Return the length of dest (which moko-sms needs to know) instead of src->length (already known).

  • gsm/src/libgsmd/libgsmd_sms.c

    old new int packing_7bit_character(const char *s 
    290290int unpacking_7bit_character(const struct gsmd_sms *src, char *dest) 
    291291{ 
    292292        int i = 0; 
     293        int l = 0; 
    293294 
    294295        if (src->has_header) 
    295                 i += ((src->data[0] << 3) + 14) / 7; 
     296                l += ((src->data[0] << 3) + 14) / 7; 
     297        i += l; 
    296298        for (; i < src->length; i ++) 
    297299                *(dest ++) = 
    298300                        ((src->data[(i * 7 + 7) >> 3] << 
    int unpacking_7bit_character(const struc 
    301303                          ((i * 7) & 7))) & 0x7f; 
    302304        *dest = '\0'; 
    303305 
    304         return i; 
     306        return i - l; 
    305307} 
    306308 
    307309int cbm_unpacking_7bit_character(const char *src, char *dest)