mirror of https://github.com/acidanthera/audk.git
* StdLib.dsc was changed to always build the sockets code.
* Fix errors detected by the GCC compiler (pointer conversions and format mismatches). * Worked around a GCC flow analysis issue in base64.c where the compiler is convinced that there is a path through the code where "input" is used but not initialized. * Added EFIAPI to the file system operation routines for sockets to match the API declaration. Note for GCC, the meaning of "l" and "L" are different in printf and sscanf format strings. The lower case "l" indicates a 32-bit value where the capital "L" indicates a 64-bit value. The native (default) integer size may be represented by a size letter of "n". Signed-off-by: lpleahy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13023 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1f33d18687
commit
7700f0f5c0
|
@ -82,6 +82,7 @@ BslFdToSocketProtocol (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
|
EFIAPI
|
||||||
BslSocketClose (
|
BslSocketClose (
|
||||||
struct __filedes * pDescriptor
|
struct __filedes * pDescriptor
|
||||||
);
|
);
|
||||||
|
@ -113,6 +114,7 @@ BslSocketCloseWork (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
short
|
short
|
||||||
|
EFIAPI
|
||||||
BslSocketPoll (
|
BslSocketPoll (
|
||||||
IN struct __filedes * pDescriptor,
|
IN struct __filedes * pDescriptor,
|
||||||
IN short Events
|
IN short Events
|
||||||
|
@ -152,6 +154,7 @@ BslSocketProtocolToFd (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
ssize_t
|
ssize_t
|
||||||
|
EFIAPI
|
||||||
BslSocketRead (
|
BslSocketRead (
|
||||||
struct __filedes *pDescriptor,
|
struct __filedes *pDescriptor,
|
||||||
off_t * pOffset,
|
off_t * pOffset,
|
||||||
|
@ -172,6 +175,7 @@ BslSocketRead (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
ssize_t
|
ssize_t
|
||||||
|
EFIAPI
|
||||||
BslSocketWrite (
|
BslSocketWrite (
|
||||||
struct __filedes *pDescriptor,
|
struct __filedes *pDescriptor,
|
||||||
off_t * pOffset,
|
off_t * pOffset,
|
||||||
|
|
|
@ -171,6 +171,7 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
|
||||||
u_char output[4];
|
u_char output[4];
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
input[0] = input[1] = input[2] = '\0';
|
||||||
while (2 < srclength) {
|
while (2 < srclength) {
|
||||||
input[0] = *src++;
|
input[0] = *src++;
|
||||||
input[1] = *src++;
|
input[1] = *src++;
|
||||||
|
|
|
@ -94,6 +94,7 @@ BslSocketCloseWork (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
int
|
int
|
||||||
|
EFIAPI
|
||||||
BslSocketClose (
|
BslSocketClose (
|
||||||
struct __filedes * pDescriptor
|
struct __filedes * pDescriptor
|
||||||
)
|
)
|
||||||
|
|
|
@ -557,8 +557,8 @@ getaddrinfo(const char *hostname, const char *servname,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const ns_dtab dtab[] = {
|
static const ns_dtab dtab[] = {
|
||||||
NS_FILES_CB(_files_getaddrinfo, NULL)
|
NS_FILES_CB(((nss_method)_files_getaddrinfo), NULL)
|
||||||
{ NSSRC_DNS, _dns_getaddrinfo, NULL }, /* force -DHESIOD */
|
{ NSSRC_DNS, ((nss_method)_dns_getaddrinfo), NULL }, /* force -DHESIOD */
|
||||||
NS_NIS_CB(_yp_getaddrinfo, NULL)
|
NS_NIS_CB(_yp_getaddrinfo, NULL)
|
||||||
NS_NULL_CB
|
NS_NULL_CB
|
||||||
};
|
};
|
||||||
|
|
|
@ -126,7 +126,7 @@ inet_net_ntop_ipv4(
|
||||||
if (dst != odst)
|
if (dst != odst)
|
||||||
*dst++ = '.';
|
*dst++ = '.';
|
||||||
m = ((1 << b) - 1) << (8 - b);
|
m = ((1 << b) - 1) << (8 - b);
|
||||||
dst += SPRINTF((dst, "%u", *src & m));
|
dst += SPRINTF((dst, "%u", ((unsigned int)(*src & m))));
|
||||||
size -= (size_t)(dst - t);
|
size -= (size_t)(dst - t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ ns_ntoa(
|
||||||
u_char *uplim = up + 6;
|
u_char *uplim = up + 6;
|
||||||
|
|
||||||
net.net_e = addr.x_net;
|
net.net_e = addr.x_net;
|
||||||
sprintf(obuf, "%lx", (u_long)ntohl(net.long_e));
|
sprintf(obuf, "%Lx", (u_long)ntohl(net.long_e));
|
||||||
cp = spectHex(obuf);
|
cp = spectHex(obuf);
|
||||||
cp2 = cp + 1;
|
cp2 = cp + 1;
|
||||||
while (*up==0 && up < uplim) up++;
|
while (*up==0 && up < uplim) up++;
|
||||||
|
|
|
@ -228,7 +228,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
/* Serial number. */
|
/* Serial number. */
|
||||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||||
T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
|
T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
|
||||||
len = SPRINTF((tmp, "%lu", t));
|
len = SPRINTF((tmp, "%Lu", t));
|
||||||
T(addstr(tmp, len, &buf, &buflen));
|
T(addstr(tmp, len, &buf, &buflen));
|
||||||
T(spaced = addtab(len, 16, spaced, &buf, &buflen));
|
T(spaced = addtab(len, 16, spaced, &buf, &buflen));
|
||||||
T(addstr("; serial\n", 9, &buf, &buflen));
|
T(addstr("; serial\n", 9, &buf, &buflen));
|
||||||
|
@ -284,7 +284,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
/* Priority. */
|
/* Priority. */
|
||||||
t = ns_get16(rdata);
|
t = ns_get16(rdata);
|
||||||
rdata += NS_INT16SZ;
|
rdata += NS_INT16SZ;
|
||||||
len = SPRINTF((tmp, "%u ", t));
|
len = SPRINTF((tmp, "%u ", (unsigned int)t));
|
||||||
T(addstr(tmp, len, &buf, &buflen));
|
T(addstr(tmp, len, &buf, &buflen));
|
||||||
|
|
||||||
/* Target. */
|
/* Target. */
|
||||||
|
@ -302,7 +302,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
/* Priority. */
|
/* Priority. */
|
||||||
t = ns_get16(rdata);
|
t = ns_get16(rdata);
|
||||||
rdata += NS_INT16SZ;
|
rdata += NS_INT16SZ;
|
||||||
len = SPRINTF((tmp, "%u ", t));
|
len = SPRINTF((tmp, "%u ", (unsigned int)t));
|
||||||
T(addstr(tmp, len, &buf, &buflen));
|
T(addstr(tmp, len, &buf, &buflen));
|
||||||
|
|
||||||
/* Name1. */
|
/* Name1. */
|
||||||
|
@ -363,7 +363,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
/* Order, Precedence. */
|
/* Order, Precedence. */
|
||||||
order = ns_get16(rdata); rdata += NS_INT16SZ;
|
order = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||||
preference = ns_get16(rdata); rdata += NS_INT16SZ;
|
preference = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||||
len = SPRINTF((t, "%u %u ", order, preference));
|
len = SPRINTF((t, "%u %u ", (unsigned int)order, (unsigned int)preference));
|
||||||
T(addstr(t, len, &buf, &buflen));
|
T(addstr(t, len, &buf, &buflen));
|
||||||
|
|
||||||
/* Flags. */
|
/* Flags. */
|
||||||
|
@ -404,7 +404,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
priority = ns_get16(rdata); rdata += NS_INT16SZ;
|
priority = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||||
weight = ns_get16(rdata); rdata += NS_INT16SZ;
|
weight = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||||
port = ns_get16(rdata); rdata += NS_INT16SZ;
|
port = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||||
len = SPRINTF((t, "%u %u %u ", priority, weight, port));
|
len = SPRINTF((t, "%u %u %u ", (unsigned int)priority, (unsigned int)weight, (unsigned int)port));
|
||||||
T(addstr(t, len, &buf, &buflen));
|
T(addstr(t, len, &buf, &buflen));
|
||||||
|
|
||||||
/* Server. */
|
/* Server. */
|
||||||
|
@ -477,7 +477,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
protocol = *rdata++;
|
protocol = *rdata++;
|
||||||
algorithm = *rdata++;
|
algorithm = *rdata++;
|
||||||
len = SPRINTF((tmp, "0x%04x %u %u",
|
len = SPRINTF((tmp, "0x%04x %u %u",
|
||||||
keyflags, protocol, algorithm));
|
(unsigned int)keyflags, (unsigned int)protocol, (unsigned int)algorithm));
|
||||||
T(addstr(tmp, len, &buf, &buflen));
|
T(addstr(tmp, len, &buf, &buflen));
|
||||||
|
|
||||||
/* Public key data. */
|
/* Public key data. */
|
||||||
|
@ -516,8 +516,8 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
algorithm = *rdata++;
|
algorithm = *rdata++;
|
||||||
labels = *rdata++;
|
labels = *rdata++;
|
||||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||||
len = SPRINTF((tmp, " %s %d %lu ",
|
len = SPRINTF((tmp, " %s %d %Lu ",
|
||||||
p_type((int)type), algorithm, t));
|
p_type((int)type), (int)algorithm, t));
|
||||||
T(addstr(tmp, len, &buf, &buflen));
|
T(addstr(tmp, len, &buf, &buflen));
|
||||||
if (labels != (u_int)dn_count_labels(name))
|
if (labels != (u_int)dn_count_labels(name))
|
||||||
goto formerr;
|
goto formerr;
|
||||||
|
@ -534,7 +534,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||||
|
|
||||||
/* Signature Footprint. */
|
/* Signature Footprint. */
|
||||||
footprint = ns_get16(rdata); rdata += NS_INT16SZ;
|
footprint = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||||
len = SPRINTF((tmp, "%u ", footprint));
|
len = SPRINTF((tmp, "%u ", (unsigned int)footprint));
|
||||||
T(addstr(tmp, len, &buf, &buflen));
|
T(addstr(tmp, len, &buf, &buflen));
|
||||||
|
|
||||||
/* Signer's name. */
|
/* Signer's name. */
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
**/
|
**/
|
||||||
short
|
short
|
||||||
|
EFIAPI
|
||||||
BslSocketPoll (
|
BslSocketPoll (
|
||||||
IN struct __filedes * pDescriptor,
|
IN struct __filedes * pDescriptor,
|
||||||
IN short Events
|
IN short Events
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
**/
|
**/
|
||||||
ssize_t
|
ssize_t
|
||||||
|
EFIAPI
|
||||||
BslSocketRead (
|
BslSocketRead (
|
||||||
struct __filedes *pDescriptor,
|
struct __filedes *pDescriptor,
|
||||||
off_t * pOffset,
|
off_t * pOffset,
|
||||||
|
|
|
@ -243,7 +243,7 @@ fp_nquery(const u_char *msg, int len, FILE *file) {
|
||||||
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX) || rcode)
|
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX) || rcode)
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
";; ->>HEADER<<- opcode: %s, status: %s, id: %d\n",
|
";; ->>HEADER<<- opcode: %s, status: %s, id: %d\n",
|
||||||
_res_opcodes[opcode], _res_resultcodes[rcode], id);
|
_res_opcodes[opcode], _res_resultcodes[rcode], (int)id);
|
||||||
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX))
|
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX))
|
||||||
putc(';', file);
|
putc(';', file);
|
||||||
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD2)) {
|
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD2)) {
|
||||||
|
@ -536,7 +536,7 @@ p_option(u_long option) {
|
||||||
case RES_DNSRCH: return "dnsrch";
|
case RES_DNSRCH: return "dnsrch";
|
||||||
case RES_INSECURE1: return "insecure1";
|
case RES_INSECURE1: return "insecure1";
|
||||||
case RES_INSECURE2: return "insecure2";
|
case RES_INSECURE2: return "insecure2";
|
||||||
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
|
default: sprintf(nbuf, "?0x%Lx?", (u_long)option);
|
||||||
return (nbuf);
|
return (nbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,6 @@ static char rcsid[] = "$Id: res_send.c,v 1.1.1.1 2003/11/19 01:51:39 kyu3 Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NOPOLL /* libc_r doesn't wrap poll yet() */
|
#ifdef NOPOLL /* libc_r doesn't wrap poll yet() */
|
||||||
static int use_poll = 0;
|
|
||||||
#else
|
#else
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
static int use_poll = 1; /* adapt to poll() syscall availability */
|
static int use_poll = 1; /* adapt to poll() syscall availability */
|
||||||
|
@ -855,10 +854,10 @@ read_len:
|
||||||
((_res.pfcode & RES_PRF_REPLY) &&
|
((_res.pfcode & RES_PRF_REPLY) &&
|
||||||
(_res.pfcode & RES_PRF_HEAD1)),
|
(_res.pfcode & RES_PRF_HEAD1)),
|
||||||
(stdout, ";; got answer:\n"));
|
(stdout, ";; got answer:\n"));
|
||||||
DprintQ((_res.options & RES_DEBUG) ||
|
if((_res.options & RES_DEBUG) ||
|
||||||
(_res.pfcode & RES_PRF_REPLY),
|
(_res.pfcode & RES_PRF_REPLY)) {
|
||||||
(stdout, ""),
|
__fp_nquery(ans, (resplen>anssiz)?anssiz:resplen, stdout);
|
||||||
ans, (resplen>anssiz)?anssiz:resplen);
|
}
|
||||||
/*
|
/*
|
||||||
* If using virtual circuits, we assume that the first server
|
* If using virtual circuits, we assume that the first server
|
||||||
* is preferred over the rest (i.e. it is on the local
|
* is preferred over the rest (i.e. it is on the local
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
**/
|
**/
|
||||||
ssize_t
|
ssize_t
|
||||||
|
EFIAPI
|
||||||
BslSocketWrite (
|
BslSocketWrite (
|
||||||
struct __filedes *pDescriptor,
|
struct __filedes *pDescriptor,
|
||||||
off_t * pOffset,
|
off_t * pOffset,
|
||||||
|
|
|
@ -120,9 +120,9 @@
|
||||||
StdLib/PosixLib/Stringlist/LibStringlist.inf
|
StdLib/PosixLib/Stringlist/LibStringlist.inf
|
||||||
|
|
||||||
# Socket Libraries - LibC based
|
# Socket Libraries - LibC based
|
||||||
# StdLib/BsdSocketLib/BsdSocketLib.inf
|
StdLib/BsdSocketLib/BsdSocketLib.inf
|
||||||
# StdLib/EfiSocketLib/EfiSocketLib.inf
|
StdLib/EfiSocketLib/EfiSocketLib.inf
|
||||||
# StdLib/UseSocketDxe/UseSocketDxe.inf
|
StdLib/UseSocketDxe/UseSocketDxe.inf
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue