And fixed const issues and other build errors.

This commit is contained in:
Pietro Gagliardi 2019-06-15 20:48:20 -04:00
parent ad209175c1
commit b6a8d24c3e
6 changed files with 11 additions and 11 deletions

View File

@ -42,7 +42,7 @@ uint32_t uiControlType(void)
static uint32_t nextControlID = UINT32_C(0x80000000); 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; struct controlType *ct;

View File

@ -70,8 +70,8 @@ uiprivPrintfFunc(
extern void uiprivReportError(const char *prefix, const char *msg, const char *suffix, bool internal); extern void uiprivReportError(const char *prefix, const char *msg, const char *suffix, bool internal);
// controls.c // controls.c
extern bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func); extern bool uiprivOSVtableValid(const uiControlOSVtable *osVtable, const char *func);
extern uiControlOSVtable *uiprivCloneOSVtable(uiControlOSVtable *osVtable); extern uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,7 +1,7 @@
// 8 june 2019 // 8 june 2019
#import "uipriv_darwin.h" #import "uipriv_darwin.h"
bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func) bool uiprivOSVtableValid(const uiControlOSVtable *osVtable, const char *func)
{ {
if (osVtable->Size != sizeof (uiControlOSVtable)) { if (osVtable->Size != sizeof (uiControlOSVtable)) {
uiprivProgrammerErrorWrongStructSize(osVtable->Size, "uiControlOSVtable", func); uiprivProgrammerErrorWrongStructSize(osVtable->Size, "uiControlOSVtable", func);
@ -10,7 +10,7 @@ bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func)
return true; return true;
} }
uiControlOSVtable *uiprivCloneOSVtable(uiControlOSVtable *osVtable) uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable)
{ {
uiControlOSVtable *v2; uiControlOSVtable *v2;

View File

@ -17,8 +17,8 @@ static void testVtableFree(uiControl *c, void *implData)
// do nothing // do nothing
} }
const uiControlVtable dummyVtable = { const uiControlVtable testVtable = {
Size: sizeof (uiControlVtable), .Size = sizeof (uiControlVtable),
Init: testVtableInit, .Init = testVtableInit,
Free: testVtableFree, .Free = testVtableFree,
}; };

View File

@ -23,7 +23,7 @@ static const struct checkErrorCase cases[] = {
memset(&vtable, 0, sizeof (uiControlVtable)); memset(&vtable, 0, sizeof (uiControlVtable));
vtable.Size = 1; vtable.Size = 1;
uiRegisterControlSize("name", &vtable, NULL, 0); uiRegisterControlType("name", &vtable, NULL, 0);
}, },
"uiRegisterControlType(): wrong size 1 for uiControlVtable", "uiRegisterControlType(): wrong size 1 for uiControlVtable",
}, },

2
ui.h
View File

@ -75,7 +75,7 @@ struct uiControlVtable {
void (*Free)(uiControl *c, void *implData); 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 void *uiCheckControlType(void *c, uint32_t type);
uiprivExtern uiControl *uiNewControl(uint32_t type, void *initData); uiprivExtern uiControl *uiNewControl(uint32_t type, void *initData);