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
This commit is contained in:
Chih-Hung Hsieh 2015-01-12 16:21:46 -08:00
parent ec556521e2
commit ba8cdf99a4
1 changed files with 2 additions and 2 deletions

View File

@ -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<time_t>(timeoutNs / 1000000000),
/* .tv_nsec = */ static_cast<long>(timeoutNs % 1000000000),
};
return -pthread_mutex_timedlock(&mMutex, &ts);
}