comparison src/mule-canna.c @ 116:9f59509498e1 r20-1b10

Import from CVS: tag r20-1b10
author cvs
date Mon, 13 Aug 2007 09:23:06 +0200
parents 8619ce7e4c50
children e121b013d1f0
comparison
equal deleted inserted replaced
115:f109f7dabbe2 116:9f59509498e1
1587 c2mu (p,l,cbuf); 1587 c2mu (p,l,cbuf);
1588 return (make_string (cbuf,strlen (cbuf))); 1588 return (make_string (cbuf,strlen (cbuf)));
1589 } 1589 }
1590 1590
1591 /* return the MULE internal string length of EUC string */ 1591 /* return the MULE internal string length of EUC string */
1592 /* Modified by sb to return a character count not byte count. */
1592 static int 1593 static int
1593 mule_strlen (unsigned char *p, int l) 1594 mule_strlen (unsigned char *p, int l)
1594 { 1595 {
1595 unsigned char ch, *cp = p; 1596 unsigned char ch, *cp = p;
1596 int len = 0; 1597 int len = 0;
1597 1598
1598 while ((cp < p + l) && (ch = *cp)) 1599 while ((cp < p + l) && (ch = *cp))
1599 { 1600 {
1600 if ((unsigned char) ch == ISO_CODE_SS2) 1601 if ((unsigned char) ch == ISO_CODE_SS2)
1601 { 1602 {
1602 len += 2; 1603 len++;
1603 cp += 2; 1604 cp += 2;
1604 } 1605 }
1605 else if ((unsigned char) ch == ISO_CODE_SS3) 1606 else if ((unsigned char) ch == ISO_CODE_SS3)
1606 { 1607 {
1607 len += 3; 1608 len++;
1608 cp += 3; 1609 cp += 3;
1609 } 1610 }
1610 else if (ch & 0x80) 1611 else if (ch & 0x80)
1611 { 1612 {
1612 len += 3; 1613 len++;
1613 cp += 2; 1614 cp += 2;
1614 } 1615 }
1615 else 1616 else
1616 { 1617 {
1617 len++; 1618 len++;