static struct task_struct *copy_process(unsigned long clone_flags,
					unsigned long stack_start,
					unsigned long stack_size,
					int __user *child_tidptr,
					struct pid *pid,
					int trace)
{
	int retval;
	struct task_struct *p;

	if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
		return ERR_PTR(-EINVAL);

	/*
	 * Thread groups must share signals as well, and detached threads
	 * can only be started up within the thread group.
	 */
	if ((clone_flags & CLONE_THREAD) && !(clone_flags & CLONE_SIGHAND))
		return ERR_PTR(-EINVAL);

	/*
	 * Shared signal handlers imply shared VM. By way of the above,
	 * thread groups also imply shared VM. Blocking this case allows
	 * for various simplifications in other code.
	 */
	if ((clone_flags & CLONE_SIGHAND) && !(clone_flags & CLONE_VM))
		return ERR_PTR(-EINVAL);

	/*
	 * Siblings of global init remain as zombies on exit since they are
	 * not reaped by their parent (swapper). To solve this and to avoid
	 * multi-rooted process trees, prevent global and container-inits
	 * from creating siblings.
	 */
	if ((clone_flags & CLONE_PARENT) &&
				current->signal->flags & SIGNAL_UNKILLABLE)
		return ERR_PTR(-EINVAL);

	/*
	 * If the new process will be in a different pid namespace
	 * don't allow the creation of threads.
	 */
	if ((clone_flags & (CLONE_VM|CLONE_NEWPID)) &&
	    (task_active_pid_ns(current) != current->nsproxy->pid_ns))
		return ERR_PTR(-EINVAL);

	retval = security_task_create(clone_flags);
	if (retval)
		goto fork_out;

	retval = -ENOMEM;
	p = dup_task_struct(current);
	if (!p)
		goto fork_out;

	ftrace_graph_init_task(p);
	get_seccomp_filter(p);

	rt_mutex_init_task(p);

#ifdef CONFIG_PROVE_LOCKING
	DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
	DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
#endif
	retval = -EAGAIN;
	if (atomic_read(&p->real_cred->user->processes) >=
			task_rlimit(p, RLIMIT_NPROC)) {
		if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
		    p->real_cred->user != INIT_USER)
			goto bad_fork_free;
	}
	current->flags &= ~PF_NPROC_EXCEEDED;

	retval = copy_creds(p, clone_flags);
	if (retval < 0)
		goto bad_fork_free;

	/*
	 * If multiple threads are within copy_process(), then this check
	 * triggers too late. This doesn't hurt, the check is only there
	 * to stop root fork bombs.
	 */
	retval = -EAGAIN;
	if (nr_threads >= max_threads)
		goto bad_fork_cleanup_count;

	if (!try_module_get(task_thread_info(p)->exec_domain->module))
		goto bad_fork_cleanup_count;

	p->did_exec = 0;
	delayacct_tsk_init(p);	/* Must remain after dup_task_struct() */
	copy_flags(clone_flags, p);
	INIT_LIST_HEAD(&p->children);
	INIT_LIST_HEAD(&p->sibling);
	rcu_copy_process(p);
	p->vfork_done = NULL;
	spin_lock_init(&p->alloc_lock);

	init_sigpending(&p->pending);

	p->utime = p->stime = p->gtime = 0;
	p->utimescaled = p->stimescaled = 0;
#ifndef CONFIG_VIRT_CPU_ACCOUNTING
	p->prev_cputime.utime = p->prev_cputime.stime = 0;
#endif
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
	seqlock_init(&p->vtime_seqlock);
	p->vtime_snap = 0;
	p->vtime_snap_whence = VTIME_SLEEPING;
#endif

#if defined(SPLIT_RSS_COUNTING)
	memset(&p->rss_stat, 0, sizeof(p->rss_stat));
#endif

	p->default_timer_slack_ns = current->timer_slack_ns;

	task_io_accounting_init(&p->ioac);
	acct_clear_integrals(p);

	posix_cpu_timers_init(p);

	do_posix_clock_monotonic_gettime(&p->start_time);
	p->real_start_time = p->start_time;
	monotonic_to_bootbased(&p->real_start_time);
	p->io_context = NULL;
	p->audit_context = NULL;
	if (clone_flags & CLONE_THREAD)
		threadgroup_change_begin(current);
	cgroup_fork(p);
#ifdef CONFIG_NUMA
	p->mempolicy = mpol_dup(p->mempolicy);
	if (IS_ERR(p->mempolicy)) {
		retval = PTR_ERR(p->mempolicy);
		p->mempolicy = NULL;
		goto bad_fork_cleanup_cgroup;
	}
	mpol_fix_fork_child_flag(p);
#endif
#ifdef CONFIG_CPUSETS
	p->cpuset_mem_spread_rotor = NUMA_NO_NODE;
	p->cpuset_slab_spread_rotor = NUMA_NO_NODE;
	seqcount_init(&p->mems_allowed_seq);
#endif
#ifdef CONFIG_TRACE_IRQFLAGS
	p->irq_events = 0;
	p->hardirqs_enabled = 0;
	p->hardirq_enable_ip = 0;
	p->hardirq_enable_event = 0;
	p->hardirq_disable_ip = _THIS_IP_;
	p->hardirq_disable_event = 0;
	p->softirqs_enabled = 1;
	p->softirq_enable_ip = _THIS_IP_;
	p->softirq_enable_event = 0;
	p->softirq_disable_ip = 0;
	p->softirq_disable_event = 0;
	p->hardirq_context = 0;
	p->softirq_context = 0;
#endif
#ifdef CONFIG_LOCKDEP
	p->lockdep_depth = 0; /* no locks held yet */
	p->curr_chain_key = 0;
	p->lockdep_recursion = 0;
#endif

#ifdef CONFIG_DEBUG_MUTEXES
	p->blocked_on = NULL; /* not blocked yet */
#endif
#ifdef CONFIG_MEMCG
	p->memcg_batch.do_batch = 0;
	p->memcg_batch.memcg = NULL;
#endif

	/* Perform scheduler related setup. Assign this task to a CPU. */
	sched_fork(p);

	retval = perf_event_init_task(p);
	if (retval)
		goto bad_fork_cleanup_policy;
	retval = audit_alloc(p);
	if (retval)
		goto bad_fork_cleanup_policy;
	/* copy all the process information */
	retval = copy_semundo(clone_flags, p);
	if (retval)
		goto bad_fork_cleanup_audit;
	retval = copy_files(clone_flags, p);
	if (retval)
		goto bad_fork_cleanup_semundo;
	retval = copy_fs(clone_flags, p);
	if (retval)
		goto bad_fork_cleanup_files;
	retval = copy_sighand(clone_flags, p);
	if (retval)
		goto bad_fork_cleanup_fs;
	retval = copy_signal(clone_flags, p);
	if (retval)
		goto bad_fork_cleanup_sighand;
	retval = copy_mm(clone_flags, p);
	if (retval)
		goto bad_fork_cleanup_signal;
	retval = copy_namespaces(clone_flags, p);
	if (retval)
		goto bad_fork_cleanup_mm;
	retval = copy_io(clone_flags, p);
	if (retval)
		goto bad_fork_cleanup_namespaces;
	retval = copy_thread(clone_flags, stack_start, stack_size, p);
	if (retval)
		goto bad_fork_cleanup_io;

	if (pid != &init_struct_pid) {
		retval = -ENOMEM;
		pid = alloc_pid(p->nsproxy->pid_ns);
		if (!pid)
			goto bad_fork_cleanup_io;
	}

	p->pid = pid_nr(pid);
	p->tgid = p->pid;
	if (clone_flags & CLONE_THREAD)
		p->tgid = current->tgid;

	p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
	/*
	 * Clear TID on mm_release()?
	 */
	p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
#ifdef CONFIG_BLOCK
	p->plug = NULL;
#endif
#ifdef CONFIG_FUTEX
	p->robust_list = NULL;
#ifdef CONFIG_COMPAT
	p->compat_robust_list = NULL;
#endif
	INIT_LIST_HEAD(&p->pi_state_list);
	p->pi_state_cache = NULL;
#endif
	uprobe_copy_process(p);
	/*
	 * sigaltstack should be cleared when sharing the same VM
	 */
	if ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM)
		p->sas_ss_sp = p->sas_ss_size = 0;

	/*
	 * Syscall tracing and stepping should be turned off in the
	 * child regardless of CLONE_PTRACE.
	 */
	user_disable_single_step(p);
	clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);
#ifdef TIF_SYSCALL_EMU
	clear_tsk_thread_flag(p, TIF_SYSCALL_EMU);
#endif
	clear_all_latency_tracing(p);

	/* ok, now we should be set up.. */
	if (clone_flags & CLONE_THREAD)
		p->exit_signal = -1;
	else if (clone_flags & CLONE_PARENT)
		p->exit_signal = current->group_leader->exit_signal;
	else
		p->exit_signal = (clone_flags & CSIGNAL);

	p->pdeath_signal = 0;
	p->exit_state = 0;

	p->nr_dirtied = 0;
	p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10);
	p->dirty_paused_when = 0;

	/*
	 * Ok, make it visible to the rest of the system.
	 * We dont wake it up yet.
	 */
	p->group_leader = p;
	INIT_LIST_HEAD(&p->thread_group);
	p->task_works = NULL;

	/* Need tasklist lock for parent etc handling! */
	write_lock_irq(&tasklist_lock);

	/* CLONE_PARENT re-uses the old parent */
	if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
		p->real_parent = current->real_parent;
		p->parent_exec_id = current->parent_exec_id;
	} else {
		p->real_parent = current;
		p->parent_exec_id = current->self_exec_id;
	}

	spin_lock(&current->sighand->siglock);

	/*
	 * Process group and session signals need to be delivered to just the
	 * parent before the fork or both the parent and the child after the
	 * fork. Restart if a signal comes in before we add the new process to
	 * it's process group.
	 * A fatal signal pending means that current will exit, so the new
	 * thread can't slip out of an OOM kill (or normal SIGKILL).
	*/
	recalc_sigpending();
	if (signal_pending(current)) {
		spin_unlock(&current->sighand->siglock);
		write_unlock_irq(&tasklist_lock);
		retval = -ERESTARTNOINTR;
		goto bad_fork_free_pid;
	}

	if (clone_flags & CLONE_THREAD) {
		current->signal->nr_threads++;
		atomic_inc(&current->signal->live);
		atomic_inc(&current->signal->sigcnt);
		p->group_leader = current->group_leader;
		list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group);
	}

	if (likely(p->pid)) {
		ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);

		if (thread_group_leader(p)) {
			if (is_child_reaper(pid)) {
				ns_of_pid(pid)->child_reaper = p;
				p->signal->flags |= SIGNAL_UNKILLABLE;
			}

			p->signal->leader_pid = pid;
			p->signal->tty = tty_kref_get(current->signal->tty);
			attach_pid(p, PIDTYPE_PGID, task_pgrp(current));
			attach_pid(p, PIDTYPE_SID, task_session(current));
			list_add_tail(&p->sibling, &p->real_parent->children);
			list_add_tail_rcu(&p->tasks, &init_task.tasks);
			__this_cpu_inc(process_counts);
		}
		attach_pid(p, PIDTYPE_PID, pid);
		nr_threads++;
	}

	total_forks++;
	spin_unlock(&current->sighand->siglock);
	write_unlock_irq(&tasklist_lock);
	proc_fork_connector(p);
	cgroup_post_fork(p);
	if (clone_flags & CLONE_THREAD)
		threadgroup_change_end(current);
	perf_event_fork(p);

	trace_task_newtask(p, clone_flags);

	return p;

bad_fork_free_pid:
	if (pid != &init_struct_pid)
		free_pid(pid);
bad_fork_cleanup_io:
	if (p->io_context)
		exit_io_context(p);
bad_fork_cleanup_namespaces:
	exit_task_namespaces(p);
bad_fork_cleanup_mm:
	if (p->mm)
		mmput(p->mm);
bad_fork_cleanup_signal:
	if (!(clone_flags & CLONE_THREAD))
		free_signal_struct(p->signal);
bad_fork_cleanup_sighand:
	__cleanup_sighand(p->sighand);
bad_fork_cleanup_fs:
	exit_fs(p); /* blocking */
bad_fork_cleanup_files:
	exit_files(p); /* blocking */
bad_fork_cleanup_semundo:
	exit_sem(p);
bad_fork_cleanup_audit:
	audit_free(p);
bad_fork_cleanup_policy:
	perf_event_free_task(p);
#ifdef CONFIG_NUMA
	mpol_put(p->mempolicy);
bad_fork_cleanup_cgroup:
#endif
	if (clone_flags & CLONE_THREAD)
		threadgroup_change_end(current);
	cgroup_exit(p, 0);
	delayacct_tsk_free(p);
	module_put(task_thread_info(p)->exec_domain->module);
bad_fork_cleanup_count:
	atomic_dec(&p->cred->user->processes);
	exit_creds(p);
bad_fork_free:
	free_task(p);
fork_out:
	return ERR_PTR(retval);
}


static gpgme_error_t gpgsm_import ( void * engine , gpgme_data_t keydata , gpgme_key_t * keyarray ) {
 engine_gpgsm_t gpgsm = engine ;
 gpgme_error_t err ;
 gpgme_data_encoding_t dataenc ;
 int idx ;
 if ( ! gpgsm ) return gpg_error ( GPG_ERR_INV_VALUE ) ;
 if ( keydata && keyarray ) return gpg_error ( GPG_ERR_INV_VALUE ) ;
 dataenc = gpgme_data_get_encoding ( keydata ) ;
 if ( keyarray ) {
 size_t buflen ;
 char * buffer , * p ;
 err = gpgsm_assuan_simple_command ( gpgsm -> assuan_ctx , "GETINFO cmd_has_option IMPORT re-import" , NULL , NULL ) ;
 if ( err ) return gpg_error ( GPG_ERR_NOT_SUPPORTED ) ;
 for ( idx = 0 , buflen = 0 ;
 keyarray [ idx ] ;
 idx ++ ) {
 if ( keyarray [ idx ] -> protocol == GPGME_PROTOCOL_CMS && keyarray [ idx ] -> subkeys && keyarray [ idx ] -> subkeys -> fpr && * keyarray [ idx ] -> subkeys -> fpr ) buflen += strlen ( keyarray [ idx ] -> subkeys -> fpr ) + 1 ;
 }
 buffer = malloc ( buflen + 1 ) ;
 if ( ! buffer ) return gpg_error_from_syserror ( ) ;
 for ( idx = 0 , p = buffer ;
 keyarray [ idx ] ;
 idx ++ ) {
 if ( keyarray [ idx ] -> protocol == GPGME_PROTOCOL_CMS && keyarray [ idx ] -> subkeys && keyarray [ idx ] -> subkeys -> fpr && * keyarray [ idx ] -> subkeys -> fpr ) p = stpcpy ( stpcpy ( p , keyarray [ idx ] -> subkeys -> fpr ) , "\n" ) ;
 }
 err = gpgme_data_new_from_mem ( & gpgsm -> input_helper_data , buffer , buflen , 0 ) ;
 if ( err ) {
 free ( buffer ) ;
 return err ;
 }
 gpgsm -> input_helper_memory = buffer ;
 gpgsm -> input_cb . data = gpgsm -> input_helper_data ;
 err = gpgsm_set_fd ( gpgsm , INPUT_FD , map_data_enc ( gpgsm -> input_cb . data ) ) ;
 if ( err ) {
 gpgme_data_release ( gpgsm -> input_helper_data ) ;
 gpgsm -> input_helper_data = NULL ;
 free ( gpgsm -> input_helper_memory ) ;
 gpgsm -> input_helper_memory = NULL ;
 return err ;
 }
 gpgsm_clear_fd ( gpgsm , OUTPUT_FD ) ;
 gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ;
 gpgsm -> inline_data = NULL ;
 return start ( gpgsm , "IMPORT --re-import" ) ;
 }
 else if ( dataenc == GPGME_DATA_ENCODING_URL || dataenc == GPGME_DATA_ENCODING_URL0 || dataenc == GPGME_DATA_ENCODING_URLESC ) {
 return gpg_error ( GPG_ERR_NOT_IMPLEMENTED ) ;
 }
 else {
 gpgsm -> input_cb . data = keydata ;
 err = gpgsm_set_fd ( gpgsm , INPUT_FD , map_data_enc ( gpgsm -> input_cb . data ) ) ;
 if ( err ) return err ;
 gpgsm_clear_fd ( gpgsm , OUTPUT_FD ) ;
 gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ;
 gpgsm -> inline_data = NULL ;
 return start ( gpgsm , "IMPORT" ) ;
 }
 }


static int ebml_read_ascii(AVIOContext *pb, int size, char **str) { av_free(*str); /* EBML strings are usually not 0-terminated, so we allocate one * byte more, read the string and NULL-terminate it ourselves. */ if (!(*str = av_malloc(size + 1))) return AVERROR(ENOMEM); if (avio_read(pb, (uint8_t *) *str, size) != size) { av_freep(str); return AVERROR(EIO); } (*str)[size] = '\0'; return 0; }


void ppc_store_sdr1(CPUPPCState *env, target_ulong value) { LOG_MMU("%s: " TARGET_FMT_lx "\n", __func__, value); if (env->spr[SPR_SDR1] != value) { env->spr[SPR_SDR1] = value; #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { target_ulong htabsize = value & SDR_64_HTABSIZE; if (htabsize > 28) { fprintf(stderr, "Invalid HTABSIZE 0x" TARGET_FMT_lx " stored in SDR1\n", htabsize); htabsize = 28; } env->htab_mask = (1ULL << (htabsize + 18)) - 1; env->htab_base = value & SDR_64_HTABORG; } else #endif /* defined(TARGET_PPC64) */ { /* FIXME: Should check for valid HTABMASK values */ env->htab_mask = ((value & SDR_32_HTABMASK) << 16) | 0xFFFF; env->htab_base = value & SDR_32_HTABORG; } tlb_flush(env, 1); } }


void stream_start(BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, int64_t speed, BlockdevOnError on_error, BlockCompletionFunc *cb, void *opaque, Error **errp) { StreamBlockJob *s; s = block_job_create(&stream_job_driver, bs, speed, cb, opaque, errp); if (!s) { return; } s->base = base; s->backing_file_str = g_strdup(backing_file_str); s->on_error = on_error; s->common.co = qemu_coroutine_create(stream_run); trace_stream_start(bs, base, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co, s); }


int ieee80211_radiotap_iterator_init ( struct ieee80211_radiotap_iterator * iterator , struct ieee80211_radiotap_header * radiotap_header , int max_length , const struct ieee80211_radiotap_vendor_namespaces * vns ) {
 if ( max_length < ( int ) sizeof ( struct ieee80211_radiotap_header ) ) return - EINVAL ;
 if ( radiotap_header -> it_version ) return - EINVAL ;
 if ( max_length < get_unaligned_le16 ( & radiotap_header -> it_len ) ) return - EINVAL ;
 iterator -> _rtheader = radiotap_header ;
 iterator -> _max_length = get_unaligned_le16 ( & radiotap_header -> it_len ) ;
 iterator -> _arg_index = 0 ;
 iterator -> _bitmap_shifter = get_unaligned_le32 ( & radiotap_header -> it_present ) ;
 iterator -> _arg = ( guint8 * ) radiotap_header + sizeof ( * radiotap_header ) ;
 iterator -> _reset_on_ext = 0 ;
 iterator -> _next_ns_data = NULL ;
 iterator -> _next_bitmap = & radiotap_header -> it_present ;
 iterator -> _next_bitmap ++ ;
 iterator -> _vns = vns ;
 iterator -> current_namespace = & radiotap_ns ;
 iterator -> is_radiotap_ns = 1 ;
 # ifdef RADIOTAP_SUPPORT_OVERRIDES iterator -> n_overrides = 0 ;
 iterator -> overrides = NULL ;
 # endif if ( iterator -> _bitmap_shifter & ( 1U << IEEE80211_RADIOTAP_EXT ) ) {
 if ( ! ITERATOR_VALID ( iterator , sizeof ( guint32 ) ) ) return - EINVAL ;
 while ( get_unaligned_le32 ( iterator -> _arg ) & ( 1U << IEEE80211_RADIOTAP_EXT ) ) {
 iterator -> _arg += sizeof ( guint32 ) ;
 if ( ! ITERATOR_VALID ( iterator , sizeof ( guint32 ) ) ) return - EINVAL ;
 }
 iterator -> _arg += sizeof ( guint32 ) ;
 }
 iterator -> this_arg = iterator -> _arg ;
 return 0 ;
 }


static gint dissect_codec ( tvbuff_t * tvb , packet_info * pinfo , proto_item * service_item , proto_tree * tree , gint offset , guint losc , gint media_type , gint media_codec_type , guint32 * vendor_id , guint16 * vendor_codec ) {
 proto_item * pitem ;
 guint32 value ;
 guint8 * value8 = ( guint8 * ) & value ;
 switch ( media_type ) {
 case MEDIA_TYPE_AUDIO : switch ( media_codec_type ) {
 case CODEC_SBC : proto_tree_add_item ( tree , hf_btavdtp_sbc_sampling_frequency_16000 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_sampling_frequency_32000 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_sampling_frequency_44100 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_sampling_frequency_48000 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_channel_mode_mono , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_channel_mode_dual_channel , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_channel_mode_stereo , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_channel_mode_joint_stereo , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_block_4 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_block_8 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_block_12 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_block_16 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_subbands_4 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_subbands_8 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_allocation_method_snr , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_sbc_allocation_method_loudness , tvb , offset + 1 , 1 , ENC_NA ) ;
 pitem = proto_tree_add_item ( tree , hf_btavdtp_sbc_min_bitpool , tvb , offset + 2 , 1 , ENC_NA ) ;
 value = tvb_get_guint8 ( tvb , offset + 2 ) ;
 if ( value < 2 || value > 250 ) {
 expert_add_info ( pinfo , pitem , & ei_btavdtp_sbc_min_bitpool_out_of_range ) ;
 }
 pitem = proto_tree_add_item ( tree , hf_btavdtp_sbc_max_bitpool , tvb , offset + 3 , 1 , ENC_NA ) ;
 value = tvb_get_guint8 ( tvb , offset + 3 ) ;
 if ( value < 2 || value > 250 ) {
 expert_add_info ( pinfo , pitem , & ei_btavdtp_sbc_max_bitpool_out_of_range ) ;
 }
 value = tvb_get_h_guint32 ( tvb , offset ) ;
 if ( value ) {
 col_append_fstr ( pinfo -> cinfo , COL_INFO , " (%s%s%s%s%s| %s%s%s%s%s| block: %s%s%s%s%s| subbands: %s%s%s| allocation: %s%s%s| bitpool: %u..%u)" , ( value8 [ 0 ] & 0x80 ) ? "16000 " : "" , ( value8 [ 0 ] & 0x40 ) ? "32000 " : "" , ( value8 [ 0 ] & 0x20 ) ? "44100 " : "" , ( value8 [ 0 ] & 0x10 ) ? "48000 " : "" , ( value8 [ 0 ] & 0xF0 ) ? "" : "not set " , ( value8 [ 0 ] & 0x08 ) ? "Mono " : "" , ( value8 [ 0 ] & 0x04 ) ? "DualChannel " : "" , ( value8 [ 0 ] & 0x02 ) ? "Stereo " : "" , ( value8 [ 0 ] & 0x01 ) ? "JointStereo " : "" , ( value8 [ 0 ] & 0x0F ) ? "" : "not set " , ( value8 [ 1 ] & 0x80 ) ? "4 " : "" , ( value8 [ 1 ] & 0x40 ) ? "8 " : "" , ( value8 [ 1 ] & 0x20 ) ? "12 " : "" , ( value8 [ 1 ] & 0x10 ) ? "16 " : "" , ( value8 [ 1 ] & 0xF0 ) ? "" : "not set " , ( value8 [ 1 ] & 0x08 ) ? "4 " : "" , ( value8 [ 1 ] & 0x04 ) ? "8 " : "" , ( value8 [ 1 ] & 0x0C ) ? "" : "not set " , ( value8 [ 1 ] & 0x02 ) ? "SNR " : "" , ( value8 [ 1 ] & 0x01 ) ? "Loudness " : "" , ( value8 [ 0 ] & 0x03 ) ? "" : "not set " , value8 [ 2 ] , value8 [ 3 ] ) ;
 proto_item_append_text ( service_item , " (%s%s%s%s%s| %s%s%s%s%s| block: %s%s%s%s%s| subbands: %s%s%s| allocation: %s%s%s| bitpool: %u..%u)" , ( value8 [ 0 ] & 0x80 ) ? "16000 " : "" , ( value8 [ 0 ] & 0x40 ) ? "32000 " : "" , ( value8 [ 0 ] & 0x20 ) ? "44100 " : "" , ( value8 [ 0 ] & 0x10 ) ? "48000 " : "" , ( value8 [ 0 ] & 0xF0 ) ? "" : "not set " , ( value8 [ 0 ] & 0x08 ) ? "Mono " : "" , ( value8 [ 0 ] & 0x04 ) ? "DualChannel " : "" , ( value8 [ 0 ] & 0x02 ) ? "Stereo " : "" , ( value8 [ 0 ] & 0x01 ) ? "JointStereo " : "" , ( value8 [ 0 ] & 0x0F ) ? "" : "not set " , ( value8 [ 1 ] & 0x80 ) ? "4 " : "" , ( value8 [ 1 ] & 0x40 ) ? "8 " : "" , ( value8 [ 1 ] & 0x20 ) ? "12 " : "" , ( value8 [ 1 ] & 0x10 ) ? "16 " : "" , ( value8 [ 1 ] & 0xF0 ) ? "" : "not set " , ( value8 [ 1 ] & 0x08 ) ? "4 " : "" , ( value8 [ 1 ] & 0x04 ) ? "8 " : "" , ( value8 [ 1 ] & 0x0C ) ? "" : "not set " , ( value8 [ 1 ] & 0x02 ) ? "SNR " : "" , ( value8 [ 1 ] & 0x01 ) ? "Loudness " : "" , ( value8 [ 0 ] & 0x03 ) ? "" : "not set " , value8 [ 2 ] , value8 [ 3 ] ) ;
 }
 else {
 col_append_fstr ( pinfo -> cinfo , COL_INFO , " (none)" ) ;
 proto_item_append_text ( service_item , " (none)" ) ;
 }
 break ;
 case CODEC_MPEG12_AUDIO : proto_tree_add_item ( tree , hf_btavdtp_mpeg12_layer_1 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_layer_2 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_layer_3 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_crc_protection , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_channel_mode_mono , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_channel_mode_dual_channel , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_channel_mode_stereo , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_channel_mode_joint_stereo , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_rfa , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_mpf_2 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_16000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_22050 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_24000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_32000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_44100 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_sampling_frequency_48000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_vbr_supported , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg12_bit_rate , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
 break ;
 case CODEC_MPEG24_AAC : proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_mpeg2_aac_lc , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_mpeg4_aac_lc , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_mpeg4_aac_ltp , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_mpeg4_aac_scalable , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_object_type_rfa , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_8000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_11025 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_12000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_16000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_22050 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_24000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_32000 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_44100 , tvb , offset + 1 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_48000 , tvb , offset + 2 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_64000 , tvb , offset + 2 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_88200 , tvb , offset + 2 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_sampling_frequency_96000 , tvb , offset + 2 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_channels_1 , tvb , offset + 2 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_channels_2 , tvb , offset + 2 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_rfa , tvb , offset + 2 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_vbr_supported , tvb , offset + 3 , 3 , ENC_BIG_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg24_bit_rate , tvb , offset + 3 , 3 , ENC_BIG_ENDIAN ) ;
 break ;
 case CODEC_ATRAC : proto_tree_add_item ( tree , hf_btavdtp_atrac_version , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_channel_mode_single_channel , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_channel_mode_dual_channel , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_channel_mode_joint_stereo , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_rfa1 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_rfa2 , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_sampling_frequency_44100 , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_sampling_frequency_48000 , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_vbr_supported , tvb , offset + 3 , 3 , ENC_BIG_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_bit_rate , tvb , offset + 3 , 3 , ENC_BIG_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_maximum_sul , tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_atrac_rfa3 , tvb , offset + 6 , 1 , ENC_NA ) ;
 break ;
 case CODEC_VENDOR : proto_tree_add_item ( tree , hf_btavdtp_vendor_id , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
 if ( vendor_id ) * vendor_id = tvb_get_letohl ( tvb , offset ) ;
 if ( vendor_codec ) * vendor_codec = tvb_get_letohs ( tvb , offset + 4 ) ;
 switch ( tvb_get_letohl ( tvb , offset ) ) {
 case 0x004F : proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_apt_codec_id , tvb , offset + 4 , 2 , ENC_LITTLE_ENDIAN ) ;
 value = tvb_get_letohs ( tvb , offset + 4 ) ;
 if ( value == 0x0001 ) {
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_aptx_sampling_frequency_16000 , tvb , offset + 6 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_aptx_sampling_frequency_32000 , tvb , offset + 6 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_aptx_sampling_frequency_44100 , tvb , offset + 6 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_aptx_sampling_frequency_48000 , tvb , offset + 6 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_aptx_channel_mode_mono , tvb , offset + 6 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_aptx_channel_mode_dual_channel , tvb , offset + 6 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_aptx_channel_mode_stereo , tvb , offset + 6 , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_aptx_channel_mode_joint_stereo , tvb , offset + 6 , 1 , ENC_NA ) ;
 col_append_fstr ( pinfo -> cinfo , COL_INFO , " (%s -" , val_to_str_const ( value , vendor_apt_codec_vals , "unknown codec" ) ) ;
 proto_item_append_text ( service_item , " (%s -" , val_to_str_const ( value , vendor_apt_codec_vals , "unknown codec" ) ) ;
 value = tvb_get_guint8 ( tvb , offset + 6 ) ;
 if ( value ) {
 col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s%s%s%s%s,%s%s%s%s%s)" , ( value & 0x80 ) ? " 16000" : "" , ( value & 0x40 ) ? " 32000" : "" , ( value & 0x20 ) ? " 44100" : "" , ( value & 0x10 ) ? " 48000" : "" , ( value & 0xF0 ) ? "" : "not set " , ( value & 0x08 ) ? " Mono" : "" , ( value & 0x04 ) ? " DualChannel" : "" , ( value & 0x02 ) ? " Stereo" : "" , ( value & 0x01 ) ? " JointStereo" : "" , ( value & 0x0F ) ? "" : "not set " ) ;
 proto_item_append_text ( service_item , "%s%s%s%s%s,%s%s%s%s%s)" , ( value & 0x80 ) ? " 16000" : "" , ( value & 0x40 ) ? " 32000" : "" , ( value & 0x20 ) ? " 44100" : "" , ( value & 0x10 ) ? " 48000" : "" , ( value & 0xF0 ) ? "" : "not set " , ( value & 0x08 ) ? " Mono" : "" , ( value & 0x04 ) ? " DualChannel" : "" , ( value & 0x02 ) ? " Stereo" : "" , ( value & 0x01 ) ? " JointStereo" : "" , ( value & 0x0F ) ? "" : "not set " ) ;
 }
 else {
 col_append_fstr ( pinfo -> cinfo , COL_INFO , " none)" ) ;
 proto_item_append_text ( service_item , " none)" ) ;
 }
 }
 else {
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_value , tvb , offset + 6 , losc - 6 , ENC_NA ) ;
 }
 break ;
 default : proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_codec_id , tvb , offset + 4 , 2 , ENC_LITTLE_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_value , tvb , offset + 6 , losc - 6 , ENC_NA ) ;
 }
 break ;
 default : proto_tree_add_item ( tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
 }
 break ;
 case MEDIA_TYPE_VIDEO : switch ( media_codec_type ) {
 case CODEC_H263_BASELINE : case CODEC_H263_PROFILE_3 : case CODEC_H263_PROFILE_8 : proto_tree_add_item ( tree , hf_btavdtp_h263_level_10 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_h263_level_20 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_h263_level_30 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_h263_level_rfa , tvb , offset , 1 , ENC_NA ) ;
 break ;
 case CODEC_MPEG4_VSP : proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_0 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_1 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_2 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_3 , tvb , offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_btavdtp_mpeg4_level_rfa , tvb , offset , 1 , ENC_NA ) ;
 break ;
 case CODEC_VENDOR : proto_tree_add_item ( tree , hf_btavdtp_vendor_id , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_codec_id , tvb , offset + 4 , 2 , ENC_LITTLE_ENDIAN ) ;
 proto_tree_add_item ( tree , hf_btavdtp_vendor_specific_value , tvb , offset + 6 , losc - 6 , ENC_NA ) ;
 break ;
 default : proto_tree_add_item ( tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
 }
 break ;
 default : proto_tree_add_item ( tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
 }
 offset += losc ;
 return offset ;
 }


int ff_spatial_idwt_init2(DWTContext *d, IDWTELEM *buffer, int width, int height, int stride, enum dwt_type type, int decomposition_count, IDWTELEM *temp) { int level; d->buffer = buffer; d->width = width; d->height = height; d->stride = stride; d->decomposition_count = decomposition_count; d->temp = temp + 8; for(level=decomposition_count-1; level>=0; level--){ int hl = height >> level; int stride_l = stride << level; switch(type){ case DWT_DIRAC_DD9_7: spatial_compose_dd97i_init(d->cs+level, buffer, hl, stride_l); break; case DWT_DIRAC_LEGALL5_3: spatial_compose53i_init2(d->cs+level, buffer, hl, stride_l); break; case DWT_DIRAC_DD13_7: spatial_compose_dd137i_init(d->cs+level, buffer, hl, stride_l); break; case DWT_DIRAC_HAAR0: case DWT_DIRAC_HAAR1: d->cs[level].y = 1; break; case DWT_DIRAC_DAUB9_7: spatial_compose97i_init2(d->cs+level, buffer, hl, stride_l); break; default: d->cs[level].y = 0; break; } } switch (type) { case DWT_DIRAC_DD9_7: d->spatial_compose = spatial_compose_dd97i_dy; d->vertical_compose_l0 = (void*)vertical_compose53iL0; d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0; d->horizontal_compose = horizontal_compose_dd97i; d->support = 7; break; case DWT_DIRAC_LEGALL5_3: d->spatial_compose = spatial_compose_dirac53i_dy; d->vertical_compose_l0 = (void*)vertical_compose53iL0; d->vertical_compose_h0 = (void*)vertical_compose_dirac53iH0; d->horizontal_compose = horizontal_compose_dirac53i; d->support = 3; break; case DWT_DIRAC_DD13_7: d->spatial_compose = spatial_compose_dd137i_dy; d->vertical_compose_l0 = (void*)vertical_compose_dd137iL0; d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0; d->horizontal_compose = horizontal_compose_dd137i; d->support = 7; break; case DWT_DIRAC_HAAR0: case DWT_DIRAC_HAAR1: d->spatial_compose = spatial_compose_haari_dy; d->vertical_compose = (void*)vertical_compose_haar; if (type == DWT_DIRAC_HAAR0) d->horizontal_compose = horizontal_compose_haar0i; else d->horizontal_compose = horizontal_compose_haar1i; d->support = 1; break; case DWT_DIRAC_FIDELITY: d->spatial_compose = spatial_compose_fidelity; d->vertical_compose_l0 = (void*)vertical_compose_fidelityiL0; d->vertical_compose_h0 = (void*)vertical_compose_fidelityiH0; d->horizontal_compose = horizontal_compose_fidelityi; break; case DWT_DIRAC_DAUB9_7: d->spatial_compose = spatial_compose_daub97i_dy; d->vertical_compose_l0 = (void*)vertical_compose_daub97iL0; d->vertical_compose_h0 = (void*)vertical_compose_daub97iH0; d->vertical_compose_l1 = (void*)vertical_compose_daub97iL1; d->vertical_compose_h1 = (void*)vertical_compose_daub97iH1; d->horizontal_compose = horizontal_compose_daub97i; d->support = 5; break; default: av_log(NULL, AV_LOG_ERROR, "Unknown wavelet type %d\n", type); return -1; } if (HAVE_MMX) ff_spatial_idwt_init_mmx(d, type); return 0; }


TPM2B_ECC_POINT_Unmarshal(TPM2B_ECC_POINT *target, BYTE **buffer, INT32 *size)
{
    TPM_RC rc = TPM_RC_SUCCESS;

    INT32 startSize;
    if (rc == TPM_RC_SUCCESS) {
	rc = UINT16_Unmarshal(&target->size, buffer, size);
    }
    if (rc == TPM_RC_SUCCESS) {
	if (target->size == 0) {
	    rc = TPM_RC_SIZE;
	}
    }
    if (rc == TPM_RC_SUCCESS) {
	startSize = *size;
    }
    if (rc == TPM_RC_SUCCESS) {
	rc = TPMS_ECC_POINT_Unmarshal(&target->point, buffer, size);
    }
    if (rc == TPM_RC_SUCCESS) {
	if (target->size != startSize - *size) {
	    rc = TPM_RC_SIZE;
	}
    }
    return rc;
}


void vp9_temporal_filter_apply_c ( uint8_t * frame1 , unsigned int stride , uint8_t * frame2 , unsigned int block_width , unsigned int block_height , int strength , int filter_weight , unsigned int * accumulator , uint16_t * count ) {
 unsigned int i , j , k ;
 int modifier ;
 int byte = 0 ;
 const int rounding = strength > 0 ? 1 << ( strength - 1 ) : 0 ;
 for ( i = 0 , k = 0 ;
 i < block_height ;
 i ++ ) {
 for ( j = 0 ;
 j < block_width ;
 j ++ , k ++ ) {
 int src_byte = frame1 [ byte ] ;
 int pixel_value = * frame2 ++ ;
 modifier = src_byte - pixel_value ;
 modifier *= modifier ;
 modifier *= 3 ;
 modifier += rounding ;
 modifier >>= strength ;
 if ( modifier > 16 ) modifier = 16 ;
 modifier = 16 - modifier ;
 modifier *= filter_weight ;
 count [ k ] += modifier ;
 accumulator [ k ] += modifier * pixel_value ;
 byte ++ ;
 }
 byte += stride - block_width ;
 }
 }


TPML_DIGEST_VALUES_Unmarshal(TPML_DIGEST_VALUES *target, BYTE **buffer, INT32 *size)
{
    TPM_RC rc = TPM_RC_SUCCESS;

    UINT32 i;
    if (rc == TPM_RC_SUCCESS) {
	rc = UINT32_Unmarshal(&target->count, buffer, size);
    }
    if (rc == TPM_RC_SUCCESS) {
	if (target->count > HASH_COUNT) {
	    rc = TPM_RC_SIZE;
	}
    }
    for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
	rc = TPMT_HA_Unmarshal(&target->digests[i], buffer, size, NO);
    }
    return rc;
}


static LAST_MSG_REC * last_msg_find ( GSList * list , const char * nick ) {
 while ( list != NULL ) {
 LAST_MSG_REC * rec = list -> data ;
 if ( g_ascii_strcasecmp ( rec -> nick , nick ) == 0 ) return rec ;
 list = list -> next ;
 }
 return NULL ;
 }


static int need_output(void) { int i; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; OutputFile *of = output_files[ost->file_index]; AVFormatContext *os = output_files[ost->file_index]->ctx; if (ost->is_past_recording_time || (os->pb && avio_tell(os->pb) >= of->limit_filesize)) continue; if (ost->frame_number >= ost->max_frames) { int j; for (j = 0; j < of->ctx->nb_streams; j++) output_streams[of->ost_index + j]->is_past_recording_time = 1; continue; } return 1; } return 0; }


static void setup_vm_cmd(IVState *s, const char *cmd, bool msix) { uint64_t barsize; s->qtest = qtest_start(cmd); s->pcibus = qpci_init_pc(NULL); s->dev = get_device(s->pcibus); s->reg_base = qpci_iomap(s->dev, 0, &barsize); g_assert_nonnull(s->reg_base); g_assert_cmpuint(barsize, ==, 256); if (msix) { qpci_msix_enable(s->dev); } s->mem_base = qpci_iomap(s->dev, 2, &barsize); g_assert_nonnull(s->mem_base); g_assert_cmpuint(barsize, ==, TMPSHMSIZE); qpci_device_enable(s->dev); }


static guint16 de_network_name ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * add_string _U_ , int string_len _U_ ) {
 guint8 oct ;
 guint32 curr_offset ;
 guint8 coding_scheme , num_spare_bits ;
 guint32 num_text_bits ;
 proto_item * item ;
 curr_offset = offset ;
 oct = tvb_get_guint8 ( tvb , curr_offset ) ;
 proto_tree_add_item ( tree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
 coding_scheme = ( oct & 0x70 ) >> 4 ;
 proto_tree_add_item ( tree , hf_gsm_a_dtap_coding_scheme , tvb , curr_offset , 1 , ENC_NA ) ;
 proto_tree_add_item ( tree , hf_gsm_a_dtap_add_ci , tvb , curr_offset , 1 , ENC_NA ) ;
 num_spare_bits = oct & 0x07 ;
 item = proto_tree_add_item ( tree , hf_gsm_a_dtap_number_of_spare_bits , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
 curr_offset ++ ;
 NO_MORE_DATA_CHECK ( len ) ;
 switch ( coding_scheme ) {
 case 0 : num_text_bits = ( ( len - 1 ) << 3 ) - num_spare_bits ;
 if ( num_spare_bits && ( num_text_bits % 7 ) ) {
 expert_add_info ( pinfo , item , & ei_gsm_a_dtap_text_string_not_multiple_of_7 ) ;
 }
 proto_tree_add_ts_23_038_7bits_item ( tree , hf_gsm_a_dtap_text_string , tvb , curr_offset << 3 , num_text_bits / 7 ) ;
 break ;
 case 1 : proto_tree_add_item ( tree , hf_gsm_a_dtap_text_string , tvb , curr_offset , len - 1 , ENC_UCS_2 | ENC_BIG_ENDIAN ) ;
 break ;
 default : proto_tree_add_expert ( tree , pinfo , & ei_gsm_a_dtap_coding_scheme , tvb , curr_offset , len - 1 ) ;
 }
 return ( len ) ;
 }


IN_PROC_BROWSER_TEST_F ( UnloadTest , DISABLED_BrowserCloseInfiniteBeforeUnloadAlert ) {
 if ( base : : CommandLine : : ForCurrentProcess ( ) -> HasSwitch ( switches : : kSingleProcess ) ) return ;
 LoadUrlAndQuitBrowser ( INFINITE_BEFORE_UNLOAD_ALERT_HTML , "infinitebeforeunloadalert" ) ;
 }


static void m68k_cpu_reset(CPUState *s) { M68kCPU *cpu = M68K_CPU(s); M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu); CPUM68KState *env = &cpu->env; mcc->parent_reset(s); memset(env, 0, offsetof(CPUM68KState, end_reset_fields)); #if !defined(CONFIG_USER_ONLY) env->sr = 0x2700; #endif m68k_switch_sp(env); /* ??? FP regs should be initialized to NaN. */ cpu_m68k_set_ccr(env, 0); /* TODO: We should set PC from the interrupt vector. */ env->pc = 0; }


static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p)
{
	memcpy(&p->id, &x->id, sizeof(p->id));
	memcpy(&p->sel, &x->sel, sizeof(p->sel));
	memcpy(&p->lft, &x->lft, sizeof(p->lft));
	memcpy(&p->curlft, &x->curlft, sizeof(p->curlft));
	memcpy(&p->stats, &x->stats, sizeof(p->stats));
	memcpy(&p->saddr, &x->props.saddr, sizeof(p->saddr));
	p->mode = x->props.mode;
	p->replay_window = x->props.replay_window;
	p->reqid = x->props.reqid;
	p->family = x->props.family;
	p->flags = x->props.flags;
	p->seq = x->km.seq;
}


static int dissect_zbee_zcl_appl_ctrl ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) {
 proto_tree * payload_tree ;
 zbee_zcl_packet * zcl ;
 guint offset = 0 ;
 guint8 cmd_id ;
 gint rem_len ;
 if ( data == NULL ) return 0 ;
 zcl = ( zbee_zcl_packet * ) data ;
 cmd_id = zcl -> cmd_id ;
 if ( zcl -> direction == ZBEE_ZCL_FCF_TO_SERVER ) {
 col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_appl_ctrl_srv_rx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ;
 proto_tree_add_item ( tree , hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id , tvb , offset , 1 , cmd_id ) ;
 rem_len = tvb_reported_length_remaining ( tvb , ++ offset ) ;
 if ( rem_len > 0 ) {
 payload_tree = proto_tree_add_subtree ( tree , tvb , offset , rem_len , ett_zbee_zcl_appl_ctrl , NULL , "Payload" ) ;
 switch ( cmd_id ) {
 case ZBEE_ZCL_CMD_ID_APPL_CTRL_EXECUTION_CMD : dissect_zcl_appl_ctrl_exec_cmd ( tvb , payload_tree , & offset ) ;
 break ;
 case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE : case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE_RESUME : case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_PAUSE : break ;
 case ZBEE_ZCL_CMD_ID_APPL_CTRL_WRITE_FUNCS : dissect_zcl_appl_ctrl_wr_funcs ( tvb , payload_tree , & offset ) ;
 break ;
 case ZBEE_ZCL_CMD_ID_APPL_CTRL_OVERLOAD_WARNING : dissect_zcl_appl_ctrl_ovrl_warning ( tvb , payload_tree , & offset ) ;
 break ;
 default : break ;
 }
 }
 }
 else {
 col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_appl_ctrl_srv_tx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ;
 proto_tree_add_item ( tree , hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id , tvb , offset , 1 , cmd_id ) ;
 rem_len = tvb_reported_length_remaining ( tvb , ++ offset ) ;
 if ( rem_len > 0 ) {
 payload_tree = proto_tree_add_subtree ( tree , tvb , offset , rem_len , ett_zbee_zcl_appl_ctrl , NULL , "Payload" ) ;
 switch ( cmd_id ) {
 case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_RSP : case ZBEE_ZCL_CMD_ID_APPL_CTRL_SIGNAL_STATE_NOTIF : dissect_zcl_appl_ctrl_signal_state_rsp ( tvb , payload_tree , & offset ) ;
 break ;
 default : break ;
 }
 }
 }
 return tvb_captured_length ( tvb ) ;
 }


TSVConn TSTransformOutputVConnGet ( TSVConn connp ) {
 sdk_assert ( sdk_sanity_check_iocore_structure ( connp ) == TS_SUCCESS ) ;
 VConnection * vc = ( VConnection * ) connp ;
 TSVConn data ;
 vc -> get_data ( TS_API_DATA_OUTPUT_VC , & data ) ;
 return data ;
 }


int socket_dgram(SocketAddressLegacy *remote, SocketAddressLegacy *local, Error **errp) { int fd; /* * TODO SOCKET_ADDRESS_LEGACY_KIND_FD when fd is AF_INET or AF_INET6 * (although other address families can do SOCK_DGRAM, too) */ switch (remote->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: fd = inet_dgram_saddr(remote->u.inet.data, local ? local->u.inet.data : NULL, errp); break; default: error_setg(errp, "socket type unsupported for datagram"); fd = -1; } return fd; }


static int s302m_parse_frame_header ( AVCodecContext * avctx , const uint8_t * buf , int buf_size ) {
 uint32_t h ;
 int frame_size , channels , bits ;
 if ( buf_size <= AES3_HEADER_LEN ) {
 av_log ( avctx , AV_LOG_ERROR , "frame is too short\n" ) ;
 return AVERROR_INVALIDDATA ;
 }
 h = AV_RB32 ( buf ) ;
 frame_size = ( h >> 16 ) & 0xffff ;
 channels = ( ( h >> 14 ) & 0x0003 ) * 2 + 2 ;
 bits = ( ( h >> 4 ) & 0x0003 ) * 4 + 16 ;
 if ( AES3_HEADER_LEN + frame_size != buf_size || bits > 24 ) {
 av_log ( avctx , AV_LOG_ERROR , "frame has invalid header\n" ) ;
 return AVERROR_INVALIDDATA ;
 }
 avctx -> bits_per_coded_sample = bits ;
 if ( bits > 16 ) avctx -> sample_fmt = AV_SAMPLE_FMT_S32 ;
 else avctx -> sample_fmt = AV_SAMPLE_FMT_S16 ;
 avctx -> channels = channels ;
 avctx -> sample_rate = 48000 ;
 avctx -> bit_rate = 48000 * avctx -> channels * ( avctx -> bits_per_coded_sample + 4 ) + 32 * ( 48000 / ( buf_size * 8 / ( avctx -> channels * ( avctx -> bits_per_coded_sample + 4 ) ) ) ) ;
 return frame_size ;
 }


static int mono_decode ( COOKContext * q , COOKSubpacket * p , float * mlt_buffer ) {
 int category_index [ 128 ] = {
 0 }
 ;
 int category [ 128 ] = {
 0 }
 ;
 int quant_index_table [ 102 ] ;
 int res ;
 if ( ( res = decode_envelope ( q , p , quant_index_table ) ) < 0 ) return res ;
 q -> num_vectors = get_bits ( & q -> gb , p -> log2_numvector_size ) ;
 categorize ( q , p , quant_index_table , category , category_index ) ;
 expand_category ( q , category , category_index ) ;
 decode_vectors ( q , p , category , quant_index_table , mlt_buffer ) ;
 return 0 ;
 }


static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TM2Context * const l = avctx->priv_data; AVFrame * const p= (AVFrame*)&l->pic; int i, skip, t; uint8_t *swbuf; swbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if(!swbuf){ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); return -1; } p->reference = 1; p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if(avctx->reget_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_free(swbuf); return -1; } l->dsp.bswap_buf((uint32_t*)swbuf, (const uint32_t*)buf, buf_size >> 2); skip = tm2_read_header(l, swbuf); if(skip == -1){ av_free(swbuf); return -1; } for(i = 0; i < TM2_NUM_STREAMS; i++){ t = tm2_read_stream(l, swbuf + skip, tm2_stream_order[i]); if(t == -1){ av_free(swbuf); return -1; } skip += t; } p->key_frame = tm2_decode_blocks(l, p); if(p->key_frame) p->pict_type = FF_I_TYPE; else p->pict_type = FF_P_TYPE; l->cur = !l->cur; *data_size = sizeof(AVFrame); *(AVFrame*)data = l->pic; av_free(swbuf); return buf_size; }


static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int yend) { int x, y; int *bounding_values= s->bounding_values_array+127; int width = s->fragment_width[!!plane]; int height = s->fragment_height[!!plane]; int fragment = s->fragment_start [plane] + ystart * width; int stride = s->current_frame.linesize[plane]; uint8_t *plane_data = s->current_frame.data [plane]; if (!s->flipped_image) stride = -stride; plane_data += s->data_offset[plane] + 8*ystart*stride; for (y = ystart; y < yend; y++) { for (x = 0; x < width; x++) { /* This code basically just deblocks on the edges of coded blocks. * However, it has to be much more complicated because of the * braindamaged deblock ordering used in VP3/Theora. Order matters * because some pixels get filtered twice. */ if( s->all_fragments[fragment].coding_method != MODE_COPY ) { /* do not perform left edge filter for left columns frags */ if (x > 0) { s->dsp.vp3_h_loop_filter( plane_data + 8*x, stride, bounding_values); } /* do not perform top edge filter for top row fragments */ if (y > 0) { s->dsp.vp3_v_loop_filter( plane_data + 8*x, stride, bounding_values); } /* do not perform right edge filter for right column * fragments or if right fragment neighbor is also coded * in this frame (it will be filtered in next iteration) */ if ((x < width - 1) && (s->all_fragments[fragment + 1].coding_method == MODE_COPY)) { s->dsp.vp3_h_loop_filter( plane_data + 8*x + 8, stride, bounding_values); } /* do not perform bottom edge filter for bottom row * fragments or if bottom fragment neighbor is also coded * in this frame (it will be filtered in the next row) */ if ((y < height - 1) && (s->all_fragments[fragment + width].coding_method == MODE_COPY)) { s->dsp.vp3_v_loop_filter( plane_data + 8*x + 8*stride, stride, bounding_values); } } fragment++; } plane_data += 8*stride; } }


static int sanitize_ptr_alu(struct bpf_verifier_env *env,
			    struct bpf_insn *insn,
			    const struct bpf_reg_state *ptr_reg,
			    const struct bpf_reg_state *off_reg,
			    struct bpf_reg_state *dst_reg,
			    struct bpf_insn_aux_data *tmp_aux,
			    const bool commit_window)
{
	struct bpf_insn_aux_data *aux = commit_window ? cur_aux(env) : tmp_aux;
	struct bpf_verifier_state *vstate = env->cur_state;
	bool off_is_neg = off_reg->smin_value < 0;
	bool ptr_is_dst_reg = ptr_reg == dst_reg;
	u8 opcode = BPF_OP(insn->code);
	u32 alu_state, alu_limit;
	struct bpf_reg_state tmp;
	bool ret;
	int err;

	if (can_skip_alu_sanitation(env, insn))
		return 0;

	/* We already marked aux for masking from non-speculative
	 * paths, thus we got here in the first place. We only care
	 * to explore bad access from here.
	 */
	if (vstate->speculative)
		goto do_sim;

	err = retrieve_ptr_limit(ptr_reg, off_reg, &alu_limit, opcode);
	if (err < 0)
		return err;

	if (commit_window) {
		/* In commit phase we narrow the masking window based on
		 * the observed pointer move after the simulated operation.
		 */
		alu_state = tmp_aux->alu_state;
		alu_limit = abs(tmp_aux->alu_limit - alu_limit);
	} else {
		alu_state  = off_is_neg ? BPF_ALU_NEG_VALUE : 0;
		alu_state |= ptr_is_dst_reg ?
			     BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST;
	}

	err = update_alu_sanitation_state(aux, alu_state, alu_limit);
	if (err < 0)
		return err;
do_sim:
	/* If we're in commit phase, we're done here given we already
	 * pushed the truncated dst_reg into the speculative verification
	 * stack.
	 */
	if (commit_window)
		return 0;

	/* Simulate and find potential out-of-bounds access under
	 * speculative execution from truncation as a result of
	 * masking when off was not within expected range. If off
	 * sits in dst, then we temporarily need to move ptr there
	 * to simulate dst (== 0) +/-= ptr. Needed, for example,
	 * for cases where we use K-based arithmetic in one direction
	 * and truncated reg-based in the other in order to explore
	 * bad access.
	 */
	if (!ptr_is_dst_reg) {
		tmp = *dst_reg;
		*dst_reg = *ptr_reg;
	}
	ret = push_stack(env, env->insn_idx + 1, env->insn_idx, true);
	if (!ptr_is_dst_reg && ret)
		*dst_reg = tmp;
	return !ret ? REASON_STACK : 0;
}


static int selinux_sk_alloc_security ( struct sock * sk , int family , gfp_t priority ) {
 struct sk_security_struct * sksec ;
 sksec = kzalloc ( sizeof ( * sksec ) , priority ) ;
 if ( ! sksec ) return - ENOMEM ;
 sksec -> peer_sid = SECINITSID_UNLABELED ;
 sksec -> sid = SECINITSID_UNLABELED ;
 sksec -> sclass = SECCLASS_SOCKET ;
 selinux_netlbl_sk_security_reset ( sksec ) ;
 sk -> sk_security = sksec ;
 return 0 ;
 }


static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid) { MXFStructuralComponent *source_clip = arg; switch(tag) { case 0x0202: source_clip->duration = avio_rb64(pb); break; case 0x1201: source_clip->start_position = avio_rb64(pb); break; case 0x1101: /* UMID, only get last 16 bytes */ avio_skip(pb, 16); avio_read(pb, source_clip->source_package_uid, 16); break; case 0x1102: source_clip->source_track_id = avio_rb32(pb); break; } return 0; }


  void Compute(OpKernelContext* context) override {
    const Tensor& input = context->input(0);
    const TensorShape& input_shape = input.shape();

    const Tensor& out_backprop = context->input(2);
    const TensorShape& out_backprop_shape = out_backprop.shape();

    TensorShape filter_shape;
    if (takes_shape_) {
      const Tensor& filter_sizes = context->input(1);
      OP_REQUIRES_OK(context, TensorShapeUtils::MakeShape(
                                  filter_sizes.vec<int32>(), &filter_shape));
    } else {
      filter_shape = context->input(1).shape();
    }

    OP_REQUIRES(context, input_shape.dims() == 5,
                errors::InvalidArgument("input tensor must have 5 dimensions"));
    OP_REQUIRES(
        context, filter_shape.dims() == 5,
        errors::InvalidArgument("filter_sizes tensor must have 5 dimensions"));
    OP_REQUIRES(
        context, out_backprop_shape.dims() == 5,
        errors::InvalidArgument("out_backprop tensor must have 5 dimensions"));
    OP_REQUIRES(
        context, input_shape.dim_size(4) == filter_shape.dim_size(3),
        errors::InvalidArgument("input and filter_sizes must have the same "
                                "number of channels. Got ",
                                input_shape.dim_size(4), " for input and ",
                                filter_shape.dim_size(3), " for filter_sizes"));
    OP_REQUIRES(
        context, out_backprop_shape.dim_size(4) == filter_shape.dim_size(4),
        errors::InvalidArgument("out_backprop and filter_sizes must have the "
                                "same number of channels. Got ",
                                out_backprop_shape.dim_size(4),
                                " for out_backprop and ",
                                filter_shape.dim_size(4), " for filter_sizes"));

    ConvBackpropDimensions dims;
    OP_REQUIRES_OK(context,
                   ConvBackpropComputeDimensions(
                       "Conv3DBackpropFilterOp", /*num_spatial_dims=*/3,
                       input_shape, filter_shape, out_backprop_shape, stride_,
                       padding_, data_format_, &dims));

    Tensor* filter_backprop;
    OP_REQUIRES_OK(context,
                   context->allocate_output(0, filter_shape, &filter_backprop));

    if (input_shape.num_elements() == 0) {
      filter_backprop->template flat<T>().setZero();
      return;
    }

    int64_t top_pad_planes, bottom_pad_planes;
    int64_t top_pad_rows, bottom_pad_rows;
    int64_t left_pad_cols, right_pad_cols;

    OP_REQUIRES_OK(context, GetWindowedOutputSizeVerbose(
                                dims.spatial_dims[0].input_size,
                                dims.spatial_dims[0].filter_size,
                                dims.spatial_dims[0].stride, padding_,
                                &dims.spatial_dims[0].output_size,
                                &top_pad_planes, &bottom_pad_planes));
    OP_REQUIRES_OK(context, GetWindowedOutputSizeVerbose(
                                dims.spatial_dims[1].input_size,
                                dims.spatial_dims[1].filter_size,
                                dims.spatial_dims[1].stride, padding_,
                                &dims.spatial_dims[1].output_size,
                                &top_pad_rows, &bottom_pad_rows));
    OP_REQUIRES_OK(context, GetWindowedOutputSizeVerbose(
                                dims.spatial_dims[2].input_size,
                                dims.spatial_dims[2].filter_size,
                                dims.spatial_dims[2].stride, padding_,
                                &dims.spatial_dims[2].output_size,
                                &left_pad_cols, &right_pad_cols));

    // TODO(ezhulenev): Extract work size and shard estimation to shared
    // functions in conv_grad_ops, and update 2d convolution backprop.

    // The total dimension size of each kernel.
    const int64_t filter_total_size =
        dims.spatial_dims[0].filter_size * dims.spatial_dims[1].filter_size *
        dims.spatial_dims[2].filter_size * dims.in_depth;
    // The output image size is the spatial size of the output.
    const int64_t output_image_size = dims.spatial_dims[0].output_size *
                                      dims.spatial_dims[1].output_size *
                                      dims.spatial_dims[2].output_size;

    // Shard 'batch' images (volumes) into 'shard_size' groups of images
    // (volumes) to be fed into the parallel matmul. Calculate 'shard_size' by
    // dividing the L3 cache size ('target_working_set_size') by the matmul size
    // of an individual image ('work_unit_size').

    const auto cache_sizes = Eigen::internal::CacheSizes();
    const ptrdiff_t l3_cache_size = cache_sizes.m_l3;

    // TODO(andydavis)
    // *) Consider reducing 'target_working_set_size' if L3 is shared by
    //    other concurrently running tensorflow ops.
    const size_t target_working_set_size = l3_cache_size / sizeof(T);

    const int64_t size_A = output_image_size * filter_total_size;

    const int64_t size_B = output_image_size * dims.out_depth;

    const int64_t size_C = filter_total_size * dims.out_depth;

    const int64_t work_unit_size = size_A + size_B + size_C;

    OP_REQUIRES(
        context, work_unit_size > 0,
        errors::InvalidArgument("input, filter_sizes and out_backprop tensors "
                                "must all have at least 1 element"));

    const size_t shard_size =
        (target_working_set_size + work_unit_size - 1) / work_unit_size;

    // Total number of elements in all the tensors used by this kernel.
    int64_t total_tensor_elements = input_shape.num_elements() +
                                    filter_shape.num_elements() +
                                    out_backprop_shape.num_elements();

    // Shape of the temporary workspace buffer.
    TensorShape col_buffer_shape = {static_cast<int64_t>(shard_size),
                                    static_cast<int64_t>(output_image_size),
                                    static_cast<int64_t>(filter_total_size)};
    int64_t col_buffer_elements = col_buffer_shape.num_elements();

    // If the temporary allocation overhead is too large, fallback on Eigen
    // implementation which requires much less memory.
    int64_t col_buffer_overhead = col_buffer_elements / total_tensor_elements;
    if (col_buffer_overhead > kMaxTempAllocationOverhead) {
      VLOG(2) << "Fallback on Eigen implementation of Conv3DBackpropFilterOp: "
                 "col_buffer_overhead="
              << col_buffer_overhead;

      functor::CuboidConvolutionBackwardFilter<Device, T>()(
          context->eigen_device<Device>(),
          filter_backprop->tensor<T, 5>(),                 // filter_backward
          input.tensor<T, 5>(),                            // input
          out_backprop.tensor<T, 5>(),                     // output_backward
          static_cast<int>(dims.spatial_dims[0].stride),   // stride_planes
          static_cast<int>(dims.spatial_dims[1].stride),   // stride_rows
          static_cast<int>(dims.spatial_dims[2].stride));  // stride_cols

      return;
    }

    Tensor col_buffer;
    OP_REQUIRES_OK(context,
                   context->allocate_temp(DataTypeToEnum<T>::value,
                                          col_buffer_shape, &col_buffer));

    // The input offset corresponding to a single input image.
    const int64_t input_offset =
        dims.spatial_dims[0].input_size * dims.spatial_dims[1].input_size *
        dims.spatial_dims[2].input_size * dims.in_depth;
    // The output offset corresponding to a single output image.
    const int64_t output_offset =
        dims.spatial_dims[0].output_size * dims.spatial_dims[1].output_size *
        dims.spatial_dims[2].output_size * dims.out_depth;

    const T* input_data = input.template flat<T>().data();
    T* col_buffer_data = col_buffer.template flat<T>().data();
    const T* out_backprop_data = out_backprop.template flat<T>().data();
    T* filter_backprop_data = filter_backprop->template flat<T>().data();

    typedef Eigen::TensorMap<Eigen::Tensor<T, 2, Eigen::RowMajor>,
                             Eigen::Unaligned>
        TensorMap;
    typedef Eigen::TensorMap<Eigen::Tensor<const T, 2, Eigen::RowMajor>,
                             Eigen::Unaligned>
        ConstTensorMap;

    TensorMap C(filter_backprop_data, filter_total_size, dims.out_depth);
    C.setZero();

    // Initialize contraction dims (we need to transpose 'A' below).
    Eigen::array<Eigen::IndexPair<Eigen::DenseIndex>, 1> contract_dims;
    contract_dims[0].first = 0;
    contract_dims[0].second = 0;

    auto worker_threads = *(context->device()->tensorflow_cpu_worker_threads());

    for (int image_id = 0; image_id < dims.batch_size; image_id += shard_size) {
      const int shard_limit =
          std::min(static_cast<int>(shard_size),
                   static_cast<int>(dims.batch_size) - image_id);

      auto shard = [&input_data, &col_buffer_data, &dims, &top_pad_planes,
                    &top_pad_rows, &left_pad_cols, &bottom_pad_planes,
                    &bottom_pad_rows, &right_pad_cols, &input_offset,
                    &size_A](int64_t start, int64_t limit) {
        for (int shard_id = start; shard_id < limit; ++shard_id) {
          const T* input_data_shard = input_data + shard_id * input_offset;
          T* col_data_shard = col_buffer_data + shard_id * size_A;

          // When we compute the gradient with respect to the filters, we need
          // to do im2col to allow gemm-type computation.
          Im2col<T>(input_data_shard, dims.in_depth,
                    // Input spatial dimensions.
                    dims.spatial_dims[0].input_size,  // input planes
                    dims.spatial_dims[1].input_size,  // input rows
                    dims.spatial_dims[2].input_size,  // input cols
                    // Filter spatial dimensions.
                    dims.spatial_dims[0].filter_size,  // filter planes
                    dims.spatial_dims[1].filter_size,  // filter rows
                    dims.spatial_dims[2].filter_size,  // filter cols
                    // Spatial padding.
                    top_pad_planes, top_pad_rows, left_pad_cols,
                    bottom_pad_planes, bottom_pad_rows, right_pad_cols,
                    // Spatial striding.
                    dims.spatial_dims[0].stride,  // stride planes
                    dims.spatial_dims[1].stride,  // stride rows
                    dims.spatial_dims[2].stride,  // stride cols
                    col_data_shard);
        }
      };
      Shard(worker_threads.num_threads, worker_threads.workers, shard_limit,
            size_A, shard);

      ConstTensorMap A(col_buffer_data, output_image_size * shard_limit,
                       filter_total_size);
      ConstTensorMap B(out_backprop_data, output_image_size * shard_limit,
                       dims.out_depth);

      // Gradient with respect to filter.
      C.device(context->eigen_cpu_device()) += A.contract(B, contract_dims);

      input_data += input_offset * shard_limit;
      out_backprop_data += output_offset * shard_limit;
    }
  }


void new_register_ber_syntax_dissector ( const char * syntax , int proto , new_dissector_t dissector ) {
 dissector_handle_t dissector_handle ;
 dissector_handle = new_create_dissector_handle ( dissector , proto ) ;
 dissector_add_string ( "ber.syntax" , syntax , dissector_handle ) ;
 }


void cpu_interrupt(CPUState *s) { s->interrupt_request = 1; }


static void test_io_channel_setup_async(SocketAddressLegacy *listen_addr, SocketAddressLegacy *connect_addr, QIOChannel **src, QIOChannel **dst) { QIOChannelSocket *lioc; struct TestIOChannelData data; data.loop = g_main_loop_new(g_main_context_default(), TRUE); lioc = qio_channel_socket_new(); qio_channel_socket_listen_async( lioc, listen_addr, test_io_channel_complete, &data, NULL); g_main_loop_run(data.loop); g_main_context_iteration(g_main_context_default(), FALSE); g_assert(!data.err); if (listen_addr->type == SOCKET_ADDRESS_LEGACY_KIND_INET) { SocketAddressLegacy *laddr = qio_channel_socket_get_local_address( lioc, &error_abort); g_free(connect_addr->u.inet.data->port); connect_addr->u.inet.data->port = g_strdup(laddr->u.inet.data->port); qapi_free_SocketAddressLegacy(laddr); } *src = QIO_CHANNEL(qio_channel_socket_new()); qio_channel_socket_connect_async( QIO_CHANNEL_SOCKET(*src), connect_addr, test_io_channel_complete, &data, NULL); g_main_loop_run(data.loop); g_main_context_iteration(g_main_context_default(), FALSE); g_assert(!data.err); qio_channel_wait(QIO_CHANNEL(lioc), G_IO_IN); *dst = QIO_CHANNEL(qio_channel_socket_accept(lioc, &error_abort)); g_assert(*dst); qio_channel_set_delay(*src, false); test_io_channel_set_socket_bufs(*src, *dst); object_unref(OBJECT(lioc)); g_main_loop_unref(data.loop); }


static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu) { return &shared_page->vcpu_iodata[vcpu].vp_ioreq; }


int xsltSecurityForbid ( xsltSecurityPrefsPtr sec ATTRIBUTE_UNUSED , xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED , const char * value ATTRIBUTE_UNUSED ) {
 return ( 0 ) ;
 }


int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t* filter_coeffs, const int16_t* in, int buffer_length, int filter_length, int stop_on_overflow, int rounder) { int i,n; // Avoids a +1 in the inner loop. filter_length++; for (n = 0; n < buffer_length; n++) { int sum = rounder; for (i = 1; i < filter_length; i++) sum -= filter_coeffs[i-1] * out[n-i]; sum = (sum >> 12) + in[n]; if (sum + 0x8000 > 0xFFFFU) { if (stop_on_overflow) return 1; sum = (sum >> 31) ^ 32767; } out[n] = sum; } return 0; }


static int dissect_btgatt_microbit_button_b_state ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data ) {
 btatt_data_t * att_data = ( btatt_data_t * ) data ;
 gint offset = 0 ;
 if ( bluetooth_gatt_has_no_parameter ( att_data -> opcode ) ) return - 1 ;
 proto_tree_add_item ( tree , hf_gatt_microbit_button_b_state , tvb , offset , 1 , ENC_NA ) ;
 offset += 1 ;
 return offset ;
 }


  double GetZoomLevel(v8::Isolate* isolate) {
    double result = 0.0;
    content::RenderFrame* render_frame;
    if (!MaybeGetRenderFrame(isolate, "getZoomLevel", &render_frame))
      return result;

    mojo::Remote<mojom::ElectronBrowser> browser_remote;
    render_frame->GetBrowserInterfaceBroker()->GetInterface(
        browser_remote.BindNewPipeAndPassReceiver());
    browser_remote->DoGetZoomLevel(&result);
    return result;
  }


static void copy_frame(J2kEncoderContext *s) { int tileno, compno, i, y, x; uint8_t *line; for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){ J2kTile *tile = s->tile + tileno; if (s->planar){ for (compno = 0; compno < s->ncomponents; compno++){ J2kComponent *comp = tile->comp + compno; int *dst = comp->data; line = s->picture->data[compno] + comp->coord[1][0] * s->picture->linesize[compno] + comp->coord[0][0]; for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){ uint8_t *ptr = line; for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++) *dst++ = *ptr++ - (1 << 7); line += s->picture->linesize[compno]; } } } else{ line = s->picture->data[0] + tile->comp[0].coord[1][0] * s->picture->linesize[0] + tile->comp[0].coord[0][0] * s->ncomponents; i = 0; for (y = tile->comp[0].coord[1][0]; y < tile->comp[0].coord[1][1]; y++){ uint8_t *ptr = line; for (x = tile->comp[0].coord[0][0]; x < tile->comp[0].coord[0][1]; x++, i++){ for (compno = 0; compno < s->ncomponents; compno++){ tile->comp[compno].data[i] = *ptr++ - (1 << 7); } } line += s->picture->linesize[0]; } } } }


int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
			     struct file *file,
			     struct snd_pcm_substream **rsubstream)
{
	struct snd_pcm_str * pstr;
	struct snd_pcm_substream *substream;
	struct snd_pcm_runtime *runtime;
	struct snd_card *card;
	int prefer_subdevice;
	size_t size;

	if (snd_BUG_ON(!pcm || !rsubstream))
		return -ENXIO;
	if (snd_BUG_ON(stream != SNDRV_PCM_STREAM_PLAYBACK &&
		       stream != SNDRV_PCM_STREAM_CAPTURE))
		return -EINVAL;
	*rsubstream = NULL;
	pstr = &pcm->streams[stream];
	if (pstr->substream == NULL || pstr->substream_count == 0)
		return -ENODEV;

	card = pcm->card;
	prefer_subdevice = snd_ctl_get_preferred_subdevice(card, SND_CTL_SUBDEV_PCM);

	if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) {
		int opposite = !stream;

		for (substream = pcm->streams[opposite].substream; substream;
		     substream = substream->next) {
			if (SUBSTREAM_BUSY(substream))
				return -EAGAIN;
		}
	}

	if (file->f_flags & O_APPEND) {
		if (prefer_subdevice < 0) {
			if (pstr->substream_count > 1)
				return -EINVAL; /* must be unique */
			substream = pstr->substream;
		} else {
			for (substream = pstr->substream; substream;
			     substream = substream->next)
				if (substream->number == prefer_subdevice)
					break;
		}
		if (! substream)
			return -ENODEV;
		if (! SUBSTREAM_BUSY(substream))
			return -EBADFD;
		substream->ref_count++;
		*rsubstream = substream;
		return 0;
	}

	for (substream = pstr->substream; substream; substream = substream->next) {
		if (!SUBSTREAM_BUSY(substream) &&
		    (prefer_subdevice == -1 ||
		     substream->number == prefer_subdevice))
			break;
	}
	if (substream == NULL)
		return -EAGAIN;

	runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
	if (runtime == NULL)
		return -ENOMEM;

	size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status));
	runtime->status = alloc_pages_exact(size, GFP_KERNEL);
	if (runtime->status == NULL) {
		kfree(runtime);
		return -ENOMEM;
	}
	memset(runtime->status, 0, size);

	size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control));
	runtime->control = alloc_pages_exact(size, GFP_KERNEL);
	if (runtime->control == NULL) {
		free_pages_exact(runtime->status,
			       PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
		kfree(runtime);
		return -ENOMEM;
	}
	memset(runtime->control, 0, size);

	init_waitqueue_head(&runtime->sleep);
	init_waitqueue_head(&runtime->tsleep);

	runtime->status->state = SNDRV_PCM_STATE_OPEN;

	substream->runtime = runtime;
	substream->private_data = pcm->private_data;
	substream->ref_count = 1;
	substream->f_flags = file->f_flags;
	substream->pid = get_pid(task_pid(current));
	pstr->substream_opened++;
	*rsubstream = substream;
	return 0;
}


static TraceEvent* find_trace_event_by_name(const char *tname) { unsigned int i; if (!tname) { return NULL; } for (i = 0; i < NR_TRACE_EVENTS; i++) { if (!strcmp(trace_list[i].tp_name, tname)) { return &trace_list[i]; } } return NULL; /* indicates end of list reached without a match */ }


void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime;

	if (PCM_RUNTIME_CHECK(substream))
		return;
	runtime = substream->runtime;
	if (runtime->private_free != NULL)
		runtime->private_free(runtime);
	free_pages_exact(runtime->status,
		       PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
	free_pages_exact(runtime->control,
		       PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));
	kfree(runtime->hw_constraints.rules);
	/* Avoid concurrent access to runtime via PCM timer interface */
	if (substream->timer) {
		spin_lock_irq(&substream->timer->lock);
		substream->runtime = NULL;
		spin_unlock_irq(&substream->timer->lock);
	} else {
		substream->runtime = NULL;
	}
	kfree(runtime);
	put_pid(substream->pid);
	substream->pid = NULL;
	substream->pstr->substream_opened--;
}


void vp9_xform_quant_dc ( MACROBLOCK * x , int plane , int block , BLOCK_SIZE plane_bsize , TX_SIZE tx_size ) {
 MACROBLOCKD * const xd = & x -> e_mbd ;
 const struct macroblock_plane * const p = & x -> plane [ plane ] ;
 const struct macroblockd_plane * const pd = & xd -> plane [ plane ] ;
 int16_t * const coeff = BLOCK_OFFSET ( p -> coeff , block ) ;
 int16_t * const qcoeff = BLOCK_OFFSET ( p -> qcoeff , block ) ;
 int16_t * const dqcoeff = BLOCK_OFFSET ( pd -> dqcoeff , block ) ;
 uint16_t * const eob = & p -> eobs [ block ] ;
 const int diff_stride = 4 * num_4x4_blocks_wide_lookup [ plane_bsize ] ;
 int i , j ;
 const int16_t * src_diff ;
 txfrm_block_to_raster_xy ( plane_bsize , tx_size , block , & i , & j ) ;
 src_diff = & p -> src_diff [ 4 * ( j * diff_stride + i ) ] ;
 switch ( tx_size ) {
 case TX_32X32 : vp9_fdct32x32_1 ( src_diff , coeff , diff_stride ) ;
 vp9_quantize_dc_32x32 ( coeff , x -> skip_block , p -> round , p -> quant_fp [ 0 ] , qcoeff , dqcoeff , pd -> dequant [ 0 ] , eob ) ;
 break ;
 case TX_16X16 : vp9_fdct16x16_1 ( src_diff , coeff , diff_stride ) ;
 vp9_quantize_dc ( coeff , x -> skip_block , p -> round , p -> quant_fp [ 0 ] , qcoeff , dqcoeff , pd -> dequant [ 0 ] , eob ) ;
 break ;
 case TX_8X8 : vp9_fdct8x8_1 ( src_diff , coeff , diff_stride ) ;
 vp9_quantize_dc ( coeff , x -> skip_block , p -> round , p -> quant_fp [ 0 ] , qcoeff , dqcoeff , pd -> dequant [ 0 ] , eob ) ;
 break ;
 case TX_4X4 : x -> fwd_txm4x4 ( src_diff , coeff , diff_stride ) ;
 vp9_quantize_dc ( coeff , x -> skip_block , p -> round , p -> quant_fp [ 0 ] , qcoeff , dqcoeff , pd -> dequant [ 0 ] , eob ) ;
 break ;
 default : assert ( 0 ) ;
 break ;
 }
 }


static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size) { GetBitContext gb; int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; int dts_flag = -1, cts_flag = -1; int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; init_get_bits(&gb, buf, buf_size * 8); if (sl->use_au_start) au_start_flag = get_bits1(&gb); if (sl->use_au_end) au_end_flag = get_bits1(&gb); if (!sl->use_au_start && !sl->use_au_end) au_start_flag = au_end_flag = 1; if (sl->ocr_len > 0) ocr_flag = get_bits1(&gb); if (sl->use_idle) idle_flag = get_bits1(&gb); if (sl->use_padding) padding_flag = get_bits1(&gb); if (padding_flag) padding_bits = get_bits(&gb, 3); if (!idle_flag && (!padding_flag || padding_bits != 0)) { if (sl->packet_seq_num_len) skip_bits_long(&gb, sl->packet_seq_num_len); if (sl->degr_prior_len) if (get_bits1(&gb)) skip_bits(&gb, sl->degr_prior_len); if (ocr_flag) skip_bits_long(&gb, sl->ocr_len); if (au_start_flag) { if (sl->use_rand_acc_pt) get_bits1(&gb); if (sl->au_seq_num_len > 0) skip_bits_long(&gb, sl->au_seq_num_len); if (sl->use_timestamps) { dts_flag = get_bits1(&gb); cts_flag = get_bits1(&gb); } } if (sl->inst_bitrate_len) inst_bitrate_flag = get_bits1(&gb); if (dts_flag == 1) dts = get_ts64(&gb, sl->timestamp_len); if (cts_flag == 1) cts = get_ts64(&gb, sl->timestamp_len); if (sl->au_len > 0) skip_bits_long(&gb, sl->au_len); if (inst_bitrate_flag) skip_bits_long(&gb, sl->inst_bitrate_len); } if (dts != AV_NOPTS_VALUE) pes->dts = dts; if (cts != AV_NOPTS_VALUE) pes->pts = cts; if (sl->timestamp_len && sl->timestamp_res) avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res); return (get_bits_count(&gb) + 7) >> 3; }


static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) { HEVCLocalContext *lc = s->HEVClc; GetBitContext *gb = &lc->gb; int ctb_addr_ts, ret; *gb = nal->gb; s->nal_unit_type = nal->type; s->temporal_id = nal->temporal_id; switch (s->nal_unit_type) { case HEVC_NAL_VPS: ret = ff_hevc_decode_nal_vps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; case HEVC_NAL_SPS: ret = ff_hevc_decode_nal_sps(gb, s->avctx, &s->ps, s->apply_defdispwin); if (ret < 0) goto fail; break; case HEVC_NAL_PPS: ret = ff_hevc_decode_nal_pps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; case HEVC_NAL_SEI_PREFIX: case HEVC_NAL_SEI_SUFFIX: ret = ff_hevc_decode_nal_sei(s); if (ret < 0) goto fail; break; case HEVC_NAL_TRAIL_R: case HEVC_NAL_TRAIL_N: case HEVC_NAL_TSA_N: case HEVC_NAL_TSA_R: case HEVC_NAL_STSA_N: case HEVC_NAL_STSA_R: case HEVC_NAL_BLA_W_LP: case HEVC_NAL_BLA_W_RADL: case HEVC_NAL_BLA_N_LP: case HEVC_NAL_IDR_W_RADL: case HEVC_NAL_IDR_N_LP: case HEVC_NAL_CRA_NUT: case HEVC_NAL_RADL_N: case HEVC_NAL_RADL_R: case HEVC_NAL_RASL_N: case HEVC_NAL_RASL_R: ret = hls_slice_header(s); if (ret < 0) return ret; if (s->max_ra == INT_MAX) { if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { s->max_ra = s->poc; } else { if (IS_IDR(s)) s->max_ra = INT_MIN; } } if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && s->poc <= s->max_ra) { s->is_decoded = 0; break; } else { if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra) s->max_ra = INT_MIN; } if (s->sh.first_slice_in_pic_flag) { ret = hevc_frame_start(s); if (ret < 0) return ret; } else if (!s->ref) { av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n"); goto fail; } if (s->nal_unit_type != s->first_nal_type) { av_log(s->avctx, AV_LOG_ERROR, "Non-matching NAL types of the VCL NALUs: %d %d\n", s->first_nal_type, s->nal_unit_type); return AVERROR_INVALIDDATA; } if (!s->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) { ret = ff_hevc_slice_rpl(s); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Error constructing the reference lists for the current slice.\n"); goto fail; } } if (s->sh.first_slice_in_pic_flag && s->avctx->hwaccel) { ret = s->avctx->hwaccel->start_frame(s->avctx, NULL, 0); if (ret < 0) goto fail; } if (s->avctx->hwaccel) { ret = s->avctx->hwaccel->decode_slice(s->avctx, nal->raw_data, nal->raw_size); if (ret < 0) goto fail; } else { if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else ctb_addr_ts = hls_slice_data(s); if (ctb_addr_ts >= (s->ps.sps->ctb_width * s->ps.sps->ctb_height)) { s->is_decoded = 1; } if (ctb_addr_ts < 0) { ret = ctb_addr_ts; goto fail; } } break; case HEVC_NAL_EOS_NUT: case HEVC_NAL_EOB_NUT: s->seq_decode = (s->seq_decode + 1) & 0xff; s->max_ra = INT_MAX; break; case HEVC_NAL_AUD: case HEVC_NAL_FD_NUT: break; default: av_log(s->avctx, AV_LOG_INFO, "Skipping NAL unit %d\n", s->nal_unit_type); } return 0; fail: if (s->avctx->err_recognition & AV_EF_EXPLODE) return ret; return 0; }


void *g_malloc(size_t size) { char * p; size += 16; p = bsd_vmalloc(size); *(size_t *)p = size; return p + 16; }


TEST_F ( ProfileInfoCacheTest , DeleteProfile ) {
 EXPECT_EQ ( 0u , GetCache ( ) -> GetNumberOfProfiles ( ) ) ;
 base : : FilePath path_1 = GetProfilePath ( "path_1" ) ;
 GetCache ( ) -> AddProfileToCache ( path_1 , ASCIIToUTF16 ( "name_1" ) , base : : string16 ( ) , 0 , std : : string ( ) ) ;
 EXPECT_EQ ( 1u , GetCache ( ) -> GetNumberOfProfiles ( ) ) ;
 base : : FilePath path_2 = GetProfilePath ( "path_2" ) ;
 base : : string16 name_2 = ASCIIToUTF16 ( "name_2" ) ;
 GetCache ( ) -> AddProfileToCache ( path_2 , name_2 , base : : string16 ( ) , 0 , std : : string ( ) ) ;
 EXPECT_EQ ( 2u , GetCache ( ) -> GetNumberOfProfiles ( ) ) ;
 GetCache ( ) -> DeleteProfileFromCache ( path_1 ) ;
 EXPECT_EQ ( 1u , GetCache ( ) -> GetNumberOfProfiles ( ) ) ;
 EXPECT_EQ ( name_2 , GetCache ( ) -> GetNameOfProfileAtIndex ( 0 ) ) ;
 GetCache ( ) -> DeleteProfileFromCache ( path_2 ) ;
 EXPECT_EQ ( 0u , GetCache ( ) -> GetNumberOfProfiles ( ) ) ;
 }


static void directory_count_stop ( NautilusDirectory * directory ) {
 NautilusFile * file ;
 if ( directory -> details -> count_in_progress != NULL ) {
 file = directory -> details -> count_in_progress -> count_file ;
 if ( file != NULL ) {
 g_assert ( NAUTILUS_IS_FILE ( file ) ) ;
 g_assert ( file -> details -> directory == directory ) ;
 if ( is_needy ( file , should_get_directory_count_now , REQUEST_DIRECTORY_COUNT ) ) {
 return ;
 }
 }
 directory_count_cancel ( directory ) ;
 }
 }


static void credential_write_item(FILE *fp, const char *key, const char *value)
{
	if (!value)
		return;
	fprintf(fp, "%s=%s\n", key, value);
}


static int elf_core_dump(int signr, const CPUState *env) { const TaskState *ts = (const TaskState *)env->opaque; struct vm_area_struct *vma = NULL; char corefile[PATH_MAX]; struct elf_note_info info; struct elfhdr elf; struct elf_phdr phdr; struct rlimit dumpsize; struct mm_struct *mm = NULL; off_t offset = 0, data_offset = 0; int segs = 0; int fd = -1; errno = 0; getrlimit(RLIMIT_CORE, &dumpsize); if (dumpsize.rlim_cur == 0) return 0; if (core_dump_filename(ts, corefile, sizeof (corefile)) < 0) return (-errno); if ((fd = open(corefile, O_WRONLY | O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) return (-errno); /* * Walk through target process memory mappings and * set up structure containing this information. After * this point vma_xxx functions can be used. */ if ((mm = vma_init()) == NULL) goto out; walk_memory_regions(mm, vma_walker); segs = vma_get_mapping_count(mm); /* * Construct valid coredump ELF header. We also * add one more segment for notes. */ fill_elf_header(&elf, segs + 1, ELF_MACHINE, 0); if (dump_write(fd, &elf, sizeof (elf)) != 0) goto out; /* fill in in-memory version of notes */ if (fill_note_info(&info, signr, env) < 0) goto out; offset += sizeof (elf); /* elf header */ offset += (segs + 1) * sizeof (struct elf_phdr); /* program headers */ /* write out notes program header */ fill_elf_note_phdr(&phdr, info.notes_size, offset); offset += info.notes_size; if (dump_write(fd, &phdr, sizeof (phdr)) != 0) goto out; /* * ELF specification wants data to start at page boundary so * we align it here. */ offset = roundup(offset, ELF_EXEC_PAGESIZE); /* * Write program headers for memory regions mapped in * the target process. */ for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { (void) memset(&phdr, 0, sizeof (phdr)); phdr.p_type = PT_LOAD; phdr.p_offset = offset; phdr.p_vaddr = vma->vma_start; phdr.p_paddr = 0; phdr.p_filesz = vma_dump_size(vma); offset += phdr.p_filesz; phdr.p_memsz = vma->vma_end - vma->vma_start; phdr.p_flags = vma->vma_flags & PROT_READ ? PF_R : 0; if (vma->vma_flags & PROT_WRITE) phdr.p_flags |= PF_W; if (vma->vma_flags & PROT_EXEC) phdr.p_flags |= PF_X; phdr.p_align = ELF_EXEC_PAGESIZE; dump_write(fd, &phdr, sizeof (phdr)); } /* * Next we write notes just after program headers. No * alignment needed here. */ if (write_note_info(&info, fd) < 0) goto out; /* align data to page boundary */ data_offset = lseek(fd, 0, SEEK_CUR); data_offset = TARGET_PAGE_ALIGN(data_offset); if (lseek(fd, data_offset, SEEK_SET) != data_offset) goto out; /* * Finally we can dump process memory into corefile as well. */ for (vma = vma_first(mm); vma != NULL; vma = vma_next(vma)) { abi_ulong addr; abi_ulong end; end = vma->vma_start + vma_dump_size(vma); for (addr = vma->vma_start; addr < end; addr += TARGET_PAGE_SIZE) { char page[TARGET_PAGE_SIZE]; int error; /* * Read in page from target process memory and * write it to coredump file. */ error = copy_from_user(page, addr, sizeof (page)); if (error != 0) { (void) fprintf(stderr, "unable to dump " TARGET_ABI_FMT_lx "\n", addr); errno = -error; goto out; } if (dump_write(fd, page, TARGET_PAGE_SIZE) < 0) goto out; } } out: free_note_info(&info); if (mm != NULL) vma_delete(mm); (void) close(fd); if (errno != 0) return (-errno); return (0); }


static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ;
 DECL_PIOCTL ( PSetAcl ) ;
 DECL_PIOCTL ( PStoreBehind ) ;
 DECL_PIOCTL ( PGCPAGs ) ;
 DECL_PIOCTL ( PGetAcl ) ;
 DECL_PIOCTL ( PNoop ) ;
 DECL_PIOCTL ( PBogus ) ;
 DECL_PIOCTL ( PGetFileCell ) ;
 DECL_PIOCTL ( PGetWSCell ) ;
 DECL_PIOCTL ( PGetUserCell ) ;
 DECL_PIOCTL ( PSetTokens ) ;
 DECL_PIOCTL ( PGetVolumeStatus ) ;
 DECL_PIOCTL ( PSetVolumeStatus ) ;
 DECL_PIOCTL ( PFlush ) ;
 DECL_PIOCTL ( PNewStatMount ) ;
 DECL_PIOCTL ( PGetTokens ) ;
 DECL_PIOCTL ( PUnlog ) ;
 DECL_PIOCTL ( PMariner ) ;
 DECL_PIOCTL ( PCheckServers ) ;
 DECL_PIOCTL ( PCheckVolNames ) ;
 DECL_PIOCTL ( PCheckAuth ) ;
 DECL_PIOCTL ( PFindVolume ) ;
 DECL_PIOCTL ( PViceAccess ) ;
 DECL_PIOCTL ( PSetCacheSize ) ;
 DECL_PIOCTL ( PGetCacheSize ) ;
 DECL_PIOCTL ( PRemoveCallBack ) ;
 DECL_PIOCTL ( PNewCell ) ;
 DECL_PIOCTL ( PNewAlias ) ;
 DECL_PIOCTL ( PListCells ) ;
 DECL_PIOCTL ( PListAliases ) ;
 DECL_PIOCTL ( PRemoveMount ) ;
 DECL_PIOCTL ( PGetCellStatus ) ;
 DECL_PIOCTL ( PSetCellStatus ) ;
 DECL_PIOCTL ( PFlushVolumeData )


SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr,
		unsigned long, data)
{
	struct task_struct *child;
	long ret;

	if (request == PTRACE_TRACEME) {
		ret = ptrace_traceme();
		if (!ret)
			arch_ptrace_attach(current);
		goto out;
	}

	child = ptrace_get_task_struct(pid);
	if (IS_ERR(child)) {
		ret = PTR_ERR(child);
		goto out;
	}

	if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) {
		ret = ptrace_attach(child, request, addr, data);
		/*
		 * Some architectures need to do book-keeping after
		 * a ptrace attach.
		 */
		if (!ret)
			arch_ptrace_attach(child);
		goto out_put_task_struct;
	}

	ret = ptrace_check_attach(child, request == PTRACE_KILL ||
				  request == PTRACE_INTERRUPT);
	if (ret < 0)
		goto out_put_task_struct;

	ret = arch_ptrace(child, request, addr, data);

 out_put_task_struct:
	put_task_struct(child);
 out:
	return ret;
}


static void tcg_target_qemu_prologue (TCGContext *s) { int i, frame_size; #ifndef __APPLE__ uint64_t addr; #endif frame_size = 0 + 8 /* back chain */ + 8 /* CR */ + 8 /* LR */ + 8 /* compiler doubleword */ + 8 /* link editor doubleword */ + 8 /* TOC save area */ + TCG_STATIC_CALL_ARGS_SIZE + ARRAY_SIZE (tcg_target_callee_save_regs) * 8 ; frame_size = (frame_size + 15) & ~15; #ifndef __APPLE__ /* First emit adhoc function descriptor */ addr = (uint64_t) s->code_ptr + 24; tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */ s->code_ptr += 16; /* skip TOC and environment pointer */ #endif /* Prologue */ tcg_out32 (s, MFSPR | RT (0) | LR); tcg_out32 (s, STDU | RS (1) | RA (1) | (-frame_size & 0xffff)); for (i = 0; i < ARRAY_SIZE (tcg_target_callee_save_regs); ++i) tcg_out32 (s, (STD | RS (tcg_target_callee_save_regs[i]) | RA (1) | (i * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE) ) ); tcg_out32 (s, STD | RS (0) | RA (1) | (frame_size + 16)); #ifdef CONFIG_USE_GUEST_BASE if (GUEST_BASE) { tcg_out_movi (s, TCG_TYPE_I64, TCG_GUEST_BASE_REG, GUEST_BASE); tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG); } #endif tcg_out32 (s, MTSPR | RS (3) | CTR); tcg_out32 (s, BCCTR | BO_ALWAYS); /* Epilogue */ tb_ret_addr = s->code_ptr; for (i = 0; i < ARRAY_SIZE (tcg_target_callee_save_regs); ++i) tcg_out32 (s, (LD | RT (tcg_target_callee_save_regs[i]) | RA (1) | (i * 8 + 48 + TCG_STATIC_CALL_ARGS_SIZE) ) ); tcg_out32 (s, LD | RT (0) | RA (1) | (frame_size + 16)); tcg_out32 (s, MTSPR | RS (0) | LR); tcg_out32 (s, ADDI | RT (1) | RA (1) | frame_size); tcg_out32 (s, BCLR | BO_ALWAYS); }


static void dumpCreateDB ( PGconn * conn ) {
 PQExpBuffer buf = createPQExpBuffer ( ) ;
 char * default_encoding = NULL ;
 char * default_collate = NULL ;
 char * default_ctype = NULL ;
 PGresult * res ;
 int i ;
 fprintf ( OPF , "--\n-- Database creation\n--\n\n" ) ;
 if ( server_version >= 80400 ) res = executeQuery ( conn , "SELECT pg_encoding_to_char(encoding), " "datcollate, datctype " "FROM pg_database " "WHERE datname = 'template0'" ) ;
 else if ( server_version >= 70100 ) res = executeQuery ( conn , "SELECT pg_encoding_to_char(encoding), " "null::text AS datcollate, null::text AS datctype " "FROM pg_database " "WHERE datname = 'template0'" ) ;
 else res = executeQuery ( conn , "SELECT pg_encoding_to_char(encoding), " "null::text AS datcollate, null::text AS datctype " "FROM pg_database " "WHERE datname = 'template1'" ) ;
 if ( PQntuples ( res ) > 0 ) {
 if ( ! PQgetisnull ( res , 0 , 0 ) ) default_encoding = pg_strdup ( PQgetvalue ( res , 0 , 0 ) ) ;
 if ( ! PQgetisnull ( res , 0 , 1 ) ) default_collate = pg_strdup ( PQgetvalue ( res , 0 , 1 ) ) ;
 if ( ! PQgetisnull ( res , 0 , 2 ) ) default_ctype = pg_strdup ( PQgetvalue ( res , 0 , 2 ) ) ;
 }
 PQclear ( res ) ;
 if ( server_version >= 90600 ) res = executeQuery ( conn , "SELECT datname, " "coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " "datcollate, datctype, datfrozenxid, datminmxid, " "datistemplate, " "(SELECT pg_catalog.array_agg(acl) FROM (SELECT pg_catalog.unnest(coalesce(datacl,pg_catalog.acldefault('d',datdba))) AS acl " "EXCEPT SELECT pg_catalog.unnest(pg_catalog.acldefault('d',datdba))) as foo)" "AS datacl," "(SELECT pg_catalog.array_agg(acl) FROM (SELECT pg_catalog.unnest(pg_catalog.acldefault('d',datdba)) AS acl " "EXCEPT SELECT pg_catalog.unnest(coalesce(datacl,pg_catalog.acldefault('d',datdba)))) as foo)" "AS rdatacl," "datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " "FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) " "WHERE datallowconn ORDER BY 1" ) ;
 else if ( server_version >= 90300 ) res = executeQuery ( conn , "SELECT datname, " "coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " "datcollate, datctype, datfrozenxid, datminmxid, " "datistemplate, datacl, '' as rdatacl, datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " "FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) " "WHERE datallowconn ORDER BY 1" ) ;
 else if ( server_version >= 80400 ) res = executeQuery ( conn , "SELECT datname, " "coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " "datcollate, datctype, datfrozenxid, 0 AS datminmxid, " "datistemplate, datacl, '' as rdatacl, datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " "FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) " "WHERE datallowconn ORDER BY 1" ) ;
 else if ( server_version >= 80100 ) res = executeQuery ( conn , "SELECT datname, " "coalesce(rolname, (select rolname from pg_authid where oid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " "null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, " "datistemplate, datacl, '' as rdatacl, datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " "FROM pg_database d LEFT JOIN pg_authid u ON (datdba = u.oid) " "WHERE datallowconn ORDER BY 1" ) ;
 else if ( server_version >= 80000 ) res = executeQuery ( conn , "SELECT datname, " "coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " "null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, " "datistemplate, datacl, '' as rdatacl, -1 as datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " "FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) " "WHERE datallowconn ORDER BY 1" ) ;
 else if ( server_version >= 70300 ) res = executeQuery ( conn , "SELECT datname, " "coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " "null::text AS datcollate, null::text AS datctype, datfrozenxid, 0 AS datminmxid, " "datistemplate, datacl, '' as rdatacl, -1 as datconnlimit, " "'pg_default' AS dattablespace " "FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) " "WHERE datallowconn ORDER BY 1" ) ;
 else if ( server_version >= 70100 ) res = executeQuery ( conn , "SELECT datname, " "coalesce(" "(select usename from pg_shadow where usesysid=datdba), " "(select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " "null::text AS datcollate, null::text AS datctype, 0 AS datfrozenxid, 0 AS datminmxid, " "datistemplate, '' as datacl, '' as rdatacl, -1 as datconnlimit, " "'pg_default' AS dattablespace " "FROM pg_database d " "WHERE datallowconn ORDER BY 1" ) ;
 else {
 res = executeQuery ( conn , "SELECT datname, " "(select usename from pg_shadow where usesysid=datdba), " "pg_encoding_to_char(d.encoding), " "null::text AS datcollate, null::text AS datctype, 0 AS datfrozenxid, 0 AS datminmxid, " "'f' as datistemplate, " "'' as datacl, '' as rdatacl, -1 as datconnlimit, " "'pg_default' AS dattablespace " "FROM pg_database d " "ORDER BY 1" ) ;
 }
 for ( i = 0 ;
 i < PQntuples ( res ) ;
 i ++ ) {
 char * dbname = PQgetvalue ( res , i , 0 ) ;
 char * dbowner = PQgetvalue ( res , i , 1 ) ;
 char * dbencoding = PQgetvalue ( res , i , 2 ) ;
 char * dbcollate = PQgetvalue ( res , i , 3 ) ;
 char * dbctype = PQgetvalue ( res , i , 4 ) ;
 uint32 dbfrozenxid = atooid ( PQgetvalue ( res , i , 5 ) ) ;
 uint32 dbminmxid = atooid ( PQgetvalue ( res , i , 6 ) ) ;
 char * dbistemplate = PQgetvalue ( res , i , 7 ) ;
 char * dbacl = PQgetvalue ( res , i , 8 ) ;
 char * rdbacl = PQgetvalue ( res , i , 9 ) ;
 char * dbconnlimit = PQgetvalue ( res , i , 10 ) ;
 char * dbtablespace = PQgetvalue ( res , i , 11 ) ;
 char * fdbname ;
 fdbname = pg_strdup ( fmtId ( dbname ) ) ;
 resetPQExpBuffer ( buf ) ;
 if ( strcmp ( dbname , "template1" ) != 0 && strcmp ( dbname , "postgres" ) != 0 ) {
 appendPQExpBuffer ( buf , "CREATE DATABASE %s" , fdbname ) ;
 appendPQExpBufferStr ( buf , " WITH TEMPLATE = template0" ) ;
 if ( strlen ( dbowner ) != 0 ) appendPQExpBuffer ( buf , " OWNER = %s" , fmtId ( dbowner ) ) ;
 if ( default_encoding && strcmp ( dbencoding , default_encoding ) != 0 ) {
 appendPQExpBufferStr ( buf , " ENCODING = " ) ;
 appendStringLiteralConn ( buf , dbencoding , conn ) ;
 }
 if ( default_collate && strcmp ( dbcollate , default_collate ) != 0 ) {
 appendPQExpBufferStr ( buf , " LC_COLLATE = " ) ;
 appendStringLiteralConn ( buf , dbcollate , conn ) ;
 }
 if ( default_ctype && strcmp ( dbctype , default_ctype ) != 0 ) {
 appendPQExpBufferStr ( buf , " LC_CTYPE = " ) ;
 appendStringLiteralConn ( buf , dbctype , conn ) ;
 }
 if ( strcmp ( dbtablespace , "pg_default" ) != 0 && ! no_tablespaces ) appendPQExpBuffer ( buf , " TABLESPACE = %s" , fmtId ( dbtablespace ) ) ;
 if ( strcmp ( dbistemplate , "t" ) == 0 ) appendPQExpBuffer ( buf , " IS_TEMPLATE = true" ) ;
 if ( strcmp ( dbconnlimit , "-1" ) != 0 ) appendPQExpBuffer ( buf , " CONNECTION LIMIT = %s" , dbconnlimit ) ;
 appendPQExpBufferStr ( buf , ";
\n" ) ;
 }
 else if ( strcmp ( dbtablespace , "pg_default" ) != 0 && ! no_tablespaces ) {
 if ( strcmp ( dbname , "postgres" ) == 0 ) appendPQExpBuffer ( buf , "\\connect template1\n" ) ;
 else appendPQExpBuffer ( buf , "\\connect postgres\n" ) ;
 appendPQExpBuffer ( buf , "ALTER DATABASE %s SET TABLESPACE %s;
\n" , fdbname , fmtId ( dbtablespace ) ) ;
 appendPQExpBuffer ( buf , "\\connect %s\n" , fdbname ) ;
 }
 if ( binary_upgrade ) {
 appendPQExpBufferStr ( buf , "-- For binary upgrade, set datfrozenxid and datminmxid.\n" ) ;
 appendPQExpBuffer ( buf , "UPDATE pg_catalog.pg_database " "SET datfrozenxid = '%u', datminmxid = '%u' " "WHERE datname = " , dbfrozenxid , dbminmxid ) ;
 appendStringLiteralConn ( buf , dbname , conn ) ;
 appendPQExpBufferStr ( buf , ";
\n" ) ;
 }
 if ( ! skip_acls && ! buildACLCommands ( fdbname , NULL , "DATABASE" , dbacl , rdbacl , dbowner , "" , server_version , buf ) ) {
 fprintf ( stderr , _ ( "%s: could not parse ACL list (%s) for database \"%s\"\n" ) , progname , dbacl , fdbname ) ;
 PQfinish ( conn ) ;
 exit_nicely ( 1 ) ;
 }
 fprintf ( OPF , "%s" , buf -> data ) ;
 if ( server_version >= 70300 ) dumpDatabaseConfig ( conn , dbname ) ;
 free ( fdbname ) ;
 }
 if ( default_encoding ) free ( default_encoding ) ;
 if ( default_collate ) free ( default_collate ) ;
 if ( default_ctype ) free ( default_ctype ) ;
 PQclear ( res ) ;
 destroyPQExpBuffer ( buf ) ;
 fprintf ( OPF , "\n\n" ) ;
 }


void srtp_add_address ( packet_info * pinfo , address * addr , int port , int other_port , const gchar * setup_method , guint32 setup_frame_number , gboolean is_video _U_ , rtp_dyn_payload_t * rtp_dyn_payload , struct srtp_info * srtp_info ) {
 address null_addr ;
 conversation_t * p_conv ;
 struct _rtp_conversation_info * p_conv_data = NULL ;
 if ( ( pinfo -> fd -> flags . visited ) || ( rtp_handle == NULL ) ) {
 return ;
 }
 DPRINT ( ( "#%u: %srtp_add_address(%s, %u, %u, %s, %u)" , pinfo -> fd -> num , ( srtp_info ) ? "s" : "" , ep_address_to_str ( addr ) , port , other_port , setup_method , setup_frame_number ) ) ;
 DINDENT ( ) ;
 SET_ADDRESS ( & null_addr , AT_NONE , 0 , NULL ) ;
 p_conv = find_conversation ( setup_frame_number , addr , & null_addr , PT_UDP , port , other_port , NO_ADDR_B | ( ! other_port ? NO_PORT_B : 0 ) ) ;
 DENDENT ( ) ;
 DPRINT ( ( "did %sfind conversation" , p_conv ? "" : "NOT " ) ) ;
 if ( ! p_conv || p_conv -> setup_frame != setup_frame_number ) {
 p_conv = conversation_new ( setup_frame_number , addr , & null_addr , PT_UDP , ( guint32 ) port , ( guint32 ) other_port , NO_ADDR2 | ( ! other_port ? NO_PORT2 : 0 ) ) ;
 }
 conversation_set_dissector ( p_conv , rtp_handle ) ;
 p_conv_data = ( struct _rtp_conversation_info * ) conversation_get_proto_data ( p_conv , proto_rtp ) ;
 if ( ! p_conv_data ) {
 DPRINT ( ( "creating new conversation data" ) ) ;
 p_conv_data = wmem_new ( wmem_file_scope ( ) , struct _rtp_conversation_info ) ;
 p_conv_data -> rtp_dyn_payload = NULL ;
 p_conv_data -> extended_seqno = 0x10000 ;
 p_conv_data -> rtp_conv_info = wmem_new ( wmem_file_scope ( ) , rtp_private_conv_info ) ;
 p_conv_data -> rtp_conv_info -> multisegment_pdus = wmem_tree_new ( wmem_file_scope ( ) ) ;
 DINDENT ( ) ;
 conversation_add_proto_data ( p_conv , proto_rtp , p_conv_data ) ;
 DENDENT ( ) ;
 }
 # ifdef DEBUG_CONVERSATION else {
 DPRINT ( ( "conversation already exists" ) ) ;
 }
 # endif if ( p_conv_data -> rtp_dyn_payload != rtp_dyn_payload ) {
 rtp_dyn_payload_free ( p_conv_data -> rtp_dyn_payload ) ;
 p_conv_data -> rtp_dyn_payload = rtp_dyn_payload_ref ( rtp_dyn_payload ) ;
 }
 else {
 DPRINT ( ( "passed-in rtp_dyn_payload is the same as in the conversation" ) ) ;
 }
 g_strlcpy ( p_conv_data -> method , setup_method , MAX_RTP_SETUP_METHOD_SIZE + 1 ) ;
 p_conv_data -> frame_number = setup_frame_number ;
 p_conv_data -> is_video = is_video ;
 p_conv_data -> srtp_info = srtp_info ;
 p_conv_data -> bta2dp_info = NULL ;
 p_conv_data -> btvdp_info = NULL ;
 }


static void nvdimm_dsm_root(NvdimmDsmIn *in, hwaddr dsm_mem_addr) { /* * function 0 is called to inquire which functions are supported by * OSPM */ if (!in->function) { nvdimm_dsm_function0(0 /* No function supported other than function 0 */, dsm_mem_addr); return; } /* No function except function 0 is supported yet. */ nvdimm_dsm_no_payload(1 /* Not Supported */, dsm_mem_addr); }


static int nbd_negotiate_read(QIOChannel *ioc, void *buffer, size_t size) { ssize_t ret; guint watch; assert(qemu_in_coroutine()); /* Negotiation are always in main loop. */ watch = qio_channel_add_watch(ioc, G_IO_IN, nbd_negotiate_continue, qemu_coroutine_self(), NULL); ret = read_sync(ioc, buffer, size, NULL); g_source_remove(watch); return ret; }


static int ohci_bus_start(OHCIState *ohci) { ohci->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ohci_frame_boundary, ohci); if (ohci->eof_timer == NULL) { trace_usb_ohci_bus_eof_timer_failed(ohci->name); ohci_die(ohci); return 0; } trace_usb_ohci_start(ohci->name); ohci_sof(ohci); return 1; }


static int64_t rm_read_dts ( AVFormatContext * s , int stream_index , int64_t * ppos , int64_t pos_limit ) {
 RMDemuxContext * rm = s -> priv_data ;
 int64_t pos , dts ;
 int stream_index2 , flags , len , h ;
 pos = * ppos ;
 if ( rm -> old_format ) return AV_NOPTS_VALUE ;
 if ( avio_seek ( s -> pb , pos , SEEK_SET ) < 0 ) return AV_NOPTS_VALUE ;
 rm -> remaining_len = 0 ;
 for ( ;
 ;
 ) {
 int seq = 1 ;
 AVStream * st ;
 len = rm_sync ( s , & dts , & flags , & stream_index2 , & pos ) ;
 if ( len < 0 ) return AV_NOPTS_VALUE ;
 st = s -> streams [ stream_index2 ] ;
 if ( st -> codecpar -> codec_type == AVMEDIA_TYPE_VIDEO ) {
 h = avio_r8 ( s -> pb ) ;
 len -- ;
 if ( ! ( h & 0x40 ) ) {
 seq = avio_r8 ( s -> pb ) ;
 len -- ;
 }
 }
 if ( ( flags & 2 ) && ( seq & 0x7F ) == 1 ) {
 av_log ( s , AV_LOG_TRACE , "%d %d-%d %" PRId64 " %d\n" , flags , stream_index2 , stream_index , dts , seq ) ;
 av_add_index_entry ( st , pos , dts , 0 , 0 , AVINDEX_KEYFRAME ) ;
 if ( stream_index2 == stream_index ) break ;
 }
 avio_skip ( s -> pb , len ) ;
 }
 * ppos = pos ;
 return dts ;
 }