Fix c++11 narrowing
The best fix for these narrowing
violations is to use static casting
As an example, this change would the following for libnaio:
error: non-constant-expression cannot be narrowed from
type 'uint32_t' (aka 'unsigned int') to 'long' in initializer list
const struct timespec req = {0, ns};
^~
Change-Id: I04ed1de4497dc19772194afef3ebf8fe0c8b82bc
diff --git a/media/libnbaio/MonoPipe.cpp b/media/libnbaio/MonoPipe.cpp
index e8d3d9b..095a4ff 100644
--- a/media/libnbaio/MonoPipe.cpp
+++ b/media/libnbaio/MonoPipe.cpp
@@ -180,7 +180,7 @@
}
}
if (ns > 0) {
- const struct timespec req = {0, ns};
+ const struct timespec req = {0, static_cast<long>(ns)};
nanosleep(&req, NULL);
}
// record the time that this write() completed