diff options
author | Greg Hackmann <ghackmann@google.com> | 2014-02-13 20:52:18 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-02-13 20:52:18 +0000 |
commit | 178f0503d5c5a9025f19b11cc77cc362aaa79826 (patch) | |
tree | a6e38045fc904730cee616e4f97aab3ea9386d13 /modules | |
parent | d3dead483ca2ddb66fb5ef1ffd6cb3e85544366e (diff) | |
parent | f6d2142d93063a02b1eab75f8f46b172da772f6b (diff) | |
download | hardware_libhardware-178f0503d5c5a9025f19b11cc77cc362aaa79826.zip hardware_libhardware-178f0503d5c5a9025f19b11cc77cc362aaa79826.tar.gz hardware_libhardware-178f0503d5c5a9025f19b11cc77cc362aaa79826.tar.bz2 |
am f6d2142d: am f4c46752: Merge "AArch64: Calculate private_handle_t\'s numInts"
* commit 'f6d2142d93063a02b1eab75f8f46b172da772f6b':
AArch64: Calculate private_handle_t's numInts
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gralloc/gralloc_priv.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/gralloc/gralloc_priv.h b/modules/gralloc/gralloc_priv.h index 9f32d58..22a5715 100644 --- a/modules/gralloc/gralloc_priv.h +++ b/modules/gralloc/gralloc_priv.h @@ -79,7 +79,9 @@ struct private_handle_t { int pid; #ifdef __cplusplus - static const int sNumInts = 6; + static inline int sNumInts() { + return (((sizeof(private_handle_t) - sizeof(native_handle_t))/sizeof(int)) - sNumFds); + } static const int sNumFds = 1; static const int sMagic = 0x3141592; @@ -88,7 +90,7 @@ struct private_handle_t { base(0), pid(getpid()) { version = sizeof(native_handle); - numInts = sNumInts; + numInts = sNumInts(); numFds = sNumFds; } ~private_handle_t() { @@ -98,7 +100,7 @@ struct private_handle_t { static int validate(const native_handle* h) { const private_handle_t* hnd = (const private_handle_t*)h; if (!h || h->version != sizeof(native_handle) || - h->numInts != sNumInts || h->numFds != sNumFds || + h->numInts != sNumInts() || h->numFds != sNumFds || hnd->magic != sMagic) { ALOGE("invalid gralloc handle (at %p)", h); |