diff options
Diffstat (limited to 'libs/ui/Fence.cpp')
-rw-r--r-- | libs/ui/Fence.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libs/ui/Fence.cpp b/libs/ui/Fence.cpp index 3c0306c..bf24ffb 100644 --- a/libs/ui/Fence.cpp +++ b/libs/ui/Fence.cpp @@ -18,10 +18,13 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 - // This is needed for stdint.h to define INT64_MAX in C++ - #define __STDC_LIMIT_MACROS - +// We would eliminate the non-conforming zero-length array, but we can't since +// this is effectively included from the Linux kernel +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wzero-length-array" #include <sync/sync.h> +#pragma clang diagnostic pop + #include <ui/Fence.h> #include <unistd.h> #include <utils/Log.h> @@ -45,7 +48,7 @@ Fence::~Fence() { } } -status_t Fence::wait(unsigned int timeout) { +status_t Fence::wait(int timeout) { ATRACE_CALL(); if (mFenceFd == -1) { return NO_ERROR; @@ -59,7 +62,7 @@ status_t Fence::waitForever(const char* logname) { if (mFenceFd == -1) { return NO_ERROR; } - unsigned int warningTimeout = 3000; + int warningTimeout = 3000; int err = sync_wait(mFenceFd, warningTimeout); if (err < 0 && errno == ETIME) { ALOGE("%s: fence %d didn't signal in %u ms", logname, mFenceFd, @@ -127,7 +130,7 @@ nsecs_t Fence::getSignalTime() const { } size_t Fence::getFlattenedSize() const { - return 1; + return 4; } size_t Fence::getFdCount() const { @@ -138,7 +141,9 @@ status_t Fence::flatten(void*& buffer, size_t& size, int*& fds, size_t& count) c if (size < getFlattenedSize() || count < getFdCount()) { return NO_MEMORY; } - FlattenableUtils::write(buffer, size, (uint32_t)getFdCount()); + // Cast to uint32_t since the size of a size_t can vary between 32- and + // 64-bit processes + FlattenableUtils::write(buffer, size, static_cast<uint32_t>(getFdCount())); if (isValid()) { *fds++ = mFenceFd; count--; |