]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StdLib: Fix more GCC warnings/errors caused by variables being set but not used.
authorOlivier Martin <olivier.martin@arm.com>
Fri, 31 Oct 2014 20:32:02 +0000 (20:32 +0000)
committerdarylm503 <darylm503@Edk2>
Fri, 31 Oct 2014 20:32:02 +0000 (20:32 +0000)
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@16286 6f19259b-4bc3-4df7-8a09-765794883524

AppPkg/Applications/Python/Python-2.7.2/Modules/getnameinfo.c
AppPkg/Applications/Python/Python-2.7.2/Parser/parsetok.c
AppPkg/Applications/Sockets/GetHostByDns/GetHostByDns.c
AppPkg/Applications/Sockets/GetHostByName/GetHostByName.c
AppPkg/Applications/Sockets/GetNetByName/GetNetByName.c
AppPkg/Applications/Sockets/GetServByName/GetServByName.c
AppPkg/Applications/Sockets/GetServByPort/GetServByPort.c
StdLib/EfiSocketLib/Socket.c
StdLib/LibC/Uefi/Devices/Console/daConsole.c

index f29d97f9df548b83096e252f7514c19618351f65..c199d662e673bf8d34640f2c3e99bf18003076c5 100644 (file)
@@ -1,4 +1,14 @@
-/*\r
+/** @file\r
+  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+\r
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\r
  * All rights reserved.\r
  *\r
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
  * SUCH DAMAGE.\r
- */\r
 \r
-/*\r
  * Issues to be discussed:\r
  * - Thread safe-ness must be checked\r
  * - Return values.  There seems to be no standard for return value (RFC2133)\r
  *   but INRIA implementation returns EAI_xxx defined for getaddrinfo().\r
- */\r
+**/\r
 \r
 #if 0\r
 #include <sys/types.h>\r
@@ -104,8 +112,8 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
     u_long v4a;\r
 #ifdef ENABLE_IPV6\r
     u_char pfx;\r
-#endif\r
     int h_error;\r
+#endif\r
     char numserv[512];\r
     char numaddr[512];\r
 \r
@@ -181,7 +189,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
         hp = getipnodebyaddr(addr, gni_afd->a_addrlen, gni_afd->a_af, &h_error);\r
 #else\r
         hp = gethostbyaddr(addr, gni_afd->a_addrlen, gni_afd->a_af);\r
-        h_error = h_errno;\r
+        //h_error = h_errno;\r
 #endif\r
 \r
         if (hp) {\r
index 6446b10a22a296d464dc1d39e15f9095054cf37e..f086449e1cf5c12780d79d3f3608b87eadae1b8f 100644 (file)
@@ -1,6 +1,15 @@
-\r
-/* Parser-tokenizer link implementation */\r
-\r
+/** @file\r
+  Parser-tokenizer link implementation.\r
+\r
+  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
 #include "pgenheaders.h"\r
 #include "tokenizer.h"\r
 #include "node.h"\r
@@ -131,7 +140,9 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
 {\r
     parser_state *ps;\r
     node *n;\r
-    int started = 0, handling_import = 0, handling_with = 0;\r
+    int started = 0;\r
+    //int handling_import = 0;\r
+    //int handling_with = 0;\r
 \r
     if ((ps = PyParser_New(g, start)) == NULL) {\r
         fprintf(stderr, "no mem for new parser\n");\r
@@ -163,7 +174,8 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
         }\r
         if (type == ENDMARKER && started) {\r
             type = NEWLINE; /* Add an extra newline */\r
-            handling_with = handling_import = 0;\r
+            //handling_with = 0;\r
+            //handling_import = 0;\r
             started = 0;\r
             /* Add the right number of dedent tokens,\r
                except if a certain flag is given --\r
index 83fa60c333ba63285f4a962730123d4e5d201fe2..e87b04f6d1bc2f938c946903bc75d236209e3dc3 100644 (file)
@@ -1,17 +1,15 @@
 /** @file\r
   Translate the host name into an IP address\r
 \r
-  Copyright (c) 2011-2012, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
 **/\r
-\r
 #include <errno.h>\r
 #include <netdb.h>\r
 #include <string.h>\r
@@ -28,8 +26,7 @@ struct hostent * _gethostbydnsname (const char *, int);
 char mBuffer[65536];\r
 \r
 \r
-/**\r
-  Translate the host name into an IP address\r
+/** Translate the host name into an IP address\r
 \r
   @param [in] Argc  The number of arguments\r
   @param [in] Argv  The argument value array\r
@@ -43,7 +40,6 @@ main (
   IN char **Argv\r
   )\r
 {\r
-  int AppStatus;\r
   UINT8 * pIpAddress;\r
   struct hostent * pHost;\r
 \r
@@ -51,17 +47,12 @@ main (
             "%a starting\r\n",\r
             Argv[0]));\r
 \r
-  //\r
   //  Determine if the host name is specified\r
-  //\r
-  AppStatus = 0;\r
   if ( 1 == Argc ) {\r
     Print ( L"%a  <host name>\r\n", Argv[0]);\r
   }\r
   else {\r
-    //\r
     //  Translate the host name\r
-    //\r
     pHost = _gethostbydnsname ( Argv[1], AF_INET );\r
     if ( NULL == pHost ) {\r
       Print ( L"ERROR - host not found, h_errno: %d\r\n", h_errno );\r
@@ -77,9 +68,6 @@ main (
               pIpAddress[3]);\r
     }\r
   }\r
-\r
-  //\r
   //  All done\r
-  //\r
   return errno;\r
 }\r
index 1bddc614ea2e0a88b74cad4cd64ab9bf4462ca4a..4d4fe5460e0fc97563a027e350c4dec4961bf8d8 100644 (file)
@@ -1,17 +1,15 @@
 /** @file\r
   Translate the host name into an IP address\r
 \r
-  Copyright (c) 2011-2012, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
 **/\r
-\r
 #include <errno.h>\r
 #include <netdb.h>\r
 #include <string.h>\r
 char mBuffer[65536];\r
 \r
 \r
-/**\r
-  Translate the host name into an IP address\r
+/** Translate the host name into an IP address\r
 \r
-  @param [in] Argc  The number of arguments\r
-  @param [in] Argv  The argument value array\r
+  @param[in]  Argc  The number of arguments\r
+  @param[in]  Argv  The argument value array\r
 \r
   @retval  0        The application exited normally.\r
   @retval  Other    An error occurred.\r
@@ -41,7 +38,6 @@ main (
   IN char **Argv\r
   )\r
 {\r
-  int AppStatus;\r
   UINTN Index;\r
   struct hostent * pHost;\r
   UINT8 * pIpAddress;\r
@@ -51,17 +47,12 @@ main (
             "%a starting\r\n",\r
             Argv[0]));\r
 \r
-  //\r
   //  Determine if the host name is specified\r
-  //\r
-  AppStatus = 0;\r
   if ( 1 == Argc ) {\r
     Print ( L"%a  <host name>\r\n", Argv[0]);\r
   }\r
   else {\r
-    //\r
     //  Translate the host name\r
-    //\r
     pHost = gethostbyname ( Argv[1]);\r
     if ( NULL == pHost ) {\r
       Print ( L"ERROR - host not found, h_errno: %d\r\n", h_errno );\r
@@ -76,9 +67,7 @@ main (
               pHost->h_addrtype,\r
               pHost->h_name );\r
 \r
-      //\r
       //  Display the other addresses\r
-      //\r
       for ( Index = 1; NULL != pHost->h_addr_list[Index]; Index++ ) {\r
         pIpAddress = (UINT8 *)pHost->h_addr_list[Index];\r
         Print ( L"%d.%d.%d.%d\r\n",\r
@@ -88,9 +77,7 @@ main (
                 pIpAddress[3]);\r
       }\r
 \r
-      //\r
       //  Display the list of aliases\r
-      //\r
       ppName = pHost->h_aliases;\r
       if (( NULL == ppName ) || ( NULL == *ppName )) {\r
         Print ( L"No aliases\r\n" );\r
@@ -115,9 +102,6 @@ main (
       }\r
     }\r
   }\r
-\r
-  //\r
   //  All done\r
-  //\r
   return errno;\r
 }\r
index f4e0aca1a199b212e7907d79943810e1cae0aec1..7ce741c08cc564c9707c361627bef32e0f139e35 100644 (file)
@@ -1,17 +1,15 @@
 /** @file\r
   Translate the network name into an IP address\r
 \r
-  Copyright (c) 2011-2012, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
 **/\r
-\r
 #include <errno.h>\r
 #include <netdb.h>\r
 #include <string.h>\r
 char mBuffer[65536];\r
 \r
 \r
-/**\r
-  Translate the network name into an IP address\r
+/** Translate the network name into an IP address\r
 \r
-  @param [in] Argc  The number of arguments\r
-  @param [in] Argv  The argument value array\r
+  @param[in]  Argc  The number of arguments\r
+  @param[in]  Argv  The argument value array\r
 \r
   @retval  0        The application exited normally.\r
   @retval  Other    An error occurred.\r
@@ -41,7 +38,6 @@ main (
   IN char **Argv\r
   )\r
 {\r
-  int AppStatus;\r
   UINT8 * pIpAddress;\r
   struct netent * pNetwork;\r
 \r
@@ -49,17 +45,12 @@ main (
             "%a starting\r\n",\r
             Argv[0]));\r
 \r
-  //\r
   //  Determine if the network name is specified\r
-  //\r
-  AppStatus = 0;\r
   if ( 1 == Argc ) {\r
     Print ( L"%a  <network name>\r\n", Argv[0]);\r
   }\r
   else {\r
-    //\r
     //  Translate the net name\r
-    //\r
     pNetwork = getnetbyname ( Argv[1]);\r
     if ( NULL == pNetwork ) {\r
       Print ( L"ERROR - network not found, errno: %d\r\n", errno );\r
@@ -75,9 +66,6 @@ main (
               pIpAddress[3]);\r
     }\r
   }\r
-\r
-  //\r
   //  All done\r
-  //\r
   return errno;\r
 }\r
index bd32d1d3448c0e3bbe328310dea9fbf35439ac56..dede76baf28b9415bfac56ccf3ba1b682b8d5279 100644 (file)
@@ -1,17 +1,15 @@
 /** @file\r
   Translate the service name into a port number\r
 \r
-  Copyright (c) 2011-2012, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
 **/\r
-\r
 #include <errno.h>\r
 #include <netdb.h>\r
 #include <string.h>\r
 char mBuffer[65536];\r
 \r
 \r
-/**\r
-  Translate the service name into a port number\r
+/** Translate the service name into a port number\r
 \r
-  @param [in] Argc  The number of arguments\r
-  @param [in] Argv  The argument value array\r
+  @param[in]  Argc  The number of arguments\r
+  @param[in]  Argv  The argument value array\r
 \r
   @retval  0        The application exited normally.\r
   @retval  Other    An error occurred.\r
@@ -41,21 +38,15 @@ main (
   IN char **Argv\r
   )\r
 {\r
-  int AppStatus;\r
   int PortNumber;\r
   struct servent * pService;\r
 \r
-  //\r
   //  Determine if the service name is specified\r
-  //\r
-  AppStatus = 0;\r
   if ( 1 == Argc ) {\r
     Print ( L"%a  <service name>\r\n", Argv[0]);\r
   }\r
   else {\r
-    //\r
     //  Translate the service name\r
-    //\r
     pService = getservbyname ( Argv[1], NULL );\r
     if ( NULL == pService ) {\r
       Print ( L"ERROR - service not found, errno: %d\r\n", errno );\r
@@ -68,9 +59,6 @@ main (
               pService->s_proto );\r
     }\r
   }\r
-\r
-  //\r
   //  All done\r
-  //\r
   return errno;\r
 }\r
index 1b8dcd32eaa6648f391bb0ad1b4a8701aafee9c9..69441e1bc07627b9447119a3e757e75459bb0d29 100644 (file)
@@ -1,17 +1,15 @@
 /** @file\r
   Translate the port number into a service name\r
 \r
-  Copyright (c) 2011-2012, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are licensed and made available under\r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
 **/\r
-\r
 #include <errno.h>\r
 #include <netdb.h>\r
 #include <stdio.h>\r
 char mBuffer[65536];\r
 \r
 \r
-/**\r
-  Translate the port number into a service name\r
+/** Translate the port number into a service name\r
 \r
-  @param [in] Argc  The number of arguments\r
-  @param [in] Argv  The argument value array\r
+  @param[in]  Argc  The number of arguments\r
+  @param[in]  Argv  The argument value array\r
 \r
   @retval  0        The application exited normally.\r
   @retval  Other    An error occurred.\r
@@ -42,22 +39,16 @@ main (
   IN char **Argv\r
   )\r
 {\r
-  int AppStatus;\r
   int PortNumber;\r
   struct servent * pService;\r
 \r
-  //\r
   //  Determine if the service name is specified\r
-  //\r
-  AppStatus = 0;\r
   if (( 2 != Argc )\r
     || ( 1 != sscanf ( Argv[1], "%d", &PortNumber ))) {\r
     Print ( L"%a  <port number>\r\n", Argv[0]);\r
   }\r
   else {\r
-    //\r
     //  Translate the port number\r
-    //\r
     pService = getservbyport ( htons ( PortNumber ), NULL );\r
     if ( NULL == pService ) {\r
       Print ( L"ERROR - service not found, errno: %d\r\n", errno );\r
@@ -69,9 +60,6 @@ main (
               pService->s_proto );\r
     }\r
   }\r
-\r
-  //\r
   //  All done\r
-  //\r
   return errno;\r
 }\r
index 96a20c331e1dd254a31e9910ea0b272c11952743..d782b435e658a8251cd02447eb00d538ee0e1fd7 100644 (file)
@@ -4006,6 +4006,7 @@ EslSocketPortCloseComplete (
   //  Determine if the receive operation is pending\r
   Status = EslSocketPortCloseRxDone ( pPort );\r
   DBG_EXIT_STATUS ( Status );\r
+  --Status;\r
 }\r
 \r
 \r
index 1f40177d474db3f730d220851320c7ebfef2d6a7..884e7017b43a69a129791af57dc6a7bc6f3a2ae5 100644 (file)
@@ -586,7 +586,6 @@ da_ConPoll(
   short              events\r
   )\r
 {\r
-  EFI_SIMPLE_TEXT_INPUT_PROTOCOL   *Proto;\r
   ConInstance                      *Stream;\r
   EFI_STATUS                        Status = RETURN_SUCCESS;\r
   short                             RdyMask = 0;\r
@@ -600,7 +599,6 @@ da_ConPoll(
   }\r
   if(Stream->InstanceNum == 0) {\r
     // STDIN: Only input is supported for this device\r
-    Proto = (EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)Stream->Dev;\r
     Status = da_ConRawRead (filp, &Stream->UnGetKey);\r
     if(Status == RETURN_SUCCESS) {\r
       RdyMask = POLLIN;\r