} *headerp = header;
*headerp = header; } else { header = *headerp; }
XPT_DoHeader(XPTCursor *cursor, XPTHeader **headerp){    XPTMode mode = cursor->state->mode;    XPTHeader *header;    uint32 ide_offset;    int i;    if (mode == XPT_DECODE) {        header = PR_NEWZAP(XPTHeader);        if (!header)            return PR_FALSE;    }     *headerp = header;    if (mode == XPT_ENCODE) {        /* IDEs appear after header, including annotations */        ide_offset = XPT_SizeOfHeader(*headerp) + 1; /* one-based offset */        header->data_pool = XPT_SizeOfHeaderBlock(*headerp);    }    for (i = 0; i < 16; i++) {        if (!XPT_Do8(cursor, &header->magic[i]))            goto error;    }        if(!XPT_Do8(cursor, &header->major_version) ||       !XPT_Do8(cursor, &header->minor_version) ||       /* XXX check major for compat! */       !XPT_Do16(cursor, &header->num_interfaces) ||       !XPT_Do32(cursor, &header->file_length) ||       !XPT_Do32(cursor, &ide_offset)) {        goto error;    }        if (mode == XPT_ENCODE)        XPT_DataOffset(cursor->state, &header->data_pool);    if (!XPT_Do32(cursor, &header->data_pool))        goto error;    if (mode == XPT_DECODE)        XPT_DataOffset(cursor->state, &header->data_pool);    if (mode == XPT_DECODE) {        header->interface_directory =             PR_CALLOC(header->num_interfaces *                       sizeof(XPTInterfaceDirectoryEntry));        if (!header->interface_directory)            goto error;    }    if (!XPT_DoAnnotation(cursor, &header->annotations))        goto error;    /* shouldn't be necessary now, but maybe later */    XPT_SeekTo(cursor, ide_offset);     for (i = 0; i < header->num_interfaces; i++) {        if (!XPT_DoInterfaceDirectoryEntry(cursor,                                            &header->interface_directory[i]))            goto error;    }        return PR_TRUE;    /* XXX need to free child data sometimes! */    XPT_ERROR_HANDLE(header);    }   