TurboGit/hubicfuse

Ubuntu 14.04 make -> warning: cast to pointer from integer of different size

Closed this issue · 5 comments

Hi, while it's been very easy to install hubicfuse on a ubuntu 16.04 distro, since a .deb is directly available, here's what I'm facing on a i686 architecture using ubuntu 14.04 :

# make
gcc -g -O2 -I/usr/include/libxml2 -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -I/usr/include/json-c -o hubicfuse cloudfsapi.c cloudfuse.c commonfs.c -lxml2 -lcurl -pthread -lfuse -lssl -lcrypto -ljson-c -lmagic
commonfs.c: In function ‘debug_print_descriptor’:
commonfs.c:240:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
openfile* of = (openfile *)info->fh;

What can I do to sort it out, please?

I suppose the machine with Ubuntu 16.04 is a 64bit machine and the one in Ubuntu 14.04 a 32bit one. Right?

Yep, the 14.04 machine arch is i686 when the 16.04 arch is x86_64.
Now, as mentioned above, on the 16.04 I just installed hubicfuse from the packages. So I had no need to compile it.

Can you try this simple patch and tell me if it's working?

diff --git a/commonfs.c b/commonfs.c
index 343e4c8..f59014d 100644
--- a/commonfs.c
+++ b/commonfs.c
@@ -237,7 +237,7 @@ void debug_print_flags(int flags)
 void debug_print_descriptor(struct fuse_file_info* info)
 {
   char file_path[MAX_PATH_SIZE];
-  openfile* of = (openfile *)info->fh;
+  openfile* of = (openfile *)(uintptr_t)info->fh;
   get_file_path_from_fd(of->fd, file_path, sizeof(file_path));
   debugf(DBG_LEVEL_EXT, KCYN "descriptor localfile=[%s] fd=%lld", file_path,
          of->fd);

Yes it works fine, no more warning nor error or whatsoever.
Thank you Pascal ! ;)

Great! I've pushed the modification.