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 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2022-03-21 18:26:37 +08:00 committed by Xiang Xiao
parent dede3698ae
commit 494b47c692

View File

@ -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;
}