tools/nxstyle.c: Add logic to catch another formatting error and to eliminate some false alarms. Includes cosmetic changes to several files ... mostly as a result of testing nxstyle and finding issues.

This commit is contained in:
Gregory Nutt
2018-10-29 16:25:57 -06:00
parent 7d2b250cbc
commit dcb7ce8afd
14 changed files with 137 additions and 117 deletions
+14 -10
View File
@@ -189,10 +189,11 @@ int netdev_foreach(netdev_callback_t callback, FAR void *arg);
* (since a "down" device has no meaningful address).
*
* Input Parameters:
* lipaddr - Local, IPv4 address of assigned to the device
* lipaddr - Local, IPv4 address assigned to the network device. Or any
* IPv4 address on the sub-net served by the network device.
*
* Returned Value:
* Pointer to driver on success; null on failure
* Pointer to driver on success; null on failure
*
****************************************************************************/
@@ -209,10 +210,11 @@ FAR struct net_driver_s *netdev_findby_lipv4addr(in_addr_t lipaddr);
* (since a "down" device has no meaningful address).
*
* Input Parameters:
* lipaddr - Local, IPv6 address of assigned to the device
* lipaddr - Local, IPv6 address assigned to the network device. Or any
* IPv6 address on the sub-net served by the network device.
*
* Returned Value:
* Pointer to driver on success; null on failure
* Pointer to driver on success; null on failure
*
****************************************************************************/
@@ -228,11 +230,12 @@ FAR struct net_driver_s *netdev_findby_lipv6addr(const net_ipv6addr_t lipaddr);
* IPv4 address that can be reached by the device.
*
* Input Parameters:
* lipaddr - Local, bound address of a connection.
* lipaddr - Local, bound address of a connection (used only if ripaddr is
* the broadcast address).
* ripaddr - Remote address of a connection to use in the lookup
*
* Returned Value:
* Pointer to driver on success; null on failure
* Pointer to driver on success; null on failure
*
****************************************************************************/
@@ -249,11 +252,12 @@ FAR struct net_driver_s *netdev_findby_ripv4addr(in_addr_t lipaddr,
* IPv6 address that can be reached by the device.
*
* Input Parameters:
* lipaddr - Local, bound address of a connection.
* lipaddr - Local, bound address of a connection (used only if ripaddr is
* a multicast address).
* ripaddr - Remote address of a connection to use in the lookup
*
* Returned Value:
* Pointer to driver on success; null on failure
* Pointer to driver on success; null on failure
*
****************************************************************************/
@@ -451,7 +455,7 @@ int netdev_count(void);
* Name: netdev_ipv4_ifconf
*
* Description:
* Return the IPv4 configuration of each network adaptor
* Return the IPv4 configuration of each network adapter
*
* Input Parameters:
* ifc - A reference to the instance of struct ifconf in which to return
@@ -475,7 +479,7 @@ int netdev_ipv4_ifconf(FAR struct ifconf *ifc);
* Name: netdev_ipv6_ifconf
*
* Description:
* Return the IPv6 configuration of each network adaptor
* Return the IPv6 configuration of each network adapter
*
* Input Parameters:
* lifc - A reference to the instance of struct lifconf in which to return
+12 -8
View File
@@ -70,10 +70,11 @@
* (since a "down" device has no meaningful address).
*
* Input Parameters:
* lipaddr - Local, IPv4 address of assigned to the device
* lipaddr - Local, IPv4 address assigned to the network device. Or any
* IPv4 address on the sub-net served by the network device.
*
* Returned Value:
* Pointer to driver on success; null on failure
* Pointer to driver on success; null on failure
*
****************************************************************************/
@@ -120,10 +121,11 @@ FAR struct net_driver_s *netdev_findby_lipv4addr(in_addr_t lipaddr)
* (since a "down" device has no meaningful address).
*
* Input Parameters:
* lipaddr - Local, IPv6 address of assigned to the device
* lipaddr - Local, IPv6 address assigned to the network device. Or any
* IPv6 address on the sub-net served by the network device.
*
* Returned Value:
* Pointer to driver on success; null on failure
* Pointer to driver on success; null on failure
*
****************************************************************************/
@@ -169,11 +171,12 @@ FAR struct net_driver_s *netdev_findby_lipv6addr(const net_ipv6addr_t lipaddr)
* IPv4 address that can be reached by the device.
*
* Input Parameters:
* lipaddr - Local, bound address of a connection.
* lipaddr - Local, bound address of a connection (used only if ripaddr is
* the broadcast address).
* ripaddr - Remote address of a connection to use in the lookup
*
* Returned Value:
* Pointer to driver on success; null on failure
* Pointer to driver on success; null on failure
*
****************************************************************************/
@@ -258,11 +261,12 @@ FAR struct net_driver_s *netdev_findby_ripv4addr(in_addr_t lipaddr,
* IPv6 address that can be reached by the device.
*
* Input Parameters:
* lipaddr - Local, bound address of a connection.
* lipaddr - Local, bound address of a connection (used only if ripaddr is
* a multicast address).
* ripaddr - Remote address of a connection to use in the lookup
*
* Returned Value:
* Pointer to driver on success; null on failure
* Pointer to driver on success; null on failure
*
****************************************************************************/
+5 -5
View File
@@ -161,12 +161,12 @@ int netdev_nextindex(int ifindex)
{
if ((g_devset & (1L << ifindex)) != 0)
{
/* NOTE that the index + 1 is returned. Zero is reserved to
* mean no-index in the POSIX standards.
*/
/* NOTE that the index + 1 is returned. Zero is reserved to
* mean no-index in the POSIX standards.
*/
net_unlock();
return ifindex + 1;
net_unlock();
return ifindex + 1;
}
}
+36 -36
View File
@@ -102,7 +102,7 @@ static int ifconf_ipv4_callback(FAR struct net_driver_s *dev, FAR void *arg)
DEBUGASSERT(dev != NULL && info != NULL && info->ifc != NULL);
ifc = info->ifc;
/* Check if this adaptor has an IPv4 address assigned and is in the UP
/* Check if this adapter has an IPv4 address assigned and is in the UP
* state.
*/
@@ -124,25 +124,25 @@ static int ifconf_ipv4_callback(FAR struct net_driver_s *dev, FAR void *arg)
* cases.
*/
if (ifc->ifc_len + sizeof(struct ifreq) <= info->bufsize)
{
FAR struct ifreq *req =
(FAR struct ifreq *)&ifc->ifc_buf[ifc->ifc_len];
FAR struct sockaddr_in *inaddr =
(FAR struct sockaddr_in *)&req->ifr_addr;
if (ifc->ifc_len + sizeof(struct ifreq) <= info->bufsize)
{
FAR struct ifreq *req =
(FAR struct ifreq *)&ifc->ifc_buf[ifc->ifc_len];
FAR struct sockaddr_in *inaddr =
(FAR struct sockaddr_in *)&req->ifr_addr;
/* There is space for information about another adaptor. Within
* each ifreq structure, ifr_name will receive the interface name
* and ifr_addr the address. The actual number of bytes
* transferred is returned in ifc_len.
*/
/* There is space for information about another adapter. Within
* each ifreq structure, ifr_name will receive the interface name
* and ifr_addr the address. The actual number of bytes
* transferred is returned in ifc_len.
*/
strncpy(req->ifr_name, dev->d_ifname, IFNAMSIZ);
strncpy(req->ifr_name, dev->d_ifname, IFNAMSIZ);
inaddr->sin_family = AF_INET;
inaddr->sin_port = 0;
net_ipv4addr_copy(inaddr->sin_addr.s_addr, dev->d_ipaddr);
}
inaddr->sin_family = AF_INET;
inaddr->sin_port = 0;
net_ipv4addr_copy(inaddr->sin_addr.s_addr, dev->d_ipaddr);
}
/* Increment the size of the buffer in any event */
@@ -179,7 +179,7 @@ static int ifconf_ipv6_callback(FAR struct net_driver_s *dev, FAR void *arg)
DEBUGASSERT(dev != NULL && info != NULL && info->lifc != NULL);
lifc = info->lifc;
/* Check if this adaptor has an IPv6 address assigned and is in the UP
/* Check if this adapter has an IPv6 address assigned and is in the UP
* state.
*/
@@ -201,25 +201,25 @@ static int ifconf_ipv6_callback(FAR struct net_driver_s *dev, FAR void *arg)
* cases.
*/
if (lifc->lifc_len + sizeof(struct lifreq) <= info->bufsize)
{
FAR struct lifreq *req =
(FAR struct lifreq *)&lifc->lifc_buf[lifc->lifc_len];
FAR struct sockaddr_in6 *inaddr =
(FAR struct sockaddr_in6 *)&req->lifr_addr;
if (lifc->lifc_len + sizeof(struct lifreq) <= info->bufsize)
{
FAR struct lifreq *req =
(FAR struct lifreq *)&lifc->lifc_buf[lifc->lifc_len];
FAR struct sockaddr_in6 *inaddr =
(FAR struct sockaddr_in6 *)&req->lifr_addr;
/* There is space for information about another adaptor. Within
* each ifreq structure, lifr_name will receive the interface
* name and lifr_addr the address. The actual number of bytes
* transferred is returned in lifc_len.
*/
/* There is space for information about another adapter. Within
* each ifreq structure, lifr_name will receive the interface
* name and lifr_addr the address. The actual number of bytes
* transferred is returned in lifc_len.
*/
strncpy(req->lifr_name, dev->d_ifname, IFNAMSIZ);
strncpy(req->lifr_name, dev->d_ifname, IFNAMSIZ);
inaddr->sin6_family = AF_INET6;
inaddr->sin6_port = 0;
net_ipv6addr_copy(inaddr->sin6_addr.s6_addr16, dev->d_ipv6addr);
}
inaddr->sin6_family = AF_INET6;
inaddr->sin6_port = 0;
net_ipv6addr_copy(inaddr->sin6_addr.s6_addr16, dev->d_ipv6addr);
}
/* Increment the size of the buffer in any event */
@@ -238,7 +238,7 @@ static int ifconf_ipv6_callback(FAR struct net_driver_s *dev, FAR void *arg)
* Name: netdev_ipv4_ifconf
*
* Description:
* Return the IPv4 configuration of each network adaptor that (1) has
* Return the IPv4 configuration of each network adapter that (1) has
* and IPv4 address assigned and (2) is in the UP state
*
* Input Parameters:
@@ -271,7 +271,7 @@ int netdev_ipv4_ifconf(FAR struct ifconf *ifc)
* Name: netdev_ipv6_ifconf
*
* Description:
* Return the IPv6 configuration of each network adaptor that (1) has
* Return the IPv6 configuration of each network adapter that (1) has
* and IPv6 address assigned and (2) is in the UP state.
*
* Input Parameters:
+1 -1
View File
@@ -95,6 +95,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration */
#undef HAVE_WRITABLE_IPv4ROUTE
@@ -695,7 +696,6 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
break;
#endif
#ifdef CONFIG_NET_IPv4
case SIOCSIFADDR: /* Set IP address */
{
-1
View File
@@ -87,7 +87,6 @@ void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr)
}
#endif /* CONFIG_NET_IPv4 */
/****************************************************************************
* Name: netdev_ipv6_txnotify
*