From f359ac8a0df9ca7d3858c8c9ed31d5aacc2b2d9b Mon Sep 17 00:00:00 2001
From: "Paolo G. Giarrusso"
Date: Thu, 3 May 2018 23:26:04 +0200
Subject: [PATCH 1/6] Use correct printf format specifiers for size_t
---
sparsebundlefs.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sparsebundlefs.cpp b/sparsebundlefs.cpp
index 749cc96..1b6b874 100644
--- a/sparsebundlefs.cpp
+++ b/sparsebundlefs.cpp
@@ -305,7 +305,7 @@ static void sparsebundle_read_buf_close_files()
{
sparsebundle_t *sparsebundle = sparsebundle_current();
- syslog(LOG_DEBUG, "closing %u open file descriptor(s)", sparsebundle->open_files.size());
+ syslog(LOG_DEBUG, "closing %zu open file descriptor(s)", sparsebundle->open_files.size());
map::iterator iter;
for(iter = sparsebundle->open_files.begin(); iter != sparsebundle->open_files.end(); ++iter) {
@@ -360,7 +360,7 @@ static int sparsebundle_read_buf(const char *path, struct fuse_bufvec **bufp,
copy(buffers.begin(), buffers.end(), buffer_vector->buf);
- syslog(LOG_DEBUG, "returning %d buffers to fuse", buffer_vector->count);
+ syslog(LOG_DEBUG, "returning %zu buffers to fuse", buffer_vector->count);
*bufp = buffer_vector;
return ret;
From a5f9c89dd9ba57f6789fbdd49c1f24ed51ea6a95 Mon Sep 17 00:00:00 2001
From: Fedor Bezrukov
Date: Thu, 3 May 2018 23:29:17 +0200
Subject: [PATCH 2/6] Fix narrowing from ssize_t to size_t in
sparsebundle_read_buf_process_band
---
sparsebundlefs.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparsebundlefs.cpp b/sparsebundlefs.cpp
index 1b6b874..86e9649 100644
--- a/sparsebundlefs.cpp
+++ b/sparsebundlefs.cpp
@@ -264,7 +264,7 @@ static int sparsebundle_read_buf_prepare_file(const char *path)
static int sparsebundle_read_buf_process_band(const char *band_path, size_t length, off_t offset, void *read_data)
{
- ssize_t read = 0;
+ size_t read = 0;
vector *buffers = static_cast*>(read_data);
From 90c81b177610f4e5b44d10b4dcb42f045d4f0c16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?=
Date: Fri, 4 May 2018 00:02:23 +0200
Subject: [PATCH 3/6] Move to size_t and other unsigned types, over off_t
We never expect the offset to be negative, so instead of keeping
it around as off_t, and having to cast to size_t to deal with
signed vs unsigned comparisons, we just use size_t directly.
There's still a few uses of off_t and ssize_t around, but
those will need further refactoring to clean up.
---
sparsebundlefs.cpp | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/sparsebundlefs.cpp b/sparsebundlefs.cpp
index 86e9649..d874646 100644
--- a/sparsebundlefs.cpp
+++ b/sparsebundlefs.cpp
@@ -37,7 +37,6 @@
#include
#include
#include
-#include
#include