examples/media: Fix the compiler wanring after off_t type change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-07-23 12:03:12 +08:00 committed by liuguo09
parent f6dfd1dbb2
commit 4109f0e8ba

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/examples/media/hello_main.c
* apps/examples/media/media_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -185,7 +185,7 @@ int main(int argc, FAR char *argv[])
for (blockno = 0; info.nblocks == 0 || blockno < info.nblocks; blockno++)
{
printf("Write/Verify: Block %lu\n", (unsigned long)blockno);
printf("Write/Verify: Block %ju\n", (uintmax_t)blockno);
/* Fill buffer with a (possibly) unique pattern */
@ -205,7 +205,8 @@ int main(int argc, FAR char *argv[])
fprintf(stderr, "ERROR: lseek to %ju failed: %d\n",
(uintmax_t)pos, errcode);
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -213,7 +214,8 @@ int main(int argc, FAR char *argv[])
{
fprintf(stderr, "ERROR: lseek failed: %ju vs %ju\n",
(uintmax_t)seekpos, (uintmax_t) pos);
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -226,7 +228,8 @@ int main(int argc, FAR char *argv[])
fprintf(stderr, "ERROR: write failed: %d\n", errcode);
if (errno != EINTR)
{
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -235,7 +238,8 @@ int main(int argc, FAR char *argv[])
{
fprintf(stderr, "ERROR: Unexpected write size: %lu vs. %lu\n",
(unsigned long)nwritten, (unsigned long)info.blocksize);
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -247,7 +251,8 @@ int main(int argc, FAR char *argv[])
fprintf(stderr, "ERROR: lseek to %ju failed: %d\n",
(uintmax_t)pos, errcode);
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -255,7 +260,8 @@ int main(int argc, FAR char *argv[])
{
fprintf(stderr, "ERROR: lseek failed: %ju vs %ju\n",
(uintmax_t)seekpos, (uintmax_t)pos);
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -268,7 +274,8 @@ int main(int argc, FAR char *argv[])
fprintf(stderr, "ERROR: read failed: %d\n", errcode);
if (errno != EINTR)
{
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -277,7 +284,8 @@ int main(int argc, FAR char *argv[])
{
fprintf(stderr, "ERROR: Unexpected read size: %lu vs. %lu\n",
(unsigned long)nread, (unsigned long)info.blocksize);
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -298,7 +306,8 @@ int main(int argc, FAR char *argv[])
if (nerrors > 100)
{
fprintf(stderr, "ERROR: Too many errors\n");
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}
@ -335,7 +344,7 @@ int main(int argc, FAR char *argv[])
for (blockno = 0; blockno < info.nblocks; blockno++)
{
printf("Re-read/Verify: Block %lu\n", (unsigned long)blockno);
printf("Re-read/Verify: Block %ju\n", (uintmax_t)blockno);
/* Fill buffer with a (possibly) unique pattern */
@ -356,7 +365,8 @@ int main(int argc, FAR char *argv[])
fprintf(stderr, "ERROR: read failed: %d\n", errcode);
if (errno != EINTR)
{
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
break;
}
}
@ -364,7 +374,8 @@ int main(int argc, FAR char *argv[])
{
fprintf(stderr, "ERROR: Unexpected read size: %lu vs. %lu\n",
(unsigned long)nread, (unsigned long)info.blocksize);
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
break;
}
else
@ -384,7 +395,8 @@ int main(int argc, FAR char *argv[])
if (nerrors > 100)
{
fprintf(stderr, "ERROR: Too many errors\n");
fprintf(stderr, "ERROR: Aborting at block: %lu\n", blockno);
fprintf(stderr, "ERROR: Aborting at block: %ju\n",
(uintmax_t)blockno);
info.nblocks = blockno;
break;
}