mirror of
https://github.com/curl/curl.git
synced 2025-02-23 15:10:03 +08:00
Dominick Meglio fixed this to build fine on MSVC
This commit is contained in:
parent
c29740f0d8
commit
e4adbf4017
@ -20,6 +20,11 @@
|
|||||||
|
|
||||||
#ifndef HAVE_INET_PTON
|
#ifndef HAVE_INET_PTON
|
||||||
|
|
||||||
|
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
|
||||||
|
#define EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||||
|
#include <winsock.h>
|
||||||
|
#else
|
||||||
|
|
||||||
#ifdef HAVE_SYS_PARAM_H
|
#ifdef HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
@ -35,6 +40,7 @@
|
|||||||
#ifdef HAVE_ARPA_INET_H
|
#ifdef HAVE_ARPA_INET_H
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@ -51,8 +57,8 @@
|
|||||||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int inet_pton4(const char *src, u_char *dst);
|
static int inet_pton4(const char *src, unsigned char *dst);
|
||||||
static int inet_pton6(const char *src, u_char *dst);
|
static int inet_pton6(const char *src, unsigned char *dst);
|
||||||
|
|
||||||
/* int
|
/* int
|
||||||
* inet_pton(af, src, dst)
|
* inet_pton(af, src, dst)
|
||||||
@ -96,11 +102,11 @@ Curl_inet_pton(af, src, dst)
|
|||||||
static int
|
static int
|
||||||
inet_pton4(src, dst)
|
inet_pton4(src, dst)
|
||||||
const char *src;
|
const char *src;
|
||||||
u_char *dst;
|
unsigned char *dst;
|
||||||
{
|
{
|
||||||
static const char digits[] = "0123456789";
|
static const char digits[] = "0123456789";
|
||||||
int saw_digit, octets, ch;
|
int saw_digit, octets, ch;
|
||||||
u_char tmp[INADDRSZ], *tp;
|
unsigned char tmp[INADDRSZ], *tp;
|
||||||
|
|
||||||
saw_digit = 0;
|
saw_digit = 0;
|
||||||
octets = 0;
|
octets = 0;
|
||||||
@ -150,11 +156,11 @@ inet_pton4(src, dst)
|
|||||||
static int
|
static int
|
||||||
inet_pton6(src, dst)
|
inet_pton6(src, dst)
|
||||||
const char *src;
|
const char *src;
|
||||||
u_char *dst;
|
unsigned char *dst;
|
||||||
{
|
{
|
||||||
static const char xdigits_l[] = "0123456789abcdef",
|
static const char xdigits_l[] = "0123456789abcdef",
|
||||||
xdigits_u[] = "0123456789ABCDEF";
|
xdigits_u[] = "0123456789ABCDEF";
|
||||||
u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
|
unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
|
||||||
const char *xdigits, *curtok;
|
const char *xdigits, *curtok;
|
||||||
int ch, saw_xdigit;
|
int ch, saw_xdigit;
|
||||||
u_int val;
|
u_int val;
|
||||||
@ -192,8 +198,8 @@ inet_pton6(src, dst)
|
|||||||
}
|
}
|
||||||
if (tp + INT16SZ > endp)
|
if (tp + INT16SZ > endp)
|
||||||
return (0);
|
return (0);
|
||||||
*tp++ = (u_char) (val >> 8) & 0xff;
|
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||||
*tp++ = (u_char) val & 0xff;
|
*tp++ = (unsigned char) val & 0xff;
|
||||||
saw_xdigit = 0;
|
saw_xdigit = 0;
|
||||||
val = 0;
|
val = 0;
|
||||||
continue;
|
continue;
|
||||||
@ -209,8 +215,8 @@ inet_pton6(src, dst)
|
|||||||
if (saw_xdigit) {
|
if (saw_xdigit) {
|
||||||
if (tp + INT16SZ > endp)
|
if (tp + INT16SZ > endp)
|
||||||
return (0);
|
return (0);
|
||||||
*tp++ = (u_char) (val >> 8) & 0xff;
|
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||||
*tp++ = (u_char) val & 0xff;
|
*tp++ = (unsigned char) val & 0xff;
|
||||||
}
|
}
|
||||||
if (colonp != NULL) {
|
if (colonp != NULL) {
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user