mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 21:02:39 +02:00
Fix inet_ntop6
This commit is contained in:
parent
472d305883
commit
888f7e101f
@ -888,16 +888,17 @@ inet_ntop6(src, dst, size)
|
|||||||
//TuxSH:
|
//TuxSH:
|
||||||
//sprintf(tp, "%x", words[i]);
|
//sprintf(tp, "%x", words[i]);
|
||||||
{
|
{
|
||||||
char *e = tp + 7;
|
char hexbuf[8];
|
||||||
memset(e, '0', 4);
|
char *e = hexbuf + 7;
|
||||||
u_int word = words[i];
|
u_int word = words[i];
|
||||||
while(word > 0) {
|
while(word > 0) {
|
||||||
static const char digits[] = "0123456789abcdef";
|
static const char digits[] = "0123456789abcdef";
|
||||||
*e-- = digits[word & 0xF];
|
*e-- = digits[word & 0xF];
|
||||||
word >>= 4;
|
word >>= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(tp, e + 1, hexbuf + 8 - (e + 1));
|
||||||
}
|
}
|
||||||
tp += strlen(tp);
|
|
||||||
}
|
}
|
||||||
/* Was it a trailing run of 0x00's? */
|
/* Was it a trailing run of 0x00's? */
|
||||||
if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))
|
if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))
|
||||||
|
Loading…
Reference in New Issue
Block a user