fix ip6_fmt (martin paljak)

master
leitner 21 years ago
parent c4828b888a
commit 25181575b6

@ -25,6 +25,7 @@
support MacOS X sendfile (and comment it out again, the headers
declare it but it's not actually there) (thanks to Bernhard Schmidt)
support AIX 5 (thanks to Lutz Chwala and Arthur Erhardt)
fix ip6_fmt (martin paljak)
0.16:
add buffer_fromsa (make buffer from stralloc)

@ -9,9 +9,10 @@ unsigned int fmt_ip6(char *s,const char ip[16])
unsigned int i;
unsigned int temp;
unsigned int compressing;
unsigned int compressed;
int j;
len = 0; compressing = 0;
len = 0; compressing = 0; compressed = 0;
for (j=0; j<16; j+=2) {
if (j==12 && ip6_isv4mapped(ip)) {
temp=ip4_fmt(s,ip+12);
@ -20,7 +21,7 @@ unsigned int fmt_ip6(char *s,const char ip[16])
}
temp = ((unsigned long) (unsigned char) ip[j] << 8) +
(unsigned long) (unsigned char) ip[j+1];
if (temp == 0) {
if (temp == 0 && !compressed) {
if (!compressing) {
compressing=1;
if (j==0) {
@ -29,7 +30,7 @@ unsigned int fmt_ip6(char *s,const char ip[16])
}
} else {
if (compressing) {
compressing=0;
compressing=0; ++compressed;
if (s) *s++=':'; ++len;
}
i = fmt_xlong(s,temp); len += i; if (s) s += i;

Loading…
Cancel
Save