mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
NOT YET PART OF SEAMONKEY:
* modified in-memory structs slightly to get them to compile * xpt_strcut.c now compiles, and with no warnings (at no extra charge) * still must do offset management
This commit is contained in:
parent
48365eb8a1
commit
5fc06bfca5
@ -143,7 +143,7 @@ struct XPTTypeDescriptorPrefix {
|
|||||||
#define XPT_TDP_SIZE 1
|
#define XPT_TDP_SIZE 1
|
||||||
|
|
||||||
struct XPTTypeDescriptor {
|
struct XPTTypeDescriptor {
|
||||||
XPTTypeDescriptorPrefix prefix;
|
XPTTypeDescriptorPrefix *prefix;
|
||||||
union {
|
union {
|
||||||
XPTInterfaceDirectoryEntry *interface;
|
XPTInterfaceDirectoryEntry *interface;
|
||||||
uint8 argnum;
|
uint8 argnum;
|
||||||
@ -160,7 +160,7 @@ struct XPTTypeDescriptor {
|
|||||||
*
|
*
|
||||||
* int8, uint8, int16, uint16, int32, uint32,
|
* int8, uint8, int16, uint16, int32, uint32,
|
||||||
* int64, uint64, wchar_t, char, string
|
* int64, uint64, wchar_t, char, string
|
||||||
* XPT_HEADER_SIZE
|
*
|
||||||
* The type (and thus the size) of the value record is determined by the
|
* The type (and thus the size) of the value record is determined by the
|
||||||
* contents of the associated TypeDescriptor record. For instance, if type
|
* contents of the associated TypeDescriptor record. For instance, if type
|
||||||
* corresponds to int16, then value is a two-byte record consisting of a
|
* corresponds to int16, then value is a two-byte record consisting of a
|
||||||
@ -238,13 +238,13 @@ struct XPTAnnotationPrefix {
|
|||||||
#define XPT_AP_SIZE 1
|
#define XPT_AP_SIZE 1
|
||||||
|
|
||||||
struct XPTPrivateAnnotation {
|
struct XPTPrivateAnnotation {
|
||||||
XPTString creator;
|
XPTString *creator;
|
||||||
XPTString private_data;
|
XPTString *private_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XPTAnnotation {
|
struct XPTAnnotation {
|
||||||
XPTAnnotationPrefix prefix;
|
XPTAnnotationPrefix *prefix;
|
||||||
XPTPrivateAnnotation private;
|
XPTPrivateAnnotation *private;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __xpt_struct_h__ */
|
#endif /* __xpt_struct_h__ */
|
||||||
|
@ -29,6 +29,7 @@ XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
|||||||
XPTHeader *header;
|
XPTHeader *header;
|
||||||
uint16 annotation_size;
|
uint16 annotation_size;
|
||||||
uint16 xpt_header_size;
|
uint16 xpt_header_size;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (mode == XPT_DECODE) {
|
if (mode == XPT_DECODE) {
|
||||||
if (!(*headerp = header = PR_NEWZAP(XPTHeader)))
|
if (!(*headerp = header = PR_NEWZAP(XPTHeader)))
|
||||||
@ -38,8 +39,8 @@ XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mode == XPT_ENCODE) {
|
if (mode == XPT_ENCODE) {
|
||||||
if !(annotation_size = XPT_GetAnnotationSize(&my_cursor,
|
if (!(annotation_size = XPT_GetAnnotationSize(&my_cursor,
|
||||||
&header->annotations)) {
|
&header->annotations))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
xpt_header_size = XPT_HEADER_BASE_SIZE + annotation_size;
|
xpt_header_size = XPT_HEADER_BASE_SIZE + annotation_size;
|
||||||
@ -48,12 +49,12 @@ XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
|||||||
xpt_header_size = XPT_HEADER_BASE_SIZE;
|
xpt_header_size = XPT_HEADER_BASE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!XPT_CreateCursor(cursor->state, XPT_HEADER, xpt_header_size,
|
if (!XPT_CreateCursor(cursor, XPT_HEADER, xpt_header_size,
|
||||||
&my_cursor)) {
|
&my_cursor)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0, i<16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
if (!XPT_Do8(&my_cursor, &header->magic[i]))
|
if (!XPT_Do8(&my_cursor, &header->magic[i]))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -64,7 +65,7 @@ XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
|||||||
!XPT_Do32(&my_cursor, &header->file_length) ||
|
!XPT_Do32(&my_cursor, &header->file_length) ||
|
||||||
!XPT_DoInterfaceDirectoryEntry(&my_cursor,
|
!XPT_DoInterfaceDirectoryEntry(&my_cursor,
|
||||||
&header->interface_directory) ||
|
&header->interface_directory) ||
|
||||||
!XPT_Do8(&my_cursor, &header->data_pool) ||
|
!XPT_Do8(&my_cursor, header->data_pool) ||
|
||||||
!XPT_DoAnnotation(&my_cursor, &header->annotations)) {
|
!XPT_DoAnnotation(&my_cursor, &header->annotations)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
@ -115,14 +116,14 @@ XPT_DoInterfaceDirectoryEntry(XPTCursor *cursor,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (mode == XPT_DECODE) {
|
if (mode == XPT_DECODE) {
|
||||||
if !((*idep = ide = PR_NEWZAP(XPTInterfaceDirectoryEntry)))
|
if (!(*idep = ide = PR_NEWZAP(XPTInterfaceDirectoryEntry)))
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
ide = *idep;
|
ide = *idep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a cursor, reserving XPT_IDE_SIZE bytes in the encode case */
|
/* create a cursor, reserving XPT_IDE_SIZE bytes in the encode case */
|
||||||
if (!XPT_CreateCursor(cursor->state, XPT_HEADER, XPT_IDE_SIZE,
|
if (!XPT_CreateCursor(cursor, XPT_HEADER, XPT_IDE_SIZE,
|
||||||
&my_cursor) ||
|
&my_cursor) ||
|
||||||
|
|
||||||
/* write the IID in our cursor space */
|
/* write the IID in our cursor space */
|
||||||
@ -157,15 +158,17 @@ PRBool
|
|||||||
XPT_DoInterfaceDescriptor(XPTCursor *cursor, XPTInterfaceDescriptor **idp)
|
XPT_DoInterfaceDescriptor(XPTCursor *cursor, XPTInterfaceDescriptor **idp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTInterfaceDescriptor id;
|
XPTInterfaceDescriptor *id;
|
||||||
XPTCursor my_cursor;
|
XPTCursor my_cursor;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
id = PR_NEWZAP(XPTInterfaceDescriptor);
|
id = PR_NEWZAP(XPTInterfaceDescriptor);
|
||||||
else
|
else
|
||||||
id = *idp;
|
id = *idp;
|
||||||
|
|
||||||
if(!XPT_CreateCursor(cursor->state, XPT_DATA, XPT_ID_SIZE, &my_cursor) ||
|
if(!XPT_CreateCursor(cursor, XPT_DATA, XPT_ID_BASE_SIZE,
|
||||||
|
&my_cursor) ||
|
||||||
!XPT_DoInterfaceDirectoryEntry(&my_cursor, &id->parent_interface) ||
|
!XPT_DoInterfaceDirectoryEntry(&my_cursor, &id->parent_interface) ||
|
||||||
!XPT_Do16(&my_cursor, &id->num_methods)) {
|
!XPT_Do16(&my_cursor, &id->num_methods)) {
|
||||||
|
|
||||||
@ -182,7 +185,7 @@ XPT_DoInterfaceDescriptor(XPTCursor *cursor, XPTInterfaceDescriptor **idp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < id->num_constants; i++) {
|
for (i = 0; i < id->num_constants; i++) {
|
||||||
if (!XPT_DoConstDescriptor(&my_cursor, &id->constant_descriptors[i])) {
|
if (!XPT_DoConstDescriptor(&my_cursor, &id->const_descriptors[i])) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,7 +204,7 @@ PRBool
|
|||||||
XPT_DoConstDescriptor(XPTCursor *cursor, XPTConstDescriptor **cdp)
|
XPT_DoConstDescriptor(XPTCursor *cursor, XPTConstDescriptor **cdp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTConstDescriptor cd;
|
XPTConstDescriptor *cd;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
cd = PR_NEWZAP(XPTConstDescriptor);
|
cd = PR_NEWZAP(XPTConstDescriptor);
|
||||||
@ -214,40 +217,40 @@ XPT_DoConstDescriptor(XPTCursor *cursor, XPTConstDescriptor **cdp)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(cd->type->prefix->tag) {
|
switch(cd->type.prefix->tag) {
|
||||||
case '0':
|
case '0':
|
||||||
XPT_Do8(&cursor, &cd->value->i8);
|
XPT_Do8(cursor, &cd->value.i8);
|
||||||
break;
|
break;
|
||||||
case '1':
|
case 1:
|
||||||
XPT_Do16(&cursor, &cd->value->i16);
|
XPT_Do16(cursor, &cd->value.i16);
|
||||||
break;
|
break;
|
||||||
case '2':
|
case 2:
|
||||||
XPT_Do32(&cursor, &cd->value->i32);
|
XPT_Do32(cursor, &cd->value.i32);
|
||||||
break;
|
break;
|
||||||
case '3':
|
case 3:
|
||||||
XPT_Do64(&cursor, &cd->value->i64);
|
XPT_Do64(cursor, &cd->value.i64);
|
||||||
break;
|
break;
|
||||||
case '4':
|
case 4:
|
||||||
XPT_Do8(&cursor, &cd->value->ui8);
|
XPT_Do8(cursor, &cd->value.ui8);
|
||||||
break;
|
break;
|
||||||
case '5':
|
case 5:
|
||||||
XPT_Do16(&cursor, &cd->value->ui16);
|
XPT_Do16(cursor, &cd->value.ui16);
|
||||||
break;
|
break;
|
||||||
case '6':
|
case 6:
|
||||||
XPT_Do32(&cursor, &cd->value->ui32);
|
XPT_Do32(cursor, &cd->value.ui32);
|
||||||
break;
|
break;
|
||||||
case '7':
|
case 7:
|
||||||
XPT_Do64(&cursor, &cd->value->ui64);
|
XPT_Do64(cursor, &cd->value.ui64);
|
||||||
break;
|
break;
|
||||||
case '11':
|
case 11:
|
||||||
XPT_Do8(&cursor, &cd->value->ch);
|
XPT_Do8(cursor, &cd->value.ch);
|
||||||
break;
|
break;
|
||||||
case '12':
|
case 12:
|
||||||
XPT_Do16(&cursor, &cd->value->wch);
|
XPT_Do16(cursor, &cd->value.wch);
|
||||||
break;
|
break;
|
||||||
case '15':
|
case 15:
|
||||||
if (cd->type->prefix->is_pointer == 1) {
|
if (cd->type.prefix->is_pointer == 1) {
|
||||||
XPT_DoString(&cursor, &cd->value->string);
|
XPT_DoString(cursor, &cd->value.string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
@ -269,7 +272,7 @@ PRBool
|
|||||||
XPT_DoMethodDescriptor(XPTCursor *cursor, XPTMethodDescriptor **mdp)
|
XPT_DoMethodDescriptor(XPTCursor *cursor, XPTMethodDescriptor **mdp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTConstDescriptor md;
|
XPTMethodDescriptor *md;
|
||||||
uintn scratch;
|
uintn scratch;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
@ -277,14 +280,14 @@ XPT_DoMethodDescriptor(XPTCursor *cursor, XPTMethodDescriptor **mdp)
|
|||||||
else
|
else
|
||||||
md = *mdp;
|
md = *mdp;
|
||||||
|
|
||||||
if (!XPT_DO_BITS(&cursor, &md->is_getter, 1, scratch) ||
|
if (!XPT_DO_BITS(&cursor, md->is_getter, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->is_setter, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, md->is_setter, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->is_varargs, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, md->is_varargs, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->is_constructor, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, md->is_constructor, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->is_hidden, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, md->is_hidden, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->reserved, 3, scratch) ||
|
!XPT_DO_BITS(&cursor, md->reserved, 3, scratch) ||
|
||||||
!XPT_DoCString(&cursor, &md->name) ||
|
!XPT_DoCString(&cursor, &md->name) ||
|
||||||
!XPT_Do8(&cursor, &md->num_args) ||
|
!XPT_Do8(cursor, &md->num_args) ||
|
||||||
!XPT_DoParamDescriptor(&cursor, &md->params) ||
|
!XPT_DoParamDescriptor(&cursor, &md->params) ||
|
||||||
!XPT_DoParamDescriptor(&cursor, &md->result)) {
|
!XPT_DoParamDescriptor(&cursor, &md->result)) {
|
||||||
|
|
||||||
@ -305,7 +308,7 @@ PRBool
|
|||||||
XPT_DoParamDescriptor(XPTCursor *cursor, XPTParamDescriptor **pdp)
|
XPT_DoParamDescriptor(XPTCursor *cursor, XPTParamDescriptor **pdp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTParamDescriptor pd;
|
XPTParamDescriptor *pd;
|
||||||
uintn scratch;
|
uintn scratch;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
@ -313,10 +316,10 @@ XPT_DoParamDescriptor(XPTCursor *cursor, XPTParamDescriptor **pdp)
|
|||||||
else
|
else
|
||||||
pd = *pdp;
|
pd = *pdp;
|
||||||
|
|
||||||
if (!XPT_DO_BITS(&cursor, &pd->in, 1, scratch) ||
|
if (!XPT_DO_BITS(&cursor, pd->in, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &pd->out, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, pd->out, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &pd->retval, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, pd->retval, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &pd->reserved, 5, scratch) ||
|
!XPT_DO_BITS(&cursor, pd->reserved, 5, scratch) ||
|
||||||
!XPT_DoTypeDescriptor(&cursor, &pd->type)) {
|
!XPT_DoTypeDescriptor(&cursor, &pd->type)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
@ -336,7 +339,7 @@ PRBool
|
|||||||
XPT_DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix **tdpp)
|
XPT_DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix **tdpp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTTypeDescriptorPrefix tdp;
|
XPTTypeDescriptorPrefix *tdp;
|
||||||
uintn scratch;
|
uintn scratch;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
@ -344,10 +347,10 @@ XPT_DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix **tdpp)
|
|||||||
else
|
else
|
||||||
tdp = *tdpp;
|
tdp = *tdpp;
|
||||||
|
|
||||||
if (!XPT_DO_BITS(&cursor, &tdp->is_pointer, 1, scratch) ||
|
if (!XPT_DO_BITS(&cursor, tdp->is_pointer, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &tdp->is_unique_pointer, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, tdp->is_unique_pointer, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &tdp->is_reference, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, tdp->is_reference, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &tdp->tag, 5, scratch)) {
|
!XPT_DO_BITS(&cursor, tdp->tag, 5, scratch)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -363,26 +366,26 @@ XPT_DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix **tdpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_DoTypeDescriptor(XPTCursor *cursor, XPTSimpleTypeDescriptor **tdp)
|
XPT_DoTypeDescriptor(XPTCursor *cursor, XPTTypeDescriptor **tdp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTSimpleTypeDescriptor td;
|
XPTTypeDescriptor *td;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
td = PR_NEWZAP(XPTTypeDescriptor);
|
td = PR_NEWZAP(XPTTypeDescriptor);
|
||||||
else
|
else
|
||||||
td = *tdp;
|
td = *tdp;
|
||||||
|
|
||||||
if (!XPT_DoTypeDescriptorPrefix(&cursor, &td->prefix)) {
|
if (!XPT_DoTypeDescriptorPrefix(cursor, &td->prefix)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (td->prefix->tag == TD_INTERFACE_TYPE) {
|
if (td->prefix->tag == TD_INTERFACE_TYPE) {
|
||||||
if (!XPT_DoInterfaceDirectoryEntry(&cursor, &td->type->interface))
|
if (!XPT_DoInterfaceDirectoryEntry(cursor, &td->type.interface))
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
if (td->prefix->tag == TD_INTERFACE_IS_TYPE) {
|
if (td->prefix->tag == TD_INTERFACE_IS_TYPE) {
|
||||||
if (!XPT_Do8(&cursor, &td->type->argnum))
|
if (!XPT_Do8(cursor, &td->type.argnum))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,7 +404,7 @@ PRBool
|
|||||||
XPT_DoAnnotationPrefix(XPTCursor *cursor, XPTAnnotationPrefix **app)
|
XPT_DoAnnotationPrefix(XPTCursor *cursor, XPTAnnotationPrefix **app)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTAnnotationPrefix ap;
|
XPTAnnotationPrefix *ap;
|
||||||
uintn scratch;
|
uintn scratch;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
@ -409,8 +412,8 @@ XPT_DoAnnotationPrefix(XPTCursor *cursor, XPTAnnotationPrefix **app)
|
|||||||
else
|
else
|
||||||
ap = *app;
|
ap = *app;
|
||||||
|
|
||||||
if (!XPT_DO_BITS(&cursor, &ap->is_last, 1, scratch) ||
|
if (!XPT_DO_BITS(&cursor, ap->is_last, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &ap->tag, 7, scratch)) {
|
!XPT_DO_BITS(&cursor, ap->tag, 7, scratch)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -429,15 +432,15 @@ PRBool
|
|||||||
XPT_DoPrivateAnnotation(XPTCursor *cursor, XPTPrivateAnnotation **pap)
|
XPT_DoPrivateAnnotation(XPTCursor *cursor, XPTPrivateAnnotation **pap)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTPrivateAnnotation pa;
|
XPTPrivateAnnotation *pa;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
pa = PR_NEWZAP(XPTPrivateAnnotation);
|
pa = PR_NEWZAP(XPTPrivateAnnotation);
|
||||||
else
|
else
|
||||||
pa = *pap;
|
pa = *pap;
|
||||||
|
|
||||||
if (!XPT_DoString(&cursor, &pa->creator) ||
|
if (!XPT_DoString(cursor, &pa->creator) ||
|
||||||
!XPT_DoString(&cursor, &pa->private_data)) {
|
!XPT_DoString(cursor, &pa->private_data)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -456,19 +459,19 @@ PRBool
|
|||||||
XPT_DoAnnotation(XPTCursor *cursor, XPTAnnotation **ap)
|
XPT_DoAnnotation(XPTCursor *cursor, XPTAnnotation **ap)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTAnnotation a;
|
XPTAnnotation *a;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
a = PR_NEWZAP(XPTPrivateAnnotation);
|
a = PR_NEWZAP(XPTAnnotation);
|
||||||
else
|
else
|
||||||
a = *ap;
|
a = *ap;
|
||||||
|
|
||||||
if (!XPT_DoAnnotationPrefix(&cursor, &a->prefix)) {
|
if (!XPT_DoAnnotationPrefix(cursor, &a->prefix)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->prefix->tag == PRIVATE_ANNOTATION) {
|
if (a->prefix->tag == PRIVATE_ANNOTATION) {
|
||||||
if (!XPT_DoPrivateAnnotation(&cursor, &a->private)) {
|
if (!XPT_DoPrivateAnnotation(cursor, &a->private)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ struct XPTTypeDescriptorPrefix {
|
|||||||
#define XPT_TDP_SIZE 1
|
#define XPT_TDP_SIZE 1
|
||||||
|
|
||||||
struct XPTTypeDescriptor {
|
struct XPTTypeDescriptor {
|
||||||
XPTTypeDescriptorPrefix prefix;
|
XPTTypeDescriptorPrefix *prefix;
|
||||||
union {
|
union {
|
||||||
XPTInterfaceDirectoryEntry *interface;
|
XPTInterfaceDirectoryEntry *interface;
|
||||||
uint8 argnum;
|
uint8 argnum;
|
||||||
@ -160,7 +160,7 @@ struct XPTTypeDescriptor {
|
|||||||
*
|
*
|
||||||
* int8, uint8, int16, uint16, int32, uint32,
|
* int8, uint8, int16, uint16, int32, uint32,
|
||||||
* int64, uint64, wchar_t, char, string
|
* int64, uint64, wchar_t, char, string
|
||||||
* XPT_HEADER_SIZE
|
*
|
||||||
* The type (and thus the size) of the value record is determined by the
|
* The type (and thus the size) of the value record is determined by the
|
||||||
* contents of the associated TypeDescriptor record. For instance, if type
|
* contents of the associated TypeDescriptor record. For instance, if type
|
||||||
* corresponds to int16, then value is a two-byte record consisting of a
|
* corresponds to int16, then value is a two-byte record consisting of a
|
||||||
@ -238,13 +238,13 @@ struct XPTAnnotationPrefix {
|
|||||||
#define XPT_AP_SIZE 1
|
#define XPT_AP_SIZE 1
|
||||||
|
|
||||||
struct XPTPrivateAnnotation {
|
struct XPTPrivateAnnotation {
|
||||||
XPTString creator;
|
XPTString *creator;
|
||||||
XPTString private_data;
|
XPTString *private_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XPTAnnotation {
|
struct XPTAnnotation {
|
||||||
XPTAnnotationPrefix prefix;
|
XPTAnnotationPrefix *prefix;
|
||||||
XPTPrivateAnnotation private;
|
XPTPrivateAnnotation *private;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __xpt_struct_h__ */
|
#endif /* __xpt_struct_h__ */
|
||||||
|
@ -29,6 +29,7 @@ XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
|||||||
XPTHeader *header;
|
XPTHeader *header;
|
||||||
uint16 annotation_size;
|
uint16 annotation_size;
|
||||||
uint16 xpt_header_size;
|
uint16 xpt_header_size;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (mode == XPT_DECODE) {
|
if (mode == XPT_DECODE) {
|
||||||
if (!(*headerp = header = PR_NEWZAP(XPTHeader)))
|
if (!(*headerp = header = PR_NEWZAP(XPTHeader)))
|
||||||
@ -38,8 +39,8 @@ XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mode == XPT_ENCODE) {
|
if (mode == XPT_ENCODE) {
|
||||||
if !(annotation_size = XPT_GetAnnotationSize(&my_cursor,
|
if (!(annotation_size = XPT_GetAnnotationSize(&my_cursor,
|
||||||
&header->annotations)) {
|
&header->annotations))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
xpt_header_size = XPT_HEADER_BASE_SIZE + annotation_size;
|
xpt_header_size = XPT_HEADER_BASE_SIZE + annotation_size;
|
||||||
@ -48,12 +49,12 @@ XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
|||||||
xpt_header_size = XPT_HEADER_BASE_SIZE;
|
xpt_header_size = XPT_HEADER_BASE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!XPT_CreateCursor(cursor->state, XPT_HEADER, xpt_header_size,
|
if (!XPT_CreateCursor(cursor, XPT_HEADER, xpt_header_size,
|
||||||
&my_cursor)) {
|
&my_cursor)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0, i<16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
if (!XPT_Do8(&my_cursor, &header->magic[i]))
|
if (!XPT_Do8(&my_cursor, &header->magic[i]))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -64,7 +65,7 @@ XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp)
|
|||||||
!XPT_Do32(&my_cursor, &header->file_length) ||
|
!XPT_Do32(&my_cursor, &header->file_length) ||
|
||||||
!XPT_DoInterfaceDirectoryEntry(&my_cursor,
|
!XPT_DoInterfaceDirectoryEntry(&my_cursor,
|
||||||
&header->interface_directory) ||
|
&header->interface_directory) ||
|
||||||
!XPT_Do8(&my_cursor, &header->data_pool) ||
|
!XPT_Do8(&my_cursor, header->data_pool) ||
|
||||||
!XPT_DoAnnotation(&my_cursor, &header->annotations)) {
|
!XPT_DoAnnotation(&my_cursor, &header->annotations)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
@ -115,14 +116,14 @@ XPT_DoInterfaceDirectoryEntry(XPTCursor *cursor,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (mode == XPT_DECODE) {
|
if (mode == XPT_DECODE) {
|
||||||
if !((*idep = ide = PR_NEWZAP(XPTInterfaceDirectoryEntry)))
|
if (!(*idep = ide = PR_NEWZAP(XPTInterfaceDirectoryEntry)))
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
ide = *idep;
|
ide = *idep;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a cursor, reserving XPT_IDE_SIZE bytes in the encode case */
|
/* create a cursor, reserving XPT_IDE_SIZE bytes in the encode case */
|
||||||
if (!XPT_CreateCursor(cursor->state, XPT_HEADER, XPT_IDE_SIZE,
|
if (!XPT_CreateCursor(cursor, XPT_HEADER, XPT_IDE_SIZE,
|
||||||
&my_cursor) ||
|
&my_cursor) ||
|
||||||
|
|
||||||
/* write the IID in our cursor space */
|
/* write the IID in our cursor space */
|
||||||
@ -157,15 +158,17 @@ PRBool
|
|||||||
XPT_DoInterfaceDescriptor(XPTCursor *cursor, XPTInterfaceDescriptor **idp)
|
XPT_DoInterfaceDescriptor(XPTCursor *cursor, XPTInterfaceDescriptor **idp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTInterfaceDescriptor id;
|
XPTInterfaceDescriptor *id;
|
||||||
XPTCursor my_cursor;
|
XPTCursor my_cursor;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
id = PR_NEWZAP(XPTInterfaceDescriptor);
|
id = PR_NEWZAP(XPTInterfaceDescriptor);
|
||||||
else
|
else
|
||||||
id = *idp;
|
id = *idp;
|
||||||
|
|
||||||
if(!XPT_CreateCursor(cursor->state, XPT_DATA, XPT_ID_SIZE, &my_cursor) ||
|
if(!XPT_CreateCursor(cursor, XPT_DATA, XPT_ID_BASE_SIZE,
|
||||||
|
&my_cursor) ||
|
||||||
!XPT_DoInterfaceDirectoryEntry(&my_cursor, &id->parent_interface) ||
|
!XPT_DoInterfaceDirectoryEntry(&my_cursor, &id->parent_interface) ||
|
||||||
!XPT_Do16(&my_cursor, &id->num_methods)) {
|
!XPT_Do16(&my_cursor, &id->num_methods)) {
|
||||||
|
|
||||||
@ -182,7 +185,7 @@ XPT_DoInterfaceDescriptor(XPTCursor *cursor, XPTInterfaceDescriptor **idp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < id->num_constants; i++) {
|
for (i = 0; i < id->num_constants; i++) {
|
||||||
if (!XPT_DoConstDescriptor(&my_cursor, &id->constant_descriptors[i])) {
|
if (!XPT_DoConstDescriptor(&my_cursor, &id->const_descriptors[i])) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,7 +204,7 @@ PRBool
|
|||||||
XPT_DoConstDescriptor(XPTCursor *cursor, XPTConstDescriptor **cdp)
|
XPT_DoConstDescriptor(XPTCursor *cursor, XPTConstDescriptor **cdp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTConstDescriptor cd;
|
XPTConstDescriptor *cd;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
cd = PR_NEWZAP(XPTConstDescriptor);
|
cd = PR_NEWZAP(XPTConstDescriptor);
|
||||||
@ -214,40 +217,40 @@ XPT_DoConstDescriptor(XPTCursor *cursor, XPTConstDescriptor **cdp)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(cd->type->prefix->tag) {
|
switch(cd->type.prefix->tag) {
|
||||||
case '0':
|
case '0':
|
||||||
XPT_Do8(&cursor, &cd->value->i8);
|
XPT_Do8(cursor, &cd->value.i8);
|
||||||
break;
|
break;
|
||||||
case '1':
|
case 1:
|
||||||
XPT_Do16(&cursor, &cd->value->i16);
|
XPT_Do16(cursor, &cd->value.i16);
|
||||||
break;
|
break;
|
||||||
case '2':
|
case 2:
|
||||||
XPT_Do32(&cursor, &cd->value->i32);
|
XPT_Do32(cursor, &cd->value.i32);
|
||||||
break;
|
break;
|
||||||
case '3':
|
case 3:
|
||||||
XPT_Do64(&cursor, &cd->value->i64);
|
XPT_Do64(cursor, &cd->value.i64);
|
||||||
break;
|
break;
|
||||||
case '4':
|
case 4:
|
||||||
XPT_Do8(&cursor, &cd->value->ui8);
|
XPT_Do8(cursor, &cd->value.ui8);
|
||||||
break;
|
break;
|
||||||
case '5':
|
case 5:
|
||||||
XPT_Do16(&cursor, &cd->value->ui16);
|
XPT_Do16(cursor, &cd->value.ui16);
|
||||||
break;
|
break;
|
||||||
case '6':
|
case 6:
|
||||||
XPT_Do32(&cursor, &cd->value->ui32);
|
XPT_Do32(cursor, &cd->value.ui32);
|
||||||
break;
|
break;
|
||||||
case '7':
|
case 7:
|
||||||
XPT_Do64(&cursor, &cd->value->ui64);
|
XPT_Do64(cursor, &cd->value.ui64);
|
||||||
break;
|
break;
|
||||||
case '11':
|
case 11:
|
||||||
XPT_Do8(&cursor, &cd->value->ch);
|
XPT_Do8(cursor, &cd->value.ch);
|
||||||
break;
|
break;
|
||||||
case '12':
|
case 12:
|
||||||
XPT_Do16(&cursor, &cd->value->wch);
|
XPT_Do16(cursor, &cd->value.wch);
|
||||||
break;
|
break;
|
||||||
case '15':
|
case 15:
|
||||||
if (cd->type->prefix->is_pointer == 1) {
|
if (cd->type.prefix->is_pointer == 1) {
|
||||||
XPT_DoString(&cursor, &cd->value->string);
|
XPT_DoString(cursor, &cd->value.string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
@ -269,7 +272,7 @@ PRBool
|
|||||||
XPT_DoMethodDescriptor(XPTCursor *cursor, XPTMethodDescriptor **mdp)
|
XPT_DoMethodDescriptor(XPTCursor *cursor, XPTMethodDescriptor **mdp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTConstDescriptor md;
|
XPTMethodDescriptor *md;
|
||||||
uintn scratch;
|
uintn scratch;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
@ -277,14 +280,14 @@ XPT_DoMethodDescriptor(XPTCursor *cursor, XPTMethodDescriptor **mdp)
|
|||||||
else
|
else
|
||||||
md = *mdp;
|
md = *mdp;
|
||||||
|
|
||||||
if (!XPT_DO_BITS(&cursor, &md->is_getter, 1, scratch) ||
|
if (!XPT_DO_BITS(&cursor, md->is_getter, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->is_setter, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, md->is_setter, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->is_varargs, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, md->is_varargs, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->is_constructor, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, md->is_constructor, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->is_hidden, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, md->is_hidden, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &md->reserved, 3, scratch) ||
|
!XPT_DO_BITS(&cursor, md->reserved, 3, scratch) ||
|
||||||
!XPT_DoCString(&cursor, &md->name) ||
|
!XPT_DoCString(&cursor, &md->name) ||
|
||||||
!XPT_Do8(&cursor, &md->num_args) ||
|
!XPT_Do8(cursor, &md->num_args) ||
|
||||||
!XPT_DoParamDescriptor(&cursor, &md->params) ||
|
!XPT_DoParamDescriptor(&cursor, &md->params) ||
|
||||||
!XPT_DoParamDescriptor(&cursor, &md->result)) {
|
!XPT_DoParamDescriptor(&cursor, &md->result)) {
|
||||||
|
|
||||||
@ -305,7 +308,7 @@ PRBool
|
|||||||
XPT_DoParamDescriptor(XPTCursor *cursor, XPTParamDescriptor **pdp)
|
XPT_DoParamDescriptor(XPTCursor *cursor, XPTParamDescriptor **pdp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTParamDescriptor pd;
|
XPTParamDescriptor *pd;
|
||||||
uintn scratch;
|
uintn scratch;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
@ -313,10 +316,10 @@ XPT_DoParamDescriptor(XPTCursor *cursor, XPTParamDescriptor **pdp)
|
|||||||
else
|
else
|
||||||
pd = *pdp;
|
pd = *pdp;
|
||||||
|
|
||||||
if (!XPT_DO_BITS(&cursor, &pd->in, 1, scratch) ||
|
if (!XPT_DO_BITS(&cursor, pd->in, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &pd->out, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, pd->out, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &pd->retval, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, pd->retval, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &pd->reserved, 5, scratch) ||
|
!XPT_DO_BITS(&cursor, pd->reserved, 5, scratch) ||
|
||||||
!XPT_DoTypeDescriptor(&cursor, &pd->type)) {
|
!XPT_DoTypeDescriptor(&cursor, &pd->type)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
@ -336,7 +339,7 @@ PRBool
|
|||||||
XPT_DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix **tdpp)
|
XPT_DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix **tdpp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTTypeDescriptorPrefix tdp;
|
XPTTypeDescriptorPrefix *tdp;
|
||||||
uintn scratch;
|
uintn scratch;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
@ -344,10 +347,10 @@ XPT_DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix **tdpp)
|
|||||||
else
|
else
|
||||||
tdp = *tdpp;
|
tdp = *tdpp;
|
||||||
|
|
||||||
if (!XPT_DO_BITS(&cursor, &tdp->is_pointer, 1, scratch) ||
|
if (!XPT_DO_BITS(&cursor, tdp->is_pointer, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &tdp->is_unique_pointer, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, tdp->is_unique_pointer, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &tdp->is_reference, 1, scratch) ||
|
!XPT_DO_BITS(&cursor, tdp->is_reference, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &tdp->tag, 5, scratch)) {
|
!XPT_DO_BITS(&cursor, tdp->tag, 5, scratch)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -363,26 +366,26 @@ XPT_DoTypeDescriptorPrefix(XPTCursor *cursor, XPTTypeDescriptorPrefix **tdpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
XPT_DoTypeDescriptor(XPTCursor *cursor, XPTSimpleTypeDescriptor **tdp)
|
XPT_DoTypeDescriptor(XPTCursor *cursor, XPTTypeDescriptor **tdp)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTSimpleTypeDescriptor td;
|
XPTTypeDescriptor *td;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
td = PR_NEWZAP(XPTTypeDescriptor);
|
td = PR_NEWZAP(XPTTypeDescriptor);
|
||||||
else
|
else
|
||||||
td = *tdp;
|
td = *tdp;
|
||||||
|
|
||||||
if (!XPT_DoTypeDescriptorPrefix(&cursor, &td->prefix)) {
|
if (!XPT_DoTypeDescriptorPrefix(cursor, &td->prefix)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (td->prefix->tag == TD_INTERFACE_TYPE) {
|
if (td->prefix->tag == TD_INTERFACE_TYPE) {
|
||||||
if (!XPT_DoInterfaceDirectoryEntry(&cursor, &td->type->interface))
|
if (!XPT_DoInterfaceDirectoryEntry(cursor, &td->type.interface))
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
if (td->prefix->tag == TD_INTERFACE_IS_TYPE) {
|
if (td->prefix->tag == TD_INTERFACE_IS_TYPE) {
|
||||||
if (!XPT_Do8(&cursor, &td->type->argnum))
|
if (!XPT_Do8(cursor, &td->type.argnum))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,7 +404,7 @@ PRBool
|
|||||||
XPT_DoAnnotationPrefix(XPTCursor *cursor, XPTAnnotationPrefix **app)
|
XPT_DoAnnotationPrefix(XPTCursor *cursor, XPTAnnotationPrefix **app)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTAnnotationPrefix ap;
|
XPTAnnotationPrefix *ap;
|
||||||
uintn scratch;
|
uintn scratch;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
@ -409,8 +412,8 @@ XPT_DoAnnotationPrefix(XPTCursor *cursor, XPTAnnotationPrefix **app)
|
|||||||
else
|
else
|
||||||
ap = *app;
|
ap = *app;
|
||||||
|
|
||||||
if (!XPT_DO_BITS(&cursor, &ap->is_last, 1, scratch) ||
|
if (!XPT_DO_BITS(&cursor, ap->is_last, 1, scratch) ||
|
||||||
!XPT_DO_BITS(&cursor, &ap->tag, 7, scratch)) {
|
!XPT_DO_BITS(&cursor, ap->tag, 7, scratch)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -429,15 +432,15 @@ PRBool
|
|||||||
XPT_DoPrivateAnnotation(XPTCursor *cursor, XPTPrivateAnnotation **pap)
|
XPT_DoPrivateAnnotation(XPTCursor *cursor, XPTPrivateAnnotation **pap)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTPrivateAnnotation pa;
|
XPTPrivateAnnotation *pa;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
pa = PR_NEWZAP(XPTPrivateAnnotation);
|
pa = PR_NEWZAP(XPTPrivateAnnotation);
|
||||||
else
|
else
|
||||||
pa = *pap;
|
pa = *pap;
|
||||||
|
|
||||||
if (!XPT_DoString(&cursor, &pa->creator) ||
|
if (!XPT_DoString(cursor, &pa->creator) ||
|
||||||
!XPT_DoString(&cursor, &pa->private_data)) {
|
!XPT_DoString(cursor, &pa->private_data)) {
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -456,19 +459,19 @@ PRBool
|
|||||||
XPT_DoAnnotation(XPTCursor *cursor, XPTAnnotation **ap)
|
XPT_DoAnnotation(XPTCursor *cursor, XPTAnnotation **ap)
|
||||||
{
|
{
|
||||||
XPTMode mode = cursor->state->mode;
|
XPTMode mode = cursor->state->mode;
|
||||||
XPTAnnotation a;
|
XPTAnnotation *a;
|
||||||
|
|
||||||
if (mode == XPT_DECODE)
|
if (mode == XPT_DECODE)
|
||||||
a = PR_NEWZAP(XPTPrivateAnnotation);
|
a = PR_NEWZAP(XPTAnnotation);
|
||||||
else
|
else
|
||||||
a = *ap;
|
a = *ap;
|
||||||
|
|
||||||
if (!XPT_DoAnnotationPrefix(&cursor, &a->prefix)) {
|
if (!XPT_DoAnnotationPrefix(cursor, &a->prefix)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->prefix->tag == PRIVATE_ANNOTATION) {
|
if (a->prefix->tag == PRIVATE_ANNOTATION) {
|
||||||
if (!XPT_DoPrivateAnnotation(&cursor, &a->private)) {
|
if (!XPT_DoPrivateAnnotation(cursor, &a->private)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user