You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/11/27 19:07:48 UTC

[incubator-nuttx] 02/02: libc/gets: Remove the unnecessary cast

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

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

commit 5da9dbe57af2d9b0b22c6cf1b92e76dfe6dcb67b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Nov 18 02:12:01 2021 +0800

    libc/gets: Remove the unnecessary cast
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libc/stdio/lib_fgets.c  | 2 +-
 libs/libc/stdio/lib_gets.c   | 2 +-
 libs/libc/stdio/lib_gets_s.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libs/libc/stdio/lib_fgets.c b/libs/libc/stdio/lib_fgets.c
index 0edc2f5..9485e23 100644
--- a/libs/libc/stdio/lib_fgets.c
+++ b/libs/libc/stdio/lib_fgets.c
@@ -57,6 +57,6 @@ char *fgets(FAR char *buf, int buflen, FAR FILE *stream)
 
   else
     {
-      return lib_fgets(buf, (size_t)buflen, stream, true, false);
+      return lib_fgets(buf, buflen, stream, true, false);
     }
 }
diff --git a/libs/libc/stdio/lib_gets.c b/libs/libc/stdio/lib_gets.c
index 6ecde39..2a25e8f 100644
--- a/libs/libc/stdio/lib_gets.c
+++ b/libs/libc/stdio/lib_gets.c
@@ -58,5 +58,5 @@ FAR char *gets(FAR char *s)
 {
   /* Let lib_fgets() do the heavy lifting */
 
-  return lib_fgets(s, (size_t)INT_MAX, stdin, false, false);
+  return lib_fgets(s, SIZE_MAX, stdin, false, false);
 }
diff --git a/libs/libc/stdio/lib_gets_s.c b/libs/libc/stdio/lib_gets_s.c
index 72aa929..ddcaa81 100644
--- a/libs/libc/stdio/lib_gets_s.c
+++ b/libs/libc/stdio/lib_gets_s.c
@@ -41,7 +41,7 @@
  *   either a terminating newline or EOF, which it replaces with '\0'.  Reads
  *   at most n-1 characters from stdin into the array pointed to by str until
  *   new-line character, end-of-file condition, or read error.   The newline
- *   character, if encountered, is not saved in the arraay.  A NUL character
+ *   character, if encountered, is not saved in the array.  A NUL character
  *   is written immediately after the last character read into the array, or
  *   to str[0] if no characters were read.
  *
@@ -69,5 +69,5 @@ FAR char *gets_s(FAR char *s, rsize_t n)
 
   /* Then let lib_fgets() do the heavy lifting */
 
-  return lib_fgets(s, (size_t)n, stdin, false, true);
+  return lib_fgets(s, n, stdin, false, true);
 }