ClosestStorm / rar2fs

Automatically exported from code.google.com/p/rar2fs
GNU General Public License v3.0
0 stars 0 forks source link

Not a bug : Fix some compile warnings. #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
gcc reports some warnings...

gcc -std=gnu99 -o mkr2i mkr2i.o -rdynamic -L../unrar  -ldl -lrt 
rar2fs.c: In function ‘lrelease’:
rar2fs.c:1248:9: warning: format ‘%p’ expects argument of type ‘void 
*’, but argument 5 has type ‘uint64_t’ [-Wformat=]
         printd(3, "(%05d) %s [%-16p]\n", getpid(), "FREE", fi->fh);
         ^
mv -f .deps/filecache.Tpo .deps/filecache.Po
mv -f .deps/iobuffer.Tpo .deps/iobuffer.Po
rar2fs.c: In function ‘rar2_release’:
rar2fs.c:3745:9: warning: format ‘%p’ expects argument of type ‘void 
*’, but argument 5 has type ‘uint64_t’ [-Wformat=]
         printd(3, "(%05d) %s [%-16p]\n", getpid(), "RELEASE", fi->fh);
         ^
mv -f .deps/optdb.Tpo .deps/optdb.Po
rar2fs.c:3797:17: warning: format ‘%p’ expects argument of type ‘void 
*’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                 printd(3, "(%05d) %s [%-16p]\n", getpid(), "FREE", fi->fh);
                 ^

That occurs because file handle(fh) is just integer, but uses "pointer" format 
to print that.

This patch can fix this. It just replaces "%p" to PRIX64 to ensure hex output - 
fh declares as uint64_t in fuse_common.h on my system.

Original issue reported on code.google.com by jyhpsy...@gmail.com on 23 Feb 2014 at 3:05

Attachments:

GoogleCodeExporter commented 9 years ago
Already fixed these since I had to compile with --enable-debug for trouble 
shooting issue28. But thanks anyway :)

Original comment by hans.bec...@gmail.com on 23 Feb 2014 at 3:09

GoogleCodeExporter commented 9 years ago

Original comment by hans.bec...@gmail.com on 23 Feb 2014 at 3:10

GoogleCodeExporter commented 9 years ago
If there's some issue on 32-bit systems - fh declares uint32_t under that 
systems -, that should be patched like this...

Original comment by jyhpsy...@gmail.com on 23 Feb 2014 at 3:11

Attachments:

GoogleCodeExporter commented 9 years ago
No, AFAIK fi->fh is not platform dependant. It is declared as a uint64_t also 
on 32-bit architectures.

Original comment by hans.bec...@gmail.com on 23 Feb 2014 at 3:15

GoogleCodeExporter commented 9 years ago

Original comment by hans.bec...@gmail.com on 23 Feb 2014 at 3:32

GoogleCodeExporter commented 9 years ago

Original comment by hans.bec...@gmail.com on 23 Feb 2014 at 4:56