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
This commit is contained in:
Olivier Martin 2014-10-30 01:05:22 +00:00 committed by darylm503
parent b07ae3d607
commit 0e565888ee
11 changed files with 449 additions and 426 deletions

View File

@ -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];
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 */
/* sa is checked below */
/* host may be NULL */
/* serv may be NULL */
if (sa == NULL)
return EAI_FAIL;
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;
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;
/* 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;
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);
}
}
(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;
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;
}
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;
/* NUMERICHOST and NAMEREQD conflicts with each other */
if (flags & NI_NAMEREQD)
return EAI_NONAME;
switch(afd->a_af) {
switch(afd->a_af) {
#ifdef INET6
case AF_INET6:
{
int error;
case AF_INET6:
{
int error;
if ((error = ip6_parsenumeric(sa, addr, host,
hostlen, flags)) != 0)
return(error);
break;
}
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);
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 (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;
case AF_INET6:
{
int error;
if ((error = ip6_parsenumeric(sa, addr, host,
hostlen,
flags)) != 0)
return(error);
break;
}
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];
size_t numaddrlen;
char numaddr[512];
_DIAGASSERT(sa != NULL);
_DIAGASSERT(addr != NULL);
_DIAGASSERT(host != NULL);
_DIAGASSERT(sa != NULL);
_DIAGASSERT(addr != NULL);
_DIAGASSERT(host != NULL);
if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL)
return EAI_SYSTEM;
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);
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;
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';
}
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;
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;
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 (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 (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;
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;
*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;
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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.
@ -653,7 +653,6 @@ EslIp4RxComplete (
)
{
size_t LengthInBytes;
ESL_PORT * pPort;
ESL_PACKET * pPacket;
EFI_IP4_RECEIVE_DATA * pRxData;
EFI_STATUS Status;
@ -663,7 +662,6 @@ EslIp4RxComplete (
//
// 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;

View File

@ -1,11 +1,11 @@
/** @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.
@ -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 );
@ -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 )

View File

@ -1,11 +1,11 @@
/** @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.
@ -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 );
@ -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 )

View File

@ -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

View File

@ -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);

View File

@ -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: //{{

View File

@ -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;

View File

@ -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++;