XPT_SeekTo(cursor, ide_offset);
if (!header->interface_directory) goto error;
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);    else        header = *headerp;    if (mode == XPT_ENCODE) {        ide_offset = XPT_SizeOfHeader(); /* IDEs appear after annotations */    }    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) ||       !XPT_Do16(cursor, &header->num_interfaces) ||       !XPT_Do32(cursor, &header->file_length) ||       !XPT_Do32(cursor, &ide_offset)) {                goto error;    }        /*     * This sections a little hairy right now. We need to do     * XPT_DataOffset before writing but after reading.       *     * if (mode == XPT_DECODE ||      *    XPT_DataOffset(cursor->state, &header->data_pool)) {     *    if(!XPT_Do32(cursor, &header->data_pool)) {     *        goto error;     *    }     * }     *     * if (mode == XPT_ENCODE ||      *    XPT_DataOffset(cursor->state, &header->data_pool)) {     *    XPT_DoAnnotations(annotations);     * }     */    if (mode == XPT_DECODE) {        header->interface_directory =             PR_CALLOC(header->num_interfaces *                       sizeof(XPTInterfaceDirectoryEntry));        /* shouldn't be necessary now, but maybe later */        XPT_SeekTo(cursor, ide_offset);     }    for (i = 0; i < header->num_interfaces; i++) {        XPT_DoInterfaceDirectoryEntry(cursor,                                      &header->interface_directory[i]);    }        if (mode == XPT_DECODE)             for (i = 0; i < header->num_interfaces; i++) {        if (!XPT_DoInterfaceDirectoryEntry(&cursor,                                            &header->interface_directory[i]))            goto error;    }        return PR_TRUE;    XPT_ERROR_HANDLE(header);    }   