Fixed some errors in type.c. Now to see why uiControl is being registered twice...

This commit is contained in:
Pietro Gagliardi 2015-05-17 19:19:51 -04:00
parent 97cb70527e
commit 0019681b02
1 changed files with 6 additions and 4 deletions

View File

@ -28,7 +28,7 @@ uintmax_t uiRegisterType(const char *name, uintmax_t parent)
void *uiIsA(void *p, uintmax_t id, int fail)
{
uiTyped *t;
struct typeinfo *ti;
struct typeinfo *ti, *ti2;
uintmax_t compareTo;
if (id == 0 || id >= types->len)
@ -42,14 +42,16 @@ void *uiIsA(void *p, uintmax_t id, int fail)
complain("invalid type ID in uiIsA()", t);
if (compareTo == id)
return t;
ti = ptrArrayIndex(types, struct typeinfo *, t->Type);
ti = ptrArrayIndex(types, struct typeinfo *, compareTo);
printf("%d %d %d\n", (int)compareTo, (int)(ti->parent), (int)id);
if (ti->parent == 0)
break;
compareTo = ti->parent;
}
if (fail) {
ti = ptrArrayIndex(types, struct typeinfo *, t->Type);
complain("object %p not a %s in uiIsA()", t, ti->name);
ti = ptrArrayIndex(types, struct typeinfo *, id);
ti2 = ptrArrayIndex(types, struct typeinfo *, t->Type);
complain("object %p not a %s in uiIsA() (is a %s)", t, ti->name, ti2->name);
}
return NULL;
}