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-apps.git

commit 494b47c692f0603f1d7100f1a0a9503617642efc
Author: Jiuzhu Dong <dongjiuz...@xiaomi.com>
AuthorDate: Mon Mar 21 18:26:37 2022 +0800

    fix compile warning
    
    scanftest_main.c:1121:34: warning: ā€˜%s’ directive writing up to 2 bytes 
into a region of size between 1 and 80 [-Wformat-overflow=]
    canftest_main.c: In function 'scanftest_main':
    scanftest_main.c:1399:42: warning: format '%n' expects argument of type 
'int *', but argument 3 has type 'unsigned int' [-Wformat=]
     1399 |               printf("Test #%u assigned %nou instead of %lli.\n",
          |                                         ~^
          |                                          |
          |                                          int *
          |                                         %d
     1400 |                      t + 1, nou, type_data[t].value.u);
          |                             ~~~
          |                             |
          |                             unsigned int
    
    Signed-off-by: Jiuzhu Dong <dongjiuz...@xiaomi.com>
---
 testing/scanftest/scanftest_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testing/scanftest/scanftest_main.c 
b/testing/scanftest/scanftest_main.c
index 5558778..e8d9cca 100644
--- a/testing/scanftest/scanftest_main.c
+++ b/testing/scanftest/scanftest_main.c
@@ -1068,7 +1068,7 @@ int main(int argc, FAR char *argv[])
   int n1 = 12345;
   int n2;
   bool ok;
-  char s1[80];
+  char s1[84];
   char s2[80];
   float f1;
   float f2;
@@ -1396,7 +1396,7 @@ int main(int argc, FAR char *argv[])
           sscanf(type_data[t].input, type_data[t].format, &nou);
           if (type_data[t].value.u != nou)
             {
-              printf("Test #%u assigned %nou instead of %lli.\n",
+              printf("Test #%u assigned %u instead of %lli.\n",
                      t + 1, nou, type_data[t].value.u);
               ok = false;
             }

Reply via email to