fuse/operations: explicitly cast pointer to uintptr_t to avoid problems on 32bit systems

This commit is contained in:
josch
2014-12-28 09:11:26 +01:00
parent a0c534b803
commit 07e545bd87

View File

@@ -376,7 +376,7 @@ int mediafirefs_open(const char *path, struct fuse_file_info *file_info)
stringv_add(ctx->sv_writefiles, path); stringv_add(ctx->sv_writefiles, path);
} }
file_info->fh = (uint64_t) openfile; file_info->fh = (uintptr_t) openfile;
return 0; return 0;
} }
@@ -407,7 +407,7 @@ int mediafirefs_create(const char *path, mode_t mode,
openfile->is_local = true; openfile->is_local = true;
openfile->is_readonly = false; openfile->is_readonly = false;
openfile->path = strdup(path); openfile->path = strdup(path);
file_info->fh = (uint64_t) openfile; file_info->fh = (uintptr_t) openfile;
// add to writefiles // add to writefiles
stringv_add(ctx->sv_writefiles, path); stringv_add(ctx->sv_writefiles, path);
@@ -419,16 +419,18 @@ int mediafirefs_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *file_info) struct fuse_file_info *file_info)
{ {
(void)path; (void)path;
return pread(((struct mediafirefs_openfile *)file_info->fh)->fd, buf, size, return
offset); pread(((struct mediafirefs_openfile *)(uintptr_t) file_info->fh)->fd,
buf, size, offset);
} }
int mediafirefs_write(const char *path, const char *buf, size_t size, int mediafirefs_write(const char *path, const char *buf, size_t size,
off_t offset, struct fuse_file_info *file_info) off_t offset, struct fuse_file_info *file_info)
{ {
(void)path; (void)path;
return pwrite(((struct mediafirefs_openfile *)file_info->fh)->fd, buf, return
size, offset); pwrite(((struct mediafirefs_openfile *)(uintptr_t) file_info->fh)->fd,
buf, size, offset);
} }
/* /*
@@ -453,7 +455,7 @@ int mediafirefs_release(const char *path, struct fuse_file_info *file_info)
ctx = fuse_get_context()->private_data; ctx = fuse_get_context()->private_data;
openfile = (struct mediafirefs_openfile *)file_info->fh; openfile = (struct mediafirefs_openfile *)(uintptr_t) file_info->fh;
// if file was opened as readonly then it just has to be closed // if file was opened as readonly then it just has to be closed
if (openfile->is_readonly) { if (openfile->is_readonly) {