void xclaimCommand(client *c) {
    streamCG *group = NULL;
    robj *o = lookupKeyRead(c->db,c->argv[1]);
    long long minidle; /* Minimum idle time argument. */
    long long retrycount = -1;   /* -1 means RETRYCOUNT option not given. */
    mstime_t deliverytime = -1;  /* -1 means IDLE/TIME options not given. */
    int force = 0;
    int justid = 0;

    if (o) {
        if (checkType(c,o,OBJ_STREAM)) return; /* Type error. */
        group = streamLookupCG(o->ptr,c->argv[2]->ptr);
    }

    /* No key or group? Send an error given that the group creation
     * is mandatory. */
    if (o == NULL || group == NULL) {
        addReplyErrorFormat(c,"-NOGROUP No such key '%s' or "
                              "consumer group '%s'", (char*)c->argv[1]->ptr,
                              (char*)c->argv[2]->ptr);
        return;
    }

    if (getLongLongFromObjectOrReply(c,c->argv[4],&minidle,
        "Invalid min-idle-time argument for XCLAIM")
        != C_OK) return;
    if (minidle < 0) minidle = 0;

    /* Start parsing the IDs, so that we abort ASAP if there is a syntax
     * error: the return value of this command cannot be an error in case
     * the client successfully claimed some message, so it should be
     * executed in a "all or nothing" fashion. */
    int j;
    streamID static_ids[STREAMID_STATIC_VECTOR_LEN];
    streamID *ids = static_ids;
    int id_count = c->argc-5;
    if (id_count > STREAMID_STATIC_VECTOR_LEN)
        ids = zmalloc(sizeof(streamID)*id_count);
    for (j = 5; j < c->argc; j++) {
        if (streamParseStrictIDOrReply(NULL,c->argv[j],&ids[j-5],0,NULL) != C_OK) break;
    }
    int last_id_arg = j-1; /* Next time we iterate the IDs we now the range. */

    /* If we stopped because some IDs cannot be parsed, perhaps they
     * are trailing options. */
    mstime_t now = mstime();
    streamID last_id = {0,0};
    int propagate_last_id = 0;
    for (; j < c->argc; j++) {
        int moreargs = (c->argc-1) - j; /* Number of additional arguments. */
        char *opt = c->argv[j]->ptr;
        if (!strcasecmp(opt,"FORCE")) {
            force = 1;
        } else if (!strcasecmp(opt,"JUSTID")) {
            justid = 1;
        } else if (!strcasecmp(opt,"IDLE") && moreargs) {
            j++;
            if (getLongLongFromObjectOrReply(c,c->argv[j],&deliverytime,
                "Invalid IDLE option argument for XCLAIM")
                != C_OK) goto cleanup;
            deliverytime = now - deliverytime;
        } else if (!strcasecmp(opt,"TIME") && moreargs) {
            j++;
            if (getLongLongFromObjectOrReply(c,c->argv[j],&deliverytime,
                "Invalid TIME option argument for XCLAIM")
                != C_OK) goto cleanup;
        } else if (!strcasecmp(opt,"RETRYCOUNT") && moreargs) {
            j++;
            if (getLongLongFromObjectOrReply(c,c->argv[j],&retrycount,
                "Invalid RETRYCOUNT option argument for XCLAIM")
                != C_OK) goto cleanup;
        } else if (!strcasecmp(opt,"LASTID") && moreargs) {
            j++;
            if (streamParseStrictIDOrReply(c,c->argv[j],&last_id,0,NULL) != C_OK) goto cleanup;
        } else {
            addReplyErrorFormat(c,"Unrecognized XCLAIM option '%s'",opt);
            goto cleanup;
        }
    }

    if (streamCompareID(&last_id,&group->last_id) > 0) {
        group->last_id = last_id;
        propagate_last_id = 1;
    }

    if (deliverytime != -1) {
        /* If a delivery time was passed, either with IDLE or TIME, we
         * do some sanity check on it, and set the deliverytime to now
         * (which is a sane choice usually) if the value is bogus.
         * To raise an error here is not wise because clients may compute
         * the idle time doing some math starting from their local time,
         * and this is not a good excuse to fail in case, for instance,
         * the computer time is a bit in the future from our POV. */
        if (deliverytime < 0 || deliverytime > now) deliverytime = now;
    } else {
        /* If no IDLE/TIME option was passed, we want the last delivery
         * time to be now, so that the idle time of the message will be
         * zero. */
        deliverytime = now;
    }

    /* Do the actual claiming. */
    streamConsumer *consumer = NULL;
    void *arraylenptr = addReplyDeferredLen(c);
    size_t arraylen = 0;
    sds name = c->argv[3]->ptr;
    for (int j = 5; j <= last_id_arg; j++) {
        streamID id = ids[j-5];
        unsigned char buf[sizeof(streamID)];
        streamEncodeID(buf,&id);

        /* Lookup the ID in the group PEL. */
        streamNACK *nack = raxFind(group->pel,buf,sizeof(buf));

        /* Item must exist for us to transfer it to another consumer. */
        if (!streamEntryExists(o->ptr,&id)) {
            /* Clear this entry from the PEL, it no longer exists */
            if (nack != raxNotFound) {
                /* Propagate this change (we are going to delete the NACK). */
                streamPropagateXCLAIM(c,c->argv[1],group,c->argv[2],c->argv[j],nack);
                propagate_last_id = 0; /* Will be propagated by XCLAIM itself. */
                server.dirty++;
                /* Release the NACK */
                raxRemove(group->pel,buf,sizeof(buf),NULL);
                raxRemove(nack->consumer->pel,buf,sizeof(buf),NULL);
                streamFreeNACK(nack);
            }
            continue;
        }

        /* If FORCE is passed, let's check if at least the entry
         * exists in the Stream. In such case, we'll create a new
         * entry in the PEL from scratch, so that XCLAIM can also
         * be used to create entries in the PEL. Useful for AOF
         * and replication of consumer groups. */
        if (force && nack == raxNotFound) {
            /* Create the NACK. */
            nack = streamCreateNACK(NULL);
            raxInsert(group->pel,buf,sizeof(buf),nack,NULL);
        }

        if (nack != raxNotFound) {
            /* We need to check if the minimum idle time requested
             * by the caller is satisfied by this entry.
             *
             * Note that the nack could be created by FORCE, in this
             * case there was no pre-existing entry and minidle should
             * be ignored, but in that case nack->consumer is NULL. */
            if (nack->consumer && minidle) {
                mstime_t this_idle = now - nack->delivery_time;
                if (this_idle < minidle) continue;
            }

            if (consumer == NULL &&
                (consumer = streamLookupConsumer(group,name,SLC_DEFAULT)) == NULL)
            {
                consumer = streamCreateConsumer(group,name,c->argv[1],c->db->id,SCC_DEFAULT);
            }
            if (nack->consumer != consumer) {
                /* Remove the entry from the old consumer.
                 * Note that nack->consumer is NULL if we created the
                 * NACK above because of the FORCE option. */
                if (nack->consumer)
                    raxRemove(nack->consumer->pel,buf,sizeof(buf),NULL);
            }
            nack->delivery_time = deliverytime;
            /* Set the delivery attempts counter if given, otherwise
             * autoincrement unless JUSTID option provided */
            if (retrycount >= 0) {
                nack->delivery_count = retrycount;
            } else if (!justid) {
                nack->delivery_count++;
            }
            if (nack->consumer != consumer) {
                /* Add the entry in the new consumer local PEL. */
                raxInsert(consumer->pel,buf,sizeof(buf),nack,NULL);
                nack->consumer = consumer;
            }
            /* Send the reply for this entry. */
            if (justid) {
                addReplyStreamID(c,&id);
            } else {
                serverAssert(streamReplyWithRange(c,o->ptr,&id,&id,1,0,NULL,NULL,STREAM_RWR_RAWENTRIES,NULL) == 1);
            }
            arraylen++;

            /* Propagate this change. */
            streamPropagateXCLAIM(c,c->argv[1],group,c->argv[2],c->argv[j],nack);
            propagate_last_id = 0; /* Will be propagated by XCLAIM itself. */
            server.dirty++;
        }
    }
    if (propagate_last_id) {
        streamPropagateGroupID(c,c->argv[1],group,c->argv[2]);
        server.dirty++;
    }
    setDeferredArrayLen(c,arraylenptr,arraylen);
    preventCommandPropagation(c);
cleanup:
    if (ids != static_ids) zfree(ids);
}


GF_Err gf_isom_remove_edit(GF_ISOFile *movie, u32 trackNumber, u32 seg_index)
{
	GF_Err e;
	GF_TrackBox *trak;
	GF_EdtsEntry *ent, *next_ent;
	trak = gf_isom_get_track_from_file(movie, trackNumber);
	if (!trak || !seg_index) return GF_BAD_PARAM;

	e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE);
	if (e) return e;

	if (!trak->editBox || !trak->editBox->editList) return GF_OK;
	if (gf_list_count(trak->editBox->editList->entryList)<=1) return gf_isom_remove_edits(movie, trackNumber);

	ent = (GF_EdtsEntry*) gf_list_get(trak->editBox->editList->entryList, seg_index-1);
	gf_list_rem(trak->editBox->editList->entryList, seg_index-1);
	next_ent = (GF_EdtsEntry *)gf_list_get(trak->editBox->editList->entryList, seg_index-1);
	if (next_ent) next_ent->segmentDuration += ent->segmentDuration;
	gf_free(ent);
	return SetTrackDuration(trak);
}


static inline bool llc_listener_match(const struct llc_sap *sap,
				      const struct llc_addr *laddr,
				      const struct sock *sk)
{
	struct llc_sock *llc = llc_sk(sk);

	return sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN &&
		llc->laddr.lsap == laddr->lsap &&
		ether_addr_equal(llc->laddr.mac, laddr->mac);
}


enum ndp_msg_type ndp_msg_type(struct ndp_msg *msg)
{
	enum ndp_msg_type msg_type;
	int err;

	err = ndp_msg_type_by_raw_type(&msg_type, msg->icmp6_hdr->icmp6_type);
	/* Type should be always set correctly (ensured by ndp_msg_init) */
	BUG_ON(err);
	return msg_type;
}


static int ceph_x_encode_ticket(struct ceph_x_ticket_handler *th,
				void **p, void *end)
{
	ceph_decode_need(p, end, 1 + sizeof(u64), bad);
	ceph_encode_8(p, 1);
	ceph_encode_64(p, th->secret_id);
	if (th->ticket_blob) {
		const char *buf = th->ticket_blob->vec.iov_base;
		u32 len = th->ticket_blob->vec.iov_len;

		ceph_encode_32_safe(p, end, len, bad);
		ceph_encode_copy_safe(p, end, buf, len, bad);
	} else {
		ceph_encode_32_safe(p, end, 0, bad);
	}

	return 0;
bad:
	return -ERANGE;
}


static int s390_ipl_init(SysBusDevice *dev)

{

    S390IPLState *ipl = S390_IPL(dev);

    int kernel_size;

    if (!ipl->kernel) {

        int bios_size;

        char *bios_filename;

        /* Load zipl bootloader */

        if (bios_name == NULL) {

            bios_name = ipl->firmware;

        }

        bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);

        if (bios_filename == NULL) {

            hw_error("could not find stage1 bootloader\n");

        }

        bios_size = load_elf(bios_filename, NULL, NULL, &ipl->start_addr, NULL,

                             NULL, 1, ELF_MACHINE, 0);

        if (bios_size == -1) {

            bios_size = load_image_targphys(bios_filename, ZIPL_IMAGE_START,

                                            4096);

            ipl->start_addr = ZIPL_IMAGE_START;

            if (bios_size > 4096) {

                hw_error("stage1 bootloader is > 4k\n");

            }

        }

        g_free(bios_filename);

        if (bios_size == -1) {

            hw_error("could not load bootloader '%s'\n", bios_name);

        }

        return 0;

    } else {

        uint64_t pentry = KERN_IMAGE_START;

        kernel_size = load_elf(ipl->kernel, NULL, NULL, &pentry, NULL,

                               NULL, 1, ELF_MACHINE, 0);

        if (kernel_size == -1) {

            kernel_size = load_image_targphys(ipl->kernel, 0, ram_size);

        }

        if (kernel_size == -1) {

            fprintf(stderr, "could not load kernel '%s'\n", ipl->kernel);

            return -1;

        }

        /*

         * Is it a Linux kernel (starting at 0x10000)? If yes, we fill in the

         * kernel parameters here as well. Note: For old kernels (up to 3.2)

         * we can not rely on the ELF entry point - it was 0x800 (the SALIPL

         * loader) and it won't work. For this case we force it to 0x10000, too.

         */

        if (pentry == KERN_IMAGE_START || pentry == 0x800) {

            ipl->start_addr = KERN_IMAGE_START;

            /* Overwrite parameters in the kernel image, which are "rom" */

            strcpy(rom_ptr(KERN_PARM_AREA), ipl->cmdline);

        } else {

            ipl->start_addr = pentry;

        }

    }

    if (ipl->initrd) {

        ram_addr_t initrd_offset;

        int initrd_size;

        initrd_offset = INITRD_START;

        while (kernel_size + 0x100000 > initrd_offset) {

            initrd_offset += 0x100000;

        }

        initrd_size = load_image_targphys(ipl->initrd, initrd_offset,

                                          ram_size - initrd_offset);

        if (initrd_size == -1) {

            fprintf(stderr, "qemu: could not load initrd '%s'\n", ipl->initrd);

            exit(1);

        }

        /* we have to overwrite values in the kernel image, which are "rom" */

        stq_p(rom_ptr(INITRD_PARM_START), initrd_offset);

        stq_p(rom_ptr(INITRD_PARM_SIZE), initrd_size);

    }

    return 0;

}


static inline u8 *skcipher_get_spot(u8 *start, unsigned int len)
{
	u8 *end_page = (u8 *)(((unsigned long)(start + len - 1)) & PAGE_MASK);

	return max(start, end_page);
}


static int g726_decode_frame(AVCodecContext *avctx,

                             void *data, int *data_size,

                             AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    G726Context *c = avctx->priv_data;

    int16_t *samples = data;

    GetBitContext gb;

    init_get_bits(&gb, buf, buf_size * 8);

    while (get_bits_count(&gb) + c->code_size <= buf_size*8)

        *samples++ = g726_decode(c, get_bits(&gb, c->code_size));

    if(buf_size*8 != get_bits_count(&gb))

        av_log(avctx, AV_LOG_ERROR, "Frame invalidly split, missing parser?\n");

    *data_size = (uint8_t*)samples - (uint8_t*)data;

    return buf_size;

}


EXPORTED const char *dlist_cstring(struct dlist *dl)
{
    static char zerochar = '\0';

    if (dl) {
        const char *res = NULL;
        dlist_toatom(dl, &res);
        if (res) return res;
    }

    return &zerochar;
}


Tab* TabStrip::tab_at(int index) const {
  return static_cast<Tab*>(tabs_.view_at(index));
}


connection_edge_end(edge_connection_t *conn, uint8_t reason)
{
  char payload[RELAY_PAYLOAD_SIZE];
  size_t payload_len=1;
  circuit_t *circ;
  uint8_t control_reason = reason;

  if (conn->edge_has_sent_end) {
    log_warn(LD_BUG,"(Harmless.) Calling connection_edge_end (reason %d) "
             "on an already ended stream?", reason);
    tor_fragile_assert();
    return -1;
  }

  if (conn->base_.marked_for_close) {
    log_warn(LD_BUG,
             "called on conn that's already marked for close at %s:%d.",
             conn->base_.marked_for_close_file, conn->base_.marked_for_close);
    return 0;
  }

  circ = circuit_get_by_edge_conn(conn);
  if (circ && CIRCUIT_PURPOSE_IS_CLIENT(circ->purpose)) {
    /* If this is a client circuit, don't send the server an informative
     * reason code; it doesn't need to know why the client stream is
     * failing. */
    reason = END_STREAM_REASON_MISC;
  }

  payload[0] = (char)reason;
  if (reason == END_STREAM_REASON_EXITPOLICY &&
      !connection_edge_is_rendezvous_stream(conn)) {
    int addrlen;
    if (tor_addr_family(&conn->base_.addr) == AF_INET) {
      set_uint32(payload+1, tor_addr_to_ipv4n(&conn->base_.addr));
      addrlen = 4;
    } else {
      memcpy(payload+1, tor_addr_to_in6_addr8(&conn->base_.addr), 16);
      addrlen = 16;
    }
    set_uint32(payload+1+addrlen, htonl(dns_clip_ttl(conn->address_ttl)));
    payload_len += 4+addrlen;
  }

  if (circ && !circ->marked_for_close) {
    log_debug(LD_EDGE,"Sending end on conn (fd "TOR_SOCKET_T_FORMAT").",
              conn->base_.s);
    connection_edge_send_command(conn, RELAY_COMMAND_END,
                                 payload, payload_len);
    /* We'll log warn if the connection was an hidden service and couldn't be
     * made because the service wasn't available. */
    warn_if_hs_unreachable(conn, control_reason);
  } else {
    log_debug(LD_EDGE,"No circ to send end on conn "
              "(fd "TOR_SOCKET_T_FORMAT").",
              conn->base_.s);
  }

  conn->edge_has_sent_end = 1;
  conn->end_reason = control_reason;
  return 0;
}


static struct server * get_server ( char * buf , int len ) {
 char * data = get_data ( buf , len ) ;
 char error_buf [ 512 ] ;
 if ( data == NULL ) {
 LOGE ( "No data found" ) ;
 return NULL ;
 }
 json_settings settings = {
 0 }
 ;
 json_value * obj = json_parse_ex ( & settings , data , strlen ( data ) , error_buf ) ;
 if ( obj == NULL ) {
 LOGE ( "%s" , error_buf ) ;
 return NULL ;
 }
 struct server * server = ss_malloc ( sizeof ( struct server ) ) ;
 memset ( server , 0 , sizeof ( struct server ) ) ;
 if ( obj -> type == json_object ) {
 int i = 0 ;
 for ( i = 0 ;
 i < obj -> u . object . length ;
 i ++ ) {
 char * name = obj -> u . object . values [ i ] . name ;
 json_value * value = obj -> u . object . values [ i ] . value ;
 if ( strcmp ( name , "server_port" ) == 0 ) {
 if ( value -> type == json_string ) {
 strncpy ( server -> port , value -> u . string . ptr , 8 ) ;
 }
 else if ( value -> type == json_integer ) {
 snprintf ( server -> port , 8 , "%" PRIu64 "" , value -> u . integer ) ;
 }
 }
 else if ( strcmp ( name , "password" ) == 0 ) {
 if ( value -> type == json_string ) {
 strncpy ( server -> password , value -> u . string . ptr , 128 ) ;
 }
 }
 else if ( strcmp ( name , "method" ) == 0 ) {
 if ( value -> type == json_string ) {
 server -> method = strdup ( value -> u . string . ptr ) ;
 }
 }
 else if ( strcmp ( name , "fast_open" ) == 0 ) {
 if ( value -> type == json_boolean ) {
 strncpy ( server -> fast_open , ( value -> u . boolean ? "true" : "false" ) , 8 ) ;
 }
 }
 else if ( strcmp ( name , "plugin" ) == 0 ) {
 if ( value -> type == json_string ) {
 server -> plugin = strdup ( value -> u . string . ptr ) ;
 }
 }
 else if ( strcmp ( name , "plugin_opts" ) == 0 ) {
 if ( value -> type == json_string ) {
 server -> plugin_opts = strdup ( value -> u . string . ptr ) ;
 }
 }
 else if ( strcmp ( name , "mode" ) == 0 ) {
 if ( value -> type == json_string ) {
 server -> mode = strdup ( value -> u . string . ptr ) ;
 }
 }
 else {
 LOGE ( "invalid data: %s" , data ) ;
 break ;
 }
 }
 }
 json_value_free ( obj ) ;
 return server ;
 }


QueryDataTyped& SQLInternal::rowsTyped() {
  return resultsTyped_;
}


void SocketLineReader::dataReceived()
{
    while (m_socket->canReadLine()) {
        const QByteArray line = m_socket->readLine();
        if (line.length() > 1) { //we don't want a single \n
            m_packets.enqueue(line);
        }
    }

    //If we have any packets, tell it to the world.
    if (!m_packets.isEmpty()) {
        Q_EMIT readyRead();
    }
}


static void iriap_getvaluebyclass_indication(struct iriap_cb *self,
					     struct sk_buff *skb)
{
	struct ias_object *obj;
	struct ias_attrib *attrib;
	int name_len;
	int attr_len;
	char name[IAS_MAX_CLASSNAME + 1];	/* 60 bytes */
	char attr[IAS_MAX_ATTRIBNAME + 1];	/* 60 bytes */
	__u8 *fp;
	int n;

	IRDA_DEBUG(4, "%s()\n", __func__);

	IRDA_ASSERT(self != NULL, return;);
	IRDA_ASSERT(self->magic == IAS_MAGIC, return;);
	IRDA_ASSERT(skb != NULL, return;);

	fp = skb->data;
	n = 1;

	name_len = fp[n++];

	IRDA_ASSERT(name_len < IAS_MAX_CLASSNAME + 1, return;);

	memcpy(name, fp+n, name_len); n+=name_len;
	name[name_len] = '\0';

	attr_len = fp[n++];

	IRDA_ASSERT(attr_len < IAS_MAX_ATTRIBNAME + 1, return;);

	memcpy(attr, fp+n, attr_len); n+=attr_len;
	attr[attr_len] = '\0';

	IRDA_DEBUG(4, "LM-IAS: Looking up %s: %s\n", name, attr);
	obj = irias_find_object(name);

	if (obj == NULL) {
		IRDA_DEBUG(2, "LM-IAS: Object %s not found\n", name);
		iriap_getvaluebyclass_response(self, 0x1235, IAS_CLASS_UNKNOWN,
					       &irias_missing);
		return;
	}
	IRDA_DEBUG(4, "LM-IAS: found %s, id=%d\n", obj->name, obj->id);

	attrib = irias_find_attrib(obj, attr);
	if (attrib == NULL) {
		IRDA_DEBUG(2, "LM-IAS: Attribute %s not found\n", attr);
		iriap_getvaluebyclass_response(self, obj->id,
					       IAS_ATTRIB_UNKNOWN,
					       &irias_missing);
		return;
	}

	/* We have a match; send the value.  */
	iriap_getvaluebyclass_response(self, obj->id, IAS_SUCCESS,
				       attrib->value);
}


static void j2k_flush(J2kDecoderContext *s)

{

    if (*s->buf == 0xff)

        s->buf++;

    s->bit_index = 8;

    s->buf++;

}


qf_free_all(win_T *wp)
{
    int		i;
    qf_info_T	*qi = &ql_info;

    if (wp != NULL)
    {
	// location list
	ll_free_all(&wp->w_llist);
	ll_free_all(&wp->w_llist_ref);
    }
    else
	// quickfix list
	for (i = 0; i < qi->qf_listcount; ++i)
	    qf_free(qf_get_list(qi, i));
}


static int set_sec_attr_from_acl(sc_card_t *card, sc_file_t *file)
{
	const sc_acl_entry_t *entry;
	u8 sec_attr[SC_RTECP_SEC_ATTR_SIZE] = { 0 };
	int r;

	assert(card && card->ctx && file);
	assert(!file->sec_attr  &&  file->sec_attr_len == 0);
	assert(1 + 6 < sizeof(sec_attr));

	entry = sc_file_get_acl_entry(file, SC_AC_OP_DELETE);
	if (entry)
	{
		sec_attr[0] |= 0x40;
		sec_attr[1 + 6] = to_sec_attr(entry->method, entry->key_ref);
	}
	if (file->type == SC_FILE_TYPE_DF)
	{
		entry = sc_file_get_acl_entry(file, SC_AC_OP_CREATE);
		if (entry)
		{
			/* ATTR: Create DF/EF file */
			sec_attr[0] |= 0x01;
			sec_attr[1 + 0] = to_sec_attr(entry->method, entry->key_ref);
			/* ATTR: Create Internal EF (RSF) file */
			sec_attr[0] |= 0x02;
			sec_attr[1 + 1] = to_sec_attr(entry->method, entry->key_ref);
		}
	}
	else
	{
		entry = sc_file_get_acl_entry(file, SC_AC_OP_READ);
		if (entry)
		{
			sec_attr[0] |= 0x01;
			sec_attr[1 + 0] = to_sec_attr(entry->method, entry->key_ref);
		}
		entry = sc_file_get_acl_entry(file, SC_AC_OP_WRITE);
		if (entry)
		{
			sec_attr[0] |= 0x02;
			sec_attr[1 + 1] = to_sec_attr(entry->method, entry->key_ref);
		}
		entry = sc_file_get_acl_entry(file, SC_AC_OP_UPDATE);
		if (entry)
		{
			/* rewrite if sec_attr[1 + 1] already set */
			sec_attr[0] |= 0x02;
			sec_attr[1 + 1] = to_sec_attr(entry->method, entry->key_ref);
		}
	}
	/* FIXME: Find the best solution */
	if (file->path.len == 2 && !memcmp(file->path.value, "\x3F\x00", 2))
	{
		/* ATTR: Put data */
		sec_attr[0] |= 0x04;
		sec_attr[1 + 2] = 1; /* so-pin reference */
	}
	r = sc_file_set_sec_attr(file, sec_attr, sizeof(sec_attr));
	SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r);
}


 void tst_QQuickWebView::scrollRequest()
 {
     webView()->setSize(QSizeF(300, 400));

    webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html")));
    QVERIFY(waitForLoadSucceeded(webView()));

    int y = qRound(50 * webView()->page()->contentsScale());
    QVERIFY(webView()->experimental()->contentY() == y);
}


PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
{
	static const char module[] = "PixarLogDecode";
	TIFFDirectory *td = &tif->tif_dir;
	PixarLogState* sp = DecoderState(tif);
	tmsize_t i;
	tmsize_t nsamples;
	int llen;
	uint16 *up;

	switch (sp->user_datafmt) {
	case PIXARLOGDATAFMT_FLOAT:
		nsamples = occ / sizeof(float);	/* XXX float == 32 bits */
		break;
	case PIXARLOGDATAFMT_16BIT:
	case PIXARLOGDATAFMT_12BITPICIO:
	case PIXARLOGDATAFMT_11BITLOG:
		nsamples = occ / sizeof(uint16); /* XXX uint16 == 16 bits */
		break;
	case PIXARLOGDATAFMT_8BIT:
	case PIXARLOGDATAFMT_8BITABGR:
		nsamples = occ;
		break;
	default:
		TIFFErrorExt(tif->tif_clientdata, module,
			"%d bit input not supported in PixarLog",
			td->td_bitspersample);
		return 0;
	}

	llen = sp->stride * td->td_imagewidth;

	(void) s;
	assert(sp != NULL);
	sp->stream.next_out = (unsigned char *) sp->tbuf;
	assert(sizeof(sp->stream.avail_out)==4);  /* if this assert gets raised,
	    we need to simplify this code to reflect a ZLib that is likely updated
	    to deal with 8byte memory sizes, though this code will respond
	    appropriately even before we simplify it */
	sp->stream.avail_out = (uInt) (nsamples * sizeof(uint16));
	if (sp->stream.avail_out != nsamples * sizeof(uint16))
	{
		TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
		return (0);
	}
	/* Check that we will not fill more than what was allocated */
	if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size)
	{
		TIFFErrorExt(tif->tif_clientdata, module, "sp->stream.avail_out > sp->tbuf_size");
		return (0);
	}
	do {
		int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
		if (state == Z_STREAM_END) {
			break;			/* XXX */
		}
		if (state == Z_DATA_ERROR) {
			TIFFErrorExt(tif->tif_clientdata, module,
			    "Decoding error at scanline %lu, %s",
			    (unsigned long) tif->tif_row, sp->stream.msg ? sp->stream.msg : "(null)");
			if (inflateSync(&sp->stream) != Z_OK)
				return (0);
			continue;
		}
		if (state != Z_OK) {
			TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
			    sp->stream.msg ? sp->stream.msg : "(null)");
			return (0);
		}
	} while (sp->stream.avail_out > 0);

	/* hopefully, we got all the bytes we needed */
	if (sp->stream.avail_out != 0) {
		TIFFErrorExt(tif->tif_clientdata, module,
		    "Not enough data at scanline %lu (short " TIFF_UINT64_FORMAT " bytes)",
		    (unsigned long) tif->tif_row, (TIFF_UINT64_T) sp->stream.avail_out);
		return (0);
	}

	up = sp->tbuf;
	/* Swap bytes in the data if from a different endian machine. */
	if (tif->tif_flags & TIFF_SWAB)
		TIFFSwabArrayOfShort(up, nsamples);

	/*
	 * if llen is not an exact multiple of nsamples, the decode operation
	 * may overflow the output buffer, so truncate it enough to prevent
	 * that but still salvage as much data as possible.
	 */
	if (nsamples % llen) {
		TIFFWarningExt(tif->tif_clientdata, module,
			"stride %lu is not a multiple of sample count, "
			"%lu, data truncated.", (unsigned long) llen, (unsigned long) nsamples);
		nsamples -= nsamples % llen;
	}

	for (i = 0; i < nsamples; i += llen, up += llen) {
		switch (sp->user_datafmt)  {
		case PIXARLOGDATAFMT_FLOAT:
			horizontalAccumulateF(up, llen, sp->stride,
					(float *)op, sp->ToLinearF);
			op += llen * sizeof(float);
			break;
		case PIXARLOGDATAFMT_16BIT:
			horizontalAccumulate16(up, llen, sp->stride,
					(uint16 *)op, sp->ToLinear16);
			op += llen * sizeof(uint16);
			break;
		case PIXARLOGDATAFMT_12BITPICIO:
			horizontalAccumulate12(up, llen, sp->stride,
					(int16 *)op, sp->ToLinearF);
			op += llen * sizeof(int16);
			break;
		case PIXARLOGDATAFMT_11BITLOG:
			horizontalAccumulate11(up, llen, sp->stride,
					(uint16 *)op);
			op += llen * sizeof(uint16);
			break;
		case PIXARLOGDATAFMT_8BIT:
			horizontalAccumulate8(up, llen, sp->stride,
					(unsigned char *)op, sp->ToLinear8);
			op += llen * sizeof(unsigned char);
			break;
		case PIXARLOGDATAFMT_8BITABGR:
			horizontalAccumulate8abgr(up, llen, sp->stride,
					(unsigned char *)op, sp->ToLinear8);
			op += llen * sizeof(unsigned char);
			break;
		default:
			TIFFErrorExt(tif->tif_clientdata, module,
				  "Unsupported bits/sample: %d",
				  td->td_bitspersample);
			return (0);
		}
	}

	return (1);
}


void FormBody::Dump(std::ostream& os, const std::string& prefix) const {
  for (auto& part : parts_) {
    os << prefix << "--" << boundary_ << std::endl;
    part->Dump(os, prefix);
  }
  os << prefix << "--" << boundary_ << "--" << std::endl;
}


f_getcmdpos(typval_T *argvars UNUSED, typval_T *rettv)
{
    cmdline_info_T *p = get_ccline_ptr();

    rettv->vval.v_number = 0;
    if (p != NULL)
    rettv->vval.v_number = p->cmdpos + 1;
}


getFileTypeNoFollowSymlinks(const StaticString &filename) {
	struct stat buf;
	int ret;

	ret = lstat(filename.c_str(), &buf);
	if (ret == 0) {
		if (S_ISREG(buf.st_mode)) {
			return FT_REGULAR;
		} else if (S_ISDIR(buf.st_mode)) {
			return FT_DIRECTORY;
		} else if (S_ISLNK(buf.st_mode)) {
			return FT_SYMLINK;
		} else {
			return FT_OTHER;
		}
	} else {
		if (errno == ENOENT) {
			return FT_NONEXISTANT;
		} else {
			int e = errno;
			string message("Cannot lstat '");
			message.append(filename);
			message.append("'");
			throw FileSystemException(message, e, filename);
		}
	}
}


static int init_common_variables ( ) {
 umask ( ( ( ~ my_umask ) & 0666 ) ) ;
 my_decimal_set_zero ( & decimal_zero ) ;
 tzset ( ) ;
 sf_leaking_memory = 0 ;
 max_system_variables . pseudo_thread_id = ( ulong ) ~ 0 ;
 server_start_time = flush_status_time = my_time ( 0 ) ;
 my_disable_copystat_in_redel = 1 ;
 rpl_filter = new Rpl_filter ;
 binlog_filter = new Rpl_filter ;
 if ( ! rpl_filter || ! binlog_filter ) {
 sql_perror ( "Could not allocate replication and binlog filters" ) ;
 return 1 ;
 }
 if ( init_thread_environment ( ) || mysql_init_variables ( ) ) return 1 ;
 if ( ignore_db_dirs_init ( ) ) return 1 ;
 # ifdef HAVE_TZNAME struct tm tm_tmp ;
 localtime_r ( & server_start_time , & tm_tmp ) ;
 const char * tz_name = tzname [ tm_tmp . tm_isdst != 0 ? 1 : 0 ] ;
 # ifdef _WIN32 wchar_t wtz_name [ sizeof ( system_time_zone ) ] ;
 mbstowcs ( wtz_name , tz_name , sizeof ( system_time_zone ) - 1 ) ;
 WideCharToMultiByte ( CP_UTF8 , 0 , wtz_name , - 1 , system_time_zone , sizeof ( system_time_zone ) - 1 , NULL , NULL ) ;
 # else strmake_buf ( system_time_zone , tz_name ) ;
 # endif # endif global_system_variables . time_zone = my_tz_SYSTEM ;
 # ifdef HAVE_PSI_INTERFACE mysql_bin_log . set_psi_keys ( key_BINLOG_LOCK_index , key_BINLOG_update_cond , key_file_binlog , key_file_binlog_index , key_BINLOG_COND_queue_busy ) ;
 # endif mysql_bin_log . init_pthread_objects ( ) ;
 if ( ! IS_TIME_T_VALID_FOR_TIMESTAMP ( server_start_time ) ) {
 sql_print_error ( "This MySQL server doesn't support dates later then 2038" ) ;
 return 1 ;
 }
 if ( gethostname ( glob_hostname , sizeof ( glob_hostname ) ) < 0 ) {
 strmake ( glob_hostname , STRING_WITH_LEN ( "localhost" ) ) ;
 sql_print_warning ( "gethostname failed, using '%s' as hostname" , glob_hostname ) ;
 opt_log_basename = const_cast < char * > ( "mysql" ) ;
 }
 else opt_log_basename = glob_hostname ;
 if ( ! * pidfile_name ) {
 strmake ( pidfile_name , opt_log_basename , sizeof ( pidfile_name ) - 5 ) ;
 strmov ( fn_ext ( pidfile_name ) , ".pid" ) ;
 }
 # if defined ( WITH_INNOBASE_STORAGE_ENGINE ) || defined ( WITH_XTRADB_STORAGE_ENGINE ) default_storage_engine = const_cast < char * > ( "InnoDB" ) ;
 # else default_storage_engine = const_cast < char * > ( "MyISAM" ) ;
 # endif if ( add_status_vars ( status_vars ) ) return 1 ;
 # ifndef DBUG_OFF compile_time_assert ( sizeof ( com_status_vars ) / sizeof ( com_status_vars [ 0 ] ) - 1 == SQLCOM_END + 8 ) ;
 # endif if ( get_options ( & remaining_argc , & remaining_argv ) ) return 1 ;
 set_server_version ( ) ;
 if ( ! opt_help ) sql_print_information ( "%s (mysqld %s) starting as process %lu ..." , my_progname , server_version , ( ulong ) getpid ( ) ) ;
 # ifndef EMBEDDED_LIBRARY if ( opt_abort && ! opt_verbose ) unireg_abort ( 0 ) ;
 # endif DBUG_PRINT ( "info" , ( "%s Ver %s for %s on %s\n" , my_progname , server_version , SYSTEM_TYPE , MACHINE_TYPE ) ) ;
 # ifdef HAVE_LARGE_PAGES if ( opt_large_pages && ( opt_large_page_size = my_get_large_page_size ( ) ) ) {
 DBUG_PRINT ( "info" , ( "Large page set, large_page_size = %d" , opt_large_page_size ) ) ;
 my_use_large_pages = 1 ;
 my_large_page_size = opt_large_page_size ;
 }
 else {
 opt_large_pages = 0 ;
 }
 # endif # ifdef HAVE_SOLARIS_LARGE_PAGES # define LARGE_PAGESIZE ( 4 * 1024 * 1024 ) # define SUPER_LARGE_PAGESIZE ( 256 * 1024 * 1024 ) if ( opt_large_pages ) {
 int nelem ;
 size_t max_desired_page_size ;
 if ( opt_super_large_pages ) max_desired_page_size = SUPER_LARGE_PAGESIZE ;
 else max_desired_page_size = LARGE_PAGESIZE ;
 nelem = getpagesizes ( NULL , 0 ) ;
 if ( nelem > 0 ) {
 size_t * pagesize = ( size_t * ) malloc ( sizeof ( size_t ) * nelem ) ;
 if ( pagesize != NULL && getpagesizes ( pagesize , nelem ) > 0 ) {
 size_t max_page_size = 0 ;
 for ( int i = 0 ;
 i < nelem ;
 i ++ ) {
 if ( pagesize [ i ] > max_page_size && pagesize [ i ] <= max_desired_page_size ) max_page_size = pagesize [ i ] ;
 }
 free ( pagesize ) ;
 if ( max_page_size > 0 ) {
 struct memcntl_mha mpss ;
 mpss . mha_cmd = MHA_MAPSIZE_BSSBRK ;
 mpss . mha_pagesize = max_page_size ;
 mpss . mha_flags = 0 ;
 memcntl ( NULL , 0 , MC_HAT_ADVISE , ( caddr_t ) & mpss , 0 , 0 ) ;
 mpss . mha_cmd = MHA_MAPSIZE_STACK ;
 memcntl ( NULL , 0 , MC_HAT_ADVISE , ( caddr_t ) & mpss , 0 , 0 ) ;
 }
 }
 }
 }
 # endif {
 uint files , wanted_files , max_open_files ;
 wanted_files = ( 10 + max_connections + extra_max_connections + table_cache_size * 2 ) ;
 max_open_files = max ( max ( wanted_files , ( max_connections + extra_max_connections ) * 5 ) , open_files_limit ) ;
 files = my_set_max_open_files ( max_open_files ) ;
 if ( files < wanted_files ) {
 if ( ! open_files_limit ) {
 max_connections = ( ulong ) min ( files - 10 - TABLE_OPEN_CACHE_MIN * 2 , max_connections ) ;
 table_cache_size = ( ulong ) min ( max ( ( files - 10 - max_connections ) / 2 , TABLE_OPEN_CACHE_MIN ) , table_cache_size ) ;
 DBUG_PRINT ( "warning" , ( "Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld" , files , max_connections , table_cache_size ) ) ;
 if ( global_system_variables . log_warnings ) sql_print_warning ( "Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld" , files , max_connections , table_cache_size ) ;
 }
 else if ( global_system_variables . log_warnings ) sql_print_warning ( "Could not increase number of max_open_files to more than %u (request: %u)" , files , wanted_files ) ;
 }
 open_files_limit = files ;
 }
 unireg_init ( opt_specialflag ) ;
 if ( ! ( my_default_lc_messages = my_locale_by_name ( lc_messages ) ) ) {
 sql_print_error ( "Unknown locale: '%s'" , lc_messages ) ;
 return 1 ;
 }
 global_system_variables . lc_messages = my_default_lc_messages ;
 if ( init_errmessage ( ) ) return 1 ;
 init_client_errs ( ) ;
 mysql_library_init ( unused , unused , unused ) ;
 lex_init ( ) ;
 if ( item_create_init ( ) ) return 1 ;
 item_init ( ) ;
 # ifndef EMBEDDED_LIBRARY my_regex_init ( & my_charset_latin1 , check_enough_stack_size ) ;
 my_string_stack_guard = check_enough_stack_size ;
 # else my_regex_init ( & my_charset_latin1 , NULL ) ;
 # endif for ( ;
 ;
 ) {
 char * next_character_set_name = strchr ( default_character_set_name , ',' ) ;
 if ( next_character_set_name ) * next_character_set_name ++ = '\0' ;
 if ( ! ( default_charset_info = get_charset_by_csname ( default_character_set_name , MY_CS_PRIMARY , MYF ( MY_WME ) ) ) ) {
 if ( next_character_set_name ) {
 default_character_set_name = next_character_set_name ;
 default_collation_name = 0 ;
 }
 else return 1 ;
 }
 else break ;
 }
 if ( default_collation_name ) {
 CHARSET_INFO * default_collation ;
 default_collation = get_charset_by_name ( default_collation_name , MYF ( 0 ) ) ;
 if ( ! default_collation ) {
 sql_print_error ( ER_DEFAULT ( ER_UNKNOWN_COLLATION ) , default_collation_name ) ;
 return 1 ;
 }
 if ( ! my_charset_same ( default_charset_info , default_collation ) ) {
 sql_print_error ( ER_DEFAULT ( ER_COLLATION_CHARSET_MISMATCH ) , default_collation_name , default_charset_info -> csname ) ;
 return 1 ;
 }
 default_charset_info = default_collation ;
 }
 global_system_variables . collation_server = default_charset_info ;
 global_system_variables . collation_database = default_charset_info ;
 global_system_variables . collation_connection = default_charset_info ;
 global_system_variables . character_set_results = default_charset_info ;
 global_system_variables . character_set_client = default_charset_info ;
 if ( ! ( character_set_filesystem = get_charset_by_csname ( character_set_filesystem_name , MY_CS_PRIMARY , MYF ( MY_WME ) ) ) ) return 1 ;
 global_system_variables . character_set_filesystem = character_set_filesystem ;
 if ( ! ( my_default_lc_time_names = my_locale_by_name ( lc_time_names_name ) ) ) {
 sql_print_error ( "Unknown locale: '%s'" , lc_time_names_name ) ;
 return 1 ;
 }
 global_system_variables . lc_time_names = my_default_lc_time_names ;
 if ( opt_log && opt_logname && * opt_logname && ! ( log_output_options & ( LOG_FILE | LOG_NONE ) ) ) sql_print_warning ( "Although a path was specified for the " "--log option, log tables are used. " "To enable logging to files use the --log-output option." ) ;
 if ( opt_slow_log && opt_slow_logname && * opt_slow_logname && ! ( log_output_options & ( LOG_FILE | LOG_NONE ) ) ) sql_print_warning ( "Although a path was specified for the " "--log-slow-queries option, log tables are used. " "To enable logging to files use the --log-output=file option." ) ;
 if ( ! opt_logname || ! * opt_logname ) make_default_log_name ( & opt_logname , ".log" , false ) ;
 if ( ! opt_slow_logname || ! * opt_slow_logname ) make_default_log_name ( & opt_slow_logname , "-slow.log" , false ) ;
 # if defined ( ENABLED_DEBUG_SYNC ) if ( debug_sync_init ( ) ) return 1 ;
 # endif # if ( ENABLE_TEMP_POOL ) if ( use_temp_pool && bitmap_init ( & temp_pool , 0 , 1024 , 1 ) ) return 1 ;
 # else use_temp_pool = 0 ;
 # endif if ( my_dboptions_cache_init ( ) ) return 1 ;
 DBUG_PRINT ( "info" , ( "lower_case_table_names: %d" , lower_case_table_names ) ) ;
 lower_case_file_system = test_if_case_insensitive ( mysql_real_data_home ) ;
 if ( ! lower_case_table_names && lower_case_file_system == 1 ) {
 if ( lower_case_table_names_used ) {
 # if MYSQL_VERSION_ID < 100100 if ( global_system_variables . log_warnings ) sql_print_warning ( "You have forced lower_case_table_names to 0 through " "a command-line option, even though your file system " "'%s' is case insensitive. This means that you can " "corrupt your tables if you access them using names " "with different letter case. You should consider " "changing lower_case_table_names to 1 or 2" , mysql_real_data_home ) ;
 # else sql_print_error ( "The server option 'lower_case_table_names' is " "configured to use case sensitive table names but the " "data directory resides on a case-insensitive file system. " "Please use a case sensitive file system for your data " "directory or switch to a case-insensitive table name " "mode." ) ;
 # endif return 1 ;
 }
 else {
 if ( global_system_variables . log_warnings ) sql_print_warning ( "Setting lower_case_table_names=2 because file system for %s is case insensitive" , mysql_real_data_home ) ;
 lower_case_table_names = 2 ;
 }
 }
 else if ( lower_case_table_names == 2 && ! ( lower_case_file_system = ( lower_case_file_system == 1 ) ) ) {
 if ( global_system_variables . log_warnings ) sql_print_warning ( "lower_case_table_names was set to 2, even though your " "the file system '%s' is case sensitive. Now setting " "lower_case_table_names to 0 to avoid future problems." , mysql_real_data_home ) ;
 lower_case_table_names = 0 ;
 }
 else {
 lower_case_file_system = ( lower_case_file_system == 1 ) ;
 }
 table_alias_charset = ( lower_case_table_names ? files_charset_info : & my_charset_bin ) ;
 if ( ignore_db_dirs_process_additions ( ) ) {
 sql_print_error ( "An error occurred while storing ignore_db_dirs to a hash." ) ;
 return 1 ;
 }
 return 0 ;
 }


static int stp_print_mstp_bpdu ( netdissect_options * ndo , const struct stp_bpdu_ * stp_bpdu , u_int length ) {
 const u_char * ptr ;
 uint16_t v3len ;
 uint16_t len ;
 uint16_t msti ;
 u_int offset ;
 ptr = ( const u_char * ) stp_bpdu ;
 ND_PRINT ( ( ndo , ", CIST Flags [%s], length %u" , bittok2str ( stp_bpdu_flag_values , "none" , stp_bpdu -> flags ) , length ) ) ;
 if ( ! ndo -> ndo_vflag ) {
 return 1 ;
 }
 ND_TCHECK ( stp_bpdu -> flags ) ;
 ND_PRINT ( ( ndo , "\n\tport-role %s, " , tok2str ( rstp_obj_port_role_values , "Unknown" , RSTP_EXTRACT_PORT_ROLE ( stp_bpdu -> flags ) ) ) ) ;
 ND_TCHECK ( stp_bpdu -> root_path_cost ) ;
 ND_PRINT ( ( ndo , "CIST root-id %s, CIST ext-pathcost %u" , stp_print_bridge_id ( ( const u_char * ) & stp_bpdu -> root_id ) , EXTRACT_32BITS ( & stp_bpdu -> root_path_cost ) ) ) ;
 ND_TCHECK ( stp_bpdu -> bridge_id ) ;
 ND_PRINT ( ( ndo , "\n\tCIST regional-root-id %s, " , stp_print_bridge_id ( ( const u_char * ) & stp_bpdu -> bridge_id ) ) ) ;
 ND_TCHECK ( stp_bpdu -> port_id ) ;
 ND_PRINT ( ( ndo , "CIST port-id %04x," , EXTRACT_16BITS ( & stp_bpdu -> port_id ) ) ) ;
 ND_TCHECK ( stp_bpdu -> forward_delay ) ;
 ND_PRINT ( ( ndo , "\n\tmessage-age %.2fs, max-age %.2fs" ", hello-time %.2fs, forwarding-delay %.2fs" , ( float ) EXTRACT_16BITS ( & stp_bpdu -> message_age ) / STP_TIME_BASE , ( float ) EXTRACT_16BITS ( & stp_bpdu -> max_age ) / STP_TIME_BASE , ( float ) EXTRACT_16BITS ( & stp_bpdu -> hello_time ) / STP_TIME_BASE , ( float ) EXTRACT_16BITS ( & stp_bpdu -> forward_delay ) / STP_TIME_BASE ) ) ;
 ND_TCHECK_16BITS ( ptr + MST_BPDU_VER3_LEN_OFFSET ) ;
 ND_PRINT ( ( ndo , "\n\tv3len %d, " , EXTRACT_16BITS ( ptr + MST_BPDU_VER3_LEN_OFFSET ) ) ) ;
 ND_TCHECK_32BITS ( ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12 ) ;
 ND_PRINT ( ( ndo , "MCID Name " ) ) ;
 if ( fn_printzp ( ndo , ptr + MST_BPDU_CONFIG_NAME_OFFSET , 32 , ndo -> ndo_snapend ) ) goto trunc ;
 ND_PRINT ( ( ndo , ", rev %u," "\n\t\tdigest %08x%08x%08x%08x, " , EXTRACT_16BITS ( ptr + MST_BPDU_CONFIG_NAME_OFFSET + 32 ) , EXTRACT_32BITS ( ptr + MST_BPDU_CONFIG_DIGEST_OFFSET ) , EXTRACT_32BITS ( ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 4 ) , EXTRACT_32BITS ( ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8 ) , EXTRACT_32BITS ( ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12 ) ) ) ;
 ND_TCHECK_32BITS ( ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET ) ;
 ND_PRINT ( ( ndo , "CIST int-root-pathcost %u," , EXTRACT_32BITS ( ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET ) ) ) ;
 ND_TCHECK_BRIDGE_ID ( ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET ) ;
 ND_PRINT ( ( ndo , "\n\tCIST bridge-id %s, " , stp_print_bridge_id ( ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET ) ) ) ;
 ND_TCHECK ( ptr [ MST_BPDU_CIST_REMAIN_HOPS_OFFSET ] ) ;
 ND_PRINT ( ( ndo , "CIST remaining-hops %d" , ptr [ MST_BPDU_CIST_REMAIN_HOPS_OFFSET ] ) ) ;
 ND_TCHECK_16BITS ( ptr + MST_BPDU_VER3_LEN_OFFSET ) ;
 v3len = EXTRACT_16BITS ( ptr + MST_BPDU_VER3_LEN_OFFSET ) ;
 if ( v3len > MST_BPDU_CONFIG_INFO_LENGTH ) {
 len = v3len - MST_BPDU_CONFIG_INFO_LENGTH ;
 offset = MST_BPDU_MSTI_OFFSET ;
 while ( len >= MST_BPDU_MSTI_LENGTH ) {
 ND_TCHECK2 ( * ( ptr + offset ) , MST_BPDU_MSTI_LENGTH ) ;
 msti = EXTRACT_16BITS ( ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET ) ;
 msti = msti & 0x0FFF ;
 ND_PRINT ( ( ndo , "\n\tMSTI %d, Flags [%s], port-role %s" , msti , bittok2str ( stp_bpdu_flag_values , "none" , ptr [ offset ] ) , tok2str ( rstp_obj_port_role_values , "Unknown" , RSTP_EXTRACT_PORT_ROLE ( ptr [ offset ] ) ) ) ) ;
 ND_PRINT ( ( ndo , "\n\t\tMSTI regional-root-id %s, pathcost %u" , stp_print_bridge_id ( ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET ) , EXTRACT_32BITS ( ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET ) ) ) ;
 ND_PRINT ( ( ndo , "\n\t\tMSTI bridge-prio %d, port-prio %d, hops %d" , ptr [ offset + MST_BPDU_MSTI_BRIDGE_PRIO_OFFSET ] >> 4 , ptr [ offset + MST_BPDU_MSTI_PORT_PRIO_OFFSET ] >> 4 , ptr [ offset + MST_BPDU_MSTI_REMAIN_HOPS_OFFSET ] ) ) ;
 len -= MST_BPDU_MSTI_LENGTH ;
 offset += MST_BPDU_MSTI_LENGTH ;
 }
 }
 return 1 ;
 trunc : return 0 ;
 }


void Part::slotTestArchive()
{
    TestJob *job = m_model->archive()->testArchive();
    if (!job) {
        return;
    }
    registerJob(job);
    connect(job, &KJob::result, this, &Part::slotTestingDone);
    job->start();
}


void MutableGraphView::UpdateMaxRegularOutputPortForRemovedFanin(
    const OutputPort& fanin,
    const absl::flat_hash_set<InputPort>& fanin_fanouts) {
  int max_port = max_regular_output_port()[fanin.node];
  if (!fanin_fanouts.empty() || max_port != fanin.port_id) {
    return;
  }
  bool updated_max_port = false;
  for (int i = fanin.port_id - 1; i >= 0; --i) {
    OutputPort fanin_port(fanin.node, i);
    if (!fanouts()[fanin_port].empty()) {
      max_regular_output_port()[fanin.node] = i;
      updated_max_port = true;
      break;
    }
  }
  if (!updated_max_port) {
    max_regular_output_port().erase(fanin.node);
  }
}


struct ImapStatus *imap_mboxcache_get(struct ImapData *idata, const char *mbox, bool create)
{
  struct ImapStatus *status = NULL;
#ifdef USE_HCACHE
  header_cache_t *hc = NULL;
  void *uidvalidity = NULL;
  void *uidnext = NULL;
#endif

  struct ListNode *np;
  STAILQ_FOREACH(np, &idata->mboxcache, entries)
  {
    status = (struct ImapStatus *) np->data;

    if (imap_mxcmp(mbox, status->name) == 0)
      return status;
  }
  status = NULL;

  /* lame */
  if (create)
  {
    struct ImapStatus *scache = mutt_mem_calloc(1, sizeof(struct ImapStatus));
    scache->name = (char *) mbox;
    mutt_list_insert_tail(&idata->mboxcache, (char *) scache);
    status = imap_mboxcache_get(idata, mbox, 0);
    status->name = mutt_str_strdup(mbox);
  }

#ifdef USE_HCACHE
  hc = imap_hcache_open(idata, mbox);
  if (hc)
  {
    uidvalidity = mutt_hcache_fetch_raw(hc, "/UIDVALIDITY", 12);
    uidnext = mutt_hcache_fetch_raw(hc, "/UIDNEXT", 8);
    if (uidvalidity)
    {
      if (!status)
      {
        mutt_hcache_free(hc, &uidvalidity);
        mutt_hcache_free(hc, &uidnext);
        mutt_hcache_close(hc);
        return imap_mboxcache_get(idata, mbox, 1);
      }
      status->uidvalidity = *(unsigned int *) uidvalidity;
      status->uidnext = uidnext ? *(unsigned int *) uidnext : 0;
      mutt_debug(3, "hcache uidvalidity %u, uidnext %u\n", status->uidvalidity,
                 status->uidnext);
    }
    mutt_hcache_free(hc, &uidvalidity);
    mutt_hcache_free(hc, &uidnext);
    mutt_hcache_close(hc);
  }
#endif

  return status;
}


static int jpc_dec_process_eoc(jpc_dec_t *dec, jpc_ms_t *ms)
{
	int tileno;
	jpc_dec_tile_t *tile;

	/* Eliminate compiler warnings about unused variables. */
	ms = 0;

	for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno,
	  ++tile) {
		if (tile->state == JPC_TILE_ACTIVE) {
			if (jpc_dec_tiledecode(dec, tile)) {
				return -1;
			}
		}
		/* If the tile has not yet been finalized, finalize it. */
		// OLD CODE: jpc_dec_tilefini(dec, tile);
		if (tile->state != JPC_TILE_DONE) {
			jpc_dec_tilefini(dec, tile);
		}
	}

	/* We are done processing the code stream. */
	dec->state = JPC_MT;

	return 1;
}


static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *request)
{
	struct inode *inode = state->inode;
	struct nfs_server *server = NFS_SERVER(inode);
	struct nfs_client *clp = server->nfs_client;
	struct nfs_lockt_args arg = {
		.fh = NFS_FH(inode),
		.fl = request,
	};
	struct nfs_lockt_res res = {
		.denied = request,
	};
	struct rpc_message msg = {
		.rpc_proc	= &nfs4_procedures[NFSPROC4_CLNT_LOCKT],
		.rpc_argp       = &arg,
		.rpc_resp       = &res,
		.rpc_cred	= state->owner->so_cred,
	};
	struct nfs4_lock_state *lsp;
	int status;

	arg.lock_owner.clientid = clp->cl_clientid;
	status = nfs4_set_lock_state(state, request);
	if (status != 0)
		goto out;
	lsp = request->fl_u.nfs4_fl.owner;
	arg.lock_owner.id = lsp->ls_seqid.owner_id;
	arg.lock_owner.s_dev = server->s_dev;
	status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
	switch (status) {
		case 0:
			request->fl_type = F_UNLCK;
			break;
		case -NFS4ERR_DENIED:
			status = 0;
	}
	request->fl_ops->fl_release_private(request);
out:
	return status;
}


static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
		struct nfsd3_accessargs *argp)
{
	p = nfs2svc_decode_fh(p, &argp->fh);
	if (!p)
		return 0;
	argp->access = ntohl(*p++);

	return xdr_argsize_check(rqstp, p);
}


bool CudnnSupport::DoPoolForward(
    Stream* stream, const dnn::PoolingDescriptor& pooling_dimensions,
    const dnn::BatchDescriptor& input_dimensions,
    const DeviceMemory<double>& input_data,
    const dnn::BatchDescriptor& output_dimensions,
    DeviceMemory<double>* output_data, ScratchAllocator* workspace_allocator) {
  // Alpha is the scaling factor for input.
  double alpha = 1.0;
  // Beta is the scaling factor for output.
  double beta = 0.0;

  CudnnTensorDescriptor src_desc(input_dimensions, CUDNN_DATA_DOUBLE);
  CudnnTensorDescriptor dest_desc(output_dimensions, CUDNN_DATA_DOUBLE);
  CudnnPoolingDescriptor pooling_desc(pooling_dimensions);

  auto cudnn = cudnn_->GetHandle(parent_, stream);
  const auto status = [&] {
    RETURN_IF_CUDNN_ERROR(cudnnPoolingForward(
        cudnn.handle(), pooling_desc.handle(), &alpha, src_desc.handle(),
        input_data.opaque(), &beta, dest_desc.handle(), output_data->opaque()));
    return port::Status::OK();
  }();
  return IsStatusOk(status, /*report_error=*/true);
}


static void process_smi_save_seg_64(struct kvm_vcpu *vcpu, char *buf, int n)
{
	struct kvm_segment seg;
	int offset;
	u16 flags;

	kvm_get_segment(vcpu, &seg, n);
	offset = 0x7e00 + n * 16;

	flags = process_smi_get_segment_flags(&seg) >> 8;
	put_smstate(u16, buf, offset, seg.selector);
	put_smstate(u16, buf, offset + 2, flags);
	put_smstate(u32, buf, offset + 4, seg.limit);
	put_smstate(u64, buf, offset + 8, seg.base);
}


void object_property_add_alias(Object *obj, const char *name,

                               Object *target_obj, const char *target_name,

                               Error **errp)

{

    AliasProperty *prop;

    ObjectProperty *target_prop;

    target_prop = object_property_find(target_obj, target_name, errp);

    if (!target_prop) {

        return;

    }

    prop = g_malloc(sizeof(*prop));

    prop->target_obj = target_obj;

    prop->target_name = target_name;

    object_property_add(obj, name, target_prop->type,

                        property_get_alias,

                        property_set_alias,

                        property_release_alias,

                        prop, errp);

}


void Range::setEndAfter(Node* refNode, ExceptionCode& ec)
{
    if (!m_start.container()) {
        ec = INVALID_STATE_ERR;
        return;
    }

    if (!refNode) {
        ec = NOT_FOUND_ERR;
        return;
    }

    if (refNode->document() != m_ownerDocument) {
        ec = WRONG_DOCUMENT_ERR;
        return;
    }

    ec = 0;
    checkNodeBA(refNode, ec);
    if (ec)
        return;

    setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, ec);

}


static void nelly_decode_block ( NellyMoserDecodeContext * s , const unsigned char block [ NELLY_BLOCK_LEN ] , float audio [ NELLY_SAMPLES ] ) {
 int i , j ;
 float buf [ NELLY_FILL_LEN ] , pows [ NELLY_FILL_LEN ] ;
 float * aptr , * bptr , * pptr , val , pval ;
 int bits [ NELLY_BUF_LEN ] ;
 unsigned char v ;
 init_get_bits ( & s -> gb , block , NELLY_BLOCK_LEN * 8 ) ;
 bptr = buf ;
 pptr = pows ;
 val = ff_nelly_init_table [ get_bits ( & s -> gb , 6 ) ] ;
 for ( i = 0 ;
 i < NELLY_BANDS ;
 i ++ ) {
 if ( i > 0 ) val += ff_nelly_delta_table [ get_bits ( & s -> gb , 5 ) ] ;
 pval = - pow ( 2 , val / 2048 ) * s -> scale_bias ;
 for ( j = 0 ;
 j < ff_nelly_band_sizes_table [ i ] ;
 j ++ ) {
 * bptr ++ = val ;
 * pptr ++ = pval ;
 }
 }
 ff_nelly_get_sample_bits ( buf , bits ) ;
 for ( i = 0 ;
 i < 2 ;
 i ++ ) {
 aptr = audio + i * NELLY_BUF_LEN ;
 init_get_bits ( & s -> gb , block , NELLY_BLOCK_LEN * 8 ) ;
 skip_bits_long ( & s -> gb , NELLY_HEADER_BITS + i * NELLY_DETAIL_BITS ) ;
 for ( j = 0 ;
 j < NELLY_FILL_LEN ;
 j ++ ) {
 if ( bits [ j ] <= 0 ) {
 aptr [ j ] = M_SQRT1_2 * pows [ j ] ;
 if ( av_lfg_get ( & s -> random_state ) & 1 ) aptr [ j ] *= - 1.0 ;
 }
 else {
 v = get_bits ( & s -> gb , bits [ j ] ) ;
 aptr [ j ] = ff_nelly_dequantization_table [ ( 1 << bits [ j ] ) - 1 + v ] * pows [ j ] ;
 }
 }
 memset ( & aptr [ NELLY_FILL_LEN ] , 0 , ( NELLY_BUF_LEN - NELLY_FILL_LEN ) * sizeof ( float ) ) ;
 s -> imdct_ctx . imdct_half ( & s -> imdct_ctx , s -> imdct_out , aptr ) ;
 s -> fdsp . vector_fmul_window ( aptr , s -> imdct_prev + NELLY_BUF_LEN / 2 , s -> imdct_out , ff_sine_128 , NELLY_BUF_LEN / 2 ) ;
 FFSWAP ( float * , s -> imdct_out , s -> imdct_prev ) ;
 }
 }


TfLiteDelegate* get_tf_lite_delegate() { return &delegate_; }


static void udp_v6_rehash(struct sock *sk)
{
	u16 new_hash = udp6_portaddr_hash(sock_net(sk),
					  &sk->sk_v6_rcv_saddr,
					  inet_sk(sk)->inet_num);

	udp_lib_rehash(sk, new_hash);
}


static char * __cvt(double value, int ndigit, int *decpt, int *sign,
                    int fmode, int pad) {
  register char *s = nullptr;
  char *p, *rve, c;
  size_t siz;

  if (ndigit < 0) {
    siz = -ndigit + 1;
  } else {
    siz = ndigit + 1;
  }

  /* __dtoa() doesn't allocate space for 0 so we do it by hand */
  if (value == 0.0) {
    *decpt = 1 - fmode; /* 1 for 'e', 0 for 'f' */
    *sign = 0;
    if ((rve = s = (char *)malloc(ndigit?siz:2)) == nullptr) {
      return(nullptr);
    }
    *rve++ = '0';
    *rve = '\0';
    if (!ndigit) {
      return(s);
    }
  } else {
    p = zend_dtoa(value, fmode + 2, ndigit, decpt, sign, &rve);
    if (*decpt == 9999) {
      /* Infinity or Nan, convert to inf or nan like printf */
      *decpt = 0;
      c = *p;
      zend_freedtoa(p);
      return strdup(c == 'I' ? "INF" : "NAN");
    }
    /* Make a local copy and adjust rve to be in terms of s */
    if (pad && fmode) {
      siz += *decpt;
    }
    if ((s = (char *)malloc(siz+1)) == nullptr) {
      zend_freedtoa(p);
      return(nullptr);
    }
    (void)string_copy(s, p, siz);
    rve = s + (rve - p);
    zend_freedtoa(p);
  }

  /* Add trailing zeros */
  if (pad) {
    siz -= rve - s;
    while (--siz) {
      *rve++ = '0';
    }
    *rve = '\0';
  }

  return(s);
}


static int task_switch_16(struct x86_emulate_ctxt *ctxt,
			  u16 tss_selector, u16 old_tss_sel,
			  ulong old_tss_base, struct desc_struct *new_desc)
{
	const struct x86_emulate_ops *ops = ctxt->ops;
	struct tss_segment_16 tss_seg;
	int ret;
	u32 new_tss_base = get_desc_base(new_desc);

	ret = ops->read_std(ctxt, old_tss_base, &tss_seg, sizeof tss_seg,
			    &ctxt->exception);
	if (ret != X86EMUL_CONTINUE)
		return ret;

	save_state_to_tss16(ctxt, &tss_seg);

	ret = ops->write_std(ctxt, old_tss_base, &tss_seg, sizeof tss_seg,
			     &ctxt->exception);
	if (ret != X86EMUL_CONTINUE)
		return ret;

	ret = ops->read_std(ctxt, new_tss_base, &tss_seg, sizeof tss_seg,
			    &ctxt->exception);
	if (ret != X86EMUL_CONTINUE)
		return ret;

	if (old_tss_sel != 0xffff) {
		tss_seg.prev_task_link = old_tss_sel;

		ret = ops->write_std(ctxt, new_tss_base,
				     &tss_seg.prev_task_link,
				     sizeof tss_seg.prev_task_link,
				     &ctxt->exception);
		if (ret != X86EMUL_CONTINUE)
			return ret;
	}

	return load_state_from_tss16(ctxt, &tss_seg);
}


char **FS_ListFilteredFiles( const char *path, const char *extension, char *filter, int *numfiles ) {
	int				nfiles;
	char			**listCopy;
	char			*list[MAX_FOUND_FILES];
	searchpath_t	*search;
	int				i;
	int				pathLength;
	int				extensionLength;
	int				length, pathDepth, temp;
	pack_t			*pak;
	fileInPack_t	*buildBuffer;
	char			zpath[MAX_ZPATH];

	if ( !fs_searchpaths ) {
		Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
	}

	if ( !path ) {
		*numfiles = 0;
		return NULL;
	}
	if ( !extension ) {
		extension = "";
	}

	pathLength = strlen( path );
	if ( path[pathLength-1] == '\\' || path[pathLength-1] == '/' ) {
		pathLength--;
	}
	extensionLength = strlen( extension );
	nfiles = 0;
	FS_ReturnPath(path, zpath, &pathDepth);

	//
	// search through the path, one element at a time, adding to list
	//
	for (search = fs_searchpaths ; search ; search = search->next) {
		// is the element a pak file?
		if (search->pack) {

			//ZOID:  If we are pure, don't search for files on paks that
			// aren't on the pure list
			if ( !FS_PakIsPure(search->pack) ) {
				continue;
			}

			// look through all the pak file elements
			pak = search->pack;
			buildBuffer = pak->buildBuffer;
			for (i = 0; i < pak->numfiles; i++) {
				char	*name;
				int		zpathLen, depth;

				// check for directory match
				name = buildBuffer[i].name;
				//
				if (filter) {
					// case insensitive
					if (!Com_FilterPath( filter, name, qfalse ))
						continue;
					// unique the match
					nfiles = FS_AddFileToList( name, list, nfiles );
				}
				else {

					zpathLen = FS_ReturnPath(name, zpath, &depth);

					if ( (depth-pathDepth)>2 || pathLength > zpathLen || Q_stricmpn( name, path, pathLength ) ) {
						continue;
					}

					// check for extension match
					length = strlen( name );
					if ( length < extensionLength ) {
						continue;
					}

					if ( Q_stricmp( name + length - extensionLength, extension ) ) {
						continue;
					}
					// unique the match

					temp = pathLength;
					if (pathLength) {
						temp++;		// include the '/'
					}
					nfiles = FS_AddFileToList( name + temp, list, nfiles );
				}
			}
		} else if (search->dir) { // scan for files in the filesystem
			char	*netpath;
			int		numSysFiles;
			char	**sysFiles;
			char	*name;

			// don't scan directories for files if we are pure or restricted
			if ( fs_numServerPaks &&
				 (!extension || Q_stricmp(extension, "fcf")) )
			{
				//rww - allow scanning for fcf files outside of pak even if pure
			    continue;
		    }
			else
			{
				netpath = FS_BuildOSPath( search->dir->path, search->dir->gamedir, path );
				sysFiles = Sys_ListFiles( netpath, extension, filter, &numSysFiles, qfalse );
				for ( i = 0 ; i < numSysFiles ; i++ ) {
					// unique the match
					name = sysFiles[i];
					nfiles = FS_AddFileToList( name, list, nfiles );
				}
				Sys_FreeFileList( sysFiles );
			}
		}
	}

	// return a copy of the list
	*numfiles = nfiles;

	if ( !nfiles ) {
		return NULL;
	}

	listCopy = (char **)Z_Malloc( ( nfiles + 1 ) * sizeof( *listCopy ), TAG_FILESYS );
	for ( i = 0 ; i < nfiles ; i++ ) {
		listCopy[i] = list[i];
	}
	listCopy[i] = NULL;

	return listCopy;
}


	__releases(&send_cq->lock) __releases(&recv_cq->lock)
{
	if (send_cq) {
		if (recv_cq) {
			if (send_cq->mcq.cqn < recv_cq->mcq.cqn)  {
				spin_unlock(&recv_cq->lock);
				spin_unlock(&send_cq->lock);
			} else if (send_cq->mcq.cqn == recv_cq->mcq.cqn) {
				__release(&recv_cq->lock);
				spin_unlock(&send_cq->lock);
			} else {
				spin_unlock(&send_cq->lock);
				spin_unlock(&recv_cq->lock);
			}
		} else {
			__release(&recv_cq->lock);
			spin_unlock(&send_cq->lock);
		}
	} else if (recv_cq) {
		__release(&send_cq->lock);
		spin_unlock(&recv_cq->lock);
	} else {
		__release(&recv_cq->lock);
		__release(&send_cq->lock);
	}
}


static void ppc6xx_set_irq (void *opaque, int pin, int level)

{

    CPUState *env = opaque;

    int cur_level;

#if defined(PPC_DEBUG_IRQ)

    if (loglevel & CPU_LOG_INT) {

        fprintf(logfile, "%s: env %p pin %d level %d\n", __func__,

                env, pin, level);

    }

#endif

    cur_level = (env->irq_input_state >> pin) & 1;

    /* Don't generate spurious events */

    if ((cur_level == 1 && level == 0) || (cur_level == 0 && level != 0)) {

        switch (pin) {

        case PPC6xx_INPUT_INT:

            /* Level sensitive - active high */

#if defined(PPC_DEBUG_IRQ)

            if (loglevel & CPU_LOG_INT) {

                fprintf(logfile, "%s: set the external IRQ state to %d\n",

                        __func__, level);

            }

#endif

            ppc_set_irq(env, PPC_INTERRUPT_EXT, level);

            break;

        case PPC6xx_INPUT_SMI:

            /* Level sensitive - active high */

#if defined(PPC_DEBUG_IRQ)

            if (loglevel & CPU_LOG_INT) {

                fprintf(logfile, "%s: set the SMI IRQ state to %d\n",

                        __func__, level);

            }

#endif

            ppc_set_irq(env, PPC_INTERRUPT_SMI, level);

            break;

        case PPC6xx_INPUT_MCP:

            /* Negative edge sensitive */

            /* XXX: TODO: actual reaction may depends on HID0 status

             *            603/604/740/750: check HID0[EMCP]

             */

            if (cur_level == 1 && level == 0) {

#if defined(PPC_DEBUG_IRQ)

                if (loglevel & CPU_LOG_INT) {

                    fprintf(logfile, "%s: raise machine check state\n",

                            __func__);

                }

#endif

                ppc_set_irq(env, PPC_INTERRUPT_MCK, 1);

            }

            break;

        case PPC6xx_INPUT_CKSTP_IN:

            /* Level sensitive - active low */

            /* XXX: TODO: relay the signal to CKSTP_OUT pin */

            if (level) {

#if defined(PPC_DEBUG_IRQ)

                if (loglevel & CPU_LOG_INT) {

                    fprintf(logfile, "%s: stop the CPU\n", __func__);

                }

#endif

                env->halted = 1;

            } else {

#if defined(PPC_DEBUG_IRQ)

                if (loglevel & CPU_LOG_INT) {

                    fprintf(logfile, "%s: restart the CPU\n", __func__);

                }

#endif

                env->halted = 0;

            }

            break;

        case PPC6xx_INPUT_HRESET:

            /* Level sensitive - active low */

            if (level) {

#if 0 // XXX: TOFIX

#if defined(PPC_DEBUG_IRQ)

                if (loglevel & CPU_LOG_INT) {

                    fprintf(logfile, "%s: reset the CPU\n", __func__);

                }

#endif

                cpu_reset(env);

#endif

            }

            break;

        case PPC6xx_INPUT_SRESET:

#if defined(PPC_DEBUG_IRQ)

            if (loglevel & CPU_LOG_INT) {

                fprintf(logfile, "%s: set the RESET IRQ state to %d\n",

                        __func__, level);

            }

#endif

            ppc_set_irq(env, PPC_INTERRUPT_RESET, level);

            break;

        default:

            /* Unknown pin - do nothing */

#if defined(PPC_DEBUG_IRQ)

            if (loglevel & CPU_LOG_INT) {

                fprintf(logfile, "%s: unknown IRQ pin %d\n", __func__, pin);

            }

#endif

            return;

        }

        if (level)

            env->irq_input_state |= 1 << pin;

        else

            env->irq_input_state &= ~(1 << pin);

    }

}


Browser* InlineLoginHandlerImpl::GetDesktopBrowser() {
  Browser* browser = chrome::FindBrowserWithWebContents(
      web_ui()->GetWebContents());
  if (!browser)
    browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui()));
  return browser;
}


QDeclarativeComponent* QQuickWebViewExperimental::proxyAuthenticationDialog() const
{
    Q_D(const QQuickWebView);
    return d->proxyAuthenticationDialog;
}


RenderBlockFlow::RenderBlockFlow(ContainerNode* node)
    : RenderBlock(node)
{
    COMPILE_ASSERT(sizeof(MarginInfo) == sizeof(SameSizeAsMarginInfo), MarginInfo_should_stay_small);
}


int ratestrtosize ( char * s , uint_fast32_t rawsize , uint_fast32_t * size ) {
 jpc_flt_t f ;
 if ( strchr ( s , 'B' ) ) {
 * size = atoi ( s ) ;
 }
 else {
 f = atof ( s ) ;
 if ( f < 0 ) {
 * size = 0 ;
 }
 else if ( f > 1.0 ) {
 * size = rawsize + 1 ;
 }
 else {
 * size = f * rawsize ;
 }
 }
 return 0 ;
 }


static void __init trace_eval_init(void)
{
	int len;

	len = __stop_ftrace_eval_maps - __start_ftrace_eval_maps;
	trace_insert_eval_map(NULL, __start_ftrace_eval_maps, len);
}


 void MockRenderThread::AddRoute(int32 routing_id,
                                 IPC::Channel::Listener* listener) {
  // We may hear this for views created from OnMsgCreateWindow as well,
  // in which case we don't want to track the new widget.
  if (routing_id_ == routing_id)
    widget_ = listener;
 }


int dmarc_process() {
    int sr, origin;             /* used in SPF section */
    int dmarc_spf_result  = 0;  /* stores spf into dmarc conn ctx */
    pdkim_signature *sig  = NULL;
    BOOL has_dmarc_record = TRUE;
    u_char **ruf; /* forensic report addressees, if called for */

  /* ACLs have "control=dmarc_disable_verify" */
  if (dmarc_disable_verify == TRUE)
  {
    dmarc_ar_header = dmarc_auth_results_header(from_header, NULL);
    return OK;
  }

  /* Store the header From: sender domain for this part of DMARC.
   * If there is no from_header struct, then it's likely this message
   * is locally generated and relying on fixups to add it.  Just skip
   * the entire DMARC system if we can't find a From: header....or if
   * there was a previous error.
   */
  if (from_header == NULL || dmarc_abort == TRUE)
     dmarc_abort = TRUE;
   else
   {
    /* I strongly encourage anybody who can make this better to contact me directly!
     * <cannonball> Is this an insane way to extract the email address from the From: header?
     * <jgh_hm> it's sure a horrid layer-crossing....
     * <cannonball> I'm not denying that :-/
     * <jgh_hm> there may well be no better though
     */
    header_from_sender = expand_string(
                           string_sprintf("${domain:${extract{1}{:}{${addresses:%s}}}}",
                             from_header->text) );
    /* The opendmarc library extracts the domain from the email address, but
     * only try to store it if it's not empty.  Otherwise, skip out of DMARC. */
    if (strcmp( CCS header_from_sender, "") == 0)
      dmarc_abort = TRUE;
    libdm_status = (dmarc_abort == TRUE) ?
                  DMARC_PARSE_OKAY :
                  opendmarc_policy_store_from_domain(dmarc_pctx, header_from_sender);
    if (libdm_status != DMARC_PARSE_OKAY)
     {
      log_write(0, LOG_MAIN|LOG_PANIC, "failure to store header From: in DMARC: %s, header was '%s'",
                           opendmarc_policy_status_to_str(libdm_status), from_header->text);
       dmarc_abort = TRUE;
     }
   }
    /* Use the envelope sender domain for this part of DMARC */
    spf_sender_domain = expand_string(US"$sender_address_domain");
    if ( spf_response == NULL )
    {
      /* No spf data means null envelope sender so generate a domain name
       * from the sender_helo_name  */
      if (spf_sender_domain == NULL)
      {
        spf_sender_domain = sender_helo_name;
        log_write(0, LOG_MAIN, "DMARC using synthesized SPF sender domain = %s\n",
                               spf_sender_domain);
        DEBUG(D_receive)
          debug_printf("DMARC using synthesized SPF sender domain = %s\n", spf_sender_domain);
      }
      dmarc_spf_result = DMARC_POLICY_SPF_OUTCOME_NONE;
      dmarc_spf_ares_result = ARES_RESULT_UNKNOWN;
      origin = DMARC_POLICY_SPF_ORIGIN_HELO;
      spf_human_readable = US"";
    }
    else
    {
      sr = spf_response->result;
      dmarc_spf_result = (sr == SPF_RESULT_NEUTRAL)  ? DMARC_POLICY_SPF_OUTCOME_NONE :
                         (sr == SPF_RESULT_PASS)     ? DMARC_POLICY_SPF_OUTCOME_PASS :
                         (sr == SPF_RESULT_FAIL)     ? DMARC_POLICY_SPF_OUTCOME_FAIL :
                         (sr == SPF_RESULT_SOFTFAIL) ? DMARC_POLICY_SPF_OUTCOME_TMPFAIL :
                         DMARC_POLICY_SPF_OUTCOME_NONE;
      dmarc_spf_ares_result = (sr == SPF_RESULT_NEUTRAL)   ? ARES_RESULT_NEUTRAL :
                              (sr == SPF_RESULT_PASS)      ? ARES_RESULT_PASS :
                              (sr == SPF_RESULT_FAIL)      ? ARES_RESULT_FAIL :
                              (sr == SPF_RESULT_SOFTFAIL)  ? ARES_RESULT_SOFTFAIL :
                              (sr == SPF_RESULT_NONE)      ? ARES_RESULT_NONE :
                              (sr == SPF_RESULT_TEMPERROR) ? ARES_RESULT_TEMPERROR :
                              (sr == SPF_RESULT_PERMERROR) ? ARES_RESULT_PERMERROR :
                              ARES_RESULT_UNKNOWN;
      origin = DMARC_POLICY_SPF_ORIGIN_MAILFROM;
      spf_human_readable = (uschar *)spf_response->header_comment;
      DEBUG(D_receive)
        debug_printf("DMARC using SPF sender domain = %s\n", spf_sender_domain);
    }
    if (strcmp( CCS spf_sender_domain, "") == 0)
      dmarc_abort = TRUE;
    if (dmarc_abort == FALSE)
    {
      libdm_status = opendmarc_policy_store_spf(dmarc_pctx, spf_sender_domain,
                                                dmarc_spf_result, origin, spf_human_readable);
      if (libdm_status != DMARC_PARSE_OKAY)
        log_write(0, LOG_MAIN|LOG_PANIC, "failure to store spf for DMARC: %s",
                             opendmarc_policy_status_to_str(libdm_status));
    }

    /* Now we cycle through the dkim signature results and put into
     * the opendmarc context, further building the DMARC reply.  */
    sig = dkim_signatures;
    dkim_history_buffer = US"";
    while (sig != NULL)
    {
      int dkim_result, dkim_ares_result, vs, ves;
      vs  = sig->verify_status;
      ves = sig->verify_ext_status;
      dkim_result = ( vs == PDKIM_VERIFY_PASS ) ? DMARC_POLICY_DKIM_OUTCOME_PASS :
                    ( vs == PDKIM_VERIFY_FAIL ) ? DMARC_POLICY_DKIM_OUTCOME_FAIL :
                    ( vs == PDKIM_VERIFY_INVALID ) ? DMARC_POLICY_DKIM_OUTCOME_TMPFAIL :
                    DMARC_POLICY_DKIM_OUTCOME_NONE;
      libdm_status = opendmarc_policy_store_dkim(dmarc_pctx, (uschar *)sig->domain,
        	                                 dkim_result, US"");
      DEBUG(D_receive)
        debug_printf("DMARC adding DKIM sender domain = %s\n", sig->domain);
      if (libdm_status != DMARC_PARSE_OKAY)
        log_write(0, LOG_MAIN|LOG_PANIC, "failure to store dkim (%s) for DMARC: %s",
        		     sig->domain, opendmarc_policy_status_to_str(libdm_status));

      dkim_ares_result = ( vs == PDKIM_VERIFY_PASS )    ? ARES_RESULT_PASS :
        	              ( vs == PDKIM_VERIFY_FAIL )    ? ARES_RESULT_FAIL :
        	              ( vs == PDKIM_VERIFY_NONE )    ? ARES_RESULT_NONE :
        	              ( vs == PDKIM_VERIFY_INVALID ) ?
                           ( ves == PDKIM_VERIFY_INVALID_PUBKEY_UNAVAILABLE ? ARES_RESULT_PERMERROR :
                             ves == PDKIM_VERIFY_INVALID_BUFFER_SIZE        ? ARES_RESULT_PERMERROR :
                             ves == PDKIM_VERIFY_INVALID_PUBKEY_PARSING     ? ARES_RESULT_PERMERROR :
                             ARES_RESULT_UNKNOWN ) :
                          ARES_RESULT_UNKNOWN;
      dkim_history_buffer = string_sprintf("%sdkim %s %d\n", dkim_history_buffer,
                                                             sig->domain, dkim_ares_result);
      sig = sig->next;
    }
    libdm_status = opendmarc_policy_query_dmarc(dmarc_pctx, US"");
    switch (libdm_status)
    {
      case DMARC_DNS_ERROR_NXDOMAIN:
      case DMARC_DNS_ERROR_NO_RECORD:
        DEBUG(D_receive)
          debug_printf("DMARC no record found for %s\n", header_from_sender);
        has_dmarc_record = FALSE;
        break;
      case DMARC_PARSE_OKAY:
        DEBUG(D_receive)
          debug_printf("DMARC record found for %s\n", header_from_sender);
        break;
      case DMARC_PARSE_ERROR_BAD_VALUE:
        DEBUG(D_receive)
          debug_printf("DMARC record parse error for %s\n", header_from_sender);
        has_dmarc_record = FALSE;
        break;
      default:
        /* everything else, skip dmarc */
        DEBUG(D_receive)
          debug_printf("DMARC skipping (%d), unsure what to do with %s",
                        libdm_status, from_header->text);
        has_dmarc_record = FALSE;
        break;
    }
    /* Can't use exim's string manipulation functions so allocate memory
     * for libopendmarc using its max hostname length definition. */
    uschar *dmarc_domain = (uschar *)calloc(DMARC_MAXHOSTNAMELEN, sizeof(uschar));
    libdm_status = opendmarc_policy_fetch_utilized_domain(dmarc_pctx, dmarc_domain,
        	                                          DMARC_MAXHOSTNAMELEN-1);
    dmarc_used_domain = string_copy(dmarc_domain);
    free(dmarc_domain);
    if (libdm_status != DMARC_PARSE_OKAY)
    {
      log_write(0, LOG_MAIN|LOG_PANIC, "failure to read domainname used for DMARC lookup: %s",
                                       opendmarc_policy_status_to_str(libdm_status));
    }
    libdm_status = opendmarc_get_policy_to_enforce(dmarc_pctx);
    dmarc_policy = libdm_status;
    switch(libdm_status)
    {
      case DMARC_POLICY_ABSENT:     /* No DMARC record found */
        dmarc_status = US"norecord";
        dmarc_pass_fail = US"none";
        dmarc_status_text = US"No DMARC record";
        action = DMARC_RESULT_ACCEPT;
        break;
      case DMARC_FROM_DOMAIN_ABSENT:    /* No From: domain */
        dmarc_status = US"nofrom";
        dmarc_pass_fail = US"temperror";
        dmarc_status_text = US"No From: domain found";
        action = DMARC_RESULT_ACCEPT;
        break;
      case DMARC_POLICY_NONE:       /* Accept and report */
        dmarc_status = US"none";
        dmarc_pass_fail = US"none";
        dmarc_status_text = US"None, Accept";
        action = DMARC_RESULT_ACCEPT;
        break;
      case DMARC_POLICY_PASS:       /* Explicit accept */
        dmarc_status = US"accept";
        dmarc_pass_fail = US"pass";
        dmarc_status_text = US"Accept";
        action = DMARC_RESULT_ACCEPT;
        break;
      case DMARC_POLICY_REJECT:       /* Explicit reject */
        dmarc_status = US"reject";
        dmarc_pass_fail = US"fail";
        dmarc_status_text = US"Reject";
        action = DMARC_RESULT_REJECT;
        break;
      case DMARC_POLICY_QUARANTINE:       /* Explicit quarantine */
        dmarc_status = US"quarantine";
        dmarc_pass_fail = US"fail";
        dmarc_status_text = US"Quarantine";
        action = DMARC_RESULT_QUARANTINE;
        break;
      default:
        dmarc_status = US"temperror";
        dmarc_pass_fail = US"temperror";
        dmarc_status_text = US"Internal Policy Error";
        action = DMARC_RESULT_TEMPFAIL;
        break;
    }

    libdm_status = opendmarc_policy_fetch_alignment(dmarc_pctx, &da, &sa);
    if (libdm_status != DMARC_PARSE_OKAY)
    {
      log_write(0, LOG_MAIN|LOG_PANIC, "failure to read DMARC alignment: %s",
                                       opendmarc_policy_status_to_str(libdm_status));
    }

    if (has_dmarc_record == TRUE)
    {
      log_write(0, LOG_MAIN, "DMARC results: spf_domain=%s dmarc_domain=%s "
                             "spf_align=%s dkim_align=%s enforcement='%s'",
                             spf_sender_domain, dmarc_used_domain,
                             (sa==DMARC_POLICY_SPF_ALIGNMENT_PASS) ?"yes":"no",
                             (da==DMARC_POLICY_DKIM_ALIGNMENT_PASS)?"yes":"no",
                             dmarc_status_text);
      history_file_status = dmarc_write_history_file();
      /* Now get the forensic reporting addresses, if any */
      ruf = opendmarc_policy_fetch_ruf(dmarc_pctx, NULL, 0, 1);
      dmarc_send_forensic_report(ruf);
    }
  }


void InputHandlerProxy::HandleInputEventWithLatencyInfo(
    WebScopedInputEvent event,
    const LatencyInfo& latency_info,
    EventDispositionCallback callback) {
  DCHECK(input_handler_);

  TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow",
                         TRACE_ID_DONT_MANGLE(latency_info.trace_id()),
                         TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT,
                         "step", "HandleInputEventImpl");

  std::unique_ptr<EventWithCallback> event_with_callback =
      std::make_unique<EventWithCallback>(std::move(event), latency_info,
                                          tick_clock_->NowTicks(),
                                          std::move(callback));

  enum {
    NO_SCROLL_PINCH = 0,
    ONGOING_SCROLL_PINCH = 1,
    SCROLL_PINCH = 2,
  };
  if (!IsGestureScrollOrPinch(event_with_callback->event().GetType())) {
    base::ScopedSampleMetadata metadata("Input.GestureScrollOrPinch",
                                        NO_SCROLL_PINCH);
    DispatchSingleInputEvent(std::move(event_with_callback),
                             tick_clock_->NowTicks());
    return;
  }

  base::ScopedSampleMetadata metadata("Input.GestureScrollOrPinch",
                                      has_ongoing_compositor_scroll_or_pinch_
                                          ? ONGOING_SCROLL_PINCH
                                          : SCROLL_PINCH);
  if (has_ongoing_compositor_scroll_or_pinch_) {
    const auto& gesture_event = ToWebGestureEvent(event_with_callback->event());
    bool is_from_set_non_blocking_touch =
        gesture_event.SourceDevice() == blink::WebGestureDevice::kTouchscreen &&
        gesture_event.is_source_touch_event_set_non_blocking;
    bool is_scroll_end_from_wheel =
        gesture_event.SourceDevice() == blink::WebGestureDevice::kTouchpad &&
        gesture_event.GetType() == blink::WebGestureEvent::kGestureScrollEnd;
    bool scroll_update_has_blocking_wheel_source =
        gesture_event.SourceDevice() == blink::WebGestureDevice::kTouchpad &&
        gesture_event.GetType() ==
            blink::WebGestureEvent::kGestureScrollUpdate &&
        is_first_gesture_scroll_update_;
    if (gesture_event.GetType() ==
        blink::WebGestureEvent::kGestureScrollUpdate) {
      is_first_gesture_scroll_update_ = false;
    }
    if (is_from_set_non_blocking_touch || is_scroll_end_from_wheel ||
        scroll_update_has_blocking_wheel_source || synchronous_input_handler_) {
      compositor_event_queue_->Queue(std::move(event_with_callback),
                                     tick_clock_->NowTicks());
      DispatchQueuedInputEvents();
      return;
    }

    bool needs_animate_input = compositor_event_queue_->empty();
    compositor_event_queue_->Queue(std::move(event_with_callback),
                                   tick_clock_->NowTicks());
    if (needs_animate_input)
      input_handler_->SetNeedsAnimateInput();
    return;
  }

  DispatchSingleInputEvent(std::move(event_with_callback),
                           tick_clock_->NowTicks());
}


int read_wvc_block (WavpackContext *wpc)
{
    WavpackStream *wps = wpc->streams [wpc->current_stream];
    int64_t bcount, file2pos;
    WavpackHeader orig_wphdr;
    WavpackHeader wphdr;
    int compare_result;

    while (1) {
        file2pos = wpc->reader->get_pos (wpc->wvc_in);
        bcount = read_next_header (wpc->reader, wpc->wvc_in, &wphdr);

        if (bcount == (uint32_t) -1) {
            wps->wvc_skip = TRUE;
            wpc->crc_errors++;
            return FALSE;
        }

        memcpy (&orig_wphdr, &wphdr, 32);       // save original header for verify step

        if (wpc->open_flags & OPEN_STREAMING)
            SET_BLOCK_INDEX (wphdr, wps->sample_index = 0);
        else
            SET_BLOCK_INDEX (wphdr, GET_BLOCK_INDEX (wphdr) - wpc->initial_index);

        if (wphdr.flags & INITIAL_BLOCK)
            wpc->file2pos = file2pos + bcount;

        compare_result = match_wvc_header (&wps->wphdr, &wphdr);

        if (!compare_result) {
            wps->block2buff = malloc (wphdr.ckSize + 8);
	    if (!wps->block2buff)
	        return FALSE;

            if (wpc->reader->read_bytes (wpc->wvc_in, wps->block2buff + 32, wphdr.ckSize - 24) !=
                wphdr.ckSize - 24) {
                    free (wps->block2buff);
                    wps->block2buff = NULL;
                    wps->wvc_skip = TRUE;
                    wpc->crc_errors++;
                    return FALSE;
            }

            memcpy (wps->block2buff, &orig_wphdr, 32);

            // don't use corrupt blocks
            if (!WavpackVerifySingleBlock (wps->block2buff, !(wpc->open_flags & OPEN_NO_CHECKSUM))) {
                free (wps->block2buff);
                wps->block2buff = NULL;
                wps->wvc_skip = TRUE;
                wpc->crc_errors++;
                return TRUE;
            }

            wps->wvc_skip = FALSE;
            memcpy (wps->block2buff, &wphdr, 32);
            memcpy (&wps->wphdr, &wphdr, 32);
            return TRUE;
        }
        else if (compare_result == -1) {
            wps->wvc_skip = TRUE;
            wpc->reader->set_pos_rel (wpc->wvc_in, -32, SEEK_CUR);
            wpc->crc_errors++;
            return TRUE;
        }
    }
}


static int find_tag(ByteIOContext *pb, uint32_t tag1)

{

    unsigned int tag;

    int size;

    for(;;) {

        if (url_feof(pb))

            return -1;

        tag = get_le32(pb);

        size = get_le32(pb);

        if (tag == tag1)

            break;

        url_fseek(pb, size, SEEK_CUR);

    }

    if (size < 0)

        size = 0x7fffffff;

    return size;

}


static bool CompareJsonValues(const std::string& lhs,
                              const std::string& rhs,
                              CompareOp op) {
  switch (op) {
    case IS_EQUAL:
      return lhs == rhs;
    case IS_NOT_EQUAL:
      return lhs != rhs;
    default:
      CHECK(0);
  }
  return false;
}


u32 h264bsdResetDpb(
 dpbStorage_t *dpb,
  u32 picSizeInMbs,
  u32 dpbSize,
  u32 maxRefFrames,
  u32 maxFrameNum,
  u32 noReordering)
{

/* Code */

    ASSERT(picSizeInMbs);
    ASSERT(maxRefFrames <= MAX_NUM_REF_PICS);
    ASSERT(maxRefFrames <= dpbSize);
    ASSERT(maxFrameNum);
    ASSERT(dpbSize);

    h264bsdFreeDpb(dpb);

 return h264bsdInitDpb(dpb, picSizeInMbs, dpbSize, maxRefFrames,
                          maxFrameNum, noReordering);
}


void test_chmod(const char *path)
{
	if (chmod(path, 0755) == 0) {
		fprintf(stderr, "leak at chmod of %s\n", path);
		exit(1);
	}
	if (errno != ENOENT && errno != ENOSYS) {
		fprintf(stderr, "leak at chmod of %s: errno was %s\n", path, strerror(errno));
		exit(1);
	}
}


void PasswordAutofillAgent::FillField(WebInputElement* input,
                                      const base::string16& credential) {
  DCHECK(input);
  DCHECK(!input->IsNull());
  input->SetAutofillValue(WebString::FromUTF16(credential));
  input->SetAutofillState(WebAutofillState::kAutofilled);
  field_data_manager_.UpdateFieldDataMap(
      *input, credential, FieldPropertiesFlags::AUTOFILLED_ON_USER_TRIGGER);
}


static void sequenceStringMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
    v8SetReturnValue(info, v8Array(imp->sequenceStringMethod(), info.GetIsolate()));
}


static int cc310_RSA_GenerateKeyPair(RsaKey* key, int size, long e)
{
    CRYSError_t             ret = 0;
    CRYS_RSAKGData_t        KeyGenData;
    CRYS_RSAKGFipsContext_t FipsCtx;
    byte ex[3];
    uint16_t eSz = sizeof(ex);
    byte n[256];
    uint16_t nSz = sizeof(n);

    ret = CRYS_RSA_KG_GenerateKeyPair(&wc_rndState,
                        wc_rndGenVectFunc,
                        (byte*)&e,
                        3*sizeof(uint8_t),
                        size,
                        &key->ctx.privKey,
                        &key->ctx.pubKey,
                        &KeyGenData,
                        &FipsCtx);

    if (ret != SA_SILIB_RET_OK){
        WOLFSSL_MSG("CRYS_RSA_KG_GenerateKeyPair failed");
        return ret;
    }

    ret = CRYS_RSA_Get_PubKey(&key->ctx.pubKey, ex, &eSz, n, &nSz);
    if (ret != SA_SILIB_RET_OK){
        WOLFSSL_MSG("CRYS_RSA_Get_PubKey failed");
        return ret;
    }
    ret = wc_RsaPublicKeyDecodeRaw(n, nSz, ex, eSz, key);

    key->type = RSA_PRIVATE;

    return ret;
}


 bool InputWindowInfo::isTrustedOverlay() const {
     return layoutParamsType == TYPE_INPUT_METHOD
             || layoutParamsType == TYPE_INPUT_METHOD_DIALOG
             || layoutParamsType == TYPE_MAGNIFICATION_OVERLAY
             || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY;
 }


static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)

{

    int64_t size;

    AVIOContext *pb  = s->pb;

    WAVContext    *wav = s->priv_data;

    AVStream *st;

    uint8_t guid[16];

    avio_read(pb, guid, 16);

    if (memcmp(guid, guid_riff, 16))

        return -1;

    if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */

        return -1;

    avio_read(pb, guid, 16);

    if (memcmp(guid, guid_wave, 16)) {

        av_log(s, AV_LOG_ERROR, "could not find wave guid\n");

        return -1;

    }

    size = find_guid(pb, guid_fmt);

    if (size < 0) {

        av_log(s, AV_LOG_ERROR, "could not find fmt guid\n");

        return -1;

    }

    st = av_new_stream(s, 0);

    if (!st)

        return AVERROR(ENOMEM);

    /* subtract chunk header size - normal wav file doesn't count it */

    ff_get_wav_header(pb, st->codec, size - 24);

    avio_skip(pb, FFALIGN(size, INT64_C(8)) - size);

    st->need_parsing = AVSTREAM_PARSE_FULL;

    av_set_pts_info(st, 64, 1, st->codec->sample_rate);

    size = find_guid(pb, guid_data);

    if (size < 0) {

        av_log(s, AV_LOG_ERROR, "could not find data guid\n");

        return -1;

    }

    wav->data_end = avio_tell(pb) + size - 24;

    wav->w64      = 1;

    return 0;

}