From 0e565888ee40264bfad5a700e0d62f4824d81c18 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Thu, 30 Oct 2014 01:05:22 +0000 Subject: 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 Reviewed by: Daryl McDaniel git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16276 6f19259b-4bc3-4df7-8a09-765794883524 --- StdLib/EfiSocketLib/Ip4.c | 36 +++++++++++------------- StdLib/EfiSocketLib/Tcp4.c | 46 ++++++++++++++---------------- StdLib/EfiSocketLib/Tcp6.c | 70 ++++++++++++++++++++++------------------------ 3 files changed, 71 insertions(+), 81 deletions(-) (limited to 'StdLib/EfiSocketLib') 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.
+ 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.
+ 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.
+ 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 ( ); // -- cgit v1.2.3