[rtems commit] shell/shell.c: Fix an implicit type cast

Sebastian Huber sebh at rtems.org
Thu Oct 15 17:23:00 UTC 2020


Module:    rtems
Branch:    master
Commit:    2361b2c8cb73267342d603514d86b003932603a5
Changeset: http://git.rtems.org/rtems/commit/?id=2361b2c8cb73267342d603514d86b003932603a5

Author:    Frank Kühndel <frank.kuehndel at embedded-brains.de>
Date:      Mon Oct 12 17:11:18 2020 +0200

shell/shell.c: Fix an implicit type cast

With some compiler warnings enabled, the implicit cast may trigger
a compiler warning. The explicit cast avoids this.

---

 cpukit/libmisc/shell/shell.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 77214d0..c5fc1f5 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -620,7 +620,9 @@ static int rtems_shell_line_editor(
         case 21:                        /* Control-U */
           if (col > 0)
           {
-            int clen = strlen (line);
+            /* strlen() returns size_t but fprintf("%*...") below requires
+             * int! */
+            int clen = (int) strlen (line);
             int bs;
 
             strcpy (line, line + col);



More information about the vc mailing list