Skip to content

Commit

Permalink
fs cases: fix compile error
Browse files Browse the repository at this point in the history
kernel/fs/cases/fs_stream_test.c:279:70: error: format ‘%zi’ expects argument of type ‘signed size_t’, but argument 4 has type ‘int’ [-Werror=format=]
  279 |           syslog(LOG_ERR, "len = %zi != return value from fwrite = %zi",
      |                                                                    ~~^
      |                                                                      |
      |                                                                      long int
      |                                                                    %i
  280 |                  len, ret);
      |                       ~~~
      |                       |
      |                       int
kernel/fs/cases/fs_stream_test.c:311:69: error: format ‘%zi’ expects argument of type ‘signed size_t’, but argument 4 has type ‘int’ [-Werror=format=]
  311 |           syslog(LOG_ERR, "len = %zi != return value from fread = %zi",
      |                                                                   ~~^
      |                                                                     |
      |                                                                     long int
      |                                                                   %i
  312 |                  len, ret);
      |                       ~~~
      |                       |
      |                       int

Signed-off-by: zhangshoukui <[email protected]>
  • Loading branch information
Zhangshoukui committed Dec 18, 2024
1 parent 9c8a96a commit 2ffa262
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions testing/testsuites/kernel/fs/cases/fs_stream_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void test_nuttx_fs_stream03(FAR void **state)
char *junk = "abcdefghijklmnopqrstuvwxyz";
size_t len = strlen(junk);
char *inbuf = NULL;
int ret;
size_t ret;
int lc;
for (lc = 0; lc < 10; lc++)
{
Expand All @@ -264,10 +264,10 @@ void test_nuttx_fs_stream03(FAR void **state)
assert_true(1 == 0);
}

if ((size_t)ret != len)
if (ret != len)
{
syslog(LOG_ERR,
"len = %zi != return value from fwrite = %i",
"len = %zi != return value from fwrite = %zi",
len, ret);
fclose(stream);
assert_true(1 == 0);
Expand Down Expand Up @@ -297,10 +297,10 @@ void test_nuttx_fs_stream03(FAR void **state)
assert_true(1 == 0);
}

if ((size_t)ret != len)
if (ret != len)
{
syslog(LOG_ERR,
"len = %zi != return value from fread = %i",
"len = %zi != return value from fread = %zi",
len, ret);
free(inbuf);
fclose(stream);
Expand Down

0 comments on commit 2ffa262

Please sign in to comment.