Added function names to the wrong struct size error.
This commit is contained in:
parent
9e05efa091
commit
e808d85e01
|
@ -53,7 +53,7 @@ uint32_t uiRegisterControlType(const char *name, uiControlVtable *vtable, uiCont
|
|||
return 0;
|
||||
}
|
||||
if (vtable->Size != sizeof (uiControlVtable)) {
|
||||
uiprivProgrammerErrorWrongStructSize(vtable->Size, "uiControlVtable");
|
||||
uiprivProgrammerErrorWrongStructSize(vtable->Size, "uiControlVtable", uiprivFunc);
|
||||
return 0;
|
||||
}
|
||||
#define checkMethod(method) \
|
||||
|
|
|
@ -49,7 +49,7 @@ uiEvent *uiNewEvent(const uiEventOptions *options)
|
|||
return NULL;
|
||||
}
|
||||
if (options->Size != sizeof (uiEventOptions)) {
|
||||
uiprivProgrammerErrorWrongStructSize(options->Size, "uiEventOptions");
|
||||
uiprivProgrammerErrorWrongStructSize(options->Size, "uiEventOptions", uiprivFunc);
|
||||
return NULL;
|
||||
}
|
||||
e = (uiEvent *) uiprivAlloc(sizeof (uiEvent), "uiEvent");
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
uiprivProgrammerError("attempt to call %s() on a thread other than the GUI thread", \
|
||||
func)
|
||||
|
||||
#define uiprivProgrammerErrorWrongStructSize(badSize, structName) \
|
||||
uiprivProgrammerError("wrong size %" uiprivSizetPrintf " for %s", \
|
||||
badSize, structName)
|
||||
#define uiprivProgrammerErrorWrongStructSize(badSize, structName, func) \
|
||||
uiprivProgrammerError("wrong size %" uiprivSizetPrintf " for %s in %s()", \
|
||||
badSize, structName, func)
|
||||
|
||||
#define uiprivProgrammerErrorIndexOutOfRange(badIndex, func) \
|
||||
uiprivProgrammerError("index %d out of range in %s()", \
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// 8 june 2019
|
||||
#include "test.h"
|
||||
|
||||
#if 0
|
||||
|
||||
struct testOSVtable {
|
||||
void (*TestMethod)(uiControl *c, void *implData);
|
||||
};
|
||||
|
@ -52,7 +54,7 @@ testingTest(ControlErrors)
|
|||
memset(&vtableBadSize, 0, sizeof (uiEventOptions));
|
||||
vtableBadSize.Size = 1;
|
||||
testProgrammerError(t, uiRegisterControlType("name", &badVtableSize, &osVtablePlaceholder, sizeof (struct testImplData)),
|
||||
"wrong size 1 for uiControlVtable");
|
||||
"wrong size 1 for uiControlVtable in uiRegisterControlType()");
|
||||
#define testBadMethod(method) { \
|
||||
uiControlVtable bad ## method ## MethodVtable; \
|
||||
bad ## method ## MethodVtable = vtablePlaceholder; \
|
||||
|
@ -64,3 +66,5 @@ testingTest(ControlErrors)
|
|||
"invalid null pointer for uiControlOSVtable passed into uiRegisterControlType()");
|
||||
// OS vtable sizes are tested per-OS
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -974,7 +974,7 @@ testingTest(EventErrors)
|
|||
memset(&eventOptionsBadSize, 0, sizeof (uiEventOptions));
|
||||
eventOptionsBadSize.Size = 1;
|
||||
testProgrammerError(t, uiNewEvent(&eventOptionsBadSize),
|
||||
"wrong size 1 for uiEventOptions");
|
||||
"wrong size 1 for uiEventOptions in uiNewEvent()");
|
||||
|
||||
memset(&opts, 0, sizeof (uiEventOptions));
|
||||
opts.Size = sizeof (uiEventOptions);
|
||||
|
|
Loading…
Reference in New Issue