From ba8cdf99a4be85eae26fb9e94c017ba85ca6c211 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Mon, 12 Jan 2015 16:21:46 -0800 Subject: [PATCH] Add required casts for clang/llvm -Wc++11-narrowing system/core/include/utils/Mutex.h:134:25: error: non-constant-expression cannot be narrowed from type 'long long' to '__kernel_time_t' (aka 'long') in initializer list [-Wc++11-narrowing] system/core/include/utils/Mutex.h:135:26: error: non-constant-expression cannot be narrowed from type 'long long' to 'long' in initializer list [-Wc++11-narrowing] Change-Id: Icb9df26aeb01617da5ab1c36987289f7c2b11954 --- include/utils/Mutex.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/utils/Mutex.h b/include/utils/Mutex.h index 4fdd27ff1..a3b594d4c 100644 --- a/include/utils/Mutex.h +++ b/include/utils/Mutex.h @@ -131,8 +131,8 @@ inline status_t Mutex::tryLock() { #if HAVE_ANDROID_OS inline status_t Mutex::timedLock(nsecs_t timeoutNs) { const struct timespec ts = { - /* .tv_sec = */ timeoutNs / 1000000000, - /* .tv_nsec = */ timeoutNs % 1000000000, + /* .tv_sec = */ static_cast(timeoutNs / 1000000000), + /* .tv_nsec = */ static_cast(timeoutNs % 1000000000), }; return -pthread_mutex_timedlock(&mMutex, &ts); }