StdLib: Fix more GCC warnings/errors caused by variables being set but not used.

Removed variables that had no effect on code behavior.
Normalized comment formatting.

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@16284 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin
2014-10-31 17:50:33 +00:00
committed by darylm503
parent 4d5b818c78
commit beaaa3b715
8 changed files with 285 additions and 550 deletions

View File

@@ -9,14 +9,11 @@
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Socket.h"
/**
Get the local socket address
/** Get the local socket address.
This routine returns the IPv4 address associated with the local
socket.
@@ -25,9 +22,7 @@
network address for the SOCK_RAW socket.
@param [in] pPort Address of an ::ESL_PORT structure.
@param [out] pAddress Network address to receive the local system address
**/
VOID
EslIp4LocalAddressGet (
@@ -40,9 +35,7 @@ EslIp4LocalAddressGet (
DBG_ENTER ( );
//
// Return the local address
//
pIp4 = &pPort->Context.Ip4;
pLocalAddress = (struct sockaddr_in *)pAddress;
pLocalAddress->sin_family = AF_INET;
@@ -54,8 +47,7 @@ EslIp4LocalAddressGet (
}
/**
Set the local port address.
/** Set the local port address.
This routine sets the local port address.
@@ -75,7 +67,6 @@ EslIp4LocalAddressGet (
@param [in] bBindTest TRUE = run bind testing
@retval EFI_SUCCESS The operation was successful
**/
EFI_STATUS
EslIp4LocalAddressSet (
@@ -91,23 +82,17 @@ EslIp4LocalAddressSet (
DBG_ENTER ( );
//
// Validate the address
//
pIpAddress = (struct sockaddr_in *)pSockAddr;
if ( INADDR_BROADCAST == pIpAddress->sin_addr.s_addr ) {
//
// The local address must not be the broadcast address
//
Status = EFI_INVALID_PARAMETER;
pPort->pSocket->errno = EADDRNOTAVAIL;
}
else {
Status = EFI_SUCCESS;
//
// Set the local address
//
pIpAddress = (struct sockaddr_in *)pSockAddr;
pIpv4Address = (UINT8 *)&pIpAddress->sin_addr.s_addr;
pConfig = &pPort->Context.Ip4.ModeData.ConfigData;
@@ -116,14 +101,10 @@ EslIp4LocalAddressSet (
pConfig->StationAddress.Addr[2] = pIpv4Address[2];
pConfig->StationAddress.Addr[3] = pIpv4Address[3];
//
// Determine if the default address is used
//
pConfig->UseDefaultAddress = (BOOLEAN)( 0 == pIpAddress->sin_addr.s_addr );
//
// Display the local address
//
DEBUG (( DEBUG_BIND,
"0x%08x: Port, Local IP4 Address: %d.%d.%d.%d\r\n",
pPort,
@@ -132,9 +113,7 @@ EslIp4LocalAddressSet (
pConfig->StationAddress.Addr[2],
pConfig->StationAddress.Addr[3]));
//
// Set the subnet mask
//
if ( pConfig->UseDefaultAddress ) {
pConfig->SubnetMask.Addr[0] = 0;
pConfig->SubnetMask.Addr[1] = 0;
@@ -148,17 +127,13 @@ EslIp4LocalAddressSet (
pConfig->SubnetMask.Addr[3] = ( 224 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
}
}
//
// Return the operation status
//
DBG_EXIT_STATUS ( Status );
return Status;
}
/**
Get the option value
/** Get the option value.
This routine handles the IPv4 level options.
@@ -171,7 +146,6 @@ EslIp4LocalAddressSet (
@param [out] pOptionLength Buffer to receive the option length
@retval EFI_SUCCESS - Socket data successfully received
**/
EFI_STATUS
EslIp4OptionGet (
@@ -185,20 +159,14 @@ EslIp4OptionGet (
DBG_ENTER ( );
//
// Assume success
//
pSocket->errno = 0;
Status = EFI_SUCCESS;
//
// Attempt to get the option
//
switch ( OptionName ) {
default:
//
// Option not supported
//
pSocket->errno = ENOPROTOOPT;
Status = EFI_INVALID_PARAMETER;
break;
@@ -208,17 +176,13 @@ EslIp4OptionGet (
*pOptionLength = sizeof ( pSocket->bIncludeHeader );
break;
}
//
// Return the operation status
//
DBG_EXIT_STATUS ( Status );
return Status;
}
/**
Set the option value
/** Set the option value.
This routine handles the IPv4 level options.
@@ -231,7 +195,6 @@ EslIp4OptionGet (
@param [in] OptionLength Length of the buffer in bytes
@retval EFI_SUCCESS - Option successfully set
**/
EFI_STATUS
EslIp4OptionSet (
@@ -242,28 +205,22 @@ EslIp4OptionSet (
)
{
BOOLEAN bTrueFalse;
socklen_t LengthInBytes;
UINT8 * pOptionData;
//socklen_t LengthInBytes;
//UINT8 * pOptionData;
EFI_STATUS Status;
DBG_ENTER ( );
//
// Assume success
//
pSocket->errno = 0;
Status = EFI_SUCCESS;
//
// Determine if the option protocol matches
//
LengthInBytes = 0;
pOptionData = NULL;
//LengthInBytes = 0;
//pOptionData = NULL;
switch ( OptionName ) {
default:
//
// Protocol level not supported
//
DEBUG (( DEBUG_INFO | DEBUG_OPTION, "ERROR - Invalid protocol option\r\n" ));
pSocket->errno = ENOTSUP;
Status = EFI_UNSUPPORTED;
@@ -271,31 +228,22 @@ EslIp4OptionSet (
case IP_HDRINCL:
//
// Validate the option length
//
if ( sizeof ( UINT32 ) == OptionLength ) {
//
// Restrict the input to TRUE or FALSE
//
bTrueFalse = TRUE;
if ( 0 == *(UINT32 *)pOptionValue ) {
bTrueFalse = FALSE;
}
pOptionValue = &bTrueFalse;
//
// Set the option value
//
pOptionData = (UINT8 *)&pSocket->bIncludeHeader;
LengthInBytes = sizeof ( pSocket->bIncludeHeader );
//pOptionData = (UINT8 *)&pSocket->bIncludeHeader;
//LengthInBytes = sizeof ( pSocket->bIncludeHeader );
}
break;
}
//
// Return the operation status
//
DBG_EXIT_STATUS ( Status );
return Status;
}