aboutsummaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
authorLaszlo Boszormenyi (GCS) <gcs@debian.org>2025-02-16 09:07:36 +0100
committerBernd Schubert <bernd@bsbernd.com>2025-02-18 22:32:49 +0100
commit6adee44e78b70f1708b5d129281e958a2dfca33a (patch)
tree08abc00e52fd8af3ba67bf849c572ed8e66212c3 /example
parenta5aa028097fb557231665292276813b85c849e86 (diff)
downloadlibfuse-6adee44e78b70f1708b5d129281e958a2dfca33a.tar.gz
Fix build of example/memfs_ll.cc on 32 bit architectures
The code uses std::min() which expects its arguments to be size_t. Two times it uses an offset declared as off_t. While both size_t and off_t are 32-bit integers, the latter is signed. On 64 bit architectures the conversation of off_t -> size_t performed automatically. On 32 bit architectures it needs a type cast. Signed-off-by: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Diffstat (limited to 'example')
-rw-r--r--example/memfs_ll.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/example/memfs_ll.cc b/example/memfs_ll.cc
index c7b9663..9898f25 100644
--- a/example/memfs_ll.cc
+++ b/example/memfs_ll.cc
@@ -150,7 +150,7 @@ class Inode {
void read_content(char *buf, size_t size, off_t offset) const
{
- size_t bytes_to_read = std::min(size, content.size() - offset);
+ size_t bytes_to_read = std::min(size, content.size() - (size_t)offset);
std::copy(content.begin() + offset,
content.begin() + offset + bytes_to_read, buf);
}
@@ -613,7 +613,7 @@ static void memfs_read(fuse_req_t req, fuse_ino_t ino, size_t size,
}
std::vector<char> content(
- std::min(size, inode->content_size() - offset));
+ std::min(size, inode->content_size() - (size_t)offset));
inode->read_content(content.data(), content.size(), offset);
inode->unlock();