mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-06 06:22:33 +00:00
Add XPT_InterfaceDescriptorAddConsts to API.
This commit is contained in:
parent
87bb504802
commit
c31d863018
@ -175,6 +175,9 @@ XPT_NewInterfaceDescriptor(uint32 parent_interface, uint32 num_methods,
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_InterfaceDescriptorAddMethods(XPTInterfaceDescriptor *id, uint16 num);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_InterfaceDescriptorAddConsts(XPTInterfaceDescriptor *id, uint16 num);
|
||||
|
||||
/*
|
||||
* This is our special string struct with a length value associated with it,
|
||||
* which means that it can contains embedded NULs.
|
||||
|
@ -322,6 +322,23 @@ XPT_InterfaceDescriptorAddMethods(XPTInterfaceDescriptor *id, uint16 num)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_InterfaceDescriptorAddConsts(XPTInterfaceDescriptor *id, uint16 num)
|
||||
{
|
||||
XPTConstDescriptor *old = id->const_descriptors, *new;
|
||||
|
||||
/* XXX should grow in chunks to minimize realloc overhead */
|
||||
new = PR_REALLOC(old,
|
||||
(id->num_constants + num) * sizeof(XPTConstDescriptor));
|
||||
if (!new)
|
||||
return PR_FALSE;
|
||||
|
||||
memset(new + id->num_constants, 0, sizeof(XPTConstDescriptor) * num);
|
||||
id->const_descriptors = new;
|
||||
id->num_constants += num;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfTypeDescriptor(XPTTypeDescriptor *td)
|
||||
{
|
||||
@ -364,6 +381,7 @@ XPT_SizeOfConstDescriptor(XPTConstDescriptor *cd)
|
||||
case TD_INT32:
|
||||
case TD_UINT32:
|
||||
case TD_PBSTR: /* XXX check for pointer! */
|
||||
case TD_PSTRING:
|
||||
size += 4;
|
||||
break;
|
||||
case TD_INT64:
|
||||
|
@ -175,6 +175,9 @@ XPT_NewInterfaceDescriptor(uint32 parent_interface, uint32 num_methods,
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_InterfaceDescriptorAddMethods(XPTInterfaceDescriptor *id, uint16 num);
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
XPT_InterfaceDescriptorAddConsts(XPTInterfaceDescriptor *id, uint16 num);
|
||||
|
||||
/*
|
||||
* This is our special string struct with a length value associated with it,
|
||||
* which means that it can contains embedded NULs.
|
||||
|
@ -322,6 +322,23 @@ XPT_InterfaceDescriptorAddMethods(XPTInterfaceDescriptor *id, uint16 num)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(PRBool)
|
||||
XPT_InterfaceDescriptorAddConsts(XPTInterfaceDescriptor *id, uint16 num)
|
||||
{
|
||||
XPTConstDescriptor *old = id->const_descriptors, *new;
|
||||
|
||||
/* XXX should grow in chunks to minimize realloc overhead */
|
||||
new = PR_REALLOC(old,
|
||||
(id->num_constants + num) * sizeof(XPTConstDescriptor));
|
||||
if (!new)
|
||||
return PR_FALSE;
|
||||
|
||||
memset(new + id->num_constants, 0, sizeof(XPTConstDescriptor) * num);
|
||||
id->const_descriptors = new;
|
||||
id->num_constants += num;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
XPT_PUBLIC_API(uint32)
|
||||
XPT_SizeOfTypeDescriptor(XPTTypeDescriptor *td)
|
||||
{
|
||||
@ -364,6 +381,7 @@ XPT_SizeOfConstDescriptor(XPTConstDescriptor *cd)
|
||||
case TD_INT32:
|
||||
case TD_UINT32:
|
||||
case TD_PBSTR: /* XXX check for pointer! */
|
||||
case TD_PSTRING:
|
||||
size += 4;
|
||||
break;
|
||||
case TD_INT64:
|
||||
|
Loading…
x
Reference in New Issue
Block a user