Ignore:
Timestamp:
Jun 11, 2008 11:18:04 AM (16 years ago)
Author:
bennylp
Message:

Fixed error representing the qvalue in Contact header (parser error), and optimize the printing to remove ending zero digits (thanks Philippe Leuba)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_msg.c

    r1954 r2005  
    11321132 
    11331133        if (hdr->q1000) { 
     1134            unsigned frac; 
     1135 
    11341136            if (buf+19 >= endbuf) 
    11351137                return -1; 
     
    11421144            printed = pj_utoa(hdr->q1000/1000, buf+3); 
    11431145            buf += printed + 3; 
    1144             *buf++ = '.'; 
    1145             printed = pj_utoa(hdr->q1000 % 1000, buf); 
    1146             buf += printed; 
     1146            frac = hdr->q1000 % 1000; 
     1147            if (frac != 0) { 
     1148                *buf++ = '.'; 
     1149                if ((frac % 100)==0) frac /= 100; 
     1150                if ((frac % 10)==0) frac /= 10; 
     1151                printed = pj_utoa(frac, buf); 
     1152                buf += printed; 
     1153            } 
    11471154        } 
    11481155 
Note: See TracChangeset for help on using the changeset viewer.