You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/04/27 13:29:43 UTC
[incubator-nuttx-apps] branch master updated (3bd2bc0 -> ef19ca0)
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.
from 3bd2bc0 examples/unionfs: Remove [a|b]testdir.h in distclean
new f55c5b6 usrsock: Fix warning: the incompatible pointer type
new ef19ca0 cle.c: Fix warning: assuming signed overflow does not occur when assuming that (X + c) < X is always false
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
system/cle/cle.c | 28 ++++++++++++-----------
system/usrsock_rpmsg/usrsock_rpmsg_client.c | 13 ++++++-----
system/usrsock_rpmsg/usrsock_rpmsg_server.c | 35 +++++++++++++++++------------
3 files changed, 43 insertions(+), 33 deletions(-)
[incubator-nuttx-apps] 01/02: usrsock: Fix warning: the
incompatible pointer type
Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit f55c5b67ee7d8c77b029958620e9bc51f6f8fb8b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Apr 27 12:36:06 2020 +0800
usrsock: Fix warning: the incompatible pointer type
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
system/usrsock_rpmsg/usrsock_rpmsg_client.c | 13 ++++++-----
system/usrsock_rpmsg/usrsock_rpmsg_server.c | 35 +++++++++++++++++------------
2 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/system/usrsock_rpmsg/usrsock_rpmsg_client.c b/system/usrsock_rpmsg/usrsock_rpmsg_client.c
index cc00dfb..29c742d 100644
--- a/system/usrsock_rpmsg/usrsock_rpmsg_client.c
+++ b/system/usrsock_rpmsg/usrsock_rpmsg_client.c
@@ -71,8 +71,9 @@ struct usrsock_rpmsg_s
static int usrsock_rpmsg_dns_handler(struct rpmsg_endpoint *ept, void *data,
size_t len, uint32_t src, void *priv);
-static int usrsock_rpmsg_default_handler(struct rpmsg_endpoint *ept, void *data,
- size_t len, uint32_t src, void *priv_);
+static int usrsock_rpmsg_default_handler(struct rpmsg_endpoint *ept,
+ void *data, size_t len,
+ uint32_t src, void *priv_);
static void usrsock_rpmsg_device_created(struct rpmsg_device *rdev,
void *priv_);
@@ -130,8 +131,9 @@ static int usrsock_rpmsg_dns_handler(struct rpmsg_endpoint *ept, void *data,
return ret;
}
-static int usrsock_rpmsg_default_handler(struct rpmsg_endpoint *ept, void *data,
- size_t len, uint32_t src, void *priv_)
+static int usrsock_rpmsg_default_handler(struct rpmsg_endpoint *ept,
+ void *data, size_t len,
+ uint32_t src, void *priv_)
{
struct usrsock_rpmsg_s *priv = priv_;
@@ -237,7 +239,7 @@ int main(int argc, char *argv[])
{
struct pollfd pfd;
void *buf;
- size_t len;
+ uint32_t len;
/* Wait the packet ready */
@@ -284,7 +286,6 @@ int main(int argc, char *argv[])
}
/* The remote side crash, loop to wait it restore */
-
}
destroy_ept:
diff --git a/system/usrsock_rpmsg/usrsock_rpmsg_server.c b/system/usrsock_rpmsg/usrsock_rpmsg_server.c
index 52c75bd..a789e1e 100644
--- a/system/usrsock_rpmsg/usrsock_rpmsg_server.c
+++ b/system/usrsock_rpmsg/usrsock_rpmsg_server.c
@@ -70,9 +70,10 @@ struct usrsock_rpmsg_s
static int usrsock_rpmsg_send_ack(struct rpmsg_endpoint *ept,
uint8_t xid, int32_t result);
static int usrsock_rpmsg_send_data_ack(struct rpmsg_endpoint *ept,
- struct usrsock_message_datareq_ack_s *ack,
- uint8_t xid, int32_t result,
- uint16_t valuelen, uint16_t valuelen_nontrunc);
+ struct usrsock_message_datareq_ack_s *ack,
+ uint8_t xid, int32_t result,
+ uint16_t valuelen,
+ uint16_t valuelen_nontrunc);
static int usrsock_rpmsg_send_event(struct rpmsg_endpoint *ept,
int16_t usockid, uint16_t events);
@@ -167,10 +168,10 @@ static int usrsock_rpmsg_send_ack(struct rpmsg_endpoint *ept,
}
static int usrsock_rpmsg_send_data_ack(struct rpmsg_endpoint *ept,
- struct usrsock_message_datareq_ack_s *ack,
- uint8_t xid, int32_t result,
- uint16_t valuelen,
- uint16_t valuelen_nontrunc)
+ struct usrsock_message_datareq_ack_s *ack,
+ uint8_t xid, int32_t result,
+ uint16_t valuelen,
+ uint16_t valuelen_nontrunc)
{
ack->reqack.head.msgid = USRSOCK_MESSAGE_RESPONSE_DATA_ACK;
ack->reqack.head.flags = 0;
@@ -372,7 +373,7 @@ static int usrsock_rpmsg_sendto_handler(struct rpmsg_endpoint *ept,
}
static int usrsock_rpmsg_recvfrom_handler(struct rpmsg_endpoint *ept,
- void *data, size_t len,
+ void *data, size_t len_,
uint32_t src, void *priv_)
{
struct usrsock_request_recvfrom_s *req = data;
@@ -382,6 +383,7 @@ static int usrsock_rpmsg_recvfrom_handler(struct rpmsg_endpoint *ept,
socklen_t inaddrlen = req->max_addrlen;
size_t buflen = req->max_buflen;
ssize_t ret = -EBADF;
+ uint32_t len;
int retr;
ack = rpmsg_get_tx_payload_buffer(ept, &len, true);
@@ -434,7 +436,7 @@ static int usrsock_rpmsg_setsockopt_handler(struct rpmsg_endpoint *ept,
}
static int usrsock_rpmsg_getsockopt_handler(struct rpmsg_endpoint *ept,
- void *data, size_t len,
+ void *data, size_t len_,
uint32_t src, void *priv_)
{
struct usrsock_request_getsockopt_s *req = data;
@@ -442,6 +444,7 @@ static int usrsock_rpmsg_getsockopt_handler(struct rpmsg_endpoint *ept,
struct usrsock_rpmsg_s *priv = priv_;
socklen_t optlen = req->max_valuelen;
int ret = -EBADF;
+ uint32_t len;
ack = rpmsg_get_tx_payload_buffer(ept, &len, true);
if (req->usockid >= 0 && req->usockid < CONFIG_NSOCKET_DESCRIPTORS)
@@ -455,7 +458,7 @@ static int usrsock_rpmsg_getsockopt_handler(struct rpmsg_endpoint *ept,
}
static int usrsock_rpmsg_getsockname_handler(struct rpmsg_endpoint *ept,
- void *data, size_t len,
+ void *data, size_t len_,
uint32_t src, void *priv_)
{
struct usrsock_request_getsockname_s *req = data;
@@ -464,6 +467,7 @@ static int usrsock_rpmsg_getsockname_handler(struct rpmsg_endpoint *ept,
socklen_t outaddrlen = req->max_addrlen;
socklen_t inaddrlen = req->max_addrlen;
int ret = -EBADF;
+ uint32_t len;
ack = rpmsg_get_tx_payload_buffer(ept, &len, true);
if (req->usockid >= 0 && req->usockid < CONFIG_NSOCKET_DESCRIPTORS)
@@ -477,7 +481,7 @@ static int usrsock_rpmsg_getsockname_handler(struct rpmsg_endpoint *ept,
}
static int usrsock_rpmsg_getpeername_handler(struct rpmsg_endpoint *ept,
- void *data, size_t len,
+ void *data, size_t len_,
uint32_t src, void *priv_)
{
struct usrsock_request_getpeername_s *req = data;
@@ -486,6 +490,7 @@ static int usrsock_rpmsg_getpeername_handler(struct rpmsg_endpoint *ept,
socklen_t outaddrlen = req->max_addrlen;
socklen_t inaddrlen = req->max_addrlen;
int ret = -EBADF;
+ uint32_t len;
ack = rpmsg_get_tx_payload_buffer(ept, &len, true);
if (req->usockid >= 0 && req->usockid < CONFIG_NSOCKET_DESCRIPTORS)
@@ -543,7 +548,7 @@ static int usrsock_rpmsg_listen_handler(struct rpmsg_endpoint *ept,
}
static int usrsock_rpmsg_accept_handler(struct rpmsg_endpoint *ept,
- void *data, size_t len,
+ void *data, size_t len_,
uint32_t src, void *priv_)
{
struct usrsock_request_accept_s *req = data;
@@ -551,9 +556,10 @@ static int usrsock_rpmsg_accept_handler(struct rpmsg_endpoint *ept,
struct usrsock_rpmsg_s *priv = priv_;
socklen_t outaddrlen = req->max_addrlen;
socklen_t inaddrlen = req->max_addrlen;
+ int ret = -EBADF;
+ uint32_t len;
int i = 0;
int retr;
- int ret = -EBADF;
ack = rpmsg_get_tx_payload_buffer(ept, &len, true);
if (req->usockid >= 0 && req->usockid < CONFIG_NSOCKET_DESCRIPTORS)
@@ -618,13 +624,14 @@ static int usrsock_rpmsg_accept_handler(struct rpmsg_endpoint *ept,
}
static int usrsock_rpmsg_ioctl_handler(struct rpmsg_endpoint *ept,
- void *data, size_t len,
+ void *data, size_t len_,
uint32_t src, void *priv_)
{
struct usrsock_request_ioctl_s *req = data;
struct usrsock_message_datareq_ack_s *ack;
struct usrsock_rpmsg_s *priv = priv_;
int ret = -EBADF;
+ uint32_t len;
ack = rpmsg_get_tx_payload_buffer(ept, &len, true);
if (req->usockid >= 0 && req->usockid < CONFIG_NSOCKET_DESCRIPTORS)
[incubator-nuttx-apps] 02/02: cle.c: Fix warning: assuming signed
overflow does not occur when assuming that (X + c) < X is always false
Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit ef19ca0243a128e23e77dc9b08231449b8428c63
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Apr 27 20:24:43 2020 +0800
cle.c: Fix warning: assuming signed overflow does not occur when assuming that (X + c) < X is always false
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
system/cle/cle.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/system/cle/cle.c b/system/cle/cle.c
index f515699..bb39371 100644
--- a/system/cle/cle.c
+++ b/system/cle/cle.c
@@ -673,22 +673,24 @@ static void cle_closetext(FAR struct cle_s *priv, uint16_t pos,
priv->nchars -= size;
- /* Check if the cursor position is beyond the deleted region */
-
- if (priv->curpos > pos + size)
+ if (priv->curpos > pos)
{
- /* Yes... just subtract the size of the deleted region */
+ /* Check if the cursor position is beyond the deleted region */
- priv->curpos -= size;
- }
+ if (priv->curpos - pos > size)
+ {
+ /* Yes... just subtract the size of the deleted region */
- /* What if the position is within the deleted region? Set it to the
- * beginning of the deleted region.
- */
+ priv->curpos -= size;
+ }
+ else
+ {
+ /* What if the position is within the deleted region? Set it to
+ * the beginning of the deleted region.
+ */
- else if (priv->curpos > pos)
- {
- priv->curpos = pos;
+ priv->curpos = pos;
+ }
}
}
@@ -1118,7 +1120,7 @@ static int cle_editloop(FAR struct cle_s *priv)
case '\n': /* LF terminates line */
#endif
{
- /* Add the newline character to the buffer at the end of the line */
+ /* Add the newline to the buffer at the end of the line */
priv->curpos = priv->nchars;
cle_insertch(priv, '\n');