summaryrefslogtreecommitdiffstats
path: root/StdLib
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2014-10-30 01:05:22 +0000
committerdarylm503 <darylm503@Edk2>2014-10-30 01:05:22 +0000
commit0e565888ee40264bfad5a700e0d62f4824d81c18 (patch)
treecc2842df141ff68b559f8faaf6182dbb49ed0dc8 /StdLib
parentb07ae3d6073f9ec69ae4316b0832fc96325c01d4 (diff)
downloadedk2-0e565888ee40264bfad5a700e0d62f4824d81c18.tar.gz
edk2-0e565888ee40264bfad5a700e0d62f4824d81c18.tar.bz2
edk2-0e565888ee40264bfad5a700e0d62f4824d81c18.zip
StdLib: Fix GCC warnings/errors caused by variables being set but not used.
Removed variables that had no effect on code behavior. Fifo.c::FIFO_Dequeue: Replaced instances of "Self->ElementSize" with preexisting variable "SizeOfElement". IIOutilities.c::IIO_GetInChar: Fixed variable of wrong, but compatible, type and made updating of housekeeping variables dependent upon successful completion of reading from the buffer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16276 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib')
-rw-r--r--StdLib/BsdSocketLib/getnameinfo.c694
-rw-r--r--StdLib/BsdSocketLib/res_comp.c15
-rw-r--r--StdLib/BsdSocketLib/res_mkupdate.c13
-rw-r--r--StdLib/EfiSocketLib/Ip4.c36
-rw-r--r--StdLib/EfiSocketLib/Tcp4.c46
-rw-r--r--StdLib/EfiSocketLib/Tcp6.c70
-rw-r--r--StdLib/LibC/Containers/Queues/Fifo.c8
-rw-r--r--StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c8
-rw-r--r--StdLib/LibC/Uefi/InteractiveIO/IIOwrite.c5
-rw-r--r--StdLib/LibC/Uefi/InteractiveIO/NonCanonRead.c3
-rw-r--r--StdLib/LibC/Uefi/writev.c17
11 files changed, 469 insertions, 446 deletions
diff --git a/StdLib/BsdSocketLib/getnameinfo.c b/StdLib/BsdSocketLib/getnameinfo.c
index fab3460dc0..6d74306880 100644
--- a/StdLib/BsdSocketLib/getnameinfo.c
+++ b/StdLib/BsdSocketLib/getnameinfo.c
@@ -1,5 +1,15 @@
-/* $NetBSD: getnameinfo.c,v 1.45 2006/10/15 16:14:46 christos Exp $ */
-/* $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $ */
+/** @file
+ Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+/* $NetBSD: getnameinfo.c,v 1.45 2006/10/15 16:14:46 christos Exp $ */
+/* $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $ */
/*
* Copyright (c) 2000 Ben Harris.
@@ -89,33 +99,33 @@ hexname(
);
static const struct afd {
- int a_af;
- socklen_t a_addrlen;
- socklen_t a_socklen;
- int a_off;
+ int a_af;
+ socklen_t a_addrlen;
+ socklen_t a_socklen;
+ int a_off;
} afdl [] = {
#ifdef INET6
- {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6),
- offsetof(struct sockaddr_in6, sin6_addr)},
+ {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6),
+ offsetof(struct sockaddr_in6, sin6_addr)},
#endif
- {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in),
- offsetof(struct sockaddr_in, sin_addr)},
- {0, 0, 0, 0},
+ {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in),
+ offsetof(struct sockaddr_in, sin_addr)},
+ {0, 0, 0, 0},
};
struct sockinet {
- u_char si_len;
- u_char si_family;
- u_short si_port;
+ u_char si_len;
+ u_char si_family;
+ u_short si_port;
};
static int getnameinfo_inet __P((const struct sockaddr *, socklen_t, char *,
socklen_t, char *, socklen_t, int));
#ifdef INET6
static int ip6_parsenumeric __P((const struct sockaddr *, const char *, char *,
- socklen_t, int));
+ socklen_t, int));
static int ip6_sa2str __P((const struct sockaddr_in6 *, char *, size_t,
- int));
+ int));
#endif
static int getnameinfo_link __P((const struct sockaddr *, socklen_t, char *,
socklen_t, char *, socklen_t, int));
@@ -137,17 +147,17 @@ getnameinfo(
)
{
- switch (sa->sa_family) {
- case AF_INET:
- case AF_INET6:
- return getnameinfo_inet(sa, salen, host, hostlen,
- serv, servlen, flags);
- case AF_LINK:
- return getnameinfo_link(sa, salen, host, hostlen,
- serv, servlen, flags);
- default:
- return EAI_FAMILY;
- }
+ switch (sa->sa_family) {
+ case AF_INET:
+ case AF_INET6:
+ return getnameinfo_inet(sa, salen, host, hostlen,
+ serv, servlen, flags);
+ case AF_LINK:
+ return getnameinfo_link(sa, salen, host, hostlen,
+ serv, servlen, flags);
+ default:
+ return EAI_FAMILY;
+ }
}
@@ -167,193 +177,193 @@ getnameinfo_inet(
int flags
)
{
- const struct afd *afd;
- struct servent *sp;
- struct hostent *hp;
- u_short port;
- int family, i;
- const char *addr;
- u_int32_t v4a;
- char numserv[512];
- char numaddr[512];
-
- /* sa is checked below */
- /* host may be NULL */
- /* serv may be NULL */
-
- if (sa == NULL)
- return EAI_FAIL;
+ const struct afd *afd;
+ struct servent *sp;
+ struct hostent *hp;
+ u_short port;
+ int family, i;
+ const char *addr;
+ u_int32_t v4a;
+ char numserv[512];
+ char numaddr[512];
+
+ /* sa is checked below */
+ /* host may be NULL */
+ /* serv may be NULL */
+
+ if (sa == NULL)
+ return EAI_FAIL;
#ifdef BSD4_4
- if (sa->sa_len != salen)
- return EAI_FAIL;
+ if (sa->sa_len != salen)
+ return EAI_FAIL;
#endif
- family = sa->sa_family;
- for (i = 0; afdl[i].a_af; i++)
- if (afdl[i].a_af == family) {
- afd = &afdl[i];
- goto found;
- }
- return EAI_FAMILY;
+ family = sa->sa_family;
+ for (i = 0; afdl[i].a_af; i++)
+ if (afdl[i].a_af == family) {
+ afd = &afdl[i];
+ goto found;
+ }
+ return EAI_FAMILY;
found:
- if (salen != afd->a_socklen)
- return EAI_FAIL;
-
- /* network byte order */
- port = ((const struct sockinet *)(const void *)sa)->si_port;
- addr = (const char *)(const void *)sa + afd->a_off;
-
- if (serv == NULL || servlen == 0) {
- /*
- * do nothing in this case.
- * in case you are wondering if "&&" is more correct than
- * "||" here: rfc2553bis-03 says that serv == NULL OR
- * servlen == 0 means that the caller does not want the result.
- */
- } else {
- if (flags & NI_NUMERICSERV)
- sp = NULL;
- else {
- struct servent_data svd;
-// struct servent sv;
-
- (void)memset(&svd, 0, sizeof(svd));
- sp = getservbyport_r(port,
- (flags & NI_DGRAM) ? "udp" : "tcp", &sv, &svd);
- endservent_r(&svd);
- }
- if (sp) {
- if (strlen(sp->s_name) + 1 > servlen)
- return EAI_MEMORY;
- strlcpy(serv, sp->s_name, servlen);
- } else {
- snprintf(numserv, sizeof(numserv), "%u", ntohs(port));
- if (strlen(numserv) + 1 > servlen)
- return EAI_MEMORY;
- strlcpy(serv, numserv, servlen);
- }
- }
-
- switch (sa->sa_family) {
- case AF_INET:
- v4a = (u_int32_t)
- ntohl(((const struct sockaddr_in *)
- (const void *)sa)->sin_addr.s_addr);
- if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
- flags |= NI_NUMERICHOST;
- v4a >>= IN_CLASSA_NSHIFT;
- if (v4a == 0)
- flags |= NI_NUMERICHOST;
- break;
+ if (salen != afd->a_socklen)
+ return EAI_FAIL;
+
+ /* network byte order */
+ port = ((const struct sockinet *)(const void *)sa)->si_port;
+ addr = (const char *)(const void *)sa + afd->a_off;
+
+ if (serv == NULL || servlen == 0) {
+ /*
+ * do nothing in this case.
+ * in case you are wondering if "&&" is more correct than
+ * "||" here: rfc2553bis-03 says that serv == NULL OR
+ * servlen == 0 means that the caller does not want the result.
+ */
+ } else {
+ if (flags & NI_NUMERICSERV)
+ sp = NULL;
+ else {
+ struct servent_data svd;
+// struct servent sv;
+
+ (void)memset(&svd, 0, sizeof(svd));
+ sp = getservbyport_r(port,
+ (flags & NI_DGRAM) ? "udp" : "tcp", &sv, &svd);
+ endservent_r(&svd);
+ }
+ if (sp) {
+ if (strlen(sp->s_name) + 1 > servlen)
+ return EAI_MEMORY;
+ strlcpy(serv, sp->s_name, servlen);
+ } else {
+ snprintf(numserv, sizeof(numserv), "%u", ntohs(port));
+ if (strlen(numserv) + 1 > servlen)
+ return EAI_MEMORY;
+ strlcpy(serv, numserv, servlen);
+ }
+ }
+
+ switch (sa->sa_family) {
+ case AF_INET:
+ v4a = (u_int32_t)
+ ntohl(((const struct sockaddr_in *)
+ (const void *)sa)->sin_addr.s_addr);
+ if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
+ flags |= NI_NUMERICHOST;
+ v4a >>= IN_CLASSA_NSHIFT;
+ if (v4a == 0)
+ flags |= NI_NUMERICHOST;
+ break;
#ifdef INET6
- case AF_INET6:
- {
- const struct sockaddr_in6 *sin6;
- sin6 = (const struct sockaddr_in6 *)(const void *)sa;
- switch (sin6->sin6_addr.s6_addr[0]) {
- case 0x00:
- if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
- ;
- else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
- ;
- else
- flags |= NI_NUMERICHOST;
- break;
- default:
- if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
- flags |= NI_NUMERICHOST;
- }
- else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
- flags |= NI_NUMERICHOST;
- break;
- }
- }
- break;
+ case AF_INET6:
+ {
+ const struct sockaddr_in6 *sin6;
+ sin6 = (const struct sockaddr_in6 *)(const void *)sa;
+ switch (sin6->sin6_addr.s6_addr[0]) {
+ case 0x00:
+ if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
+ ;
+ else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
+ ;
+ else
+ flags |= NI_NUMERICHOST;
+ break;
+ default:
+ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
+ flags |= NI_NUMERICHOST;
+ }
+ else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
+ flags |= NI_NUMERICHOST;
+ break;
+ }
+ }
+ break;
#endif
- }
- if (host == NULL || hostlen == 0) {
- /*
- * do nothing in this case.
- * in case you are wondering if "&&" is more correct than
- * "||" here: rfc2553bis-03 says that host == NULL or
- * hostlen == 0 means that the caller does not want the result.
- */
- } else if (flags & NI_NUMERICHOST) {
- size_t numaddrlen;
-
- /* NUMERICHOST and NAMEREQD conflicts with each other */
- if (flags & NI_NAMEREQD)
- return EAI_NONAME;
-
- switch(afd->a_af) {
+ }
+ if (host == NULL || hostlen == 0) {
+ /*
+ * do nothing in this case.
+ * in case you are wondering if "&&" is more correct than
+ * "||" here: rfc2553bis-03 says that host == NULL or
+ * hostlen == 0 means that the caller does not want the result.
+ */
+ } else if (flags & NI_NUMERICHOST) {
+ size_t numaddrlen;
+
+ /* NUMERICHOST and NAMEREQD conflicts with each other */
+ if (flags & NI_NAMEREQD)
+ return EAI_NONAME;
+
+ switch(afd->a_af) {
#ifdef INET6
- case AF_INET6:
- {
- int error;
-
- if ((error = ip6_parsenumeric(sa, addr, host,
- hostlen, flags)) != 0)
- return(error);
- break;
- }
+ case AF_INET6:
+ {
+ int error;
+
+ if ((error = ip6_parsenumeric(sa, addr, host,
+ hostlen, flags)) != 0)
+ return(error);
+ break;
+ }
#endif
- default:
- if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
- == NULL)
- return EAI_SYSTEM;
- numaddrlen = strlen(numaddr);
- if (numaddrlen + 1 > hostlen) /* don't forget terminator */
- return EAI_MEMORY;
- strlcpy(host, numaddr, hostlen);
- break;
- }
- } else {
- hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
-
- if (hp) {
+ default:
+ if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
+ == NULL)
+ return EAI_SYSTEM;
+ numaddrlen = strlen(numaddr);
+ if (numaddrlen + 1 > hostlen) /* don't forget terminator */
+ return EAI_MEMORY;
+ strlcpy(host, numaddr, hostlen);
+ break;
+ }
+ } else {
+ hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
+
+ if (hp) {
#if 0
- /*
- * commented out, since "for local host" is not
- * implemented here - see RFC2553 p30
- */
- if (flags & NI_NOFQDN) {
- char *p;
- p = strchr(hp->h_name, '.');
- if (p)
- *p = '\0';
- }
+ /*
+ * commented out, since "for local host" is not
+ * implemented here - see RFC2553 p30
+ */
+ if (flags & NI_NOFQDN) {
+ char *p;
+ p = strchr(hp->h_name, '.');
+ if (p)
+ *p = '\0';
+ }
#endif
- if (strlen(hp->h_name) + 1 > hostlen) {
- return EAI_MEMORY;
- }
- strlcpy(host, hp->h_name, hostlen);
- } else {
- if (flags & NI_NAMEREQD)
- return EAI_NONAME;
- switch(afd->a_af) {
+ if (strlen(hp->h_name) + 1 > hostlen) {
+ return EAI_MEMORY;
+ }
+ strlcpy(host, hp->h_name, hostlen);
+ } else {
+ if (flags & NI_NAMEREQD)
+ return EAI_NONAME;
+ switch(afd->a_af) {
#ifdef INET6
- case AF_INET6:
- {
- int error;
-
- if ((error = ip6_parsenumeric(sa, addr, host,
- hostlen,
- flags)) != 0)
- return(error);
- break;
- }
+ case AF_INET6:
+ {
+ int error;
+
+ if ((error = ip6_parsenumeric(sa, addr, host,
+ hostlen,
+ flags)) != 0)
+ return(error);
+ break;
+ }
#endif
- default:
- if (inet_ntop(afd->a_af, addr, host,
- hostlen) == NULL)
- return EAI_SYSTEM;
- break;
- }
- }
- }
- return(0);
+ default:
+ if (inet_ntop(afd->a_af, addr, host,
+ hostlen) == NULL)
+ return EAI_SYSTEM;
+ break;
+ }
+ }
+ }
+ return(0);
}
#ifdef INET6
@@ -366,40 +376,40 @@ ip6_parsenumeric(
int flags
)
{
- size_t numaddrlen;
- char numaddr[512];
-
- _DIAGASSERT(sa != NULL);
- _DIAGASSERT(addr != NULL);
- _DIAGASSERT(host != NULL);
-
- if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL)
- return EAI_SYSTEM;
-
- numaddrlen = strlen(numaddr);
- if (numaddrlen + 1 > hostlen) /* don't forget terminator */
- return EAI_OVERFLOW;
- strlcpy(host, numaddr, hostlen);
-
- if (((const struct sockaddr_in6 *)(const void *)sa)->sin6_scope_id) {
- char zonebuf[MAXHOSTNAMELEN];
- int zonelen;
-
- zonelen = ip6_sa2str(
- (const struct sockaddr_in6 *)(const void *)sa,
- zonebuf, sizeof(zonebuf), flags);
- if (zonelen < 0)
- return EAI_OVERFLOW;
- if ((size_t) zonelen + 1 + numaddrlen + 1 > hostlen)
- return EAI_OVERFLOW;
- /* construct <numeric-addr><delim><zoneid> */
- memcpy(host + numaddrlen + 1, zonebuf,
- (size_t)zonelen);
- host[numaddrlen] = SCOPE_DELIMITER;
- host[numaddrlen + 1 + zonelen] = '\0';
- }
-
- return 0;
+ size_t numaddrlen;
+ char numaddr[512];
+
+ _DIAGASSERT(sa != NULL);
+ _DIAGASSERT(addr != NULL);
+ _DIAGASSERT(host != NULL);
+
+ if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL)
+ return EAI_SYSTEM;
+
+ numaddrlen = strlen(numaddr);
+ if (numaddrlen + 1 > hostlen) /* don't forget terminator */
+ return EAI_OVERFLOW;
+ strlcpy(host, numaddr, hostlen);
+
+ if (((const struct sockaddr_in6 *)(const void *)sa)->sin6_scope_id) {
+ char zonebuf[MAXHOSTNAMELEN];
+ int zonelen;
+
+ zonelen = ip6_sa2str(
+ (const struct sockaddr_in6 *)(const void *)sa,
+ zonebuf, sizeof(zonebuf), flags);
+ if (zonelen < 0)
+ return EAI_OVERFLOW;
+ if ((size_t) zonelen + 1 + numaddrlen + 1 > hostlen)
+ return EAI_OVERFLOW;
+ /* construct <numeric-addr><delim><zoneid> */
+ memcpy(host + numaddrlen + 1, zonebuf,
+ (size_t)zonelen);
+ host[numaddrlen] = SCOPE_DELIMITER;
+ host[numaddrlen + 1 + zonelen] = '\0';
+ }
+
+ return 0;
}
/* ARGSUSED */
@@ -411,43 +421,47 @@ ip6_sa2str(
int flags
)
{
- unsigned int ifindex;
- const struct in6_addr *a6;
- int n;
+#if 0
+ unsigned int ifindex;
+ const struct in6_addr *a6;
+#endif
+ int n;
- _DIAGASSERT(sa6 != NULL);
- _DIAGASSERT(buf != NULL);
+ _DIAGASSERT(sa6 != NULL);
+ _DIAGASSERT(buf != NULL);
- ifindex = (unsigned int)sa6->sin6_scope_id;
- a6 = &sa6->sin6_addr;
+#if 0
+ ifindex = (unsigned int)sa6->sin6_scope_id;
+ a6 = &sa6->sin6_addr;
+#endif
#ifdef NI_NUMERICSCOPE
- if ((flags & NI_NUMERICSCOPE) != 0) {
- n = snprintf(buf, bufsiz, "%u", sa6->sin6_scope_id);
- if ((n < 0) || ((size_t)n >= bufsiz))
- return -1;
- else
- return n;
- }
+ if ((flags & NI_NUMERICSCOPE) != 0) {
+ n = snprintf(buf, bufsiz, "%u", sa6->sin6_scope_id);
+ if ((n < 0) || ((size_t)n >= bufsiz))
+ return -1;
+ else
+ return n;
+ }
#endif
#if 0
- /* if_indextoname() does not take buffer size. not a good api... */
- if ((IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) &&
- bufsiz >= IF_NAMESIZE) {
- char *p = if_indextoname(ifindex, buf);
- if (p) {
- return(strlen(p));
- }
- }
+ /* if_indextoname() does not take buffer size. not a good api... */
+ if ((IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) &&
+ bufsiz >= IF_NAMESIZE) {
+ char *p = if_indextoname(ifindex, buf);
+ if (p) {
+ return(strlen(p));
+ }
+ }
#endif // 0
- /* last resort */
- n = snprintf(buf, bufsiz, "%u", sa6->sin6_scope_id);
- if (n < 0 || (size_t) n >= bufsiz)
- return -1;
- else
- return n;
+ /* last resort */
+ n = snprintf(buf, bufsiz, "%u", sa6->sin6_scope_id);
+ if (n < 0 || (size_t) n >= bufsiz)
+ return -1;
+ else
+ return n;
}
#endif /* INET6 */
@@ -470,73 +484,73 @@ getnameinfo_link (
int flags
)
{
- const struct sockaddr_dl *sdl =
- (const struct sockaddr_dl *)(const void *)sa;
-// const struct ieee1394_hwaddr *iha;
- int n;
-
- if (serv != NULL && servlen > 0)
- *serv = '\0';
-
- if (sdl->sdl_nlen == 0 && sdl->sdl_alen == 0 && sdl->sdl_slen == 0) {
- n = snprintf(host, hostlen, "link#%u", sdl->sdl_index);
- if (n < 0 || (socklen_t) n > hostlen) {
- *host = '\0';
- return EAI_MEMORY;
- }
- return 0;
- }
+ const struct sockaddr_dl *sdl =
+ (const struct sockaddr_dl *)(const void *)sa;
+// const struct ieee1394_hwaddr *iha;
+ int n;
+
+ if (serv != NULL && servlen > 0)
+ *serv = '\0';
+
+ if (sdl->sdl_nlen == 0 && sdl->sdl_alen == 0 && sdl->sdl_slen == 0) {
+ n = snprintf(host, hostlen, "link#%u", sdl->sdl_index);
+ if (n < 0 || (socklen_t) n > hostlen) {
+ *host = '\0';
+ return EAI_MEMORY;
+ }
+ return 0;
+ }
#if 0
- switch (sdl->sdl_type) {
+ switch (sdl->sdl_type) {
#ifdef IFT_ECONET
- case IFT_ECONET:
- if (sdl->sdl_alen < 2)
- return EAI_FAMILY;
- if (CLLADDR(sdl)[1] == 0)
- n = snprintf(host, hostlen, "%u", CLLADDR(sdl)[0]);
- else
- n = snprintf(host, hostlen, "%u.%u",
- CLLADDR(sdl)[1], CLLADDR(sdl)[0]);
- if (n < 0 || (socklen_t) n >= hostlen) {
- *host = '\0';
- return EAI_MEMORY;
- } else
- return 0;
+ case IFT_ECONET:
+ if (sdl->sdl_alen < 2)
+ return EAI_FAMILY;
+ if (CLLADDR(sdl)[1] == 0)
+ n = snprintf(host, hostlen, "%u", CLLADDR(sdl)[0]);
+ else
+ n = snprintf(host, hostlen, "%u.%u",
+ CLLADDR(sdl)[1], CLLADDR(sdl)[0]);
+ if (n < 0 || (socklen_t) n >= hostlen) {
+ *host = '\0';
+ return EAI_MEMORY;
+ } else
+ return 0;
#endif
- case IFT_IEEE1394:
- if (sdl->sdl_alen < sizeof(iha->iha_uid))
- return EAI_FAMILY;
- iha =
- (const struct ieee1394_hwaddr *)(const void *)CLLADDR(sdl);
- return hexname(iha->iha_uid, sizeof(iha->iha_uid),
- host, hostlen);
- /*
- * The following have zero-length addresses.
- * IFT_ATM (net/if_atmsubr.c)
- * IFT_FAITH (net/if_faith.c)
- * IFT_GIF (net/if_gif.c)
- * IFT_LOOP (net/if_loop.c)
- * IFT_PPP (net/if_ppp.c, net/if_spppsubr.c)
- * IFT_SLIP (net/if_sl.c, net/if_strip.c)
- * IFT_STF (net/if_stf.c)
- * IFT_L2VLAN (net/if_vlan.c)
- * IFT_PROPVIRTUAL (net/if_bridge.h>
- */
- /*
- * The following use IPv4 addresses as link-layer addresses:
- * IFT_OTHER (net/if_gre.c)
- */
- case IFT_ARCNET: /* default below is believed correct for all these. */
- case IFT_ETHER:
- case IFT_FDDI:
- case IFT_HIPPI:
- case IFT_ISO88025:
- default:
+ case IFT_IEEE1394:
+ if (sdl->sdl_alen < sizeof(iha->iha_uid))
+ return EAI_FAMILY;
+ iha =
+ (const struct ieee1394_hwaddr *)(const void *)CLLADDR(sdl);
+ return hexname(iha->iha_uid, sizeof(iha->iha_uid),
+ host, hostlen);
+ /*
+ * The following have zero-length addresses.
+ * IFT_ATM (net/if_atmsubr.c)
+ * IFT_FAITH (net/if_faith.c)
+ * IFT_GIF (net/if_gif.c)
+ * IFT_LOOP (net/if_loop.c)
+ * IFT_PPP (net/if_ppp.c, net/if_spppsubr.c)
+ * IFT_SLIP (net/if_sl.c, net/if_strip.c)
+ * IFT_STF (net/if_stf.c)
+ * IFT_L2VLAN (net/if_vlan.c)
+ * IFT_PROPVIRTUAL (net/if_bridge.h>
+ */
+ /*
+ * The following use IPv4 addresses as link-layer addresses:
+ * IFT_OTHER (net/if_gre.c)
+ */
+ case IFT_ARCNET: /* default below is believed correct for all these. */
+ case IFT_ETHER:
+ case IFT_FDDI:
+ case IFT_HIPPI:
+ case IFT_ISO88025:
+ default:
#endif // 0
- return hexname((const u_int8_t *)CLLADDR(sdl),
- (size_t)sdl->sdl_alen, host, hostlen);
-// }
+ return hexname((const u_int8_t *)CLLADDR(sdl),
+ (size_t)sdl->sdl_alen, host, hostlen);
+// }
}
static
@@ -548,20 +562,20 @@ hexname(
socklen_t hostlen
)
{
- int n;
- size_t i;
- char *outp = host;
-
- *outp = '\0';
- for (i = 0; i < len; i++) {
- n = snprintf(outp, hostlen, "%s%02x",
- i ? ":" : "", cp[i]);
- if (n < 0 || (socklen_t) n >= hostlen) {
- *host = '\0';
- return EAI_MEMORY;
- }
- outp += n;
- hostlen -= n;
- }
- return 0;
+ int n;
+ size_t i;
+ char *outp = host;
+
+ *outp = '\0';
+ for (i = 0; i < len; i++) {
+ n = snprintf(outp, hostlen, "%s%02x",
+ i ? ":" : "", cp[i]);
+ if (n < 0 || (socklen_t) n >= hostlen) {
+ *host = '\0';
+ return EAI_MEMORY;
+ }
+ outp += n;
+ hostlen -= n;
+ }
+ return 0;
}
diff --git a/StdLib/BsdSocketLib/res_comp.c b/StdLib/BsdSocketLib/res_comp.c
index cddda3e150..7c327fac2e 100644
--- a/StdLib/BsdSocketLib/res_comp.c
+++ b/StdLib/BsdSocketLib/res_comp.c
@@ -1,3 +1,13 @@
+/** @file
+ Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -168,7 +178,7 @@ res_hnok(
const char *dn
)
{
- int ppch = '\0', pch = PERIOD, ch = *dn++;
+ int pch = PERIOD, ch = *dn++;
while (ch != '\0') {
int nch = *dn++;
@@ -185,7 +195,8 @@ res_hnok(
if (!middlechar(ch))
return (0);
}
- ppch = pch, pch = ch, ch = nch;
+ pch = ch;
+ ch = nch;
}
return (1);
}
diff --git a/StdLib/BsdSocketLib/res_mkupdate.c b/StdLib/BsdSocketLib/res_mkupdate.c
index 3201f312e6..d81d7d6f15 100644
--- a/StdLib/BsdSocketLib/res_mkupdate.c
+++ b/StdLib/BsdSocketLib/res_mkupdate.c
@@ -1,3 +1,13 @@
+/** @file
+ Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
/*
* Copyright (c) 1996 by Internet Software Consortium.
*
@@ -100,7 +110,7 @@ int
res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
ns_updrec *rrecp_start = rrecp_in;
HEADER *hp;
- u_char *cp, *sp1, *sp2, *startp, *endp;
+ u_char *cp, *sp2, *startp, *endp;
int n, i, soanum, multiline;
ns_updrec *rrecp;
struct in_addr ina;
@@ -125,7 +135,6 @@ res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
hp->id = htons(++_res.id);
hp->opcode = ns_o_update;
hp->rcode = NOERROR;
- sp1 = buf + 2*INT16SZ; /* save pointer to zocount */
cp = buf + HFIXEDSZ;
buflen -= HFIXEDSZ;
dpp = dnptrs;
diff --git a/StdLib/EfiSocketLib/Ip4.c b/StdLib/EfiSocketLib/Ip4.c
index ed71194163..84646e726a 100644
--- a/StdLib/EfiSocketLib/Ip4.c
+++ b/StdLib/EfiSocketLib/Ip4.c
@@ -1,11 +1,11 @@
/** @file
Implement the IP4 driver support for the socket layer.
- Copyright (c) 2011, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
+ Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@@ -430,13 +430,13 @@ EslIp4PortAllocate (
@param [in] pPort Address of an ::ESL_PORT structure.
@param [in] pPacket Address of an ::ESL_PACKET structure.
-
+
@param [in] pbConsumePacket Address of a BOOLEAN indicating if the packet is to be consumed
-
+
@param [in] BufferLength Length of the the buffer
-
+
@param [in] pBuffer Address of a buffer to receive the data.
-
+
@param [in] pDataLength Number of received data bytes in the buffer.
@param [out] pAddress Network address to receive the remote system address
@@ -653,17 +653,15 @@ EslIp4RxComplete (
)
{
size_t LengthInBytes;
- ESL_PORT * pPort;
ESL_PACKET * pPacket;
EFI_IP4_RECEIVE_DATA * pRxData;
EFI_STATUS Status;
-
+
DBG_ENTER ( );
-
+
//
// Get the operation status.
//
- pPort = pIo->pPort;
Status = pIo->Token.Ip4Rx.Status;
//
@@ -672,7 +670,7 @@ EslIp4RxComplete (
pRxData = pIo->Token.Ip4Rx.Packet.RxData;
LengthInBytes = pRxData->HeaderLength + pRxData->DataLength;
- //
+ //{{
// +--------------------+ +----------------------+
// | ESL_IO_MGMT | | Data Buffer |
// | | | (Driver owned) |
@@ -692,7 +690,7 @@ EslIp4RxComplete (
//
//
// Save the data in the packet
- //
+ //}}
pPacket = pIo->pPacket;
pPacket->Op.Ip4Rx.pRxData = pRxData;
@@ -717,7 +715,7 @@ EslIp4RxComplete (
that the socket is configured.
@param [in] pSocket Address of an ::ESL_SOCKET structure
-
+
@retval EFI_SUCCESS - The port is connected
@retval EFI_NOT_STARTED - The port is not connected
@@ -904,7 +902,7 @@ EslIp4RxComplete (
// Determine the socket configuration status
//
Status = pSocket->bConfigured ? EFI_SUCCESS : EFI_NOT_STARTED;
-
+
//
// Return the port connected state.
//
@@ -1188,9 +1186,9 @@ EslIp4TxComplete (
ESL_PACKET * pPacket;
ESL_SOCKET * pSocket;
EFI_STATUS Status;
-
+
DBG_ENTER ( );
-
+
//
// Locate the active transmit packet
//
diff --git a/StdLib/EfiSocketLib/Tcp4.c b/StdLib/EfiSocketLib/Tcp4.c
index 7ece38d521..943af946bc 100644
--- a/StdLib/EfiSocketLib/Tcp4.c
+++ b/StdLib/EfiSocketLib/Tcp4.c
@@ -1,18 +1,18 @@
/** @file
Implement the TCP4 driver support for the socket layer.
- Copyright (c) 2011, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
+ Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
\section ConnectionManagement Connection Management
-
+
The ::EslTcp4Listen routine initially places the SOCK_STREAM or
SOCK_SEQPACKET socket into a listen state. When a remote machine
makes a connection to the socket, the TCPv4 network layer calls
@@ -487,7 +487,7 @@ EslTcp4ConnectStart (
EFI_STATUS Status;
DBG_ENTER ( );
-
+
//
// Determine if any more local adapters are available
//
@@ -776,7 +776,7 @@ EslTcp4Listen (
//
pPort = pNextPort;
}
-
+
//
// Determine if any ports are in the listen state
//
@@ -840,7 +840,6 @@ EslTcp4ListenComplete (
EFI_HANDLE ChildHandle;
struct sockaddr_in LocalAddress;
EFI_TCP4_CONFIG_DATA * pConfigData;
- ESL_LAYER * pLayer;
ESL_PORT * pNewPort;
ESL_SOCKET * pNewSocket;
ESL_SOCKET * pSocket;
@@ -869,7 +868,6 @@ EslTcp4ListenComplete (
// Allocate a socket for this connection
//
ChildHandle = NULL;
- pLayer = &mEslLayer;
Status = EslSocketAllocate ( &ChildHandle,
DEBUG_CONNECTION,
&pNewSocket );
@@ -1041,7 +1039,7 @@ EslTcp4ListenComplete (
// Process:
// Call close
// Release the resources
-
+
}
DBG_EXIT ( );
@@ -1151,7 +1149,7 @@ EslTcp4LocalAddressSet (
// Determine if the default address is used
//
pAccessPoint->UseDefaultAddress = (BOOLEAN)( 0 == pIpAddress->sin_addr.s_addr );
-
+
//
// Set the subnet mask
//
@@ -1345,7 +1343,7 @@ EslTcp4PortAllocate (
This routine is called by ::EslSocketPortClose.
See the \ref PortCloseStateMachine section.
-
+
@param [in] pPort Address of an ::ESL_PORT structure.
@retval EFI_SUCCESS The port is closed
@@ -1360,7 +1358,7 @@ EslTcp4PortClose (
UINTN DebugFlags;
ESL_TCP4_CONTEXT * pTcp4;
EFI_STATUS Status;
-
+
DBG_ENTER ( );
//
@@ -1504,13 +1502,13 @@ EslTcp4PortCloseOp (
@param [in] pPort Address of an ::ESL_PORT structure.
@param [in] pPacket Address of an ::ESL_PACKET structure.
-
+
@param [in] pbConsumePacket Address of a BOOLEAN indicating if the packet is to be consumed
-
+
@param [in] BufferLength Length of the the buffer
-
+
@param [in] pBuffer Address of a buffer to receive the data.
-
+
@param [in] pDataLength Number of received data bytes in the buffer.
@param [out] pAddress Network address to receive the remote system address
@@ -1888,13 +1886,13 @@ EslTcp4RxStart (
during the current transmission attempt.
@param [in] pSocket Address of an ::ESL_SOCKET structure
-
+
@param [in] Flags Message control flags
-
+
@param [in] BufferLength Length of the the buffer
-
+
@param [in] pBuffer Address of a buffer to receive the data.
-
+
@param [in] pDataLength Number of received data bytes in the buffer.
@param [in] pAddress Network address of the remote system address
@@ -1924,7 +1922,6 @@ EslTcp4TxBuffer (
ESL_PACKET ** ppQueueHead;
ESL_PACKET ** ppQueueTail;
ESL_PACKET * pPreviousPacket;
- ESL_TCP4_CONTEXT * pTcp4;
size_t * pTxBytes;
EFI_TCP4_TRANSMIT_DATA * pTxData;
EFI_STATUS Status;
@@ -1951,7 +1948,6 @@ EslTcp4TxBuffer (
//
// Determine the queue head
//
- pTcp4 = &pPort->Context.Tcp4;
bUrgent = (BOOLEAN)( 0 != ( Flags & MSG_OOB ));
bUrgentQueue = bUrgent
&& ( !pSocket->bOobInLine )
@@ -2142,7 +2138,7 @@ EslTcp4TxComplete (
ESL_PORT * pPort;
ESL_SOCKET * pSocket;
EFI_STATUS Status;
-
+
DBG_ENTER ( );
//
diff --git a/StdLib/EfiSocketLib/Tcp6.c b/StdLib/EfiSocketLib/Tcp6.c
index 21c4109d6e..0f6d2d6ac9 100644
--- a/StdLib/EfiSocketLib/Tcp6.c
+++ b/StdLib/EfiSocketLib/Tcp6.c
@@ -1,18 +1,18 @@
/** @file
Implement the TCP6 driver support for the socket layer.
- Copyright (c) 2011, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
+ Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
\section ConnectionManagement Connection Management
-
+
The ::EslTcp6Listen routine initially places the SOCK_STREAM or
SOCK_SEQPACKET socket into a listen state. When a remote machine
makes a connection to the socket, the TCPv6 network layer calls
@@ -398,55 +398,55 @@ EslTcp6ConnectPoll (
case EFI_DEVICE_ERROR:
pSocket->errno = EIO;
break;
-
+
case EFI_ABORTED:
pSocket->errno = ECONNABORTED;
break;
-
+
case EFI_ACCESS_DENIED:
pSocket->errno = EACCES;
break;
-
+
case EFI_CONNECTION_RESET:
pSocket->errno = ECONNRESET;
break;
-
+
case EFI_INVALID_PARAMETER:
pSocket->errno = EADDRNOTAVAIL;
break;
-
+
case EFI_HOST_UNREACHABLE:
case EFI_NO_RESPONSE:
pSocket->errno = EHOSTUNREACH;
break;
-
+
case EFI_NO_MAPPING:
pSocket->errno = EAFNOSUPPORT;
break;
-
+
case EFI_NO_MEDIA:
case EFI_NETWORK_UNREACHABLE:
pSocket->errno = ENETDOWN;
break;
-
+
case EFI_OUT_OF_RESOURCES:
pSocket->errno = ENOBUFS;
break;
-
+
case EFI_PORT_UNREACHABLE:
case EFI_PROTOCOL_UNREACHABLE:
case EFI_CONNECTION_REFUSED:
pSocket->errno = ECONNREFUSED;
break;
-
+
case EFI_SUCCESS:
pSocket->errno = 0;
break;
-
+
case EFI_TIMEOUT:
pSocket->errno = ETIMEDOUT;
break;
-
+
case EFI_UNSUPPORTED:
pSocket->errno = EOPNOTSUPP;
break;
@@ -505,7 +505,7 @@ EslTcp6ConnectStart (
EFI_STATUS Status;
DBG_ENTER ( );
-
+
//
// Determine if any more local adapters are available
//
@@ -601,7 +601,7 @@ EslTcp6ConnectStart (
// Status to errno translation gets done in EslTcp4ConnectPoll
//
pTcp6->ConnectToken.CompletionToken.Status = Status;
-
+
//
// Continue with the next port
//
@@ -807,7 +807,7 @@ EslTcp6Listen (
//
pPort = pNextPort;
}
-
+
//
// Determine if any ports are in the listen state
//
@@ -871,7 +871,6 @@ EslTcp6ListenComplete (
EFI_HANDLE ChildHandle;
struct sockaddr_in6 LocalAddress;
EFI_TCP6_CONFIG_DATA * pConfigData;
- ESL_LAYER * pLayer;
ESL_PORT * pNewPort;
ESL_SOCKET * pNewSocket;
ESL_SOCKET * pSocket;
@@ -900,7 +899,6 @@ EslTcp6ListenComplete (
// Allocate a socket for this connection
//
ChildHandle = NULL;
- pLayer = &mEslLayer;
Status = EslSocketAllocate ( &ChildHandle,
DEBUG_CONNECTION,
&pNewSocket );
@@ -1098,7 +1096,7 @@ EslTcp6ListenComplete (
// Process:
// Call close
// Release the resources
-
+
}
DBG_EXIT ( );
@@ -1397,7 +1395,7 @@ EslTcp6PortAllocate (
This routine is called by ::EslSocketPortClose.
See the \ref PortCloseStateMachine section.
-
+
@param [in] pPort Address of an ::ESL_PORT structure.
@retval EFI_SUCCESS The port is closed
@@ -1412,7 +1410,7 @@ EslTcp6PortClose (
UINTN DebugFlags;
ESL_TCP6_CONTEXT * pTcp6;
EFI_STATUS Status;
-
+
DBG_ENTER ( );
//
@@ -1556,13 +1554,13 @@ EslTcp6PortCloseOp (
@param [in] pPort Address of an ::ESL_PORT structure.
@param [in] pPacket Address of an ::ESL_PACKET structure.
-
+
@param [in] pbConsumePacket Address of a BOOLEAN indicating if the packet is to be consumed
-
+
@param [in] BufferLength Length of the the buffer
-
+
@param [in] pBuffer Address of a buffer to receive the data.
-
+
@param [in] pDataLength Number of received data bytes in the buffer.
@param [out] pAddress Network address to receive the remote system address
@@ -1957,13 +1955,13 @@ EslTcp6RxStart (
during the current transmission attempt.
@param [in] pSocket Address of an ::ESL_SOCKET structure
-
+
@param [in] Flags Message control flags
-
+
@param [in] BufferLength Length of the the buffer
-
+
@param [in] pBuffer Address of a buffer to receive the data.
-
+
@param [in] pDataLength Number of received data bytes in the buffer.
@param [in] pAddress Network address of the remote system address
@@ -1993,7 +1991,6 @@ EslTcp6TxBuffer (
ESL_PACKET ** ppQueueHead;
ESL_PACKET ** ppQueueTail;
ESL_PACKET * pPreviousPacket;
- ESL_TCP6_CONTEXT * pTcp6;
size_t * pTxBytes;
EFI_TCP6_TRANSMIT_DATA * pTxData;
EFI_STATUS Status;
@@ -2020,7 +2017,6 @@ EslTcp6TxBuffer (
//
// Determine the queue head
//
- pTcp6 = &pPort->Context.Tcp6;
bUrgent = (BOOLEAN)( 0 != ( Flags & MSG_OOB ));
bUrgentQueue = bUrgent
&& ( !pSocket->bOobInLine )
@@ -2211,7 +2207,7 @@ EslTcp6TxComplete (
ESL_PORT * pPort;
ESL_SOCKET * pSocket;
EFI_STATUS Status;
-
+
DBG_ENTER ( );
//
diff --git a/StdLib/LibC/Containers/Queues/Fifo.c b/StdLib/LibC/Containers/Queues/Fifo.c
index 73254d2e56..60def644e9 100644
--- a/StdLib/LibC/Containers/Queues/Fifo.c
+++ b/StdLib/LibC/Containers/Queues/Fifo.c
@@ -292,17 +292,17 @@ FIFO_Dequeue (
SizeOfElement = Self->ElementSize; // Get size of this FIFO's elements
Count = MIN(Count, Self->Count(Self, AsElements)); // Lesser of requested or actual
- QPtr = (UINTN)Self->Queue + (RDex * Self->ElementSize); // Point to Read location in FIFO
+ QPtr = (UINTN)Self->Queue + (RDex * SizeOfElement); // Point to Read location in FIFO
for(i = 0; i < Count; ++i) { // Iterate Count times...
- (void)CopyMem(pElement, (const void *)QPtr, Self->ElementSize); // Copy element from FIFO to caller's buffer
+ (void)CopyMem(pElement, (const void *)QPtr, SizeOfElement); // Copy element from FIFO to caller's buffer
RDex = (UINT32)ModuloIncrement(RDex, Self->NumElements); // Increment Read Index
if(RDex == 0) { // If the index wrapped
QPtr = (UINTN)Self->Queue; // Point back to beginning of data
}
else { // Otherwise
- QPtr += Self->ElementSize; // Point to the next element in FIFO
+ QPtr += SizeOfElement; // Point to the next element in FIFO
}
- pElement = (char*)pElement + Self->ElementSize; // Point to next element in caller's buffer
+ pElement = (char*)pElement + SizeOfElement; // Point to next element in caller's buffer
} // Iterate: for loop
if(Consume) { // If caller requests data consumption
Self->ReadIndex = RDex; // Set FIFO's Read Index to new Index
diff --git a/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c b/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c
index 0e80ff0eaf..2e61cd1e80 100644
--- a/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c
+++ b/StdLib/LibC/Uefi/InteractiveIO/IIOutilities.c
@@ -75,7 +75,7 @@ IIO_GetInChar (
{
cIIO *This;
cFIFO *InBuf;
- EFI_STATUS Status;
+ size_t Status;
ssize_t NumRead;
wint_t RetVal;
wchar_t InChar;
@@ -92,8 +92,10 @@ IIO_GetInChar (
}
if(BufCnt > 0) {
Status = InBuf->Read(InBuf, &InChar, 1);
- --BufCnt;
- NumRead = 1;
+ if (Status > 0) {
+ --BufCnt;
+ NumRead = 1;
+ }
}
else {
NumRead = filp->f_ops->fo_read(filp, &filp->f_offset, sizeof(wchar_t), &InChar);
diff --git a/StdLib/LibC/Uefi/InteractiveIO/IIOwrite.c b/StdLib/LibC/Uefi/InteractiveIO/IIOwrite.c
index 927f4f4ff3..ef52cc890e 100644
--- a/StdLib/LibC/Uefi/InteractiveIO/IIOwrite.c
+++ b/StdLib/LibC/Uefi/InteractiveIO/IIOwrite.c
@@ -8,7 +8,7 @@
It is the responsibility of the caller, or higher level function, to perform
any necessary translation between wide and narrow characters.
- Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -63,7 +63,6 @@ IIO_WriteOne(struct __filedes *filp, cFIFO *OBuf, wchar_t InCh)
UINT32 CurRow; // Current cursor row on the screen
UINT32 PrevColumn; // Previous column. Used to detect wrapping.
UINT32 AdjColumn; // Current cursor column on the screen
- UINT32 AdjRow; // Current cursor row on the screen
RetVal = -1;
wcb = wc;
@@ -79,7 +78,6 @@ IIO_WriteOne(struct __filedes *filp, cFIFO *OBuf, wchar_t InCh)
CurRow = This->CurrentXY.Row;
numW = 1; // The majority of characters buffer one character
- AdjRow = 0; // Most characters just cause horizontal movement
AdjColumn = 0;
if(OFlag & OPOST) {
/* Perform output processing */
@@ -127,7 +125,6 @@ IIO_WriteOne(struct __filedes *filp, cFIFO *OBuf, wchar_t InCh)
numW = 2;
CurColumn = 0;
}
- AdjRow = 1;
break; //}}
case CHAR_BACKSPACE: //{{
diff --git a/StdLib/LibC/Uefi/InteractiveIO/NonCanonRead.c b/StdLib/LibC/Uefi/InteractiveIO/NonCanonRead.c
index bcae9c8239..aab81cdaa8 100644
--- a/StdLib/LibC/Uefi/InteractiveIO/NonCanonRead.c
+++ b/StdLib/LibC/Uefi/InteractiveIO/NonCanonRead.c
@@ -37,7 +37,6 @@ IIO_NonCanonRead (
cIIO *This;
cFIFO *InBuf;
struct termios *Termio;
- EFI_STATUS Status;
ssize_t NumRead;
cc_t tioMin;
cc_t tioTime;
@@ -74,7 +73,7 @@ IIO_NonCanonRead (
if(InBuf->IsEmpty(InBuf)) {
NumRead = filp->f_ops->fo_read(filp, &filp->f_offset, sizeof(wchar_t), &InChar);
if(NumRead > 0) {
- Status = InBuf->Write(InBuf, &InChar, 1); // Buffer the character
+ (void) InBuf->Write(InBuf, &InChar, 1); // Buffer the character
}
}
// break;
diff --git a/StdLib/LibC/Uefi/writev.c b/StdLib/LibC/Uefi/writev.c
index 9cff086c6a..31d2acd629 100644
--- a/StdLib/LibC/Uefi/writev.c
+++ b/StdLib/LibC/Uefi/writev.c
@@ -1,7 +1,6 @@
-/*
- * Copyright (c) 1999, 2000
- * Intel Corporation.
- * All rights reserved.
+/** @file
+ *
+ * Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -100,9 +99,11 @@ writev(
int iovcnt
)
{
- const struct iovec *pVecTmp;
- char *pBuf, *pBufTmp;
- size_t TotalBytes, i, ret;
+ const struct iovec *pVecTmp;
+ char *pBuf;
+ size_t TotalBytes;
+ size_t i;
+ size_t ret;
//
// See how much memory we'll need
@@ -126,7 +127,7 @@ writev(
// Copy vectors to the buffer
//
- for (pBufTmp = pBuf; iovcnt; iovcnt--) {
+ for (; iovcnt; iovcnt--) {
bcopy(iov->iov_base, pBuf, iov->iov_len);
pBuf += iov->iov_len;
iov++;