* 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:
lpleahy 2012-02-17 23:43:35 +00:00
parent 1f33d18687
commit 7700f0f5c0
13 changed files with 31 additions and 23 deletions

View File

@ -82,6 +82,7 @@ BslFdToSocketProtocol (
**/
int
EFIAPI
BslSocketClose (
struct __filedes * pDescriptor
);
@ -113,6 +114,7 @@ BslSocketCloseWork (
**/
short
EFIAPI
BslSocketPoll (
IN struct __filedes * pDescriptor,
IN short Events
@ -152,6 +154,7 @@ BslSocketProtocolToFd (
**/
ssize_t
EFIAPI
BslSocketRead (
struct __filedes *pDescriptor,
off_t * pOffset,
@ -172,6 +175,7 @@ BslSocketRead (
**/
ssize_t
EFIAPI
BslSocketWrite (
struct __filedes *pDescriptor,
off_t * pOffset,

View File

@ -171,6 +171,7 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
u_char output[4];
size_t i;
input[0] = input[1] = input[2] = '\0';
while (2 < srclength) {
input[0] = *src++;
input[1] = *src++;

View File

@ -94,6 +94,7 @@ BslSocketCloseWork (
**/
int
EFIAPI
BslSocketClose (
struct __filedes * pDescriptor
)

View File

@ -557,8 +557,8 @@ getaddrinfo(const char *hostname, const char *servname,
}
static const ns_dtab dtab[] = {
NS_FILES_CB(_files_getaddrinfo, NULL)
{ NSSRC_DNS, _dns_getaddrinfo, NULL }, /* force -DHESIOD */
NS_FILES_CB(((nss_method)_files_getaddrinfo), NULL)
{ NSSRC_DNS, ((nss_method)_dns_getaddrinfo), NULL }, /* force -DHESIOD */
NS_NIS_CB(_yp_getaddrinfo, NULL)
NS_NULL_CB
};

View File

@ -126,7 +126,7 @@ inet_net_ntop_ipv4(
if (dst != odst)
*dst++ = '.';
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);
}

View File

@ -55,7 +55,7 @@ ns_ntoa(
u_char *uplim = up + 6;
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);
cp2 = cp + 1;
while (*up==0 && up < uplim) up++;

View File

@ -228,7 +228,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
/* Serial number. */
t = ns_get32(rdata); rdata += NS_INT32SZ;
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(spaced = addtab(len, 16, spaced, &buf, &buflen));
T(addstr("; serial\n", 9, &buf, &buflen));
@ -284,7 +284,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
/* Priority. */
t = ns_get16(rdata);
rdata += NS_INT16SZ;
len = SPRINTF((tmp, "%u ", t));
len = SPRINTF((tmp, "%u ", (unsigned int)t));
T(addstr(tmp, len, &buf, &buflen));
/* Target. */
@ -302,7 +302,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
/* Priority. */
t = ns_get16(rdata);
rdata += NS_INT16SZ;
len = SPRINTF((tmp, "%u ", t));
len = SPRINTF((tmp, "%u ", (unsigned int)t));
T(addstr(tmp, len, &buf, &buflen));
/* Name1. */
@ -363,7 +363,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
/* Order, Precedence. */
order = 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));
/* Flags. */
@ -404,7 +404,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
priority = ns_get16(rdata); rdata += NS_INT16SZ;
weight = 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));
/* Server. */
@ -477,7 +477,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
protocol = *rdata++;
algorithm = *rdata++;
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));
/* Public key data. */
@ -516,8 +516,8 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
algorithm = *rdata++;
labels = *rdata++;
t = ns_get32(rdata); rdata += NS_INT32SZ;
len = SPRINTF((tmp, " %s %d %lu ",
p_type((int)type), algorithm, t));
len = SPRINTF((tmp, " %s %d %Lu ",
p_type((int)type), (int)algorithm, t));
T(addstr(tmp, len, &buf, &buflen));
if (labels != (u_int)dn_count_labels(name))
goto formerr;
@ -534,7 +534,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
/* Signature Footprint. */
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));
/* Signer's name. */

View File

@ -26,6 +26,7 @@
**/
short
EFIAPI
BslSocketPoll (
IN struct __filedes * pDescriptor,
IN short Events

View File

@ -33,6 +33,7 @@
**/
ssize_t
EFIAPI
BslSocketRead (
struct __filedes *pDescriptor,
off_t * pOffset,

View File

@ -243,7 +243,7 @@ fp_nquery(const u_char *msg, int len, FILE *file) {
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX) || rcode)
fprintf(file,
";; ->>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))
putc(';', file);
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD2)) {
@ -536,7 +536,7 @@ p_option(u_long option) {
case RES_DNSRCH: return "dnsrch";
case RES_INSECURE1: return "insecure1";
case RES_INSECURE2: return "insecure2";
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
default: sprintf(nbuf, "?0x%Lx?", (u_long)option);
return (nbuf);
}
}

View File

@ -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
#ifdef NOPOLL /* libc_r doesn't wrap poll yet() */
static int use_poll = 0;
#else
#include <poll.h>
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_HEAD1)),
(stdout, ";; got answer:\n"));
DprintQ((_res.options & RES_DEBUG) ||
(_res.pfcode & RES_PRF_REPLY),
(stdout, ""),
ans, (resplen>anssiz)?anssiz:resplen);
if((_res.options & RES_DEBUG) ||
(_res.pfcode & RES_PRF_REPLY)) {
__fp_nquery(ans, (resplen>anssiz)?anssiz:resplen, stdout);
}
/*
* If using virtual circuits, we assume that the first server
* is preferred over the rest (i.e. it is on the local

View File

@ -28,6 +28,7 @@
**/
ssize_t
EFIAPI
BslSocketWrite (
struct __filedes *pDescriptor,
off_t * pOffset,

View File

@ -120,9 +120,9 @@
StdLib/PosixLib/Stringlist/LibStringlist.inf
# Socket Libraries - LibC based
# StdLib/BsdSocketLib/BsdSocketLib.inf
# StdLib/EfiSocketLib/EfiSocketLib.inf
# StdLib/UseSocketDxe/UseSocketDxe.inf
StdLib/BsdSocketLib/BsdSocketLib.inf
StdLib/EfiSocketLib/EfiSocketLib.inf
StdLib/UseSocketDxe/UseSocketDxe.inf
##############################################################################
#