From 494b47c692f0603f1d7100f1a0a9503617642efc Mon Sep 17 00:00:00 2001 From: Jiuzhu Dong Date: Mon, 21 Mar 2022 18:26:37 +0800 Subject: [PATCH] fix compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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 555877840..e8d9cca98 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; }