From: Sage Weil Date: Fri, 19 Jun 2015 00:45:37 +0000 (-0700) Subject: client: fix signed/unsigned warnings in preadv code X-Git-Tag: v9.0.3~103^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=373e065037250a4e04039427702931ff10603a9a;p=ceph.git client: fix signed/unsigned warnings in preadv code Fixes: #12120 Signed-off-by: Sage Weil --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 17d191331d91..28fefb610c86 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 a1ad18c417cd..cc9a5acdb231 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();