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 2022/04/13 02:16:49 UTC

[incubator-nuttx] 02/04: libc/strptime:_conv_num skip space

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 6d3f14d41d2527843007dff8bca4fad4cea8fbb1
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Mon Dec 6 17:56:39 2021 +0800

    libc/strptime:_conv_num skip space
    
    Signed-off-by: anjiahao <an...@xiaomi.com>
---
 libs/libc/time/lib_strptime.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libs/libc/time/lib_strptime.c b/libs/libc/time/lib_strptime.c
index 43b3df7c5a..7e4d8828e8 100644
--- a/libs/libc/time/lib_strptime.c
+++ b/libs/libc/time/lib_strptime.c
@@ -413,6 +413,9 @@ _conv_num(const unsigned char **buf, int *dest, int llim, int ulim)
     int result = 0;
     int rulim = ulim;
 
+    while (ispace(**buf))
+        *buf++;
+
     if (**buf < '0' || **buf > '9')
         return (0);