From 373e065037250a4e04039427702931ff10603a9a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 18 Jun 2015 17:45:37 -0700 Subject: [PATCH] client: fix signed/unsigned warnings in preadv code Fixes: #12120 Signed-off-by: Sage Weil --- src/client/Client.cc | 7 +++---- src/client/Client.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 17d191331d918..28fefb610c862 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7461,7 +7461,7 @@ int Client::pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset) return _preadv_pwritev(fd, iov, iovcnt, offset, true); } -int Client::_preadv_pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset, bool write) +int Client::_preadv_pwritev(int fd, const struct iovec *iov, unsigned iovcnt, int64_t offset, bool write) { Mutex::Locker lock(client_lock); tout(cct) << fd << std::endl; @@ -7475,7 +7475,7 @@ int Client::_preadv_pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t return -EBADF; #endif loff_t totallen = 0; - for (int i = 0; i < iovcnt; i++) { + for (unsigned i = 0; i < iovcnt; i++) { totallen += iov[i].iov_len; } if (write) { @@ -7487,8 +7487,7 @@ int Client::_preadv_pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t int r = _read(fh, offset, totallen, &bl); ldout(cct, 3) << "preadv(" << fd << ", " << offset << ") = " << r << dendl; int bufoff = 0; - uint32_t rlen = 0; - for (int j = 0, resid = r; j < iovcnt && resid > 0; j++) { + for (unsigned j = 0, resid = r; j < iovcnt && resid > 0; j++) { /* * This piece of code aims to handle the case that bufferlist does not have enough data * to fill in the iov diff --git a/src/client/Client.h b/src/client/Client.h index a1ad18c417cd7..cc9a5acdb231f 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -680,7 +680,7 @@ private: int _read(Fh *fh, int64_t offset, uint64_t size, bufferlist *bl); int _write(Fh *fh, int64_t offset, uint64_t size, const char *buf, const struct iovec *iov, int iovcnt); - int _preadv_pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset, bool write); + int _preadv_pwritev(int fd, const struct iovec *iov, unsigned iovcnt, int64_t offset, bool write); int _flush(Fh *fh); int _fsync(Fh *fh, bool syncdataonly); int _sync_fs(); -- 2.39.5