You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/04/12 18:09:43 UTC

[incubator-nuttx] 01/04: Fix warnings noted in PR build checks:

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 62c13898255fea1a303d7beef40fb5202d6c952c
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sun Apr 12 09:52:56 2020 -0600

    Fix warnings noted in PR build checks:
    
        net/telnet.c:1317:40: warning: result of comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
                          if (priv->td_pending < CONFIG_TELNET_RXBUFFER_SIZE)
                              ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        time/lib_localtime.c:569:32: warning: sizeof on pointer operation will return size of 'char *' instead of 'char [33]' [-Wsizeof-array-decay]
                  sizeof(lsp->fullname - 1) <= strlen(p) + strlen(name))
                         ~~~~~~~~~~~~~ ^
---
 drivers/net/telnet.c           | 2 +-
 libs/libc/time/lib_localtime.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index 5346065..493e958 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -144,10 +144,10 @@ struct telnet_dev_s
   sem_t             td_exclsem;   /* Enforces mutually exclusive access */
   sem_t             td_iosem;     /* I/O thread will notify that data is available */
   uint8_t           td_state;     /* (See telnet_state_e) */
-  uint8_t           td_pending;   /* Number of valid, pending bytes in the rxbuffer */
   uint8_t           td_offset;    /* Offset to the valid, pending bytes in the rxbuffer */
   uint8_t           td_crefs;     /* The number of open references to the session */
   uint8_t           td_minor;     /* Minor device number */
+  uint16_t          td_pending;   /* Number of valid, pending bytes in the rxbuffer */
 #ifdef CONFIG_TELNET_SUPPORT_NAWS
   uint16_t          td_rows;      /* Number of NAWS rows */
   uint16_t          td_cols;      /* Number of NAWS cols */
diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c
index e18b3b5..e2c411a 100644
--- a/libs/libc/time/lib_localtime.c
+++ b/libs/libc/time/lib_localtime.c
@@ -566,7 +566,7 @@ static int tzload(FAR const char *name,
     {
       p = TZDIR;
       if (p == NULL ||
-          sizeof(lsp->fullname - 1) <= strlen(p) + strlen(name))
+          FILENAME_MAX <= strlen(p) + strlen(name))
         {
           goto oops;
         }