bool ecdsa_verify_legacy(const ecdsa_verify_context_t *ctx, const ecc_25519_work_t *pubkey) {
  ecc_25519_work_t s2, work;
  ecc_int256_t w, tmp;

  ecc_25519_scalarmult(&s2, &ctx->u2, pubkey);
  ecc_25519_add(&work, &ctx->s1, &s2);
  ecc_25519_store_xy_legacy(&w, NULL, &work);
  ecc_25519_gf_sub(&tmp, &ctx->r, &w);

  return ecc_25519_gf_is_zero(&tmp);
}


static int decode_cabac_b_mb_sub_type ( H264Context * h ) {
 int type ;
 if ( ! get_cabac ( & h -> cabac , & h -> cabac_state [ 36 ] ) ) return 0 ;
 if ( ! get_cabac ( & h -> cabac , & h -> cabac_state [ 37 ] ) ) return 1 + get_cabac ( & h -> cabac , & h -> cabac_state [ 39 ] ) ;
 type = 3 ;
 if ( get_cabac ( & h -> cabac , & h -> cabac_state [ 38 ] ) ) {
 if ( get_cabac ( & h -> cabac , & h -> cabac_state [ 39 ] ) ) return 11 + get_cabac ( & h -> cabac , & h -> cabac_state [ 39 ] ) ;
 type += 4 ;
 }
 type += 2 * get_cabac ( & h -> cabac , & h -> cabac_state [ 39 ] ) ;
 type += get_cabac ( & h -> cabac , & h -> cabac_state [ 39 ] ) ;
 return type ;
 }


append_command(char_u *cmd)
{
    char_u *s = cmd;
    char_u *d;

    STRCAT(IObuff, ": ");
    d = IObuff + STRLEN(IObuff);
    while (*s != NUL && d - IObuff < IOSIZE - 7)
    {
	if (enc_utf8 ? (s[0] == 0xc2 && s[1] == 0xa0) : *s == 0xa0)
	{
	    s += enc_utf8 ? 2 : 1;
	    STRCPY(d, "<a0>");
	    d += 4;
	}
	else
	    MB_COPY_CHAR(s, d);
    }
    *d = NUL;
}


static inline void gen_intermediate_code_internal(CPUARMState *env, TranslationBlock *tb, int search_pc) { DisasContext dc1, *dc = &dc1; CPUBreakpoint *bp; uint16_t *gen_opc_end; int j, lj; target_ulong pc_start; uint32_t next_page_start; int num_insns; int max_insns; /* generate intermediate code */ pc_start = tb->pc; dc->tb = tb; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = env->singlestep_enabled; dc->condjmp = 0; dc->thumb = ARM_TBFLAG_THUMB(tb->flags); dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1; dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4; #if !defined(CONFIG_USER_ONLY) dc->user = (ARM_TBFLAG_PRIV(tb->flags) == 0); #endif dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags); dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags); dc->vec_stride = ARM_TBFLAG_VECSTRIDE(tb->flags); cpu_F0s = tcg_temp_new_i32(); cpu_F1s = tcg_temp_new_i32(); cpu_F0d = tcg_temp_new_i64(); cpu_F1d = tcg_temp_new_i64(); cpu_V0 = cpu_F0d; cpu_V1 = cpu_F1d; /* FIXME: cpu_M0 can probably be the same as cpu_V0. */ cpu_M0 = tcg_temp_new_i64(); next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_icount_start(); tcg_clear_temp_count(); /* A note on handling of the condexec (IT) bits: * * We want to avoid the overhead of having to write the updated condexec * bits back to the CPUARMState for every instruction in an IT block. So: * (1) if the condexec bits are not already zero then we write * zero back into the CPUARMState now. This avoids complications trying * to do it at the end of the block. (For example if we don't do this * it's hard to identify whether we can safely skip writing condexec * at the end of the TB, which we definitely want to do for the case * where a TB doesn't do anything with the IT state at all.) * (2) if we are going to leave the TB then we call gen_set_condexec() * which will write the correct value into CPUARMState if zero is wrong. * This is done both for leaving the TB at the end, and for leaving * it because of an exception we know will happen, which is done in * gen_exception_insn(). The latter is necessary because we need to * leave the TB with the PC/IT state just prior to execution of the * instruction which caused the exception. * (3) if we leave the TB unexpectedly (eg a data abort on a load) * then the CPUARMState will be wrong and we need to reset it. * This is handled in the same way as restoration of the * PC in these situations: we will be called again with search_pc=1 * and generate a mapping of the condexec bits for each PC in * gen_opc_condexec_bits[]. restore_state_to_opc() then uses * this to restore the condexec bits. * * Note that there are no instructions which can read the condexec * bits, and none which can write non-static values to them, so * we don't need to care about whether CPUARMState is correct in the * middle of a TB. */ /* Reset the conditional execution bits immediately. This avoids complications trying to do it at the end of the block. */ if (dc->condexec_mask || dc->condexec_cond) { TCGv tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); store_cpu_field(tmp, condexec_bits); } do { #ifdef CONFIG_USER_ONLY /* Intercept jump to the magic kernel page. */ if (dc->pc >= 0xffff0000) { /* We always get here via a jump, so know we are not in a conditional execution block. */ gen_exception(EXCP_KERNEL_TRAP); dc->is_jmp = DISAS_UPDATE; break; } #else if (dc->pc >= 0xfffffff0 && IS_M(env)) { /* We always get here via a jump, so know we are not in a conditional execution block. */ gen_exception(EXCP_EXCEPTION_EXIT); dc->is_jmp = DISAS_UPDATE; break; } #endif if (unlikely(!QTAILQ_EMPTY(&env->breakpoints))) { QTAILQ_FOREACH(bp, &env->breakpoints, entry) { if (bp->pc == dc->pc) { gen_exception_insn(dc, 0, EXCP_DEBUG); /* Advance PC so that clearing the breakpoint will invalidate this TB. */ dc->pc += 2; goto done_generating; break; } } } if (search_pc) { j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; } gen_opc_pc[lj] = dc->pc; gen_opc_condexec_bits[lj] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1); gen_opc_instr_start[lj] = 1; gen_opc_icount[lj] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { tcg_gen_debug_insn_start(dc->pc); } if (dc->thumb) { disas_thumb_insn(env, dc); if (dc->condexec_mask) { dc->condexec_cond = (dc->condexec_cond & 0xe) | ((dc->condexec_mask >> 4) & 1); dc->condexec_mask = (dc->condexec_mask << 1) & 0x1f; if (dc->condexec_mask == 0) { dc->condexec_cond = 0; } } } else { disas_arm_insn(env, dc); } if (dc->condjmp && !dc->is_jmp) { gen_set_label(dc->condlabel); dc->condjmp = 0; } if (tcg_check_temp_count()) { fprintf(stderr, "TCG temporary leak before %08x\n", dc->pc); } /* Translation stops when a conditional branch is encountered. * Otherwise the subsequent code could get translated several times. * Also stop translation when a page boundary is reached. This * ensures prefetch aborts occur at the right place. */ num_insns ++; } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && dc->pc < next_page_start && num_insns < max_insns); if (tb->cflags & CF_LAST_IO) { if (dc->condjmp) { /* FIXME: This can theoretically happen with self-modifying code. */ cpu_abort(env, "IO on conditional branch instruction"); } gen_io_end(); } /* At this stage dc->condjmp will only be set when the skipped instruction was a conditional branch or trap, and the PC has already been written. */ if (unlikely(env->singlestep_enabled)) { /* Make sure the pc is updated, and raise a debug exception. */ if (dc->condjmp) { gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI) { gen_exception(EXCP_SWI); } else { gen_exception(EXCP_DEBUG); } gen_set_label(dc->condlabel); } if (dc->condjmp || !dc->is_jmp) { gen_set_pc_im(dc->pc); dc->condjmp = 0; } gen_set_condexec(dc); if (dc->is_jmp == DISAS_SWI && !dc->condjmp) { gen_exception(EXCP_SWI); } else { /* FIXME: Single stepping a WFI insn will not halt the CPU. */ gen_exception(EXCP_DEBUG); } } else { /* While branches must always occur at the end of an IT block, there are a few other things that can cause us to terminate the TB in the middel of an IT block: - Exception generating instructions (bkpt, swi, undefined). - Page boundaries. - Hardware watchpoints. Hardware breakpoints have already been handled and skip this code. */ gen_set_condexec(dc); switch(dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: /* indicate that the hash table must be used to find the next TB */ tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: /* nothing more to generate */ break; case DISAS_WFI: gen_helper_wfi(); break; case DISAS_SWI: gen_exception(EXCP_SWI); break; } if (dc->condjmp) { gen_set_label(dc->condlabel); gen_set_condexec(dc); gen_goto_tb(dc, 1, dc->pc); dc->condjmp = 0; } } done_generating: gen_icount_end(tb, num_insns); *gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(pc_start, dc->pc - pc_start, dc->thumb); qemu_log("\n"); } #endif if (search_pc) { j = gen_opc_ptr - gen_opc_buf; lj++; while (lj <= j) gen_opc_instr_start[lj++] = 0; } else { tb->size = dc->pc - pc_start; tb->icount = num_insns; } }


static void xhci_ring_init ( XHCIState * xhci , XHCIRing * ring , dma_addr_t base ) {
 ring -> dequeue = base ;
 ring -> ccs = 1 ;
 }


static int read_len_table ( uint8_t * dst , GetBitContext * gb ) {
 int i , val , repeat ;
 for ( i = 0 ;
 i < 256 ;
 ) {
 repeat = get_bits ( gb , 3 ) ;
 val = get_bits ( gb , 5 ) ;
 if ( repeat == 0 ) repeat = get_bits ( gb , 8 ) ;
 if ( i + repeat > 256 || get_bits_left ( gb ) < 0 ) {
 av_log ( NULL , AV_LOG_ERROR , "Error reading huffman table\n" ) ;
 return - 1 ;
 }
 while ( repeat -- ) dst [ i ++ ] = val ;
 }
 return 0 ;
 }


int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name,
			      u32 result)
{
	struct sk_buff *msg;
	void *hdr;

	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
	if (!msg)
		return -ENOMEM;

	hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0,
			  NFC_CMD_FW_DOWNLOAD);
	if (!hdr)
		goto free_msg;

	if (nla_put_string(msg, NFC_ATTR_FIRMWARE_NAME, firmware_name) ||
	    nla_put_u32(msg, NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, result) ||
	    nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx))
		goto nla_put_failure;

	genlmsg_end(msg, hdr);

	genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL);

	return 0;

nla_put_failure:
free_msg:
	nlmsg_free(msg);
	return -EMSGSIZE;
}


void nfc_unregister_device(struct nfc_dev *dev)
{
	int rc;

	pr_debug("dev_name=%s\n", dev_name(&dev->dev));

	rc = nfc_genl_device_removed(dev);
	if (rc)
		pr_debug("The userspace won't be notified that the device %s "
			 "was removed\n", dev_name(&dev->dev));

	device_lock(&dev->dev);
	if (dev->rfkill) {
		rfkill_unregister(dev->rfkill);
		rfkill_destroy(dev->rfkill);
	}
	device_unlock(&dev->dev);

	if (dev->ops->check_presence) {
		device_lock(&dev->dev);
		dev->shutting_down = true;
		device_unlock(&dev->dev);
		del_timer_sync(&dev->check_pres_timer);
		cancel_work_sync(&dev->check_pres_work);
	}

	nfc_llcp_unregister_device(dev);

	mutex_lock(&nfc_devlist_mutex);
	nfc_devlist_generation++;
	device_del(&dev->dev);
	mutex_unlock(&nfc_devlist_mutex);
}


int mime_format_uint ( char * buf , uint32_t val , size_t buf_len ) {
 return ink_fast_uitoa ( val , buf , buf_len ) ;
 }


int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { uint8_t *buf; int size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples, sample_fmt, align); if (size < 0) return size; buf = av_mallocz(size); if (!buf) return AVERROR(ENOMEM); size = av_samples_fill_arrays(audio_data, linesize, buf, nb_channels, nb_samples, sample_fmt, align); if (size < 0) { av_free(buf); return size; } return 0; }


static const OptionDef *find_option(const OptionDef *po, const char *name) { const char *p = strchr(name, ':'); int len = p ? p - name : strlen(name); while (po->name != NULL) { if (!strncmp(name, po->name, len) && strlen(po->name) == len) break; po++; } return po; }


static void virtio_gpu_handle_cursor(VirtIODevice *vdev, VirtQueue *vq) { VirtIOGPU *g = VIRTIO_GPU(vdev); VirtQueueElement elem; size_t s; struct virtio_gpu_update_cursor cursor_info; if (!virtio_queue_ready(vq)) { return; } while (virtqueue_pop(vq, &elem)) { s = iov_to_buf(elem.out_sg, elem.out_num, 0, &cursor_info, sizeof(cursor_info)); if (s != sizeof(cursor_info)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: cursor size incorrect %zu vs %zu\n", __func__, s, sizeof(cursor_info)); } else { update_cursor(g, &cursor_info); } virtqueue_push(vq, &elem, 0); virtio_notify(vdev, vq); } }


void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap, int64_t cur_sector, int64_t nr_sectors) { assert(bdrv_dirty_bitmap_enabled(bitmap)); hbitmap_reset(bitmap->bitmap, cur_sector, nr_sectors); }


static int coroutine_fn mirror_iteration(MirrorBlockJob *s) { BlockDriverState *source = s->common.bs; BlockDriverState *target = s->target; QEMUIOVector qiov; int ret, nb_sectors; int64_t end; struct iovec iov; end = s->common.len >> BDRV_SECTOR_BITS; s->sector_num = bdrv_get_next_dirty(source, s->sector_num); nb_sectors = MIN(BDRV_SECTORS_PER_DIRTY_CHUNK, end - s->sector_num); bdrv_reset_dirty(source, s->sector_num, nb_sectors); /* Copy the dirty cluster. */ iov.iov_base = s->buf; iov.iov_len = nb_sectors * 512; qemu_iovec_init_external(&qiov, &iov, 1); trace_mirror_one_iteration(s, s->sector_num, nb_sectors); ret = bdrv_co_readv(source, s->sector_num, nb_sectors, &qiov); if (ret < 0) { return ret; } return bdrv_co_writev(target, s->sector_num, nb_sectors, &qiov); }


TEST_F ( TemplateURLTest , URLRefTestIndices2 ) {
 TemplateURLData data ;
 data . SetURL ( "http://foo{
searchTerms}
x{
startIndex}
y{
startPage}
" ) ;
 TemplateURL url ( data ) ;
 EXPECT_TRUE ( url . url_ref ( ) . IsValid ( search_terms_data_ ) ) ;
 ASSERT_TRUE ( url . url_ref ( ) . SupportsReplacement ( search_terms_data_ ) ) ;
 GURL result ( url . url_ref ( ) . ReplaceSearchTerms ( TemplateURLRef : : SearchTermsArgs ( ASCIIToUTF16 ( "X" ) ) , search_terms_data_ ) ) ;
 ASSERT_TRUE ( result . is_valid ( ) ) ;
 EXPECT_EQ ( "http://fooxx1y1/" , result . spec ( ) ) ;
 }


METHOD ( certificate_t , has_issuer , id_match_t , private_x509_cert_t * this , identification_t * issuer ) {
 return this -> issuer -> matches ( this -> issuer , issuer ) ;
 }


static void qemu_spice_display_init_one ( QemuConsole * con ) {
 SimpleSpiceDisplay * ssd = g_new0 ( SimpleSpiceDisplay , 1 ) ;
 qemu_spice_display_init_common ( ssd ) ;
 ssd -> qxl . base . sif = & dpy_interface . base ;
 qemu_spice_add_display_interface ( & ssd -> qxl , con ) ;
 assert ( ssd -> worker ) ;
 qemu_spice_create_host_memslot ( ssd ) ;
 ssd -> dcl . ops = & display_listener_ops ;
 ssd -> dcl . con = con ;
 register_displaychangelistener ( & ssd -> dcl ) ;
 }


void do_set_charset ( struct st_command * command ) {
 char * charset_name = command -> first_argument ;
 char * p ;
 if ( ! charset_name || ! * charset_name ) die ( "Missing charset name in 'character_set'" ) ;
 p = charset_name ;
 while ( * p && ! my_isspace ( charset_info , * p ) ) p ++ ;
 if ( * p ) * p ++ = 0 ;
 command -> last_argument = p ;
 charset_info = get_charset_by_csname ( charset_name , MY_CS_PRIMARY , MYF ( MY_WME ) ) ;
 if ( ! charset_info ) abort_not_supported_test ( "Test requires charset '%s'" , charset_name ) ;
 }


static inline void RENAME(bgr16ToY)(uint8_t *dst, uint8_t *src, int width) { int i; for(i=0; i<width; i++) { int d= ((uint16_t*)src)[i]; int b= d&0x1F; int g= (d>>5)&0x3F; int r= (d>>11)&0x1F; dst[i]= ((2*RY*r + GY*g + 2*BY*b)>>(RGB2YUV_SHIFT-2)) + 16; } }


static int film_read_packet(AVFormatContext *s, AVPacket *pkt) { FilmDemuxContext *film = s->priv_data; AVIOContext *pb = s->pb; film_sample *sample; int ret = 0; int i; int left, right; if (film->current_sample >= film->sample_count) sample = &film->sample_table[film->current_sample]; /* position the stream (will probably be there anyway) */ avio_seek(pb, sample->sample_offset, SEEK_SET); /* do a special song and dance when loading FILM Cinepak chunks */ if ((sample->stream == film->video_stream_index) && (film->video_type == CODEC_ID_CINEPAK)) { pkt->pos= avio_tell(pb); if (av_new_packet(pkt, sample->sample_size)) return AVERROR(ENOMEM); avio_read(pb, pkt->data, sample->sample_size); } else if ((sample->stream == film->audio_stream_index) && (film->audio_channels == 2) && (film->audio_type != CODEC_ID_ADPCM_ADX)) { /* stereo PCM needs to be interleaved */ if (av_new_packet(pkt, sample->sample_size)) return AVERROR(ENOMEM); /* make sure the interleave buffer is large enough */ if (sample->sample_size > film->stereo_buffer_size) { av_free(film->stereo_buffer); film->stereo_buffer_size = sample->sample_size; film->stereo_buffer = av_malloc(film->stereo_buffer_size); if (!film->stereo_buffer) { film->stereo_buffer_size = 0; return AVERROR(ENOMEM); } } pkt->pos= avio_tell(pb); ret = avio_read(pb, film->stereo_buffer, sample->sample_size); if (ret != sample->sample_size) ret = AVERROR(EIO); left = 0; right = sample->sample_size / 2; for (i = 0; i < sample->sample_size; ) { if (film->audio_bits == 8) { pkt->data[i++] = film->stereo_buffer[left++]; pkt->data[i++] = film->stereo_buffer[right++]; } else { pkt->data[i++] = film->stereo_buffer[left++]; pkt->data[i++] = film->stereo_buffer[left++]; pkt->data[i++] = film->stereo_buffer[right++]; pkt->data[i++] = film->stereo_buffer[right++]; } } } else { ret= av_get_packet(pb, pkt, sample->sample_size); if (ret != sample->sample_size) ret = AVERROR(EIO); } pkt->stream_index = sample->stream; pkt->pts = sample->pts; film->current_sample++; return ret; }


nv_brackets(cmdarg_T *cap)
{
    pos_T	prev_pos;
    pos_T	*pos = NULL;	    // init for GCC
    pos_T	old_pos;	    // cursor position before command
    int		flag;
    long	n;

    cap->oap->motion_type = MCHAR;
    cap->oap->inclusive = FALSE;
    old_pos = curwin->w_cursor;
    curwin->w_cursor.coladd = 0;    // TODO: don't do this for an error.

#ifdef FEAT_SEARCHPATH
    // "[f" or "]f" : Edit file under the cursor (same as "gf")
    if (cap->nchar == 'f')
	nv_gotofile(cap);
    else
#endif

#ifdef FEAT_FIND_ID
    // Find the occurrence(s) of the identifier or define under cursor
    // in current and included files or jump to the first occurrence.
    //
    //			search	     list	    jump
    //		      fwd   bwd    fwd	 bwd	 fwd	bwd
    // identifier     "]i"  "[i"   "]I"  "[I"	"]^I"  "[^I"
    // define	      "]d"  "[d"   "]D"  "[D"	"]^D"  "[^D"
    if (vim_strchr((char_u *)"iI\011dD\004", cap->nchar) != NULL)
    {
	char_u	*ptr;
	int	len;

	if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)
	    clearop(cap->oap);
	else
	{
	    find_pattern_in_path(ptr, 0, len, TRUE,
		cap->count0 == 0 ? !isupper(cap->nchar) : FALSE,
		((cap->nchar & 0xf) == ('d' & 0xf)) ?  FIND_DEFINE : FIND_ANY,
		cap->count1,
		isupper(cap->nchar) ? ACTION_SHOW_ALL :
			    islower(cap->nchar) ? ACTION_SHOW : ACTION_GOTO,
		cap->cmdchar == ']' ? curwin->w_cursor.lnum + 1 : (linenr_T)1,
		(linenr_T)MAXLNUM);
	    curwin->w_set_curswant = TRUE;
	}
    }
    else
#endif

    // "[{", "[(", "]}" or "])": go to Nth unclosed '{', '(', '}' or ')'
    // "[#", "]#": go to start/end of Nth innermost #if..#endif construct.
    // "[/", "[*", "]/", "]*": go to Nth comment start/end.
    // "[m" or "]m" search for prev/next start of (Java) method.
    // "[M" or "]M" search for prev/next end of (Java) method.
    if (  (cap->cmdchar == '['
		&& vim_strchr((char_u *)"{(*/#mM", cap->nchar) != NULL)
	    || (cap->cmdchar == ']'
		&& vim_strchr((char_u *)"})*/#mM", cap->nchar) != NULL))
	nv_bracket_block(cap, &old_pos);

    // "[[", "[]", "]]" and "][": move to start or end of function
    else if (cap->nchar == '[' || cap->nchar == ']')
    {
	if (cap->nchar == cap->cmdchar)		    // "]]" or "[["
	    flag = '{';
	else
	    flag = '}';		    // "][" or "[]"

	curwin->w_set_curswant = TRUE;
	// Imitate strange Vi behaviour: When using "]]" with an operator
	// we also stop at '}'.
	if (!findpar(&cap->oap->inclusive, cap->arg, cap->count1, flag,
	      (cap->oap->op_type != OP_NOP
				      && cap->arg == FORWARD && flag == '{')))
	    clearopbeep(cap->oap);
	else
	{
	    if (cap->oap->op_type == OP_NOP)
		beginline(BL_WHITE | BL_FIX);
#ifdef FEAT_FOLDING
	    if ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)
		foldOpenCursor();
#endif
	}
    }

    // "[p", "[P", "]P" and "]p": put with indent adjustment
    else if (cap->nchar == 'p' || cap->nchar == 'P')
    {
	nv_put_opt(cap, TRUE);
    }

    // "['", "[`", "]'" and "]`": jump to next mark
    else if (cap->nchar == '\'' || cap->nchar == '`')
    {
	pos = &curwin->w_cursor;
	for (n = cap->count1; n > 0; --n)
	{
	    prev_pos = *pos;
	    pos = getnextmark(pos, cap->cmdchar == '[' ? BACKWARD : FORWARD,
							  cap->nchar == '\'');
	    if (pos == NULL)
		break;
	}
	if (pos == NULL)
	    pos = &prev_pos;
	nv_cursormark(cap, cap->nchar == '\'', pos);
    }

    // [ or ] followed by a middle mouse click: put selected text with
    // indent adjustment.  Any other button just does as usual.
    else if (cap->nchar >= K_RIGHTRELEASE && cap->nchar <= K_LEFTMOUSE)
    {
	(void)do_mouse(cap->oap, cap->nchar,
		       (cap->cmdchar == ']') ? FORWARD : BACKWARD,
		       cap->count1, PUT_FIXINDENT);
    }

#ifdef FEAT_FOLDING
    // "[z" and "]z": move to start or end of open fold.
    else if (cap->nchar == 'z')
    {
	if (foldMoveTo(FALSE, cap->cmdchar == ']' ? FORWARD : BACKWARD,
							 cap->count1) == FAIL)
	    clearopbeep(cap->oap);
    }
#endif

#ifdef FEAT_DIFF
    // "[c" and "]c": move to next or previous diff-change.
    else if (cap->nchar == 'c')
    {
	if (diff_move_to(cap->cmdchar == ']' ? FORWARD : BACKWARD,
							 cap->count1) == FAIL)
	    clearopbeep(cap->oap);
    }
#endif

#ifdef FEAT_SPELL
    // "[s", "[S", "]s" and "]S": move to next spell error.
    else if (cap->nchar == 's' || cap->nchar == 'S')
    {
	setpcmark();
	for (n = 0; n < cap->count1; ++n)
	    if (spell_move_to(curwin, cap->cmdchar == ']' ? FORWARD : BACKWARD,
			  cap->nchar == 's' ? TRUE : FALSE, FALSE, NULL) == 0)
	    {
		clearopbeep(cap->oap);
		break;
	    }
	    else
		curwin->w_set_curswant = TRUE;
# ifdef FEAT_FOLDING
	if (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped)
	    foldOpenCursor();
# endif
    }
#endif

    // Not a valid cap->nchar.
    else
	clearopbeep(cap->oap);
}


				    struct timespec64 *ts, enum hrtimer_mode mode)
	__must_hold(&ctx->timeout_lock)
{
	struct io_timeout_data *io;
	struct io_kiocb *req;
	bool found = false;

	list_for_each_entry(req, &ctx->ltimeout_list, timeout.list) {
		found = user_data == req->cqe.user_data;
		if (found)
			break;
	}
	if (!found)
		return -ENOENT;

	io = req->async_data;
	if (hrtimer_try_to_cancel(&io->timer) == -1)
		return -EALREADY;
	hrtimer_init(&io->timer, io_timeout_get_clock(io), mode);
	io->timer.function = io_link_timeout_fn;
	hrtimer_start(&io->timer, timespec64_to_ktime(*ts), mode);
	return 0;


static void iterative_me(SnowContext *s){ int pass, mb_x, mb_y; const int b_width = s->b_width << s->block_max_depth; const int b_height= s->b_height << s->block_max_depth; const int b_stride= b_width; int color[3]; for(pass=0; pass<50; pass++){ int change= 0; for(mb_y= 0; mb_y<b_height; mb_y++){ for(mb_x= 0; mb_x<b_width; mb_x++){ int dia_change, i, j; int best_rd= INT_MAX; BlockNode backup; const int index= mb_x + mb_y * b_stride; BlockNode *block= &s->block[index]; BlockNode *tb = mb_y ? &s->block[index-b_stride ] : &null_block; BlockNode *lb = mb_x ? &s->block[index -1] : &null_block; BlockNode *rb = mb_x<b_width ? &s->block[index +1] : &null_block; BlockNode *bb = mb_y<b_height ? &s->block[index+b_stride ] : &null_block; BlockNode *tlb= mb_x && mb_y ? &s->block[index-b_stride-1] : &null_block; BlockNode *trb= mb_x<b_width && mb_y ? &s->block[index-b_stride+1] : &null_block; BlockNode *blb= mb_x && mb_y<b_height ? &s->block[index+b_stride-1] : &null_block; BlockNode *brb= mb_x<b_width && mb_y<b_height ? &s->block[index+b_stride+1] : &null_block; if(pass && (block->type & BLOCK_OPT)) continue; block->type |= BLOCK_OPT; backup= *block; if(!s->me_cache_generation) memset(s->me_cache, 0, sizeof(s->me_cache)); s->me_cache_generation += 1<<22; // get previous score (cant be cached due to OBMC) check_block(s, mb_x, mb_y, (int[2]){block->mx, block->my}, 0, &best_rd); check_block(s, mb_x, mb_y, (int[2]){0, 0}, 0, &best_rd); check_block(s, mb_x, mb_y, (int[2]){tb->mx, tb->my}, 0, &best_rd); check_block(s, mb_x, mb_y, (int[2]){lb->mx, lb->my}, 0, &best_rd); check_block(s, mb_x, mb_y, (int[2]){rb->mx, rb->my}, 0, &best_rd); check_block(s, mb_x, mb_y, (int[2]){bb->mx, bb->my}, 0, &best_rd); /* fullpel ME */ //FIXME avoid subpel interpol / round to nearest integer do{ dia_change=0; for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){ for(j=0; j<i; j++){ dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+4*(i-j), block->my+(4*j)}, 0, &best_rd); dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx-4*(i-j), block->my-(4*j)}, 0, &best_rd); dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+4*(i-j), block->my-(4*j)}, 0, &best_rd); dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx-4*(i-j), block->my+(4*j)}, 0, &best_rd); } } }while(dia_change); /* subpel ME */ do{ static const int square[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},}; dia_change=0; for(i=0; i<8; i++) dia_change |= check_block(s, mb_x, mb_y, (int[2]){block->mx+square[i][0], block->my+square[i][1]}, 0, &best_rd); }while(dia_change); //FIXME or try the standard 2 pass qpel or similar for(i=0; i<3; i++){ color[i]= get_dc(s, mb_x, mb_y, i); } check_block(s, mb_x, mb_y, color, 1, &best_rd); //FIXME RD style color selection if(!same_block(block, &backup)){ if(tb != &null_block) tb ->type &= ~BLOCK_OPT; if(lb != &null_block) lb ->type &= ~BLOCK_OPT; if(rb != &null_block) rb ->type &= ~BLOCK_OPT; if(bb != &null_block) bb ->type &= ~BLOCK_OPT; if(tlb!= &null_block) tlb->type &= ~BLOCK_OPT; if(trb!= &null_block) trb->type &= ~BLOCK_OPT; if(blb!= &null_block) blb->type &= ~BLOCK_OPT; if(brb!= &null_block) brb->type &= ~BLOCK_OPT; change ++; } } } av_log(NULL, AV_LOG_ERROR, "pass:%d changed:%d\n", pass, change); if(!change) break; } }


static void processStdStringsEntry ( ArchiveHandle * AH , TocEntry * te ) {
 char * ptr1 ;
 ptr1 = strchr ( te -> defn , '\'' ) ;
 if ( ptr1 && strncmp ( ptr1 , "'on'" , 4 ) == 0 ) AH -> public . std_strings = true ;
 else if ( ptr1 && strncmp ( ptr1 , "'off'" , 5 ) == 0 ) AH -> public . std_strings = false ;
 else exit_horribly ( modulename , "invalid STDSTRINGS item: %s\n" , te -> defn ) ;
 }


bool agg_item_collations ( DTCollation & c , const char * fname , Item * * av , uint count , uint flags , int item_sep ) {
 uint i ;
 Item * * arg ;
 bool unknown_cs = 0 ;
 c . set ( av [ 0 ] -> collation ) ;
 for ( i = 1 , arg = & av [ item_sep ] ;
 i < count ;
 i ++ , arg += item_sep ) {
 if ( c . aggregate ( ( * arg ) -> collation , flags ) ) {
 if ( c . derivation == DERIVATION_NONE && c . collation == & my_charset_bin ) {
 unknown_cs = 1 ;
 continue ;
 }
 my_coll_agg_error ( av , count , fname , item_sep ) ;
 return TRUE ;
 }
 }
 if ( unknown_cs && c . derivation != DERIVATION_EXPLICIT ) {
 my_coll_agg_error ( av , count , fname , item_sep ) ;
 return TRUE ;
 }
 if ( ( flags & MY_COLL_DISALLOW_NONE ) && c . derivation == DERIVATION_NONE ) {
 my_coll_agg_error ( av , count , fname , item_sep ) ;
 return TRUE ;
 }
 if ( flags & MY_COLL_ALLOW_NUMERIC_CONV && c . derivation == DERIVATION_NUMERIC ) c . set ( Item : : default_charset ( ) , DERIVATION_COERCIBLE , MY_REPERTOIRE_NUMERIC ) ;
 return FALSE ;
 }


static void compute_pkt_fields(AVFormatContext *s, AVStream *st, AVCodecParserContext *pc, AVPacket *pkt) { int num, den, presentation_delayed, delay, i; int64_t offset; if (s->flags & AVFMT_FLAG_NOFILLIN) return; if((s->flags & AVFMT_FLAG_IGNDTS) && pkt->pts != AV_NOPTS_VALUE) pkt->dts= AV_NOPTS_VALUE; if (st->codec->codec_id != CODEC_ID_H264 && pc && pc->pict_type == AV_PICTURE_TYPE_B) //FIXME Set low_delay = 0 when has_b_frames = 1 st->codec->has_b_frames = 1; /* do we have a video B-frame ? */ delay= st->codec->has_b_frames; presentation_delayed = 0; // ignore delay caused by frame threading so that the mpeg2-without-dts // warning will not trigger if (delay && st->codec->active_thread_type&FF_THREAD_FRAME) delay -= st->codec->thread_count-1; /* XXX: need has_b_frame, but cannot get it if the codec is not initialized */ if (delay && pc && pc->pict_type != AV_PICTURE_TYPE_B) presentation_delayed = 1; if(pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && pkt->dts - (1LL<<(st->pts_wrap_bits-1)) > pkt->pts && st->pts_wrap_bits<63){ pkt->dts -= 1LL<<st->pts_wrap_bits; } // some mpeg2 in mpeg-ps lack dts (issue171 / input_file.mpg) // we take the conservative approach and discard both // Note, if this is misbehaving for a H.264 file then possibly presentation_delayed is not set correctly. if(delay==1 && pkt->dts == pkt->pts && pkt->dts != AV_NOPTS_VALUE && presentation_delayed){ av_log(s, AV_LOG_DEBUG, "invalid dts/pts combination %"PRIi64"\n", pkt->dts); pkt->dts= pkt->pts= AV_NOPTS_VALUE; } if (pkt->duration == 0) { compute_frame_duration(&num, &den, st, pc, pkt); if (den && num) { pkt->duration = av_rescale_rnd(1, num * (int64_t)st->time_base.den, den * (int64_t)st->time_base.num, AV_ROUND_DOWN); if(pkt->duration != 0 && s->packet_buffer) update_initial_durations(s, st, pkt); } } /* correct timestamps with byte offset if demuxers only have timestamps on packet boundaries */ if(pc && st->need_parsing == AVSTREAM_PARSE_TIMESTAMPS && pkt->size){ /* this will estimate bitrate based on this frame's duration and size */ offset = av_rescale(pc->offset, pkt->duration, pkt->size); if(pkt->pts != AV_NOPTS_VALUE) pkt->pts += offset; if(pkt->dts != AV_NOPTS_VALUE) pkt->dts += offset; } if (pc && pc->dts_sync_point >= 0) { // we have synchronization info from the parser int64_t den = st->codec->time_base.den * (int64_t) st->time_base.num; if (den > 0) { int64_t num = st->codec->time_base.num * (int64_t) st->time_base.den; if (pkt->dts != AV_NOPTS_VALUE) { // got DTS from the stream, update reference timestamp st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den; pkt->pts = pkt->dts + pc->pts_dts_delta * num / den; } else if (st->reference_dts != AV_NOPTS_VALUE) { // compute DTS based on reference timestamp pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den; pkt->pts = pkt->dts + pc->pts_dts_delta * num / den; } if (pc->dts_sync_point > 0) st->reference_dts = pkt->dts; // new reference } } /* This may be redundant, but it should not hurt. */ if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts) presentation_delayed = 1; // av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc); /* interpolate PTS and DTS if they are not present */ //We skip H264 currently because delay and has_b_frames are not reliably set if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != CODEC_ID_H264){ if (presentation_delayed) { /* DTS = decompression timestamp */ /* PTS = presentation timestamp */ if (pkt->dts == AV_NOPTS_VALUE) pkt->dts = st->last_IP_pts; update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts); if (pkt->dts == AV_NOPTS_VALUE) pkt->dts = st->cur_dts; /* this is tricky: the dts must be incremented by the duration of the frame we are displaying, i.e. the last I- or P-frame */ if (st->last_IP_duration == 0) st->last_IP_duration = pkt->duration; if(pkt->dts != AV_NOPTS_VALUE) st->cur_dts = pkt->dts + st->last_IP_duration; st->last_IP_duration = pkt->duration; st->last_IP_pts= pkt->pts; /* cannot compute PTS if not present (we can compute it only by knowing the future */ } else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){ if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){ int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts); int64_t new_diff= FFABS(st->cur_dts - pkt->pts); if(old_diff < new_diff && old_diff < (pkt->duration>>3)){ pkt->pts += pkt->duration; // av_log(NULL, AV_LOG_DEBUG, "id:%d old:%"PRId64" new:%"PRId64" dur:%d cur:%"PRId64" size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size); } } /* presentation is not delayed : PTS and DTS are the same */ if(pkt->pts == AV_NOPTS_VALUE) pkt->pts = pkt->dts; update_initial_timestamps(s, pkt->stream_index, pkt->pts, pkt->pts); if(pkt->pts == AV_NOPTS_VALUE) pkt->pts = st->cur_dts; pkt->dts = pkt->pts; if(pkt->pts != AV_NOPTS_VALUE) st->cur_dts = pkt->pts + pkt->duration; } } if(pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY){ st->pts_buffer[0]= pkt->pts; for(i=0; i<delay && st->pts_buffer[i] > st->pts_buffer[i+1]; i++) FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]); if(pkt->dts == AV_NOPTS_VALUE) pkt->dts= st->pts_buffer[0]; if(st->codec->codec_id == CODEC_ID_H264){ //we skiped it above so we try here update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts); // this should happen on the first packet } if(pkt->dts > st->cur_dts) st->cur_dts = pkt->dts; } // av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts); /* update flags */ if(is_intra_only(st->codec)) pkt->flags |= AV_PKT_FLAG_KEY; else if (pc) { pkt->flags = 0; /* keyframe computation */ if (pc->key_frame == 1) pkt->flags |= AV_PKT_FLAG_KEY; else if (pc->key_frame == -1 && pc->pict_type == AV_PICTURE_TYPE_I) pkt->flags |= AV_PKT_FLAG_KEY; } if (pc) pkt->convergence_duration = pc->convergence_duration; }


 */
static void io_drop_inflight_file(struct io_kiocb *req)
{
	if (unlikely(req->flags & REQ_F_INFLIGHT)) {
		fput(req->file);
		req->file = NULL;
		req->flags &= ~REQ_F_INFLIGHT;
	}


static int dissect_h225_UnregRequestReason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
 # line 603 "./asn1/h225/h225.cnf" gint32 value ;
 h225_packet_info * h225_pi ;
 h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
 offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_UnregRequestReason , UnregRequestReason_choice , & value ) ;
 if ( h225_pi != NULL ) {
 h225_pi -> reason = value ;
 }
 return offset ;
 }


static MagickBooleanType load_hierarchy ( Image * image , XCFDocInfo * inDocInfo , XCFLayerInfo * inLayer , ExceptionInfo * exception ) {
 MagickOffsetType saved_pos , offset , junk ;
 size_t width , height , bytes_per_pixel ;
 width = ReadBlobMSBLong ( image ) ;
 ( void ) width ;
 height = ReadBlobMSBLong ( image ) ;
 ( void ) height ;
 bytes_per_pixel = inDocInfo -> bytes_per_pixel = ReadBlobMSBLong ( image ) ;
 ( void ) bytes_per_pixel ;
 offset = ( MagickOffsetType ) ReadBlobMSBLong ( image ) ;
 do {
 junk = ( MagickOffsetType ) ReadBlobMSBLong ( image ) ;
 }
 while ( junk != 0 ) ;
 saved_pos = TellBlob ( image ) ;
 offset = SeekBlob ( image , offset , SEEK_SET ) ;
 if ( load_level ( image , inDocInfo , inLayer , exception ) == 0 ) return ( MagickFalse ) ;
 offset = SeekBlob ( image , saved_pos , SEEK_SET ) ;
 return ( MagickTrue ) ;
 }


static uint64_t get_fourcc(AVIOContext *bc) { unsigned int len = ffio_read_varlen(bc); if (len == 2) return avio_rl16(bc); else if (len == 4) return avio_rl32(bc); else return -1; }


void tcg_exec_init ( unsigned long tb_size ) {
 cpu_gen_init ( ) ;
 code_gen_alloc ( tb_size ) ;
 tcg_ctx . code_gen_ptr = tcg_ctx . code_gen_buffer ;
 tcg_register_jit ( tcg_ctx . code_gen_buffer , tcg_ctx . code_gen_buffer_size ) ;
 page_init ( ) ;
 # if ! defined ( CONFIG_USER_ONLY ) || ! defined ( CONFIG_USE_GUEST_BASE ) tcg_prologue_init ( & tcg_ctx ) ;
 # endif }


static int zxcheck ( i_ctx_t * i_ctx_p ) {
 os_ptr op = osp ;
 check_op ( 1 ) ;
 make_bool ( op , ( r_has_attr ( ACCESS_REF ( op ) , a_executable ) ? 1 : 0 ) ) ;
 return 0 ;
 }


static void * Type_Dictionary_Read ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsUInt32Number * nItems , cmsUInt32Number SizeOfTag ) {
 cmsHANDLE hDict ;
 cmsUInt32Number i , Count , Length ;
 cmsUInt32Number BaseOffset ;
 _cmsDICarray a ;
 wchar_t * NameWCS = NULL , * ValueWCS = NULL ;
 cmsMLU * DisplayNameMLU = NULL , * DisplayValueMLU = NULL ;
 cmsBool rc ;
 * nItems = 0 ;
 BaseOffset = io -> Tell ( io ) - sizeof ( _cmsTagBase ) ;
 if ( ! _cmsReadUInt32Number ( io , & Count ) ) return NULL ;
 SizeOfTag -= sizeof ( cmsUInt32Number ) ;
 if ( ! _cmsReadUInt32Number ( io , & Length ) ) return NULL ;
 SizeOfTag -= sizeof ( cmsUInt32Number ) ;
 if ( Length != 16 && Length != 24 && Length != 32 ) {
 cmsSignalError ( self -> ContextID , cmsERROR_UNKNOWN_EXTENSION , "Unknown record length in dictionary '%d'" , Length ) ;
 return NULL ;
 }
 hDict = cmsDictAlloc ( self -> ContextID ) ;
 if ( hDict == NULL ) return NULL ;
 if ( ! AllocArray ( self -> ContextID , & a , Count , Length ) ) goto Error ;
 if ( ! ReadOffsetArray ( io , & a , Count , Length , BaseOffset ) ) goto Error ;
 for ( i = 0 ;
 i < Count ;
 i ++ ) {
 if ( ! ReadOneWChar ( io , & a . Name , i , & NameWCS ) ) goto Error ;
 if ( ! ReadOneWChar ( io , & a . Value , i , & ValueWCS ) ) goto Error ;
 if ( Length > 16 ) {
 if ( ! ReadOneMLUC ( self , io , & a . DisplayName , i , & DisplayNameMLU ) ) goto Error ;
 }
 if ( Length > 24 ) {
 if ( ! ReadOneMLUC ( self , io , & a . DisplayValue , i , & DisplayValueMLU ) ) goto Error ;
 }
 if ( NameWCS == NULL || ValueWCS == NULL ) {
 cmsSignalError ( self -> ContextID , cmsERROR_CORRUPTION_DETECTED , "Bad dictionary Name/Value" ) ;
 rc = FALSE ;
 }
 else {
 rc = cmsDictAddEntry ( hDict , NameWCS , ValueWCS , DisplayNameMLU , DisplayValueMLU ) ;
 }
 if ( NameWCS != NULL ) _cmsFree ( self -> ContextID , NameWCS ) ;
 if ( ValueWCS != NULL ) _cmsFree ( self -> ContextID , ValueWCS ) ;
 if ( DisplayNameMLU != NULL ) cmsMLUfree ( DisplayNameMLU ) ;
 if ( DisplayValueMLU != NULL ) cmsMLUfree ( DisplayValueMLU ) ;
 if ( ! rc ) goto Error ;
 }
 FreeArray ( & a ) ;
 * nItems = 1 ;
 return ( void * ) hDict ;
 Error : FreeArray ( & a ) ;
 cmsDictFree ( hDict ) ;
 return NULL ;
 }


void vp9_iht8x8_add ( TX_TYPE tx_type , const tran_low_t * input , uint8_t * dest , int stride , int eob ) {
 if ( tx_type == DCT_DCT ) {
 vp9_idct8x8_add ( input , dest , stride , eob ) ;
 }
 else {
 vp9_iht8x8_64_add ( input , dest , stride , tx_type ) ;
 }
 }


void load_cgroup(const char *fname) {
	if (!fname)
		return;

	FILE *fp = fopen(fname, "re");
	if (fp) {
		char buf[MAXBUF];
		if (fgets(buf, MAXBUF, fp)) {
			cfg.cgroup = strdup(buf);
			if (!cfg.cgroup)
				errExit("strdup");
		}
		else
			goto errout;

		fclose(fp);
		return;
	}
errout:
	fwarning("cannot load control group\n");
	if (fp)
		fclose(fp);
}


static void spapr_phb_remove_pci_device_cb(DeviceState *dev, void *opaque) { /* some version guests do not wait for completion of a device * cleanup (generally done asynchronously by the kernel) before * signaling to QEMU that the device is safe, but instead sleep * for some 'safe' period of time. unfortunately on a busy host * this sleep isn't guaranteed to be long enough, resulting in * bad things like IRQ lines being left asserted during final * device removal. to deal with this we call reset just prior * to finalizing the device, which will put the device back into * an 'idle' state, as the device cleanup code expects. */ pci_device_reset(PCI_DEVICE(dev)); object_unparent(OBJECT(dev)); }


static void segment_properties_destroy ( hb_segment_properties_t * g ) {
 free ( g ) ;
 }


static void extract_user_namespace(pid_t pid) {
	// test user namespaces available in the kernel
	struct stat s1;
	struct stat s2;
	struct stat s3;
	if (stat("/proc/self/ns/user", &s1) == 0 &&
	    stat("/proc/self/uid_map", &s2) == 0 &&
	    stat("/proc/self/gid_map", &s3) == 0);
	else
		return;

	// read uid map
	char *uidmap;
	if (asprintf(&uidmap, "/proc/%u/uid_map", pid) == -1)
		errExit("asprintf");
	FILE *fp = fopen(uidmap, "re");
	if (!fp) {
		free(uidmap);
		return;
	}

	// check uid map
	int u1;
	int u2;
	if (fscanf(fp, "%d %d", &u1, &u2) == 2) {
		if (arg_debug)
			printf("User namespace detected: %s, %d, %d\n", uidmap, u1, u2);
		if (u1 != 0 || u2 != 0)
			arg_noroot = 1;
	}
	fclose(fp);
	free(uidmap);
}


static struct omap_rtc_s *omap_rtc_init(MemoryRegion *system_memory, target_phys_addr_t base, qemu_irq *irq, omap_clk clk) { struct omap_rtc_s *s = (struct omap_rtc_s *) g_malloc0(sizeof(struct omap_rtc_s)); s->irq = irq[0]; s->alarm = irq[1]; s->clk = qemu_new_timer_ms(rt_clock, omap_rtc_tick, s); omap_rtc_reset(s); memory_region_init_io(&s->iomem, &omap_rtc_ops, s, "omap-rtc", 0x800); memory_region_add_subregion(system_memory, base, &s->iomem); return s; }


bool is_ready_for_join(const pid_t pid) {
	EUID_ASSERT();
	// check if a file /run/firejail/mnt/join exists
	char *fname;
	if (asprintf(&fname, "/proc/%d/root%s", pid, RUN_JOIN_FILE) == -1)
		errExit("asprintf");
	EUID_ROOT();
	int fd = open(fname, O_RDONLY|O_CLOEXEC);
	EUID_USER();
	free(fname);
	if (fd == -1)
		return false;
	struct stat s;
	if (fstat(fd, &s) == -1)
		errExit("fstat");
	if (!S_ISREG(s.st_mode) || s.st_uid != 0 || s.st_size != 1) {
		close(fd);
		return false;
	}
	char status;
	if (read(fd, &status, 1) == 1 && status == SANDBOX_DONE) {
		close(fd);
		return true;
	}
	close(fd);
	return false;
}


static void e1000e_calc_rxdesclen ( E1000ECore * core ) {
 if ( e1000e_rx_use_legacy_descriptor ( core ) ) {
 core -> rx_desc_len = sizeof ( struct e1000_rx_desc ) ;
 }
 else {
 if ( core -> mac [ RCTL ] & E1000_RCTL_DTYP_PS ) {
 core -> rx_desc_len = sizeof ( union e1000_rx_desc_packet_split ) ;
 }
 else {
 core -> rx_desc_len = sizeof ( union e1000_rx_desc_extended ) ;
 }
 }
 trace_e1000e_rx_desc_len ( core -> rx_desc_len ) ;
 }


static int32_t _appendVariantsToLanguageTag ( const char * localeID , char * appendAt , int32_t capacity , UBool strict , UBool * hadPosix , UErrorCode * status ) {
 char buf [ ULOC_FULLNAME_CAPACITY ] ;
 UErrorCode tmpStatus = U_ZERO_ERROR ;
 int32_t len , i ;
 int32_t reslen = 0 ;
 if ( U_FAILURE ( * status ) ) {
 return 0 ;
 }
 len = uloc_getVariant ( localeID , buf , sizeof ( buf ) , & tmpStatus ) ;
 if ( U_FAILURE ( tmpStatus ) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING ) {
 if ( strict ) {
 * status = U_ILLEGAL_ARGUMENT_ERROR ;
 }
 return 0 ;
 }
 if ( len > 0 ) {
 char * p , * pVar ;
 UBool bNext = TRUE ;
 VariantListEntry * var ;
 VariantListEntry * varFirst = NULL ;
 pVar = NULL ;
 p = buf ;
 while ( bNext ) {
 if ( * p == SEP || * p == LOCALE_SEP || * p == 0 ) {
 if ( * p == 0 ) {
 bNext = FALSE ;
 }
 else {
 * p = 0 ;
 }
 if ( pVar == NULL ) {
 if ( strict ) {
 * status = U_ILLEGAL_ARGUMENT_ERROR ;
 break ;
 }
 }
 else {
 for ( i = 0 ;
 * ( pVar + i ) != 0 ;
 i ++ ) {
 * ( pVar + i ) = uprv_tolower ( * ( pVar + i ) ) ;
 }
 if ( _isVariantSubtag ( pVar , - 1 ) ) {
 if ( uprv_strcmp ( pVar , POSIX_VALUE ) || len != ( int32_t ) uprv_strlen ( POSIX_VALUE ) ) {
 var = ( VariantListEntry * ) uprv_malloc ( sizeof ( VariantListEntry ) ) ;
 if ( var == NULL ) {
 * status = U_MEMORY_ALLOCATION_ERROR ;
 break ;
 }
 var -> variant = pVar ;
 if ( ! _addVariantToList ( & varFirst , var ) ) {
 uprv_free ( var ) ;
 if ( strict ) {
 * status = U_ILLEGAL_ARGUMENT_ERROR ;
 break ;
 }
 }
 }
 else {
 * hadPosix = TRUE ;
 }
 }
 else if ( strict ) {
 * status = U_ILLEGAL_ARGUMENT_ERROR ;
 break ;
 }
 else if ( _isPrivateuseValueSubtag ( pVar , - 1 ) ) {
 break ;
 }
 }
 pVar = NULL ;
 }
 else if ( pVar == NULL ) {
 pVar = p ;
 }
 p ++ ;
 }
 if ( U_SUCCESS ( * status ) ) {
 if ( varFirst != NULL ) {
 int32_t varLen ;
 var = varFirst ;
 while ( var != NULL ) {
 if ( reslen < capacity ) {
 * ( appendAt + reslen ) = SEP ;
 }
 reslen ++ ;
 varLen = ( int32_t ) uprv_strlen ( var -> variant ) ;
 if ( reslen < capacity ) {
 uprv_memcpy ( appendAt + reslen , var -> variant , uprv_min ( varLen , capacity - reslen ) ) ;
 }
 reslen += varLen ;
 var = var -> next ;
 }
 }
 }
 var = varFirst ;
 while ( var != NULL ) {
 VariantListEntry * tmpVar = var -> next ;
 uprv_free ( var ) ;
 var = tmpVar ;
 }
 if ( U_FAILURE ( * status ) ) {
 return 0 ;
 }
 }
 u_terminateChars ( appendAt , capacity , reslen , status ) ;
 return reslen ;
 }


void check_join_permission(pid_t pid) {
	// check if pid belongs to a fully set up firejail sandbox
	unsigned long i;
	for (i = SNOOZE; is_ready_for_join(pid) == false; i += SNOOZE) { // give sandbox some time to start up
		if (i > join_timeout) {
			fprintf(stderr, "Error: no valid sandbox\n");
			exit(1);
		}
		usleep(SNOOZE);
	}
	// check privileges for non-root users
	uid_t uid = getuid();
	if (uid != 0) {
		uid_t sandbox_uid = pid_get_uid(pid);
		if (uid != sandbox_uid) {
			fprintf(stderr, "Error: permission is denied to join a sandbox created by a different user.\n");
			exit(1);
		}
	}
}


static void extract_nonewprivs(pid_t pid) {
	char *fname;
	if (asprintf(&fname, "/proc/%d/root%s", pid, RUN_NONEWPRIVS_CFG) == -1)
		errExit("asprintf");

	struct stat s;
	if (stat(fname, &s) == -1) {
		free(fname);
		return;
	}

	arg_nonewprivs = 1;
	free(fname);
}


static int proc_connectinfo ( struct usb_dev_state * ps , void __user * arg ) {
 struct usbdevfs_connectinfo ci = {
 . devnum = ps -> dev -> devnum , . slow = ps -> dev -> speed == USB_SPEED_LOW }
 ;
 if ( copy_to_user ( arg , & ci , sizeof ( ci ) ) ) return - EFAULT ;
 return 0 ;
 }


int process_open(ProcessHandle process, const char *fname) {
	int rv = process_open_nofail(process, fname);
	if (rv < 0) {
		fprintf(stderr, "Error: cannot open /proc/%d/%s: %s\n", process->pid, fname, strerror(errno));
		exit(1);
	}

	return rv;
}


static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, int *data_size, const uint8_t * buf, int buf_size) { static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int a, b, c; int i; signed short *shptr; int16_t *data = vdata; unsigned int val; Real144_internal *glob = avctx->priv_data; GetBitContext gb; if(buf_size == 0) return 0; init_get_bits(&gb, buf, 20 * 8); for (i=0; i<10; i++) // "<< 1"? Doesn't this make one value out of two of the table useless? glob->swapbuf1[i] = decodetable[i][get_bits(&gb, sizes[i]) << 1]; do_voice(glob->swapbuf1, glob->swapbuf2); val = decodeval[get_bits(&gb, 5) << 1]; // Useless table entries? a = t_sqrt(val*glob->oldval) >> 12; for (c=0; c < NBLOCKS; c++) { if (c == (NBLOCKS - 1)) { dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val); } else { if (c * 2 == (NBLOCKS - 2)) { if (glob->oldval < val) { dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, a, glob->swapbuf2alt, c); } else { dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, a, glob->swapbuf2, c); } } else { if (c * 2 < (NBLOCKS - 2)) { dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, glob->oldval, glob->swapbuf2, c); } else { dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, c); } } } } /* do output */ for (b=0, c=0; c<4; c++) { unsigned int gval = glob->gbuf1[c * 2]; unsigned short *gsp = glob->gbuf2 + b; signed short output_buffer[40]; do_output_subblock(glob, gsp, gval, output_buffer, &gb); shptr = output_buffer; while (shptr < output_buffer + BLOCKSIZE) *data++ = av_clip_int16(*(shptr++) << 2); b += 30; } glob->oldval = val; FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1); FFSWAP(unsigned int *, glob->swapbuf2alt, glob->swapbuf2); *data_size = 2*160; return 20; }


static int h261_decode_picture_header(H261Context *h) { MpegEncContext *const s = &h->s; int format, i; uint32_t startcode = 0; for (i = get_bits_left(&s->gb); i > 24; i -= 1) { startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF; if (startcode == 0x10) break; } if (startcode != 0x10) { av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } /* temporal reference */ i = get_bits(&s->gb, 5); /* picture timestamp */ if (i < (s->picture_number & 31)) i += 32; s->picture_number = (s->picture_number & ~31) + i; s->avctx->time_base = (AVRational) { 1001, 30000 }; /* PTYPE starts here */ skip_bits1(&s->gb); /* split screen off */ skip_bits1(&s->gb); /* camera off */ skip_bits1(&s->gb); /* freeze picture release off */ format = get_bits1(&s->gb); // only 2 formats possible if (format == 0) { // QCIF s->width = 176; s->height = 144; s->mb_width = 11; s->mb_height = 9; } else { // CIF s->width = 352; s->height = 288; s->mb_width = 22; s->mb_height = 18; } s->mb_num = s->mb_width * s->mb_height; skip_bits1(&s->gb); /* still image mode off */ skip_bits1(&s->gb); /* Reserved */ /* PEI */ while (get_bits1(&s->gb) != 0) skip_bits(&s->gb, 8); /* H.261 has no I-frames, but if we pass AV_PICTURE_TYPE_I for the first * frame, the codec crashes if it does not contain all I-blocks * (e.g. when a packet is lost). */ s->pict_type = AV_PICTURE_TYPE_P; h->gob_number = 0; return 0; }


static block_t * Encode ( encoder_t * p_enc , picture_t * p_pic ) {
 encoder_sys_t * p_sys = p_enc -> p_sys ;
 block_t * p_block , * p_output_chain = NULL ;
 SchroFrame * p_frame ;
 bool b_go = true ;
 if ( ! p_pic ) {
 if ( ! p_sys -> started || p_sys -> b_eos_pulled ) return NULL ;
 if ( ! p_sys -> b_eos_signalled ) {
 p_sys -> b_eos_signalled = 1 ;
 schro_encoder_end_of_stream ( p_sys -> p_schro ) ;
 }
 }
 else {
 p_sys -> p_format -> interlaced = ! p_pic -> b_progressive ;
 p_sys -> p_format -> top_field_first = p_pic -> b_top_field_first ;
 if ( p_sys -> b_auto_field_coding ) schro_encoder_setting_set_double ( p_sys -> p_schro , "interlaced_coding" , ! p_pic -> b_progressive ) ;
 }
 if ( ! p_sys -> started ) {
 date_t date ;
 if ( p_pic -> format . i_chroma != p_enc -> fmt_in . i_codec ) {
 char chroma_in [ 5 ] , chroma_out [ 5 ] ;
 vlc_fourcc_to_char ( p_pic -> format . i_chroma , chroma_in ) ;
 chroma_in [ 4 ] = '\0' ;
 chroma_out [ 4 ] = '\0' ;
 vlc_fourcc_to_char ( p_enc -> fmt_in . i_codec , chroma_out ) ;
 msg_Warn ( p_enc , "Resetting chroma from %s to %s" , chroma_out , chroma_in ) ;
 if ( ! SetEncChromaFormat ( p_enc , p_pic -> format . i_chroma ) ) {
 msg_Err ( p_enc , "Could not reset chroma format to %s" , chroma_in ) ;
 return NULL ;
 }
 }
 date_Init ( & date , p_enc -> fmt_in . video . i_frame_rate , p_enc -> fmt_in . video . i_frame_rate_base ) ;
 date_Increment ( & date , 1 ) ;
 p_sys -> i_pts_offset = date_Get ( & date ) ;
 if ( schro_encoder_setting_get_double ( p_sys -> p_schro , "interlaced_coding" ) > 0.0 ) {
 date_Set ( & date , 0 ) ;
 date_Increment ( & date , 1 ) ;
 p_sys -> i_field_time = date_Get ( & date ) / 2 ;
 }
 schro_video_format_set_std_signal_range ( p_sys -> p_format , SCHRO_SIGNAL_RANGE_8BIT_VIDEO ) ;
 schro_encoder_set_video_format ( p_sys -> p_schro , p_sys -> p_format ) ;
 schro_encoder_start ( p_sys -> p_schro ) ;
 p_sys -> started = 1 ;
 }
 if ( ! p_sys -> b_eos_signalled ) {
 picture_Hold ( p_pic ) ;
 p_frame = CreateSchroFrameFromInputPic ( p_enc , p_pic ) ;
 if ( ! p_frame ) return NULL ;
 schro_encoder_push_frame ( p_sys -> p_schro , p_frame ) ;
 StorePicturePTS ( p_enc , p_sys -> i_input_picnum , p_pic -> date ) ;
 p_sys -> i_input_picnum ++ ;
 p_block = block_Alloc ( 1 ) ;
 if ( ! p_block ) return NULL ;
 p_block -> i_dts = p_pic -> date - p_sys -> i_pts_offset ;
 block_FifoPut ( p_sys -> p_dts_fifo , p_block ) ;
 p_block = NULL ;
 if ( schro_encoder_setting_get_double ( p_sys -> p_schro , "interlaced_coding" ) > 0.0 ) {
 StorePicturePTS ( p_enc , p_sys -> i_input_picnum , p_pic -> date + p_sys -> i_field_time ) ;
 p_sys -> i_input_picnum ++ ;
 p_block = block_Alloc ( 1 ) ;
 if ( ! p_block ) return NULL ;
 p_block -> i_dts = p_pic -> date - p_sys -> i_pts_offset + p_sys -> i_field_time ;
 block_FifoPut ( p_sys -> p_dts_fifo , p_block ) ;
 p_block = NULL ;
 }
 }
 do {
 SchroStateEnum state ;
 state = schro_encoder_wait ( p_sys -> p_schro ) ;
 switch ( state ) {
 case SCHRO_STATE_NEED_FRAME : b_go = false ;
 break ;
 case SCHRO_STATE_AGAIN : break ;
 case SCHRO_STATE_END_OF_STREAM : p_sys -> b_eos_pulled = 1 ;
 b_go = false ;
 break ;
 case SCHRO_STATE_HAVE_BUFFER : {
 SchroBuffer * p_enc_buf ;
 uint32_t u_pic_num ;
 int i_presentation_frame ;
 p_enc_buf = schro_encoder_pull ( p_sys -> p_schro , & i_presentation_frame ) ;
 p_block = block_Alloc ( p_enc_buf -> length ) ;
 if ( ! p_block ) return NULL ;
 memcpy ( p_block -> p_buffer , p_enc_buf -> data , p_enc_buf -> length ) ;
 schro_buffer_unref ( p_enc_buf ) ;
 if ( 0 == p_block -> p_buffer [ 4 ] ) {
 p_block -> i_flags |= BLOCK_FLAG_TYPE_I ;
 if ( ! p_enc -> fmt_out . p_extra ) {
 const uint8_t eos [ ] = {
 'B' , 'B' , 'C' , 'D' , 0x10 , 0 , 0 , 0 , 13 , 0 , 0 , 0 , 0 }
 ;
 uint32_t len = GetDWBE ( p_block -> p_buffer + 5 ) ;
 p_enc -> fmt_out . p_extra = malloc ( len + sizeof ( eos ) ) ;
 if ( ! p_enc -> fmt_out . p_extra ) return NULL ;
 memcpy ( p_enc -> fmt_out . p_extra , p_block -> p_buffer , len ) ;
 memcpy ( ( uint8_t * ) p_enc -> fmt_out . p_extra + len , eos , sizeof ( eos ) ) ;
 SetDWBE ( ( uint8_t * ) p_enc -> fmt_out . p_extra + len + sizeof ( eos ) - 4 , len ) ;
 p_enc -> fmt_out . i_extra = len + sizeof ( eos ) ;
 }
 }
 if ( ReadDiracPictureNumber ( & u_pic_num , p_block ) ) {
 block_t * p_dts_block = block_FifoGet ( p_sys -> p_dts_fifo ) ;
 p_block -> i_dts = p_dts_block -> i_dts ;
 p_block -> i_pts = GetPicturePTS ( p_enc , u_pic_num ) ;
 block_Release ( p_dts_block ) ;
 block_ChainAppend ( & p_output_chain , p_block ) ;
 }
 else {
 block_ChainAppend ( & p_output_chain , p_block ) ;
 }
 break ;
 }
 default : break ;
 }
 }
 while ( b_go ) ;
 return p_output_chain ;
 }


current_quote(
    oparg_T	*oap,
    long	count,
    int		include,	// TRUE == include quote char
    int		quotechar)	// Quote character
{
    char_u	*line = ml_get_curline();
    int		col_end;
    int		col_start = curwin->w_cursor.col;
    int		inclusive = FALSE;
    int		vis_empty = TRUE;	// Visual selection <= 1 char
    int		vis_bef_curs = FALSE;	// Visual starts before cursor
    int		did_exclusive_adj = FALSE;  // adjusted pos for 'selection'
    int		inside_quotes = FALSE;	// Looks like "i'" done before
    int		selected_quote = FALSE;	// Has quote inside selection
    int		i;
    int		restore_vis_bef = FALSE; // restore VIsual on abort

    // When 'selection' is "exclusive" move the cursor to where it would be
    // with 'selection' "inclusive", so that the logic is the same for both.
    // The cursor then is moved forward after adjusting the area.
    if (VIsual_active)
    {
	// this only works within one line
	if (VIsual.lnum != curwin->w_cursor.lnum)
	    return FALSE;

	vis_bef_curs = LT_POS(VIsual, curwin->w_cursor);
	vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
	if (*p_sel == 'e')
	{
	    if (vis_bef_curs)
	    {
		dec_cursor();
		did_exclusive_adj = TRUE;
	    }
	    else if (!vis_empty)
	    {
		dec(&VIsual);
		did_exclusive_adj = TRUE;
	    }
	    vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
	    if (!vis_bef_curs && !vis_empty)
	    {
		// VIsual needs to be the start of Visual selection.
		pos_T t = curwin->w_cursor;

		curwin->w_cursor = VIsual;
		VIsual = t;
		vis_bef_curs = TRUE;
		restore_vis_bef = TRUE;
	    }
	}
    }

    if (!vis_empty)
    {
	// Check if the existing selection exactly spans the text inside
	// quotes.
	if (vis_bef_curs)
	{
	    inside_quotes = VIsual.col > 0
			&& line[VIsual.col - 1] == quotechar
			&& line[curwin->w_cursor.col] != NUL
			&& line[curwin->w_cursor.col + 1] == quotechar;
	    i = VIsual.col;
	    col_end = curwin->w_cursor.col;
	}
	else
	{
	    inside_quotes = curwin->w_cursor.col > 0
			&& line[curwin->w_cursor.col - 1] == quotechar
			&& line[VIsual.col] != NUL
			&& line[VIsual.col + 1] == quotechar;
	    i = curwin->w_cursor.col;
	    col_end = VIsual.col;
	}

	// Find out if we have a quote in the selection.
	while (i <= col_end)
	    if (line[i++] == quotechar)
	    {
		selected_quote = TRUE;
		break;
	    }
    }

    if (!vis_empty && line[col_start] == quotechar)
    {
	// Already selecting something and on a quote character.  Find the
	// next quoted string.
	if (vis_bef_curs)
	{
	    // Assume we are on a closing quote: move to after the next
	    // opening quote.
	    col_start = find_next_quote(line, col_start + 1, quotechar, NULL);
	    if (col_start < 0)
		goto abort_search;
	    col_end = find_next_quote(line, col_start + 1, quotechar,
							      curbuf->b_p_qe);
	    if (col_end < 0)
	    {
		// We were on a starting quote perhaps?
		col_end = col_start;
		col_start = curwin->w_cursor.col;
	    }
	}
	else
	{
	    col_end = find_prev_quote(line, col_start, quotechar, NULL);
	    if (line[col_end] != quotechar)
		goto abort_search;
	    col_start = find_prev_quote(line, col_end, quotechar,
							      curbuf->b_p_qe);
	    if (line[col_start] != quotechar)
	    {
		// We were on an ending quote perhaps?
		col_start = col_end;
		col_end = curwin->w_cursor.col;
	    }
	}
    }
    else

    if (line[col_start] == quotechar || !vis_empty)
    {
	int	first_col = col_start;

	if (!vis_empty)
	{
	    if (vis_bef_curs)
		first_col = find_next_quote(line, col_start, quotechar, NULL);
	    else
		first_col = find_prev_quote(line, col_start, quotechar, NULL);
	}

	// The cursor is on a quote, we don't know if it's the opening or
	// closing quote.  Search from the start of the line to find out.
	// Also do this when there is a Visual area, a' may leave the cursor
	// in between two strings.
	col_start = 0;
	for (;;)
	{
	    // Find open quote character.
	    col_start = find_next_quote(line, col_start, quotechar, NULL);
	    if (col_start < 0 || col_start > first_col)
		goto abort_search;
	    // Find close quote character.
	    col_end = find_next_quote(line, col_start + 1, quotechar,
							      curbuf->b_p_qe);
	    if (col_end < 0)
		goto abort_search;
	    // If is cursor between start and end quote character, it is
	    // target text object.
	    if (col_start <= first_col && first_col <= col_end)
		break;
	    col_start = col_end + 1;
	}
    }
    else
    {
	// Search backward for a starting quote.
	col_start = find_prev_quote(line, col_start, quotechar, curbuf->b_p_qe);
	if (line[col_start] != quotechar)
	{
	    // No quote before the cursor, look after the cursor.
	    col_start = find_next_quote(line, col_start, quotechar, NULL);
	    if (col_start < 0)
		goto abort_search;
	}

	// Find close quote character.
	col_end = find_next_quote(line, col_start + 1, quotechar,
							      curbuf->b_p_qe);
	if (col_end < 0)
	    goto abort_search;
    }

    // When "include" is TRUE, include spaces after closing quote or before
    // the starting quote.
    if (include)
    {
	if (VIM_ISWHITE(line[col_end + 1]))
	    while (VIM_ISWHITE(line[col_end + 1]))
		++col_end;
	else
	    while (col_start > 0 && VIM_ISWHITE(line[col_start - 1]))
		--col_start;
    }

    // Set start position.  After vi" another i" must include the ".
    // For v2i" include the quotes.
    if (!include && count < 2 && (vis_empty || !inside_quotes))
	++col_start;
    curwin->w_cursor.col = col_start;
    if (VIsual_active)
    {
	// Set the start of the Visual area when the Visual area was empty, we
	// were just inside quotes or the Visual area didn't start at a quote
	// and didn't include a quote.
	if (vis_empty
		|| (vis_bef_curs
		    && !selected_quote
		    && (inside_quotes
			|| (line[VIsual.col] != quotechar
			    && (VIsual.col == 0
				|| line[VIsual.col - 1] != quotechar)))))
	{
	    VIsual = curwin->w_cursor;
	    redraw_curbuf_later(INVERTED);
	}
    }
    else
    {
	oap->start = curwin->w_cursor;
	oap->motion_type = MCHAR;
    }

    // Set end position.
    curwin->w_cursor.col = col_end;
    if ((include || count > 1 // After vi" another i" must include the ".
		|| (!vis_empty && inside_quotes)
	) && inc_cursor() == 2)
	inclusive = TRUE;
    if (VIsual_active)
    {
	if (vis_empty || vis_bef_curs)
	{
	    // decrement cursor when 'selection' is not exclusive
	    if (*p_sel != 'e')
		dec_cursor();
	}
	else
	{
	    // Cursor is at start of Visual area.  Set the end of the Visual
	    // area when it was just inside quotes or it didn't end at a
	    // quote.
	    if (inside_quotes
		    || (!selected_quote
			&& line[VIsual.col] != quotechar
			&& (line[VIsual.col] == NUL
			    || line[VIsual.col + 1] != quotechar)))
	    {
		dec_cursor();
		VIsual = curwin->w_cursor;
	    }
	    curwin->w_cursor.col = col_start;
	}
	if (VIsual_mode == 'V')
	{
	    VIsual_mode = 'v';
	    redraw_cmdline = TRUE;		// show mode later
	}
    }
    else
    {
	// Set inclusive and other oap's flags.
	oap->inclusive = inclusive;
    }

    return OK;

abort_search:
    if (VIsual_active && *p_sel == 'e')
    {
	if (did_exclusive_adj)
	    inc_cursor();
	if (restore_vis_bef)
	{
	    pos_T t = curwin->w_cursor;

	    curwin->w_cursor = VIsual;
	    VIsual = t;
	}
    }
    return FALSE;
}


static void mpeg_decode_sequence_display_extension ( Mpeg1Context * s1 ) {
 MpegEncContext * s = & s1 -> mpeg_enc_ctx ;
 int color_description , w , h ;
 skip_bits ( & s -> gb , 3 ) ;
 color_description = get_bits1 ( & s -> gb ) ;
 if ( color_description ) {
 s -> avctx -> color_primaries = get_bits ( & s -> gb , 8 ) ;
 s -> avctx -> color_trc = get_bits ( & s -> gb , 8 ) ;
 s -> avctx -> colorspace = get_bits ( & s -> gb , 8 ) ;
 }
 w = get_bits ( & s -> gb , 14 ) ;
 skip_bits ( & s -> gb , 1 ) ;
 h = get_bits ( & s -> gb , 14 ) ;
 s1 -> pan_scan . width = 16 * w ;
 s1 -> pan_scan . height = 16 * h ;
 if ( s -> avctx -> debug & FF_DEBUG_PICT_INFO ) av_log ( s -> avctx , AV_LOG_DEBUG , "sde w:%d, h:%d\n" , w , h ) ;
 }


static void xenfb_update(void *opaque) { struct XenFB *xenfb = opaque; DisplaySurface *surface; int i; if (xenfb->c.xendev.be_state != XenbusStateConnected) return; if (!xenfb->feature_update) { /* we don't get update notifications, thus use the * sledge hammer approach ... */ xenfb->up_fullscreen = 1; } /* resize if needed */ if (xenfb->do_resize) { pixman_format_code_t format; xenfb->do_resize = 0; switch (xenfb->depth) { case 16: case 32: /* console.c supported depth -> buffer can be used directly */ format = qemu_default_pixman_format(xenfb->depth, true); surface = qemu_create_displaysurface_from (xenfb->width, xenfb->height, format, xenfb->row_stride, xenfb->pixels + xenfb->offset); break; default: /* we must convert stuff */ surface = qemu_create_displaysurface(xenfb->width, xenfb->height); break; } dpy_gfx_replace_surface(xenfb->c.con, surface); xen_pv_printf(&xenfb->c.xendev, 1, "update: resizing: %dx%d @ %d bpp%s\n", xenfb->width, xenfb->height, xenfb->depth, is_buffer_shared(surface) ? " (shared)" : ""); xenfb->up_fullscreen = 1; } /* run queued updates */ if (xenfb->up_fullscreen) { xen_pv_printf(&xenfb->c.xendev, 3, "update: fullscreen\n"); xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height); } else if (xenfb->up_count) { xen_pv_printf(&xenfb->c.xendev, 3, "update: %d rects\n", xenfb->up_count); for (i = 0; i < xenfb->up_count; i++) xenfb_guest_copy(xenfb, xenfb->up_rects[i].x, xenfb->up_rects[i].y, xenfb->up_rects[i].w, xenfb->up_rects[i].h); } else { xen_pv_printf(&xenfb->c.xendev, 3, "update: nothing\n"); } xenfb->up_count = 0; xenfb->up_fullscreen = 0; }


static int dissect_CPMGetNotify ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree _U_ , gboolean in _U_ , void * data _U_ ) {
 col_append_str ( pinfo -> cinfo , COL_INFO , "GetNotify" ) ;
 return tvb_reported_length ( tvb ) ;
 }


void do_move_file ( struct st_command * command ) {
 int error ;
 static DYNAMIC_STRING ds_from_file ;
 static DYNAMIC_STRING ds_to_file ;
 const struct command_arg move_file_args [ ] = {
 {
 "from_file" , ARG_STRING , TRUE , & ds_from_file , "Filename to move from" }
 , {
 "to_file" , ARG_STRING , TRUE , & ds_to_file , "Filename to move to" }
 }
 ;
 DBUG_ENTER ( "do_move_file" ) ;
 check_command_args ( command , command -> first_argument , move_file_args , sizeof ( move_file_args ) / sizeof ( struct command_arg ) , ' ' ) ;
 DBUG_PRINT ( "info" , ( "Move %s to %s" , ds_from_file . str , ds_to_file . str ) ) ;
 error = ( my_rename ( ds_from_file . str , ds_to_file . str , MYF ( disable_warnings ? 0 : MY_WME ) ) != 0 ) ;
 handle_command_error ( command , error , my_errno ) ;
 dynstr_free ( & ds_from_file ) ;
 dynstr_free ( & ds_to_file ) ;
 DBUG_VOID_RETURN ;
 }


static void write_modes_sb ( VP9_COMP * cpi , const TileInfo * const tile , vp9_writer * w , TOKENEXTRA * * tok , const TOKENEXTRA * const tok_end , int mi_row , int mi_col , BLOCK_SIZE bsize ) {
 const VP9_COMMON * const cm = & cpi -> common ;
 MACROBLOCKD * const xd = & cpi -> mb . e_mbd ;
 const int bsl = b_width_log2 ( bsize ) ;
 const int bs = ( 1 << bsl ) / 4 ;
 PARTITION_TYPE partition ;
 BLOCK_SIZE subsize ;
 const MODE_INFO * m = NULL ;
 if ( mi_row >= cm -> mi_rows || mi_col >= cm -> mi_cols ) return ;
 m = cm -> mi_grid_visible [ mi_row * cm -> mi_stride + mi_col ] ;
 partition = partition_lookup [ bsl ] [ m -> mbmi . sb_type ] ;
 write_partition ( cm , xd , bs , mi_row , mi_col , partition , bsize , w ) ;
 subsize = get_subsize ( bsize , partition ) ;
 if ( subsize < BLOCK_8X8 ) {
 write_modes_b ( cpi , tile , w , tok , tok_end , mi_row , mi_col ) ;
 }
 else {
 switch ( partition ) {
 case PARTITION_NONE : write_modes_b ( cpi , tile , w , tok , tok_end , mi_row , mi_col ) ;
 break ;
 case PARTITION_HORZ : write_modes_b ( cpi , tile , w , tok , tok_end , mi_row , mi_col ) ;
 if ( mi_row + bs < cm -> mi_rows ) write_modes_b ( cpi , tile , w , tok , tok_end , mi_row + bs , mi_col ) ;
 break ;
 case PARTITION_VERT : write_modes_b ( cpi , tile , w , tok , tok_end , mi_row , mi_col ) ;
 if ( mi_col + bs < cm -> mi_cols ) write_modes_b ( cpi , tile , w , tok , tok_end , mi_row , mi_col + bs ) ;
 break ;
 case PARTITION_SPLIT : write_modes_sb ( cpi , tile , w , tok , tok_end , mi_row , mi_col , subsize ) ;
 write_modes_sb ( cpi , tile , w , tok , tok_end , mi_row , mi_col + bs , subsize ) ;
 write_modes_sb ( cpi , tile , w , tok , tok_end , mi_row + bs , mi_col , subsize ) ;
 write_modes_sb ( cpi , tile , w , tok , tok_end , mi_row + bs , mi_col + bs , subsize ) ;
 break ;
 default : assert ( 0 ) ;
 }
 }
 if ( bsize >= BLOCK_8X8 && ( bsize == BLOCK_8X8 || partition != PARTITION_SPLIT ) ) update_partition_context ( xd , mi_row , mi_col , subsize , bsize ) ;
 }


TEST_F ( NativeBackendLibsecretTest , RemoveLoginsCreatedBetween ) {
 CheckRemoveLoginsBetween ( CREATED ) ;
 }


check_termcode(
    int		max_offset,
    char_u	*buf,
    int		bufsize,
    int		*buflen)
{
    char_u	*tp;
    char_u	*p;
    int		slen = 0;	// init for GCC
    int		modslen;
    int		len;
    int		retval = 0;
    int		offset;
    char_u	key_name[2];
    int		modifiers;
    char_u	*modifiers_start = NULL;
    int		key;
    int		new_slen;   // Length of what will replace the termcode
    char_u	string[MAX_KEY_CODE_LEN + 1];
    int		i, j;
    int		idx = 0;
    int		cpo_koffset;

    cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL);

    /*
     * Speed up the checks for terminal codes by gathering all first bytes
     * used in termleader[].  Often this is just a single <Esc>.
     */
    if (need_gather)
	gather_termleader();

    /*
     * Check at several positions in typebuf.tb_buf[], to catch something like
     * "x<Up>" that can be mapped. Stop at max_offset, because characters
     * after that cannot be used for mapping, and with @r commands
     * typebuf.tb_buf[] can become very long.
     * This is used often, KEEP IT FAST!
     */
    for (offset = 0; offset < max_offset; ++offset)
    {
	if (buf == NULL)
	{
	    if (offset >= typebuf.tb_len)
		break;
	    tp = typebuf.tb_buf + typebuf.tb_off + offset;
	    len = typebuf.tb_len - offset;	// length of the input
	}
	else
	{
	    if (offset >= *buflen)
		break;
	    tp = buf + offset;
	    len = *buflen - offset;
	}

	/*
	 * Don't check characters after K_SPECIAL, those are already
	 * translated terminal chars (avoid translating ~@^Hx).
	 */
	if (*tp == K_SPECIAL)
	{
	    offset += 2;	// there are always 2 extra characters
	    continue;
	}

	/*
	 * Skip this position if the character does not appear as the first
	 * character in term_strings. This speeds up a lot, since most
	 * termcodes start with the same character (ESC or CSI).
	 */
	i = *tp;
	for (p = termleader; *p && *p != i; ++p)
	    ;
	if (*p == NUL)
	    continue;

	/*
	 * Skip this position if p_ek is not set and tp[0] is an ESC and we
	 * are in Insert mode.
	 */
	if (*tp == ESC && !p_ek && (State & MODE_INSERT))
	    continue;

	key_name[0] = NUL;	// no key name found yet
	key_name[1] = NUL;	// no key name found yet
	modifiers = 0;		// no modifiers yet

#ifdef FEAT_GUI
	if (gui.in_use)
	{
	    /*
	     * GUI special key codes are all of the form [CSI xx].
	     */
	    if (*tp == CSI)	    // Special key from GUI
	    {
		if (len < 3)
		    return -1;	    // Shouldn't happen
		slen = 3;
		key_name[0] = tp[1];
		key_name[1] = tp[2];
	    }
	}
	else
#endif // FEAT_GUI
	{
	    int  mouse_index_found = -1;

	    for (idx = 0; idx < tc_len; ++idx)
	    {
		/*
		 * Ignore the entry if we are not at the start of
		 * typebuf.tb_buf[]
		 * and there are not enough characters to make a match.
		 * But only when the 'K' flag is in 'cpoptions'.
		 */
		slen = termcodes[idx].len;
		modifiers_start = NULL;
		if (cpo_koffset && offset && len < slen)
		    continue;
		if (STRNCMP(termcodes[idx].code, tp,
				     (size_t)(slen > len ? len : slen)) == 0)
		{
		    int	    looks_like_mouse_start = FALSE;

		    if (len < slen)		// got a partial sequence
			return -1;		// need to get more chars

		    /*
		     * When found a keypad key, check if there is another key
		     * that matches and use that one.  This makes <Home> to be
		     * found instead of <kHome> when they produce the same
		     * key code.
		     */
		    if (termcodes[idx].name[0] == 'K'
				       && VIM_ISDIGIT(termcodes[idx].name[1]))
		    {
			for (j = idx + 1; j < tc_len; ++j)
			    if (termcodes[j].len == slen &&
				    STRNCMP(termcodes[idx].code,
					    termcodes[j].code, slen) == 0)
			    {
				idx = j;
				break;
			    }
		    }

		    if (slen == 2 && len > 2
			    && termcodes[idx].code[0] == ESC
			    && termcodes[idx].code[1] == '[')
		    {
			// The mouse termcode "ESC [" is also the prefix of
			// "ESC [ I" (focus gained) and other keys.  Check some
			// more bytes to find out.
			if (!isdigit(tp[2]))
			{
			    // ESC [ without number following: Only use it when
			    // there is no other match.
			    looks_like_mouse_start = TRUE;
			}
			else if (termcodes[idx].name[0] == KS_DEC_MOUSE)
			{
			    char_u  *nr = tp + 2;
			    int	    count = 0;

			    // If a digit is following it could be a key with
			    // modifier, e.g., ESC [ 1;2P.  Can be confused
			    // with DEC_MOUSE, which requires four numbers
			    // following.  If not then it can't be a DEC_MOUSE
			    // code.
			    for (;;)
			    {
				++count;
				(void)getdigits(&nr);
				if (nr >= tp + len)
				    return -1;	// partial sequence
				if (*nr != ';')
				    break;
				++nr;
				if (nr >= tp + len)
				    return -1;	// partial sequence
			    }
			    if (count < 4)
				continue;	// no match
			}
		    }
		    if (looks_like_mouse_start)
		    {
			// Only use it when there is no other match.
			if (mouse_index_found < 0)
			    mouse_index_found = idx;
		    }
		    else
		    {
			key_name[0] = termcodes[idx].name[0];
			key_name[1] = termcodes[idx].name[1];
			break;
		    }
		}

		/*
		 * Check for code with modifier, like xterm uses:
		 * <Esc>[123;*X  (modslen == slen - 3)
		 * <Esc>[@;*X    (matches <Esc>[X and <Esc>[1;9X )
		 * Also <Esc>O*X and <M-O>*X (modslen == slen - 2).
		 * When there is a modifier the * matches a number.
		 * When there is no modifier the ;* or * is omitted.
		 */
		if (termcodes[idx].modlen > 0 && mouse_index_found < 0)
		{
		    int at_code;

		    modslen = termcodes[idx].modlen;
		    if (cpo_koffset && offset && len < modslen)
			continue;
		    at_code = termcodes[idx].code[modslen] == '@';
		    if (STRNCMP(termcodes[idx].code, tp,
				(size_t)(modslen > len ? len : modslen)) == 0)
		    {
			int	    n;

			if (len <= modslen)	// got a partial sequence
			    return -1;		// need to get more chars

			if (tp[modslen] == termcodes[idx].code[slen - 1])
			    // no modifiers
			    slen = modslen + 1;
			else if (tp[modslen] != ';' && modslen == slen - 3)
			    // no match for "code;*X" with "code;"
			    continue;
			else if (at_code && tp[modslen] != '1')
			    // no match for "<Esc>[@" with "<Esc>[1"
			    continue;
			else
			{
			    // Skip over the digits, the final char must
			    // follow. URXVT can use a negative value, thus
			    // also accept '-'.
			    for (j = slen - 2; j < len && (isdigit(tp[j])
				       || tp[j] == '-' || tp[j] == ';'); ++j)
				;
			    ++j;
			    if (len < j)	// got a partial sequence
				return -1;	// need to get more chars
			    if (tp[j - 1] != termcodes[idx].code[slen - 1])
				continue;	// no match

			    modifiers_start = tp + slen - 2;

			    // Match!  Convert modifier bits.
			    n = atoi((char *)modifiers_start);
			    modifiers |= decode_modifiers(n);

			    slen = j;
			}
			key_name[0] = termcodes[idx].name[0];
			key_name[1] = termcodes[idx].name[1];
			break;
		    }
		}
	    }
	    if (idx == tc_len && mouse_index_found >= 0)
	    {
		key_name[0] = termcodes[mouse_index_found].name[0];
		key_name[1] = termcodes[mouse_index_found].name[1];
	    }
	}

#ifdef FEAT_TERMRESPONSE
	if (key_name[0] == NUL
	    // Mouse codes of DEC and pterm start with <ESC>[.  When
	    // detecting the start of these mouse codes they might as well be
	    // another key code or terminal response.
# ifdef FEAT_MOUSE_DEC
	    || key_name[0] == KS_DEC_MOUSE
# endif
# ifdef FEAT_MOUSE_PTERM
	    || key_name[0] == KS_PTERM_MOUSE
# endif
	   )
	{
	    char_u *argp = tp[0] == ESC ? tp + 2 : tp + 1;

	    /*
	     * Check for responses from the terminal starting with {lead}:
	     * "<Esc>[" or CSI followed by [0-9>?]
	     *
	     * - Xterm version string: {lead}>{x};{vers};{y}c
	     *   Also eat other possible responses to t_RV, rxvt returns
	     *   "{lead}?1;2c".
	     *
	     * - Cursor position report: {lead}{row};{col}R
	     *   The final byte must be 'R'. It is used for checking the
	     *   ambiguous-width character state.
	     *
	     * - window position reply: {lead}3;{x};{y}t
	     *
	     * - key with modifiers when modifyOtherKeys is enabled:
	     *	    {lead}27;{modifier};{key}~
	     *	    {lead}{key};{modifier}u
	     */
	    if (((tp[0] == ESC && len >= 3 && tp[1] == '[')
			    || (tp[0] == CSI && len >= 2))
		    && (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?'))
	    {
		int resp = handle_csi(tp, len, argp, offset, buf,
					     bufsize, buflen, key_name, &slen);
		if (resp != 0)
		{
# ifdef DEBUG_TERMRESPONSE
		    if (resp == -1)
			LOG_TR(("Not enough characters for CSI sequence"));
# endif
		    return resp;
		}
	    }

	    // Check for fore/background color response from the terminal,
	    // starting} with <Esc>] or OSC
	    else if ((*T_RBG != NUL || *T_RFG != NUL)
			&& ((tp[0] == ESC && len >= 2 && tp[1] == ']')
			    || tp[0] == OSC))
	    {
		if (handle_osc(tp, argp, len, key_name, &slen) == FAIL)
		    return -1;
	    }

	    // Check for key code response from xterm,
	    // starting with <Esc>P or DCS
	    else if ((check_for_codes || rcs_status.tr_progress == STATUS_SENT)
		    && ((tp[0] == ESC && len >= 2 && tp[1] == 'P')
			|| tp[0] == DCS))
	    {
		if (handle_dcs(tp, argp, len, key_name, &slen) == FAIL)
		    return -1;
	    }
	}
#endif

	if (key_name[0] == NUL)
	    continue;	    // No match at this position, try next one

	// We only get here when we have a complete termcode match

#ifdef FEAT_GUI
	/*
	 * Only in the GUI: Fetch the pointer coordinates of the scroll event
	 * so that we know which window to scroll later.
	 */
	if (gui.in_use
		&& key_name[0] == (int)KS_EXTRA
		&& (key_name[1] == (int)KE_X1MOUSE
		    || key_name[1] == (int)KE_X2MOUSE
		    || key_name[1] == (int)KE_MOUSEMOVE_XY
		    || key_name[1] == (int)KE_MOUSELEFT
		    || key_name[1] == (int)KE_MOUSERIGHT
		    || key_name[1] == (int)KE_MOUSEDOWN
		    || key_name[1] == (int)KE_MOUSEUP))
	{
	    char_u	bytes[6];
	    int		num_bytes = get_bytes_from_buf(tp + slen, bytes, 4);

	    if (num_bytes == -1)	// not enough coordinates
		return -1;
	    mouse_col = 128 * (bytes[0] - ' ' - 1) + bytes[1] - ' ' - 1;
	    mouse_row = 128 * (bytes[2] - ' ' - 1) + bytes[3] - ' ' - 1;
	    slen += num_bytes;
	    // equal to K_MOUSEMOVE
	    if (key_name[1] == (int)KE_MOUSEMOVE_XY)
		key_name[1] = (int)KE_MOUSEMOVE;
	}
	else
#endif
	/*
	 * If it is a mouse click, get the coordinates.
	 */
	if (key_name[0] == KS_MOUSE
#ifdef FEAT_MOUSE_GPM
		|| key_name[0] == KS_GPM_MOUSE
#endif
#ifdef FEAT_MOUSE_JSB
		|| key_name[0] == KS_JSBTERM_MOUSE
#endif
#ifdef FEAT_MOUSE_NET
		|| key_name[0] == KS_NETTERM_MOUSE
#endif
#ifdef FEAT_MOUSE_DEC
		|| key_name[0] == KS_DEC_MOUSE
#endif
#ifdef FEAT_MOUSE_PTERM
		|| key_name[0] == KS_PTERM_MOUSE
#endif
#ifdef FEAT_MOUSE_URXVT
		|| key_name[0] == KS_URXVT_MOUSE
#endif
		|| key_name[0] == KS_SGR_MOUSE
		|| key_name[0] == KS_SGR_MOUSE_RELEASE)
	{
	    if (check_termcode_mouse(tp, &slen, key_name, modifiers_start, idx,
							     &modifiers) == -1)
		return -1;
	}

#ifdef FEAT_GUI
	/*
	 * If using the GUI, then we get menu and scrollbar events.
	 *
	 * A menu event is encoded as K_SPECIAL, KS_MENU, KE_FILLER followed by
	 * four bytes which are to be taken as a pointer to the vimmenu_T
	 * structure.
	 *
	 * A tab line event is encoded as K_SPECIAL KS_TABLINE nr, where "nr"
	 * is one byte with the tab index.
	 *
	 * A scrollbar event is K_SPECIAL, KS_VER_SCROLLBAR, KE_FILLER followed
	 * by one byte representing the scrollbar number, and then four bytes
	 * representing a long_u which is the new value of the scrollbar.
	 *
	 * A horizontal scrollbar event is K_SPECIAL, KS_HOR_SCROLLBAR,
	 * KE_FILLER followed by four bytes representing a long_u which is the
	 * new value of the scrollbar.
	 */
# ifdef FEAT_MENU
	else if (key_name[0] == (int)KS_MENU)
	{
	    long_u	val;
	    int		num_bytes = get_long_from_buf(tp + slen, &val);

	    if (num_bytes == -1)
		return -1;
	    current_menu = (vimmenu_T *)val;
	    slen += num_bytes;

	    // The menu may have been deleted right after it was used, check
	    // for that.
	    if (check_menu_pointer(root_menu, current_menu) == FAIL)
	    {
		key_name[0] = KS_EXTRA;
		key_name[1] = (int)KE_IGNORE;
	    }
	}
# endif
# ifdef FEAT_GUI_TABLINE
	else if (key_name[0] == (int)KS_TABLINE)
	{
	    // Selecting tabline tab or using its menu.
	    char_u	bytes[6];
	    int		num_bytes = get_bytes_from_buf(tp + slen, bytes, 1);

	    if (num_bytes == -1)
		return -1;
	    current_tab = (int)bytes[0];
	    if (current_tab == 255)	// -1 in a byte gives 255
		current_tab = -1;
	    slen += num_bytes;
	}
	else if (key_name[0] == (int)KS_TABMENU)
	{
	    // Selecting tabline tab or using its menu.
	    char_u	bytes[6];
	    int		num_bytes = get_bytes_from_buf(tp + slen, bytes, 2);

	    if (num_bytes == -1)
		return -1;
	    current_tab = (int)bytes[0];
	    current_tabmenu = (int)bytes[1];
	    slen += num_bytes;
	}
# endif
# ifndef USE_ON_FLY_SCROLL
	else if (key_name[0] == (int)KS_VER_SCROLLBAR)
	{
	    long_u	val;
	    char_u	bytes[6];
	    int		num_bytes;

	    // Get the last scrollbar event in the queue of the same type
	    j = 0;
	    for (i = 0; tp[j] == CSI && tp[j + 1] == KS_VER_SCROLLBAR
						     && tp[j + 2] != NUL; ++i)
	    {
		j += 3;
		num_bytes = get_bytes_from_buf(tp + j, bytes, 1);
		if (num_bytes == -1)
		    break;
		if (i == 0)
		    current_scrollbar = (int)bytes[0];
		else if (current_scrollbar != (int)bytes[0])
		    break;
		j += num_bytes;
		num_bytes = get_long_from_buf(tp + j, &val);
		if (num_bytes == -1)
		    break;
		scrollbar_value = val;
		j += num_bytes;
		slen = j;
	    }
	    if (i == 0)		// not enough characters to make one
		return -1;
	}
	else if (key_name[0] == (int)KS_HOR_SCROLLBAR)
	{
	    long_u	val;
	    int		num_bytes;

	    // Get the last horiz. scrollbar event in the queue
	    j = 0;
	    for (i = 0; tp[j] == CSI && tp[j + 1] == KS_HOR_SCROLLBAR
						     && tp[j + 2] != NUL; ++i)
	    {
		j += 3;
		num_bytes = get_long_from_buf(tp + j, &val);
		if (num_bytes == -1)
		    break;
		scrollbar_value = val;
		j += num_bytes;
		slen = j;
	    }
	    if (i == 0)		// not enough characters to make one
		return -1;
	}
# endif // !USE_ON_FLY_SCROLL
#endif // FEAT_GUI

#if (defined(UNIX) || defined(VMS))
	/*
	 * Handle FocusIn/FocusOut event sequences reported by XTerm.
	 * (CSI I/CSI O)
	 */
	if (key_name[0] == KS_EXTRA
# ifdef FEAT_GUI
		&& !gui.in_use
# endif
	    )
	{
	    if (key_name[1] == KE_FOCUSGAINED)
	    {
		if (!focus_state)
		{
		    ui_focus_change(TRUE);
		    did_cursorhold = TRUE;
		    focus_state = TRUE;
		}
		key_name[1] = (int)KE_IGNORE;
	    }
	    else if (key_name[1] == KE_FOCUSLOST)
	    {
		if (focus_state)
		{
		    ui_focus_change(FALSE);
		    did_cursorhold = TRUE;
		    focus_state = FALSE;
		}
		key_name[1] = (int)KE_IGNORE;
	    }
	}
#endif

	/*
	 * Change <xHome> to <Home>, <xUp> to <Up>, etc.
	 */
	key = handle_x_keys(TERMCAP2KEY(key_name[0], key_name[1]));

	/*
	 * Add any modifier codes to our string.
	 */
	new_slen = modifiers2keycode(modifiers, &key, string);

	// Finally, add the special key code to our string
	key_name[0] = KEY2TERMCAP0(key);
	key_name[1] = KEY2TERMCAP1(key);
	if (key_name[0] == KS_KEY)
	{
	    // from ":set <M-b>=xx"
	    if (has_mbyte)
		new_slen += (*mb_char2bytes)(key_name[1], string + new_slen);
	    else
		string[new_slen++] = key_name[1];
	}
	else if (new_slen == 0 && key_name[0] == KS_EXTRA
						  && key_name[1] == KE_IGNORE)
	{
	    // Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED
	    // to indicate what happened.
	    retval = KEYLEN_REMOVED;
	}
	else
	{
	    string[new_slen++] = K_SPECIAL;
	    string[new_slen++] = key_name[0];
	    string[new_slen++] = key_name[1];
	}
	if (put_string_in_typebuf(offset, slen, string, new_slen,
						 buf, bufsize, buflen) == FAIL)
	    return -1;
	return retval == 0 ? (len + new_slen - slen + offset) : retval;
    }

#ifdef FEAT_TERMRESPONSE
    LOG_TR(("normal character"));
#endif

    return 0;			    // no match found
}


static void pdf_clear_stack ( fz_context * ctx , pdf_csi * csi ) {
 int i ;
 pdf_drop_obj ( ctx , csi -> obj ) ;
 csi -> obj = NULL ;
 csi -> name [ 0 ] = 0 ;
 csi -> string_len = 0 ;
 for ( i = 0 ;
 i < csi -> top ;
 i ++ ) csi -> stack [ i ] = 0 ;
 csi -> top = 0 ;
 }


int gdev_mem_bits_size ( const gx_device_memory * dev , int width , int height , ulong * psize ) {
 int num_planes = dev -> is_planar ? dev -> color_info . num_components : 0 ;
 gx_render_plane_t plane1 ;
 const gx_render_plane_t * planes ;
 ulong size ;
 int pi ;
 if ( num_planes ) planes = dev -> planes ;
 else planes = & plane1 , plane1 . depth = dev -> color_info . depth , num_planes = 1 ;
 for ( size = 0 , pi = 0 ;
 pi < num_planes ;
 ++ pi ) size += bitmap_raster_pad_align ( width * planes [ pi ] . depth , dev -> pad , dev -> log2_align_mod ) ;
 if ( height != 0 ) if ( size > ( max_ulong - ARCH_ALIGN_PTR_MOD ) / ( ulong ) height ) return_error ( gs_error_VMerror ) ;
 size = ROUND_UP ( size * height , ARCH_ALIGN_PTR_MOD ) ;
 if ( dev -> log2_align_mod > log2_align_bitmap_mod ) size += 1 << dev -> log2_align_mod ;
 * psize = size ;
 return 0 ;
 }


static int x_set_buffer ( gx_device_X * xdev ) {
 gs_memory_t * mem = gs_memory_stable ( xdev -> memory ) ;
 bool buffered = xdev -> space_params . MaxBitmap > 0 ;
 const gx_device_procs * procs ;
 setup : if ( buffered ) {
 gx_device_memory * mdev = ( gx_device_memory * ) xdev -> target ;
 if ( mdev == 0 || mdev -> color_info . depth != xdev -> orig_color_info . depth ) {
 const gx_device_memory * mdproto = gdev_mem_device_for_bits ( xdev -> orig_color_info . depth ) ;
 if ( ! mdproto ) {
 buffered = false ;
 goto setup ;
 }
 if ( mdev ) {
 gx_device_set_target ( ( gx_device_forward * ) mdev , NULL ) ;
 }
 else {
 mdev = gs_alloc_struct ( mem , gx_device_memory , & st_device_memory , "memory device" ) ;
 if ( mdev == 0 ) {
 buffered = false ;
 goto setup ;
 }
 }
 gs_make_mem_device ( mdev , mdproto , mem , 0 , ( gx_device * ) xdev ) ;
 gx_device_set_target ( ( gx_device_forward * ) xdev , ( gx_device * ) mdev ) ;
 xdev -> is_buffered = true ;
 }
 if ( mdev -> width != xdev -> width || mdev -> height != xdev -> height ) {
 byte * buffer ;
 ulong space ;
 if ( gdev_mem_data_size ( mdev , xdev -> width , xdev -> height , & space ) < 0 || space > xdev -> space_params . MaxBitmap ) {
 buffered = false ;
 goto setup ;
 }
 buffer = ( xdev -> buffer ? ( byte * ) gs_resize_object ( mem , xdev -> buffer , space , "buffer" ) : gs_alloc_bytes ( mem , space , "buffer" ) ) ;
 if ( ! buffer ) {
 buffered = false ;
 goto setup ;
 }
 xdev -> buffer_size = space ;
 xdev -> buffer = buffer ;
 mdev -> width = xdev -> width ;
 mdev -> height = xdev -> height ;
 mdev -> icc_struct = xdev -> icc_struct ;
 rc_increment ( xdev -> icc_struct ) ;
 mdev -> color_info = xdev -> orig_color_info ;
 mdev -> base = xdev -> buffer ;
 gdev_mem_open_scan_lines ( mdev , xdev -> height ) ;
 }
 xdev -> white = gx_device_white ( ( gx_device * ) xdev ) ;
 xdev -> black = gx_device_black ( ( gx_device * ) xdev ) ;
 procs = & gs_bbox_device . procs ;
 }
 else {
 gs_free_object ( mem , xdev -> buffer , "buffer" ) ;
 xdev -> buffer = 0 ;
 xdev -> buffer_size = 0 ;
 if ( ! xdev -> is_buffered ) return 0 ;
 gx_device_set_target ( ( gx_device_forward * ) xdev -> target , NULL ) ;
 gx_device_set_target ( ( gx_device_forward * ) xdev , NULL ) ;
 xdev -> is_buffered = false ;
 procs = & gs_x11_device . procs ;
 }
 if ( dev_proc ( xdev , fill_rectangle ) != procs -> fill_rectangle ) {
 # define COPY_PROC ( p ) set_dev_proc ( xdev , p , procs -> p ) COPY_PROC ( fill_rectangle ) ;
 COPY_PROC ( copy_mono ) ;
 COPY_PROC ( copy_color ) ;
 COPY_PROC ( copy_alpha ) ;
 COPY_PROC ( fill_path ) ;
 COPY_PROC ( stroke_path ) ;
 COPY_PROC ( fill_mask ) ;
 COPY_PROC ( fill_trapezoid ) ;
 COPY_PROC ( fill_parallelogram ) ;
 COPY_PROC ( fill_triangle ) ;
 COPY_PROC ( draw_thin_line ) ;
 COPY_PROC ( strip_tile_rectangle ) ;
 COPY_PROC ( strip_copy_rop ) ;
 COPY_PROC ( begin_typed_image ) ;
 COPY_PROC ( text_begin ) ;
 # undef COPY_PROC if ( xdev -> is_buffered ) {
 check_device_separable ( ( gx_device * ) xdev ) ;
 gx_device_forward_fill_in_procs ( ( gx_device_forward * ) xdev ) ;
 xdev -> box_procs = gdev_x_box_procs ;
 xdev -> box_proc_data = xdev ;
 }
 else {
 check_device_separable ( ( gx_device * ) xdev ) ;
 gx_device_fill_in_procs ( ( gx_device * ) xdev ) ;
 }
 }
 return 0 ;
 }


void PPC_init_hw ( uint32_t mem_size , uint32_t kernel_addr , uint32_t kernel_size , uint32_t stack_addr , int boot_device , const unsigned char * initrd_file ) {
 CPUPPCState * env = global_env ;
 uint8_t * p ;
 # if ! defined ( USE_OPEN_FIRMWARE ) char * tmp ;
 uint32_t tmpi [ 2 ] ;
 # endif printf ( "RAM size: %u 0x%08x (%u)\n" , mem_size , mem_size , mem_size >> 20 ) ;
 # if defined ( USE_OPEN_FIRMWARE ) setup_memory ( env , mem_size ) ;
 # endif {
 # if 1 uint32_t offset = get_le32 ( phys_ram_base + kernel_addr ) ;
 # else uint32_t offset = 12 ;
 # endif env -> nip = kernel_addr + offset ;
 printf ( "Start address: 0x%08x\n" , env -> nip ) ;
 }
 msr_ee = 0 ;
 msr_fp = 1 ;
 msr_pr = 0 ;
 msr_me = 1 ;
 msr_fe0 = msr_fe1 = 0 ;
 msr_ip = 0 ;
 msr_ir = msr_dr = 1 ;
 msr_le = msr_ile = 0 ;
 env -> gpr [ 1 ] = stack_addr ;
 env -> gpr [ 2 ] = 0 ;
 env -> gpr [ 8 ] = kernel_addr ;
 env -> decr = 0xFFFFFFFF ;
 p = phys_ram_base + kernel_addr ;
 # if ! defined ( USE_OPEN_FIRMWARE ) setup_BAT ( env , 0 , 0x00000000 , 0x00000000 , mem_size , 1 , 0 , 2 ) ;
 put_long ( p , 0xdeadc0de ) ;
 p = phys_ram_base + stack_addr ;
 put_long ( p , stack_addr ) ;
 p -= 32 ;
 env -> gpr [ 1 ] -= 32 ;
 env -> gpr [ 3 ] = 0 ;
 if ( initrd_file != NULL ) {
 int size ;
 env -> gpr [ 4 ] = ( kernel_addr + kernel_size + 4095 ) & ~ 4095 ;
 size = load_initrd ( initrd_file , phys_ram_base + env -> gpr [ 4 ] ) ;
 if ( size < 0 ) {
 env -> gpr [ 4 ] = env -> gpr [ 5 ] = 0 ;
 }
 else {
 env -> gpr [ 5 ] = size ;
 boot_device = 'e' ;
 }
 printf ( "Initrd loaded at 0x%08x (%d) (0x%08x 0x%08x)\n" , env -> gpr [ 4 ] , env -> gpr [ 5 ] , kernel_addr , kernel_size ) ;
 }
 else {
 env -> gpr [ 4 ] = env -> gpr [ 5 ] = 0 ;
 }
 # if 0 p = phys_ram_base + kernel_addr + kernel_size + ( 1 << 20 ) - 1 ) & ~ ( ( 1 << 20 ) - 1 ) ;
 # else p = phys_ram_base + kernel_addr + 0x400000 ;
 # endif if ( loglevel > 0 ) {
 fprintf ( logfile , "bootinfos: %p 0x%08x\n" , p , ( int ) ( p - phys_ram_base ) ) ;
 }
 else {
 printf ( "bootinfos: %p 0x%08x\n" , p , ( int ) ( p - phys_ram_base ) ) ;
 }
 # if 0 sprintf ( p + 0x1000 , "console=ttyS0,9600 root=%02x%02x mem=%dM" , boot_devs [ boot_device - 'a' ] . major , boot_devs [ boot_device - 'a' ] . minor , mem_size >> 20 ) ;
 # else sprintf ( p + 0x1000 , "console=ttyS0,9600 console=tty0 root=%s mem=%dM" , boot_devs [ boot_device - 'a' ] . name , mem_size >> 20 ) ;
 # endif env -> gpr [ 6 ] = p + 0x1000 - phys_ram_base ;
 env -> gpr [ 7 ] = env -> gpr [ 6 ] + strlen ( p + 0x1000 ) ;
 if ( loglevel > 0 ) {
 fprintf ( logfile , "cmdline: %p 0x%08x [%s]\n" , p + 0x1000 , env -> gpr [ 6 ] , p + 0x1000 ) ;
 }
 else {
 printf ( "cmdline: %p 0x%08x [%s]\n" , p + 0x1000 , env -> gpr [ 6 ] , p + 0x1000 ) ;
 }
 p = set_bootinfo_tag ( p , 0x1010 , 0 , 0 ) ;
 p = set_bootinfo_tag ( p , 0x1012 , env -> gpr [ 7 ] - env -> gpr [ 6 ] , env -> gpr [ 6 ] + phys_ram_base ) ;
 tmp = ( void * ) tmpi ;
 tmp [ 0 ] = ( mem_size >> 24 ) & 0xFF ;
 tmp [ 1 ] = ( mem_size >> 16 ) & 0xFF ;
 tmp [ 2 ] = ( mem_size >> 8 ) & 0xFF ;
 tmp [ 3 ] = mem_size & 0xFF ;
 p = set_bootinfo_tag ( p , 0x1017 , 4 , tmpi ) ;
 tmp [ 0 ] = ( env -> gpr [ 4 ] >> 24 ) & 0xFF ;
 tmp [ 1 ] = ( env -> gpr [ 4 ] >> 16 ) & 0xFF ;
 tmp [ 2 ] = ( env -> gpr [ 4 ] >> 8 ) & 0xFF ;
 tmp [ 3 ] = env -> gpr [ 4 ] & 0xFF ;
 tmp [ 4 ] = ( env -> gpr [ 5 ] >> 24 ) & 0xFF ;
 tmp [ 5 ] = ( env -> gpr [ 5 ] >> 16 ) & 0xFF ;
 tmp [ 6 ] = ( env -> gpr [ 5 ] >> 8 ) & 0xFF ;
 tmp [ 7 ] = env -> gpr [ 5 ] & 0xFF ;
 p = set_bootinfo_tag ( p , 0x1014 , 8 , tmpi ) ;
 env -> gpr [ 4 ] = env -> gpr [ 5 ] = 0 ;
 p = set_bootinfo_tag ( p , 0x1011 , 0 , 0 ) ;
 # else setup_BAT ( env , 0 , 0x01000000 , kernel_addr , 0x00400000 , 1 , 0 , 2 ) ;
 {
 # if 0 uint32_t offset = get_le32 ( phys_ram_base + kernel_addr ) ;
 # else uint32_t offset = 12 ;
 # endif env -> nip = 0x01000000 | ( kernel_addr + offset ) ;
 printf ( "Start address: 0x%08x\n" , env -> nip ) ;
 }
 env -> gpr [ 1 ] = env -> nip + ( 1 << 22 ) ;
 p = phys_ram_base + stack_addr ;
 put_long ( p - 32 , stack_addr ) ;
 env -> gpr [ 1 ] -= 32 ;
 printf ( "Kernel starts at 0x%08x stack 0x%08x\n" , env -> nip , env -> gpr [ 1 ] ) ;
 setup_BAT ( env , 1 , 0x00000000 , 0x00000000 , 0x010000000 , 1 , 1 , 2 ) ;
 setup_BAT ( env , 2 , 0xFFFE0000 , mem_size - 131072 , 131072 , 1 , 0 , 1 ) ;
 {
 char * p ;
 p = ( char * ) phys_ram_base + mem_size - 131072 ;
 * p ++ = 0x18 ;
 * p ++ = 0x00 ;
 * p ++ = 0x00 ;
 * p ++ = 0x02 ;
 * p ++ = 0x4E ;
 * p ++ = 0x80 ;
 * p ++ = 0x00 ;
 * p ++ = 0x20 ;
 }
 env -> gpr [ 5 ] = 0xFFFE0000 ;
 {
 OF_transl_t translations [ 3 ] = {
 {
 0x01000000 , 0x00400000 , kernel_addr , 0x00000002 , }
 , {
 0x00000000 , 0x01000000 , 0x00000000 , 0x00000002 , }
 , {
 0xFFFE0000 , 0x00020000 , mem_size - ( 128 * 1024 ) , 0x00000001 , }
 , }
 ;
 OF_register_translations ( 3 , translations ) ;
 }
 OF_register_bus ( "isa" , "isa" ) ;
 OF_register_serial ( "isa" , "serial" , 4 , 0x3f8 ) ;
 OF_register_stdio ( "serial" , "serial" ) ;
 RTAS_init ( ) ;
 # if 0 # if 0 p = phys_ram_base + kernel_addr + kernel_size + ( 1 << 20 ) - 1 ) & ~ ( ( 1 << 20 ) - 1 ) ;
 # else p = phys_ram_base + kernel_addr + 0x400000 ;
 # endif # if 1 sprintf ( p , "console=ttyS0,9600 root=%02x%02x mem=%dM" , boot_devs [ boot_device - 'a' ] . major , boot_devs [ boot_device - 'a' ] . minor , mem_size >> 20 ) ;
 # else sprintf ( p , "console=ttyS0,9600 root=%s mem=%dM ne2000=0x300,9" , boot_devs [ boot_device - 'a' ] . name , mem_size >> 20 ) ;
 # endif OF_register_bootargs ( p ) ;
 # endif # endif }


static int dissect_h225_H322Caps ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
 offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_H322Caps , H322Caps_sequence ) ;
 return offset ;
 }


static int get_buffer(AVCodecContext *avctx, AVFrame *pic) { pic->type = FF_BUFFER_TYPE_USER; pic->data[0] = (void *)1; return 0; }


static PREDICTION_MODE read_intra_mode ( vp9_reader * r , const vp9_prob * p ) {
 return ( PREDICTION_MODE ) vp9_read_tree ( r , vp9_intra_mode_tree , p ) ;
 }


static CharDriverState *qemu_chr_open_pipe(QemuOpts *opts) { int fd_in, fd_out; char filename_in[256], filename_out[256]; const char *filename = qemu_opt_get(opts, "path"); if (filename == NULL) { fprintf(stderr, "chardev: pipe: no filename given\n"); return NULL; } snprintf(filename_in, 256, "%s.in", filename); snprintf(filename_out, 256, "%s.out", filename); TFR(fd_in = open(filename_in, O_RDWR | O_BINARY)); TFR(fd_out = open(filename_out, O_RDWR | O_BINARY)); if (fd_in < 0 || fd_out < 0) { if (fd_in >= 0) close(fd_in); if (fd_out >= 0) close(fd_out); TFR(fd_in = fd_out = open(filename, O_RDWR | O_BINARY)); if (fd_in < 0) return NULL; } return qemu_chr_open_fd(fd_in, fd_out); }