diff --git a/common/controls.c b/common/controls.c index 4b4384a8..a52a7584 100644 --- a/common/controls.c +++ b/common/controls.c @@ -42,7 +42,7 @@ uint32_t uiControlType(void) static uint32_t nextControlID = UINT32_C(0x80000000); -uint32_t uiRegisterControlType(const char *name, uiControlVtable *vtable, uiControlOSVtable *osVtable, size_t implDataSize) +uint32_t uiRegisterControlType(const char *name, const uiControlVtable *vtable, const uiControlOSVtable *osVtable, size_t implDataSize) { struct controlType *ct; diff --git a/common/uipriv.h b/common/uipriv.h index 89888cae..bd84dd22 100644 --- a/common/uipriv.h +++ b/common/uipriv.h @@ -70,8 +70,8 @@ uiprivPrintfFunc( extern void uiprivReportError(const char *prefix, const char *msg, const char *suffix, bool internal); // controls.c -extern bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func); -extern uiControlOSVtable *uiprivCloneOSVtable(uiControlOSVtable *osVtable); +extern bool uiprivOSVtableValid(const uiControlOSVtable *osVtable, const char *func); +extern uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable); #ifdef __cplusplus } diff --git a/darwin/control.m b/darwin/control.m index 51724e14..0122a26f 100644 --- a/darwin/control.m +++ b/darwin/control.m @@ -1,7 +1,7 @@ // 8 june 2019 #import "uipriv_darwin.h" -bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func) +bool uiprivOSVtableValid(const uiControlOSVtable *osVtable, const char *func) { if (osVtable->Size != sizeof (uiControlOSVtable)) { uiprivProgrammerErrorWrongStructSize(osVtable->Size, "uiControlOSVtable", func); @@ -10,7 +10,7 @@ bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func) return true; } -uiControlOSVtable *uiprivCloneOSVtable(uiControlOSVtable *osVtable) +uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable) { uiControlOSVtable *v2; diff --git a/test/controls.c b/test/controls.c index b94f07c4..9d359887 100644 --- a/test/controls.c +++ b/test/controls.c @@ -17,8 +17,8 @@ static void testVtableFree(uiControl *c, void *implData) // do nothing } -const uiControlVtable dummyVtable = { - Size: sizeof (uiControlVtable), - Init: testVtableInit, - Free: testVtableFree, +const uiControlVtable testVtable = { + .Size = sizeof (uiControlVtable), + .Init = testVtableInit, + .Free = testVtableFree, }; diff --git a/test/controls_errors.cpp b/test/controls_errors.cpp index 4b5930da..41e866f6 100644 --- a/test/controls_errors.cpp +++ b/test/controls_errors.cpp @@ -23,7 +23,7 @@ static const struct checkErrorCase cases[] = { memset(&vtable, 0, sizeof (uiControlVtable)); vtable.Size = 1; - uiRegisterControlSize("name", &vtable, NULL, 0); + uiRegisterControlType("name", &vtable, NULL, 0); }, "uiRegisterControlType(): wrong size 1 for uiControlVtable", }, diff --git a/ui.h b/ui.h index 7ba942ba..4a0524b1 100644 --- a/ui.h +++ b/ui.h @@ -75,7 +75,7 @@ struct uiControlVtable { void (*Free)(uiControl *c, void *implData); }; -uiprivExtern uint32_t uiRegisterControlType(const char *nane, uiControlVtable *vtable, uiControlOSVtable *osVtable, size_t implDataSize); +uiprivExtern uint32_t uiRegisterControlType(const char *nane, const uiControlVtable *vtable, const uiControlOSVtable *osVtable, size_t implDataSize); uiprivExtern void *uiCheckControlType(void *c, uint32_t type); uiprivExtern uiControl *uiNewControl(uint32_t type, void *initData);