summaryrefslogtreecommitdiff
path: root/StdLib/BsdSocketLib
diff options
context:
space:
mode:
authorlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-17 23:43:35 +0000
committerlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-17 23:43:35 +0000
commit7700f0f5c0ab90bf052e33fa0ddd2f2aa7e7893e (patch)
tree1cc135c837ceba9c2010f8d1b096c33c820fe884 /StdLib/BsdSocketLib
parent1f33d186878b707d956f07607b1f4b1b6063d543 (diff)
downloadedk2-7700f0f5c0ab90bf052e33fa0ddd2f2aa7e7893e.zip
edk2-7700f0f5c0ab90bf052e33fa0ddd2f2aa7e7893e.tar.gz
edk2-7700f0f5c0ab90bf052e33fa0ddd2f2aa7e7893e.tar.bz2
* 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
Diffstat (limited to 'StdLib/BsdSocketLib')
-rw-r--r--StdLib/BsdSocketLib/SocketInternals.h4
-rw-r--r--StdLib/BsdSocketLib/base64.c1
-rw-r--r--StdLib/BsdSocketLib/close.c1
-rw-r--r--StdLib/BsdSocketLib/getaddrinfo.c4
-rw-r--r--StdLib/BsdSocketLib/inet_net_ntop.c2
-rw-r--r--StdLib/BsdSocketLib/ns_ntoa.c2
-rw-r--r--StdLib/BsdSocketLib/ns_print.c18
-rw-r--r--StdLib/BsdSocketLib/poll.c1
-rw-r--r--StdLib/BsdSocketLib/read.c1
-rw-r--r--StdLib/BsdSocketLib/res_debug.c4
-rw-r--r--StdLib/BsdSocketLib/res_send.c9
-rw-r--r--StdLib/BsdSocketLib/write.c1
12 files changed, 28 insertions, 20 deletions
diff --git a/StdLib/BsdSocketLib/SocketInternals.h b/StdLib/BsdSocketLib/SocketInternals.h
index 1b19869..c30f7fb 100644
--- a/StdLib/BsdSocketLib/SocketInternals.h
+++ b/StdLib/BsdSocketLib/SocketInternals.h
@@ -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,
diff --git a/StdLib/BsdSocketLib/base64.c b/StdLib/BsdSocketLib/base64.c
index d8c588d..363ee18 100644
--- a/StdLib/BsdSocketLib/base64.c
+++ b/StdLib/BsdSocketLib/base64.c
@@ -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++;
diff --git a/StdLib/BsdSocketLib/close.c b/StdLib/BsdSocketLib/close.c
index 3dfeb2b..f3f7e98 100644
--- a/StdLib/BsdSocketLib/close.c
+++ b/StdLib/BsdSocketLib/close.c
@@ -94,6 +94,7 @@ BslSocketCloseWork (
**/
int
+EFIAPI
BslSocketClose (
struct __filedes * pDescriptor
)
diff --git a/StdLib/BsdSocketLib/getaddrinfo.c b/StdLib/BsdSocketLib/getaddrinfo.c
index c8ed784..5a0baf6 100644
--- a/StdLib/BsdSocketLib/getaddrinfo.c
+++ b/StdLib/BsdSocketLib/getaddrinfo.c
@@ -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
};
diff --git a/StdLib/BsdSocketLib/inet_net_ntop.c b/StdLib/BsdSocketLib/inet_net_ntop.c
index 3925727..e741143 100644
--- a/StdLib/BsdSocketLib/inet_net_ntop.c
+++ b/StdLib/BsdSocketLib/inet_net_ntop.c
@@ -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);
}
diff --git a/StdLib/BsdSocketLib/ns_ntoa.c b/StdLib/BsdSocketLib/ns_ntoa.c
index 1162b4d..d079dc8 100644
--- a/StdLib/BsdSocketLib/ns_ntoa.c
+++ b/StdLib/BsdSocketLib/ns_ntoa.c
@@ -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++;
diff --git a/StdLib/BsdSocketLib/ns_print.c b/StdLib/BsdSocketLib/ns_print.c
index ff7047a..a5d8ad3 100644
--- a/StdLib/BsdSocketLib/ns_print.c
+++ b/StdLib/BsdSocketLib/ns_print.c
@@ -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. */
diff --git a/StdLib/BsdSocketLib/poll.c b/StdLib/BsdSocketLib/poll.c
index 336924d..dc17567 100644
--- a/StdLib/BsdSocketLib/poll.c
+++ b/StdLib/BsdSocketLib/poll.c
@@ -26,6 +26,7 @@
**/
short
+EFIAPI
BslSocketPoll (
IN struct __filedes * pDescriptor,
IN short Events
diff --git a/StdLib/BsdSocketLib/read.c b/StdLib/BsdSocketLib/read.c
index 293c101..f4348a5 100644
--- a/StdLib/BsdSocketLib/read.c
+++ b/StdLib/BsdSocketLib/read.c
@@ -33,6 +33,7 @@
**/
ssize_t
+EFIAPI
BslSocketRead (
struct __filedes *pDescriptor,
off_t * pOffset,
diff --git a/StdLib/BsdSocketLib/res_debug.c b/StdLib/BsdSocketLib/res_debug.c
index 5cdc674..5dc0302 100644
--- a/StdLib/BsdSocketLib/res_debug.c
+++ b/StdLib/BsdSocketLib/res_debug.c
@@ -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);
}
}
diff --git a/StdLib/BsdSocketLib/res_send.c b/StdLib/BsdSocketLib/res_send.c
index 0b887e7..d9ae465 100644
--- a/StdLib/BsdSocketLib/res_send.c
+++ b/StdLib/BsdSocketLib/res_send.c
@@ -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
diff --git a/StdLib/BsdSocketLib/write.c b/StdLib/BsdSocketLib/write.c
index 1f8ad00..a6856b5 100644
--- a/StdLib/BsdSocketLib/write.c
+++ b/StdLib/BsdSocketLib/write.c
@@ -28,6 +28,7 @@
**/
ssize_t
+EFIAPI
BslSocketWrite (
struct __filedes *pDescriptor,
off_t * pOffset,