From 0e6c737626f920178102c730235615407d3fdaab Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Sep 2014 22:11:47 +0200 Subject: [PATCH] idnode: Fix sorting for bool and time types --- src/idnode.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/idnode.c b/src/idnode.c index f22c5f1a..a2e065d7 100644 --- a/src/idnode.c +++ b/src/idnode.c @@ -424,8 +424,11 @@ idnode_get_bool const property_t *p = idnode_find_prop(self, key); if (p->islist) return 1; if (p) { - void *ptr = self; - ptr += p->off; + const void *ptr; + if (p->get) + ptr = p->get(self); + else + ptr = ((void*)self) + p->off; switch (p->type) { case PT_BOOL: *b = *(int*)ptr; @@ -447,8 +450,11 @@ idnode_get_time const property_t *p = idnode_find_prop(self, key); if (p->islist) return 1; if (p) { - void *ptr = self; - ptr += p->off; + const void *ptr; + if (p->get) + ptr = p->get(self); + else + ptr = ((void*)self) + p->off; switch (p->type) { case PT_TIME: *tm = *(time_t*)ptr;