acassis commented on code in PR #6666:
URL: https://github.com/apache/incubator-nuttx/pull/6666#discussion_r929332968


##########
libs/libc/wchar/lib_wcsnrtombs.c:
##########
@@ -72,50 +67,57 @@
 size_t wcsnrtombs(FAR char *dst, FAR const wchar_t **src, size_t nwc,
                   size_t len, FAR mbstate_t *ps)
 {
-  size_t i;
+  FAR const wchar_t *ws = *src;
+  size_t cnt = 0;
 
   if (dst == NULL)
     {
-      for (i = 0; i < nwc; i++)
+      len = 0;
+    }
+
+  while (ws != NULL && nwc != 0)
+    {
+      char tmp[MB_LEN_MAX];
+      size_t l;
+
+      if (*ws == 0)
         {
-          wchar_t wc = (*src)[i];
+          ws = NULL;
+          break;
+        }
 
-          if (wc < 0 || wc > 0xff)
-            {
-              set_errno(EILSEQ);
-              return -1;
-            }
+      l = wcrtomb(len < MB_LEN_MAX ? tmp : dst, *ws, ps);
+      if ((ssize_t)l < 0)

Review Comment:
   @Donny9 suggestion, instead of declaring ```size_t l``` please use other 
variable name because ```l is very similar to 1``` depending on the used font.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to