]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
utime: fix narrowing conversion compiler warning in sleep()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sun, 27 Jan 2013 20:57:31 +0000 (21:57 +0100)
committerSage Weil <sage@inktank.com>
Mon, 28 Jan 2013 21:56:32 +0000 (13:56 -0800)
Fix compiler warning:
./include/utime.h: In member function 'void utime_t::sleep()':
./include/utime.h:139:50: warning: narrowing conversion of
 '((utime_t*)this)->utime_t::tv.utime_t::<anonymous struct>::tv_sec' from
 '__u32 {aka unsigned int}' to '__time_t {aka long int}' inside { } is
 ill-formed in C++11 [-Wnarrowing]
./include/utime.h:139:50: warning: narrowing conversion of
 '((utime_t*)this)->utime_t::tv.utime_t::<anonymous struct>::tv_nsec' from
 '__u32 {aka unsigned int}' to 'long int' inside { } is
 ill-formed in C++11 [-Wnarrowing]

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/include/utime.h

index 526dec568aec9eb0a6915ea04a0037ede7db3e50..f433fff446733d9eefff6a3a551e3314aa3094f3 100644 (file)
@@ -136,7 +136,7 @@ public:
   }
 
   void sleep() {
-    struct timespec ts = { tv.tv_sec, tv.tv_nsec };
+    struct timespec ts = { (__time_t)tv.tv_sec, (long)tv.tv_nsec };
     nanosleep(&ts, &ts);
   }