Skip to content

Commit

Permalink
tools/nxstyle.c: Fix logic error that prevent detecion of '/' and '/=…
Browse files Browse the repository at this point in the history
…' as operators. net/: Minor updates resulting from testing tools/nxstyle.
  • Loading branch information
gregory-nutt committed Mar 11, 2019
1 parent 0a7f764 commit f6b00e1
Show file tree
Hide file tree
Showing 77 changed files with 474 additions and 284 deletions.
6 changes: 6 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ that copyrighted additions were made during the years of 2007 and 2011
whereas "2007-2011" would indicate copyrighted additions in the years 2007,
2008, 2009, 2010, and 2011.

Copyright Line Continuation: Copy information which exceeds the usable line
lengh may be broken and continued on the following line, such as:

Copyright (C) 2007-2010, 2012, 2014-2015, 2017 Gregory Nutt. All
rights reserved.

NuttX
^^^^^

Expand Down
1 change: 1 addition & 0 deletions net/arp/arp.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/* Configuration ************************************************************/

#ifndef CONFIG_DEBUG_FEATURES
Expand Down
6 changes: 4 additions & 2 deletions net/arp/arp_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ static uint16_t arp_send_eventhandler(FAR struct net_driver_s *dev,
return flags;
}

/* It looks like we are good to send the data */
/* Copy the packet data into the device packet buffer and send it */
/* It looks like we are good to send the data.
*
* Copy the packet data into the device packet buffer and send it.
*/

arp_format(dev, state->snd_ipaddr);

Expand Down
1 change: 0 additions & 1 deletion net/arp/arp_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ static int arp_match(FAR struct net_driver_s *dev, FAR void *arg)
return 1;
}


/****************************************************************************
* Name: arp_return_old_entry
*
Expand Down
6 changes: 4 additions & 2 deletions net/bluetooth/bluetooth_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ void bluetooth_poll(FAR struct net_driver_s *dev,
radio->r_dev.d_len = 0;
radio->r_dev.d_sndlen = 0;

/* Perform the application callback */
/* REVISIT: Need to pass the meta data and the IOB through the callback */
/* Perform the application callback.
*
* REVISIT: Need to pass the meta data and the IOB through the callback
*/
#warning Missing logic

/* Perform the application callback */
Expand Down
7 changes: 4 additions & 3 deletions net/bluetooth/bluetooth_sockif.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ static int bluetooth_bind(FAR struct socket *psock,

iaddr = (FAR const struct sockaddr_bt_s *)addr;

/* Very that some address was provided */
/* REVISIT: Currently and explict address must be assigned. Should we
/* Very that some address was provided.
*
* REVISIT: Currently and explict address must be assigned. Should we
* support some moral equivalent to INADDR_ANY?
*/

Expand Down Expand Up @@ -667,7 +668,7 @@ static ssize_t bluetooth_send(FAR struct socket *psock, FAR const void *buf,
{
/* send() may be used only if the socket is has been connected. */

if (!_SS_ISCONNECTED( psock->s_flags))
if (!_SS_ISCONNECTED(psock->s_flags))
{
ret = -ENOTCONN;
}
Expand Down
7 changes: 4 additions & 3 deletions net/devif/ipv4_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ static uint8_t devif_reassembly(FAR struct net_driver_s *dev)
g_reassembly_bitmap[offset / (8 * 8)] |=
g_bitmap_bits[(offset / 8) & 7] &
~g_bitmap_bits[((offset + len) / 8) & 7];

}
else
{
Expand Down Expand Up @@ -342,8 +341,10 @@ int ipv4_input(FAR struct net_driver_s *dev)
g_netstats.ipv4.recv++;
#endif

/* Start of IP input header processing code. */
/* Check validity of the IP header. */
/* Start of IP input header processing code.
*
* Check validity of the IP header.
*/

if (ipv4->vhl != 0x45)
{
Expand Down
6 changes: 4 additions & 2 deletions net/devif/ipv6_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ int ipv6_input(FAR struct net_driver_s *dev)
g_netstats.ipv6.recv++;
#endif

/* Start of IP input header processing code. */
/* Check validity of the IP header. */
/* Start of IP input header processing code.
*
* Check validity of the IP header.
*/

if ((ipv6->vtc & 0xf0) != 0x60)
{
Expand Down
5 changes: 3 additions & 2 deletions net/ieee802154/ieee802154_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ FAR struct ieee802154_conn_s *
conn != NULL;
conn = (FAR struct ieee802154_conn_s *)conn->node.flink)
{
/* Does the destination address match the bound address of the socket. */
/* REVISIT: Currently and explicit address must be assigned. Should we
/* Does the destination address match the bound address of the socket.
*
* REVISIT: Currently and explicit address must be assigned. Should we
* support some moral equivalent to INADDR_ANY?
*/

Expand Down
6 changes: 4 additions & 2 deletions net/ieee802154/ieee802154_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ void ieee802154_poll(FAR struct net_driver_s *dev,
radio->r_dev.d_len = 0;
radio->r_dev.d_sndlen = 0;

/* Perform the application callback */
/* REVISIT: Need to pass the meta data and the IOB through the callback */
/* Perform the application callback.
*
* REVISIT: Need to pass the meta data and the IOB through the callback.
*/
#warning Missing logic

/* Perform the application callback */
Expand Down
5 changes: 3 additions & 2 deletions net/ieee802154/ieee802154_sendto.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ static void ieee802154_meta_data(FAR struct radio_driver_s *radio,
meta->flags.ackreq = TRUE;
}

/* Destination address */
/* If the output address is NULL, then it is broadcast on the 802.15.4
/* Destination address.
*
* If the output address is NULL, then it is broadcast on the 802.15.4
* network.
*/

Expand Down
5 changes: 3 additions & 2 deletions net/ieee802154/ieee802154_sockif.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ static int ieee802154_bind(FAR struct socket *psock,

iaddr = (FAR const struct sockaddr_ieee802154_s *)addr;

/* Very that some address was provided */
/* REVISIT: Currently and explict address must be assigned. Should we
/* Very that some address was provided.
*
* REVISIT: Currently and explict address must be assigned. Should we
* support some moral equivalent to INADDR_ANY?
*/

Expand Down
4 changes: 2 additions & 2 deletions net/igmp/igmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/*
* ________________

/* ________________
* | |
* | |
* | |
Expand Down
1 change: 1 addition & 0 deletions net/igmp/igmp_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ static inline void igmp_sched_send(FAR struct net_driver_s *dev,
in_addr_t *dest;

/* REVISIT: This should be deferred to a work queue */

/* Check what kind of message we need to send. There are only two
* possibilities:
*/
Expand Down
5 changes: 3 additions & 2 deletions net/inet/inet_recvfrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,9 @@ ssize_t inet_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
}
}

/* Read from the network interface driver buffer */
/* Or perform the TCP/IP or UDP recv() operation */
/* Read from the network interface driver buffer.
* Or perform the TCP/IP or UDP recv() operation.
*/

switch (psock->s_type)
{
Expand Down
3 changes: 1 addition & 2 deletions net/local/local.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ struct local_conn_s
struct
{
uint16_t lc_remaining; /* (For binary compatibility with peer) */
volatile int lc_result; /* Result of the connection operation (client)*/
volatile int lc_result; /* Result of the connection operation (client) */
} client;

/* Fields common to connected peers (connected or accepted) */
Expand Down Expand Up @@ -651,7 +651,6 @@ int local_open_sender(FAR struct local_conn_s *conn, FAR const char *path,
bool nonblock);
#endif


/****************************************************************************
* Name: local_accept_pollnotify
****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions net/local/local_accept.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
conn->lc_type = LOCAL_TYPE_PATHNAME;
conn->lc_state = LOCAL_STATE_CONNECTED;

strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX-1);
conn->lc_path[UNIX_PATH_MAX-1] = '\0';
strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX - 1);
conn->lc_path[UNIX_PATH_MAX - 1] = '\0';
conn->lc_instance_id = client->lc_instance_id;

/* Open the server-side write-only FIFO. This should not
Expand Down
6 changes: 3 additions & 3 deletions net/local/local_bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int psock_local_bind(FAR struct socket *psock,
}
else
{
namelen = strnlen(unaddr->sun_path, UNIX_PATH_MAX-1);
namelen = strnlen(unaddr->sun_path, UNIX_PATH_MAX - 1);
if (namelen <= 0)
{
/* Zero-length sun_path... This is an abstract Unix domain socket */
Expand All @@ -107,8 +107,8 @@ int psock_local_bind(FAR struct socket *psock,

/* Copy the path into the connection structure */

(void)strncpy(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1);
conn->lc_path[UNIX_PATH_MAX-1] = '\0';
(void)strncpy(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1);
conn->lc_path[UNIX_PATH_MAX - 1] = '\0';
conn->lc_instance_id = -1;
}
}
Expand Down
7 changes: 4 additions & 3 deletions net/local/local_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,16 @@ int psock_local_connect(FAR struct socket *psock,

case LOCAL_TYPE_PATHNAME: /* lc_path holds a null terminated string */
{
if (strncmp(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1) == 0)
if (strncmp(conn->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1)
== 0)
{
int ret = OK;

/* Bind the address and protocol */

client->lc_proto = conn->lc_proto;
strncpy(client->lc_path, unaddr->sun_path, UNIX_PATH_MAX-1);
client->lc_path[UNIX_PATH_MAX-1] = '\0';
strncpy(client->lc_path, unaddr->sun_path, UNIX_PATH_MAX - 1);
client->lc_path[UNIX_PATH_MAX - 1] = '\0';
client->lc_instance_id = local_generate_instance_id();

/* The client is now bound to an address */
Expand Down
17 changes: 9 additions & 8 deletions net/local/local_fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ static inline void local_cs_name(FAR struct local_conn_s *conn,
{
if (conn->lc_instance_id < 0)
{
(void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_CS_SUFFIX,
(void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_CS_SUFFIX,
conn->lc_path);
}
else
{
(void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_CS_SUFFIX "%x",
(void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_CS_SUFFIX "%x",
conn->lc_path, conn->lc_instance_id);
}

path[LOCAL_FULLPATH_LEN-1] = '\0';
path[LOCAL_FULLPATH_LEN - 1] = '\0';
}
#endif /* CONFIG_NET_LOCAL_STREAM */

Expand All @@ -109,16 +109,16 @@ static inline void local_sc_name(FAR struct local_conn_s *conn,
{
if (conn->lc_instance_id < 0)
{
(void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_SC_SUFFIX,
(void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_SC_SUFFIX,
conn->lc_path);
}
else
{
(void)snprintf(path, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_SC_SUFFIX "%x",
(void)snprintf(path, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_SC_SUFFIX "%x",
conn->lc_path, conn->lc_instance_id);
}

path[LOCAL_FULLPATH_LEN-1] = '\0';
path[LOCAL_FULLPATH_LEN - 1] = '\0';
}
#endif /* CONFIG_NET_LOCAL_STREAM */

Expand All @@ -133,8 +133,9 @@ static inline void local_sc_name(FAR struct local_conn_s *conn,
#ifdef CONFIG_NET_LOCAL_DGRAM
static inline void local_hd_name(FAR const char *inpath, FAR char *outpath)
{
(void)snprintf(outpath, LOCAL_FULLPATH_LEN-1, "%s" LOCAL_HD_SUFFIX, inpath);
outpath[LOCAL_FULLPATH_LEN-1] = '\0';
(void)snprintf(outpath, LOCAL_FULLPATH_LEN - 1, "%s" LOCAL_HD_SUFFIX,
inpath);
outpath[LOCAL_FULLPATH_LEN - 1] = '\0';
}
#endif /* CONFIG_NET_LOCAL_DGRAM */

Expand Down
2 changes: 1 addition & 1 deletion net/local/local_recvutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ int local_getaddr(FAR struct local_conn_s *conn, FAR struct sockaddr *addr,
* of the whole Unix domain address.
*/

pathlen = strnlen(conn->lc_path, UNIX_PATH_MAX-1);
pathlen = strnlen(conn->lc_path, UNIX_PATH_MAX - 1);
totlen = sizeof(sa_family_t) + pathlen + 1;

/* If the length of the whole Unix domain address is larger than the
Expand Down
1 change: 0 additions & 1 deletion net/local/local_release.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@

int local_release(FAR struct local_conn_s *conn)
{

/* There should be no references on this structure */

DEBUGASSERT(conn->lc_crefs == 0);
Expand Down
2 changes: 2 additions & 0 deletions net/local/local_sockif.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ static int local_connect(FAR struct socket *psock,
{
/* Perform the datagram connection logic */
#warning Missing logic

return -ENOSYS;
}
break;
Expand Down Expand Up @@ -703,6 +704,7 @@ static ssize_t local_send(FAR struct socket *psock, FAR const void *buf,
{
/* Local UDP packet send */
#warning Missing logic

ret = -ENOSYS;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion net/loopback/loopback.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* Public Types
****************************************************************************/

/****************************************************************************
/****************************************************************************
* Public Data
****************************************************************************/

Expand Down
24 changes: 12 additions & 12 deletions net/mld/mld_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,18 @@ void mld_new_pollcycle(FAR struct net_driver_s *dev)

/* Update member ship in every group */

for (member = (FAR struct mld_group_s *)dev->d_mld.grplist.head;
member;
member = member->next)
{
/* Save the number of members that reported in the previous query
* cycle; reset the number of members that have reported in the new
* query cycle.
*/

member->lstmbrs = member->members;
member->members = 0;
}
for (member = (FAR struct mld_group_s *)dev->d_mld.grplist.head;
member;
member = member->next)
{
/* Save the number of members that reported in the previous query
* cycle; reset the number of members that have reported in the new
* query cycle.
*/

member->lstmbrs = member->members;
member->members = 0;
}
}
#endif

Expand Down
1 change: 0 additions & 1 deletion net/mld/mld_report.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ int mld_report(FAR struct net_driver_s *dev, FAR const net_ipv6addr_t grpaddr)
return -EINVAL;
}


group = mld_grpallocfind(dev, grpaddr);
if (group == NULL)
{
Expand Down
Loading

0 comments on commit f6b00e1

Please sign in to comment.