mirror of
https://frontier.innolan.net/rainlance/c-ares.git
synced 2025-12-09 12:30:07 +00:00
ares_inet_ntop: remove definition and usage of macro SPRINTF
Existing definition of SPRINTF always resulted in sprintf() being used, and sprintf() returning 'int' is already used throughout the library.
This commit is contained in:
10
inet_ntop.c
10
inet_ntop.c
@ -48,12 +48,6 @@
|
||||
|
||||
#ifndef HAVE_INET_NTOP
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WARNING: Don't even consider trying to compile this on a system where
|
||||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||
@ -107,7 +101,7 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size)
|
||||
static const char fmt[] = "%u.%u.%u.%u";
|
||||
char tmp[sizeof("255.255.255.255")];
|
||||
|
||||
if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) >= size) {
|
||||
if ((size_t)sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) >= size) {
|
||||
SET_ERRNO(ENOSPC);
|
||||
return (NULL);
|
||||
}
|
||||
@ -194,7 +188,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
|
||||
tp += strlen(tp);
|
||||
break;
|
||||
}
|
||||
tp += SPRINTF((tp, "%x", words[i]));
|
||||
tp += sprintf(tp, "%x", words[i]);
|
||||
}
|
||||
/* Was it a trailing run of 0x00's? */
|
||||
if (best.base != -1 && (best.base + best.len) ==
|
||||
|
||||
Reference in New Issue
Block a user