[dm-devel] [PATCH 48/72] libmultipath: print: use unsigned int for "width" field

Martin Wilck Martin.Wilck at suse.com
Sat Oct 12 21:28:36 UTC 2019


From: Martin Wilck <mwilck at suse.com>

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 libmultipath/print.c | 4 ++--
 libmultipath/print.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libmultipath/print.c b/libmultipath/print.c
index 8fa86267..b98e9bda 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -36,7 +36,7 @@
 #define NOPAD    s = c
 #define PAD(x) \
 do { \
-	while ((int)(c - s) < (x) && (c < (line + len - 1))) \
+	while (c < (s + x) && (c < (line + len - 1))) \
 		*c++ = ' '; \
 	s = c; \
 } while (0)
@@ -783,7 +783,7 @@ get_path_layout(vector pathvec, int header)
 }
 
 static void
-reset_width(int *width, enum layout_reset reset, const char *header)
+reset_width(unsigned int *width, enum layout_reset reset, const char *header)
 {
 	switch (reset) {
 	case LAYOUT_RESET_HEADER:
diff --git a/libmultipath/print.h b/libmultipath/print.h
index 0c909e75..e8260d03 100644
--- a/libmultipath/print.h
+++ b/libmultipath/print.h
@@ -78,21 +78,21 @@
 struct path_data {
 	char wildcard;
 	char * header;
-	int width;
+	unsigned int width;
 	int (*snprint)(char * buff, size_t len, const struct path * pp);
 };
 
 struct multipath_data {
 	char wildcard;
 	char * header;
-	int width;
+	unsigned int width;
 	int (*snprint)(char * buff, size_t len, const struct multipath * mpp);
 };
 
 struct pathgroup_data {
 	char wildcard;
 	char * header;
-	int width;
+	unsigned int width;
 	int (*snprint)(char * buff, size_t len, const struct pathgroup * pgp);
 };
 
-- 
2.23.0





More information about the dm-devel mailing list