summaryrefslogtreecommitdiffstats
path: root/modules/gralloc/gralloc_priv.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gralloc/gralloc_priv.h')
-rw-r--r--modules/gralloc/gralloc_priv.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/gralloc/gralloc_priv.h b/modules/gralloc/gralloc_priv.h
index 86a5d52..22a5715 100644
--- a/modules/gralloc/gralloc_priv.h
+++ b/modules/gralloc/gralloc_priv.h
@@ -75,11 +75,13 @@ struct private_handle_t {
int offset;
// FIXME: the attributes below should be out-of-line
- int base;
+ uintptr_t base;
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);