void BackendImpl::CriticalError(int error) {
  STRESS_NOTREACHED();
  LOG(ERROR) << "Critical error found " << error;
  if (disabled_)
    return;

  stats_.OnEvent(Stats::FATAL_ERROR);
  LogStats();
  ReportError(error);

  data_->header.table_len = 1;
  disabled_ = true;

  if (!num_refs_)
    base::ThreadTaskRunnerHandle::Get()->PostTask(
        FROM_HERE, base::Bind(&BackendImpl::RestartCache, GetWeakPtr(), true));
}


void PrintWebViewHelper::OnPrintForPrintPreview(
    const DictionaryValue& job_settings) {
  DCHECK(is_preview_enabled_);
  if (print_web_view_)
    return;

  if (!render_view()->GetWebView())
    return;
  WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
  if (!main_frame)
    return;

  WebDocument document = main_frame->document();
  WebElement pdf_element = document.getElementById("pdf-viewer");
  if (pdf_element.isNull()) {
    NOTREACHED();
    return;
  }

  AutoReset<bool> set_printing_flag(&print_for_preview_, true);

  WebFrame* pdf_frame = pdf_element.document().frame();
  if (!UpdatePrintSettings(pdf_frame, pdf_element, job_settings)) {
    LOG(ERROR) << "UpdatePrintSettings failed";
    DidFinishPrinting(FAIL_PRINT);
    return;
  }

  if (!RenderPagesForPrint(pdf_frame, pdf_element)) {
    LOG(ERROR) << "RenderPagesForPrint failed";
    DidFinishPrinting(FAIL_PRINT);
  }
}


static int mbochs_check_framebuffer(struct mdev_state *mdev_state,
				    struct mbochs_mode *mode)
{
	struct device *dev = mdev_dev(mdev_state->mdev);
	u16 *vbe = mdev_state->vbe;
	u32 virt_width;

	WARN_ON(!mutex_is_locked(&mdev_state->ops_lock));

	if (!(vbe[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED))
		goto nofb;

	memset(mode, 0, sizeof(*mode));
	switch (vbe[VBE_DISPI_INDEX_BPP]) {
	case 32:
		mode->drm_format = DRM_FORMAT_XRGB8888;
		mode->bytepp = 4;
		break;
	default:
		dev_info_ratelimited(dev, "%s: bpp %d not supported\n",
				     __func__, vbe[VBE_DISPI_INDEX_BPP]);
		goto nofb;
	}

	mode->width  = vbe[VBE_DISPI_INDEX_XRES];
	mode->height = vbe[VBE_DISPI_INDEX_YRES];
	virt_width  = vbe[VBE_DISPI_INDEX_VIRT_WIDTH];
	if (virt_width < mode->width)
		virt_width = mode->width;
	mode->stride = virt_width * mode->bytepp;
	mode->size   = (u64)mode->stride * mode->height;
	mode->offset = ((u64)vbe[VBE_DISPI_INDEX_X_OFFSET] * mode->bytepp +
		       (u64)vbe[VBE_DISPI_INDEX_Y_OFFSET] * mode->stride);

	if (mode->width < 64 || mode->height < 64) {
		dev_info_ratelimited(dev, "%s: invalid resolution %dx%d\n",
				     __func__, mode->width, mode->height);
		goto nofb;
	}
	if (mode->offset + mode->size > mdev_state->memsize) {
		dev_info_ratelimited(dev, "%s: framebuffer memory overflow\n",
				     __func__);
		goto nofb;
	}

	return 0;

nofb:
	memset(mode, 0, sizeof(*mode));
	return -EINVAL;
}


IN_PROC_BROWSER_TEST_F ( FullscreenControllerTest , FullscreenOnFileURL ) {
 static const base : : FilePath : : CharType * kEmptyFile = FILE_PATH_LITERAL ( "empty.html" ) ;
 GURL file_url ( ui_test_utils : : GetTestUrl ( base : : FilePath ( base : : FilePath : : kCurrentDirectory ) , base : : FilePath ( kEmptyFile ) ) ) ;
 AddTabAtIndex ( 0 , file_url , PAGE_TRANSITION_TYPED ) ;
 RequestToLockMouse ( true , false ) ;
 ASSERT_TRUE ( IsFullscreenBubbleDisplayed ( ) ) ;
 ASSERT_TRUE ( IsFullscreenBubbleDisplayingButtons ( ) ) ;
 }


FWCfgState *pc_memory_init(PCMachineState *pcms,

                           MemoryRegion *system_memory,

                           MemoryRegion *rom_memory,

                           MemoryRegion **ram_memory,

                           PcGuestInfo *guest_info)

{

    int linux_boot, i;

    MemoryRegion *ram, *option_rom_mr;

    MemoryRegion *ram_below_4g, *ram_above_4g;

    FWCfgState *fw_cfg;

    MachineState *machine = MACHINE(pcms);

    assert(machine->ram_size == pcms->below_4g_mem_size +

                                pcms->above_4g_mem_size);

    linux_boot = (machine->kernel_filename != NULL);

    /* Allocate RAM.  We allocate it as a single memory region and use

     * aliases to address portions of it, mostly for backwards compatibility

     * with older qemus that used qemu_ram_alloc().

     */

    ram = g_malloc(sizeof(*ram));

    memory_region_allocate_system_memory(ram, NULL, "pc.ram",

                                         machine->ram_size);

    *ram_memory = ram;

    ram_below_4g = g_malloc(sizeof(*ram_below_4g));

    memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram,

                             0, pcms->below_4g_mem_size);

    memory_region_add_subregion(system_memory, 0, ram_below_4g);

    e820_add_entry(0, pcms->below_4g_mem_size, E820_RAM);

    if (pcms->above_4g_mem_size > 0) {

        ram_above_4g = g_malloc(sizeof(*ram_above_4g));

        memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g", ram,

                                 pcms->below_4g_mem_size,

                                 pcms->above_4g_mem_size);

        memory_region_add_subregion(system_memory, 0x100000000ULL,

                                    ram_above_4g);

        e820_add_entry(0x100000000ULL, pcms->above_4g_mem_size, E820_RAM);

    }

    if (!guest_info->has_reserved_memory &&

        (machine->ram_slots ||

         (machine->maxram_size > machine->ram_size))) {

        MachineClass *mc = MACHINE_GET_CLASS(machine);

        error_report("\"-memory 'slots|maxmem'\" is not supported by: %s",

                     mc->name);

        exit(EXIT_FAILURE);

    }

    /* initialize hotplug memory address space */

    if (guest_info->has_reserved_memory &&

        (machine->ram_size < machine->maxram_size)) {

        ram_addr_t hotplug_mem_size =

            machine->maxram_size - machine->ram_size;

        if (machine->ram_slots > ACPI_MAX_RAM_SLOTS) {

            error_report("unsupported amount of memory slots: %"PRIu64,

                         machine->ram_slots);

            exit(EXIT_FAILURE);

        }

        if (QEMU_ALIGN_UP(machine->maxram_size,

                          TARGET_PAGE_SIZE) != machine->maxram_size) {

            error_report("maximum memory size must by aligned to multiple of "

                         "%d bytes", TARGET_PAGE_SIZE);

            exit(EXIT_FAILURE);

        }

        pcms->hotplug_memory.base =

            ROUND_UP(0x100000000ULL + pcms->above_4g_mem_size, 1ULL << 30);

        if (pcms->enforce_aligned_dimm) {

            /* size hotplug region assuming 1G page max alignment per slot */

            hotplug_mem_size += (1ULL << 30) * machine->ram_slots;

        }

        if ((pcms->hotplug_memory.base + hotplug_mem_size) <

            hotplug_mem_size) {

            error_report("unsupported amount of maximum memory: " RAM_ADDR_FMT,

                         machine->maxram_size);

            exit(EXIT_FAILURE);

        }

        memory_region_init(&pcms->hotplug_memory.mr, OBJECT(pcms),

                           "hotplug-memory", hotplug_mem_size);

        memory_region_add_subregion(system_memory, pcms->hotplug_memory.base,

                                    &pcms->hotplug_memory.mr);

    }

    /* Initialize PC system firmware */

    pc_system_firmware_init(rom_memory, guest_info->isapc_ram_fw);

    option_rom_mr = g_malloc(sizeof(*option_rom_mr));

    memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,

                           &error_abort);

    vmstate_register_ram_global(option_rom_mr);

    memory_region_add_subregion_overlap(rom_memory,

                                        PC_ROM_MIN_VGA,

                                        option_rom_mr,

                                        1);

    fw_cfg = bochs_bios_init();

    rom_set_fw(fw_cfg);

    if (guest_info->has_reserved_memory && pcms->hotplug_memory.base) {

        uint64_t *val = g_malloc(sizeof(*val));

        uint64_t res_mem_end = pcms->hotplug_memory.base +

                               memory_region_size(&pcms->hotplug_memory.mr);

        *val = cpu_to_le64(ROUND_UP(res_mem_end, 0x1ULL << 30));

        fw_cfg_add_file(fw_cfg, "etc/reserved-memory-end", val, sizeof(*val));

    }

    if (linux_boot) {

        load_linux(pcms, fw_cfg);

    }

    for (i = 0; i < nb_option_roms; i++) {

        rom_add_option(option_rom[i].name, option_rom[i].bootindex);

    }

    guest_info->fw_cfg = fw_cfg;

    return fw_cfg;

}


static int ras_puthdr(jas_stream_t *out, ras_hdr_t *hdr)
{
	if (ras_putint(out, RAS_MAGIC) || ras_putint(out, hdr->width) ||
	  ras_putint(out, hdr->height) || ras_putint(out, hdr->depth) ||
	  ras_putint(out, hdr->length) || ras_putint(out, hdr->type) ||
	  ras_putint(out, hdr->maptype) || ras_putint(out, hdr->maplength)) {
		return -1;
	}

	return 0;
}


int check_smtp_error(char *str, int expected, char *error, int error_size) {
   if (atoi(str) != expected) {
      if (error)
         strlcpy(error, str + 4, error_size);
      return 0;
   }

   return 1;
}


iasecc_read_public_key(struct sc_card *card, unsigned type,
		struct sc_path *key_path, unsigned ref, unsigned size,
		unsigned char **out, size_t *out_len)
{
	struct sc_context *ctx = card->ctx;
	struct iasecc_sdo sdo;
	struct sc_pkcs15_bignum bn[2];
	struct sc_pkcs15_pubkey_rsa rsa_key;
	int rv;

	LOG_FUNC_CALLED(ctx);
	if (type != SC_ALGORITHM_RSA)
		LOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED);

	sc_log(ctx, "read public kay(ref:%i;size:%i)", ref, size);

	memset(&sdo, 0, sizeof(sdo));
	sdo.sdo_class = IASECC_SDO_CLASS_RSA_PUBLIC;
	sdo.sdo_ref  = ref & ~IASECC_OBJECT_REF_LOCAL;

	rv = iasecc_sdo_get_data(card, &sdo);
	LOG_TEST_RET(ctx, rv, "failed to read public key: cannot get RSA SDO data");

	if (out)
		*out = NULL;
	if (out_len)
		*out_len = 0;

	bn[0].data = (unsigned char *) malloc(sdo.data.pub_key.n.size);
	if (!bn[0].data)
		LOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, "failed to read public key: cannot allocate modulus");
	bn[0].len = sdo.data.pub_key.n.size;
	memcpy(bn[0].data, sdo.data.pub_key.n.value, sdo.data.pub_key.n.size);

	bn[1].data = (unsigned char *) malloc(sdo.data.pub_key.e.size);
	if (!bn[1].data)
		LOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, "failed to read public key: cannot allocate exponent");
	bn[1].len = sdo.data.pub_key.e.size;
	memcpy(bn[1].data, sdo.data.pub_key.e.value, sdo.data.pub_key.e.size);

	rsa_key.modulus = bn[0];
	rsa_key.exponent = bn[1];

	rv = sc_pkcs15_encode_pubkey_rsa(ctx, &rsa_key, out, out_len);
	LOG_TEST_RET(ctx, rv, "failed to read public key: cannot encode RSA public key");

	if (out && out_len)
		sc_log(ctx, "encoded public key: %s", sc_dump_hex(*out, *out_len));

	if (bn[0].data)
		free(bn[0].data);
	if (bn[1].data)
		free(bn[1].data);

	iasecc_sdo_free_fields(card, &sdo);

	LOG_FUNC_RETURN(ctx, SC_SUCCESS);
}


  explicit ConnectionListener(ConnectionTracker* tracker)
      : task_runner_(base::ThreadTaskRunnerHandle::Get()), tracker_(tracker) {}


bool TextTrackCueList::Remove(TextTrackCue* cue) {
  size_t index = list_.Find(cue);
  if (index == kNotFound)
    return false;

  list_.EraseAt(index);
  InvalidateCueIndex(index);
  cue->InvalidateCueIndex();
  return true;
}


static void *__alloc_from_contiguous(struct device *dev, size_t size,
				     pgprot_t prot, struct page **ret_page,
				     const void *caller)
{
	unsigned long order = get_order(size);
	size_t count = size >> PAGE_SHIFT;
	struct page *page;
	void *ptr;

	page = dma_alloc_from_contiguous(dev, count, order);
	if (!page)
		return NULL;

	__dma_clear_buffer(page, size);

	if (PageHighMem(page)) {
		ptr = __dma_alloc_remap(page, size, GFP_KERNEL, prot, caller);
		if (!ptr) {
			dma_release_from_contiguous(dev, page, count);
			return NULL;
		}
	} else {
		__dma_remap(page, size, prot);
		ptr = page_address(page);
	}
	*ret_page = page;
	return ptr;
}


void usage_exit() {
void usage_exit(void) {
   fprintf(stderr, "Usage: %s <codec> <width> <height> <infile> <outfile>\n",
           exec_name);
   exit(EXIT_FAILURE);
 }


static void _imap_quote_string (char *dest, size_t dlen, const char *src,
                                const char *to_quote)
{
  char *pt;
  const char *s;

  if (!(dest && dlen && src && to_quote))
    return;

  if (dlen < 3)
  {
    *dest = 0;
    return;
  }

  pt = dest;
  s  = src;

  /* save room for pre/post quote-char and trailing null */
  dlen -= 3;

  *pt++ = '"';
  for (; *s && dlen; s++)
  {
    if (strchr (to_quote, *s))
    {
      if (dlen < 2)
        break;
      dlen -= 2;
      *pt++ = '\\';
      *pt++ = *s;
    }
    else
    {
      *pt++ = *s;
      dlen--;
    }
  }
  *pt++ = '"';
  *pt = 0;
}


bool UDPSocketLibevent::SetSendBufferSize(int32 size) {
  DCHECK(CalledOnValidThread());
  int rv = setsockopt(socket_, SOL_SOCKET, SO_SNDBUF,
                      reinterpret_cast<const char*>(&size), sizeof(size));
  DCHECK(!rv) << "Could not set socket send buffer size: " << errno;
  return rv == 0;
}


int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new)
{
	struct dcb_app_type event;
	int err = 0;

	event.ifindex = dev->ifindex;
	memcpy(&event.app, new, sizeof(event.app));
	if (dev->dcbnl_ops->getdcbx)
		event.dcbx = dev->dcbnl_ops->getdcbx(dev);

	spin_lock(&dcb_lock);
	/* Search for existing match and abort if found */
	if (dcb_app_lookup(new, dev->ifindex, new->priority)) {
		err = -EEXIST;
		goto out;
	}

	err = dcb_app_add(new, dev->ifindex);
out:
	spin_unlock(&dcb_lock);
	if (!err)
		call_dcbevent_notifiers(DCB_APP_EVENT, &event);
	return err;
}


static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs,
        int64_t sector_num, int nb_sectors)
{
    BdrvTrackedRequest *req;
    int64_t cluster_sector_num;
    int cluster_nb_sectors;
    bool retry;
    /* If we touch the same cluster it counts as an overlap.  This guarantees
     * that allocating writes will be serialized and not race with each other
     * for the same cluster.  For example, in copy-on-read it ensures that the
     * CoR read and write operations are atomic and guest writes cannot
     * interleave between them.
    round_to_clusters(bs, sector_num, nb_sectors,
                      &cluster_sector_num, &cluster_nb_sectors);
    do {
        retry = false;
        QLIST_FOREACH(req, &bs->tracked_requests, list) {
            if (tracked_request_overlaps(req, cluster_sector_num,
                                         cluster_nb_sectors)) {
                qemu_co_queue_wait(&req->wait_queue);
                retry = true;
                break;
            }
        }
    } while (retry);
}


static struct net_device *packet_cached_dev_get(struct packet_sock *po)
{
	struct net_device *dev;

	rcu_read_lock();
	dev = rcu_dereference(po->cached_dev);
	if (likely(dev))
		dev_hold(dev);
	rcu_read_unlock();

	return dev;
}


    template<typename t>
    CImg<_cimg_Tt> operator*(const t value) const {
      return CImg<_cimg_Tt>(*this,false)*=value;


Variant HHVM_FUNCTION(mb_convert_kana,
                      const String& str,
                      const Variant& opt_option,
                      const Variant& opt_encoding) {
  const String option = convertArg(opt_option);
  const String encoding = convertArg(opt_encoding);

  mbfl_string string, result, *ret;
  mbfl_string_init(&string);
  string.no_language = MBSTRG(current_language);
  string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
  string.val = (unsigned char *)str.data();
  string.len = str.size();

  int opt = 0x900;
  if (!option.empty()) {
    const char *p = option.data();
    int n = option.size();
    int i = 0;
    opt = 0;
    while (i < n) {
      i++;
      switch (*p++) {
      case 'A': opt |= 0x1;      break;
      case 'a': opt |= 0x10;     break;
      case 'R': opt |= 0x2;      break;
      case 'r': opt |= 0x20;     break;
      case 'N': opt |= 0x4;      break;
      case 'n': opt |= 0x40;     break;
      case 'S': opt |= 0x8;      break;
      case 's': opt |= 0x80;     break;
      case 'K': opt |= 0x100;    break;
      case 'k': opt |= 0x1000;   break;
      case 'H': opt |= 0x200;    break;
      case 'h': opt |= 0x2000;   break;
      case 'V': opt |= 0x800;    break;
      case 'C': opt |= 0x10000;  break;
      case 'c': opt |= 0x20000;  break;
      case 'M': opt |= 0x100000; break;
      case 'm': opt |= 0x200000; break;
      }
    }
  }

  /* encoding */
  if (!encoding.empty()) {
    string.no_encoding = mbfl_name2no_encoding(encoding.data());
    if (string.no_encoding == mbfl_no_encoding_invalid) {
      raise_warning("Unknown encoding \"%s\"", encoding.data());
      return false;
    }
  }

  ret = mbfl_ja_jp_hantozen(&string, &result, opt);
  if (ret != nullptr) {
    if (ret->len > StringData::MaxSize) {
      raise_warning("String too long, max is %d", StringData::MaxSize);
      return false;
    }
    return String(reinterpret_cast<char*>(ret->val), ret->len, AttachString);
  }
  return false;
}


int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
{
    *key = TlsAlloc();
    if (*key == TLS_OUT_OF_INDEXES)
        return 0;

    return 1;
}


void * jas_realloc2 ( void * ptr , size_t num_elements , size_t element_size ) {
 size_t size ;
 if ( ! jas_safe_size_mul ( num_elements , element_size , & size ) ) {
 return 0 ;
 }
 return jas_realloc ( ptr , size ) ;
 }


void device_wink(void)
{
    wink_time = 10;
    winkt1 = 0;
}


sysapi_opsys(void)
{
    if (_sysapi_opsys_is_versioned) {
        return sysapi_opsys_versioned();
    }
    return "WINDOWS";
}


void RenderProcessHostImpl::DisableAudioDebugRecordings() {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);

  GetAecDumpFileTaskRunner().PostTaskAndReply(
      FROM_HERE, base::BindOnce(&base::DoNothing),
      base::BindOnce(&RenderProcessHostImpl::SendDisableAecDumpToRenderer,
                     weak_factory_.GetWeakPtr()));
}


bool IDNSpoofChecker::SimilarToTopDomains(base::StringPiece16 hostname) {
  size_t hostname_length = hostname.length() - (hostname.back() == '.' ? 1 : 0);
  icu::UnicodeString ustr_host(FALSE, hostname.data(), hostname_length);
   if (lgc_letters_n_ascii_.span(ustr_host, 0, USET_SPAN_CONTAINED) ==
       ustr_host.length())
    diacritic_remover_.get()->transliterate(ustr_host);
  extra_confusable_mapper_.get()->transliterate(ustr_host);

   UErrorCode status = U_ZERO_ERROR;
   icu::UnicodeString ustr_skeleton;
  uspoof_getSkeletonUnicodeString(checker_, 0, ustr_host, ustr_skeleton,
                                  &status);
   if (U_FAILURE(status))
     return false;
   std::string skeleton;
  return LookupMatchInTopDomains(ustr_skeleton.toUTF8String(skeleton));
 }


str_node_split_last_char(Node* node, OnigEncoding enc)
{
  const UChar *p;
  Node* rn;
  StrNode* sn;

  sn = STR_(node);
  rn = NULL_NODE;
  if (sn->end > sn->s) {
    p = onigenc_get_prev_char_head(enc, sn->s, sn->end);
    if (p && p > sn->s) { /* can be split. */
      rn = node_new_str(p, sn->end);
      CHECK_NULL_RETURN(rn);
      if (NODE_STRING_IS_RAW(node))
        NODE_STRING_SET_RAW(rn);

      sn->end = (UChar* )p;
    }
  }
  return rn;
}


ScriptValue WebGLRenderingContextBase::getTexParameter(
    ScriptState* script_state,
    GLenum target,
    GLenum pname) {
  if (isContextLost())
    return ScriptValue::CreateNull(script_state);
  if (!ValidateTextureBinding("getTexParameter", target))
    return ScriptValue::CreateNull(script_state);
  switch (pname) {
    case GL_TEXTURE_MAG_FILTER:
    case GL_TEXTURE_MIN_FILTER:
    case GL_TEXTURE_WRAP_S:
    case GL_TEXTURE_WRAP_T: {
      GLint value = 0;
      ContextGL()->GetTexParameteriv(target, pname, &value);
      return WebGLAny(script_state, static_cast<unsigned>(value));
    }
    case GL_TEXTURE_MAX_ANISOTROPY_EXT:  // EXT_texture_filter_anisotropic
      if (ExtensionEnabled(kEXTTextureFilterAnisotropicName)) {
        GLfloat value = 0.f;
        ContextGL()->GetTexParameterfv(target, pname, &value);
        return WebGLAny(script_state, value);
      }
      SynthesizeGLError(
          GL_INVALID_ENUM, "getTexParameter",
          "invalid parameter name, EXT_texture_filter_anisotropic not enabled");
      return ScriptValue::CreateNull(script_state);
    default:
      SynthesizeGLError(GL_INVALID_ENUM, "getTexParameter",
                        "invalid parameter name");
      return ScriptValue::CreateNull(script_state);
  }
}


static int dv_decode_video_segment ( AVCodecContext * avctx , void * arg ) {
 DVVideoContext * s = avctx -> priv_data ;
 DVwork_chunk * work_chunk = arg ;
 int quant , dc , dct_mode , class1 , j ;
 int mb_index , mb_x , mb_y , last_index ;
 int y_stride , linesize ;
 int16_t * block , * block1 ;
 int c_offset ;
 uint8_t * y_ptr ;
 const uint8_t * buf_ptr ;
 PutBitContext pb , vs_pb ;
 GetBitContext gb ;
 BlockInfo mb_data [ 5 * DV_MAX_BPM ] , * mb , * mb1 ;
 LOCAL_ALIGNED_16 ( int16_t , sblock , [ 5 * DV_MAX_BPM ] , [ 64 ] ) ;
 LOCAL_ALIGNED_16 ( uint8_t , mb_bit_buffer , [ 80 + FF_INPUT_BUFFER_PADDING_SIZE ] ) ;
 LOCAL_ALIGNED_16 ( uint8_t , vs_bit_buffer , [ 5 * 80 + FF_INPUT_BUFFER_PADDING_SIZE ] ) ;
 const int log2_blocksize = 3 ;
 int is_field_mode [ 5 ] ;
 assert ( ( ( ( int ) mb_bit_buffer ) & 7 ) == 0 ) ;
 assert ( ( ( ( int ) vs_bit_buffer ) & 7 ) == 0 ) ;
 memset ( sblock , 0 , 5 * DV_MAX_BPM * sizeof ( * sblock ) ) ;
 buf_ptr = & s -> buf [ work_chunk -> buf_offset * 80 ] ;
 block1 = & sblock [ 0 ] [ 0 ] ;
 mb1 = mb_data ;
 init_put_bits ( & vs_pb , vs_bit_buffer , 5 * 80 ) ;
 for ( mb_index = 0 ;
 mb_index < 5 ;
 mb_index ++ , mb1 += s -> sys -> bpm , block1 += s -> sys -> bpm * 64 ) {
 quant = buf_ptr [ 3 ] & 0x0f ;
 buf_ptr += 4 ;
 init_put_bits ( & pb , mb_bit_buffer , 80 ) ;
 mb = mb1 ;
 block = block1 ;
 is_field_mode [ mb_index ] = 0 ;
 for ( j = 0 ;
 j < s -> sys -> bpm ;
 j ++ ) {
 last_index = s -> sys -> block_sizes [ j ] ;
 init_get_bits ( & gb , buf_ptr , last_index ) ;
 dc = get_sbits ( & gb , 9 ) ;
 dct_mode = get_bits1 ( & gb ) ;
 class1 = get_bits ( & gb , 2 ) ;
 if ( DV_PROFILE_IS_HD ( s -> sys ) ) {
 mb -> idct_put = s -> idct_put [ 0 ] ;
 mb -> scan_table = s -> dv_zigzag [ 0 ] ;
 mb -> factor_table = & s -> sys -> idct_factor [ ( j >= 4 ) * 4 * 16 * 64 + class1 * 16 * 64 + quant * 64 ] ;
 is_field_mode [ mb_index ] |= ! j && dct_mode ;
 }
 else {
 mb -> idct_put = s -> idct_put [ dct_mode && log2_blocksize == 3 ] ;
 mb -> scan_table = s -> dv_zigzag [ dct_mode ] ;
 mb -> factor_table = & s -> sys -> idct_factor [ ( class1 == 3 ) * 2 * 22 * 64 + dct_mode * 22 * 64 + ( quant + ff_dv_quant_offset [ class1 ] ) * 64 ] ;
 }
 dc = dc << 2 ;
 dc += 1024 ;
 block [ 0 ] = dc ;
 buf_ptr += last_index >> 3 ;
 mb -> pos = 0 ;
 mb -> partial_bit_count = 0 ;
 av_dlog ( avctx , "MB block: %d, %d " , mb_index , j ) ;
 dv_decode_ac ( & gb , mb , block ) ;
 if ( mb -> pos >= 64 ) bit_copy ( & pb , & gb ) ;
 block += 64 ;
 mb ++ ;
 }
 av_dlog ( avctx , "***pass 2 size=%d MB#=%d\n" , put_bits_count ( & pb ) , mb_index ) ;
 block = block1 ;
 mb = mb1 ;
 init_get_bits ( & gb , mb_bit_buffer , put_bits_count ( & pb ) ) ;
 put_bits32 ( & pb , 0 ) ;
 flush_put_bits ( & pb ) ;
 for ( j = 0 ;
 j < s -> sys -> bpm ;
 j ++ , block += 64 , mb ++ ) {
 if ( mb -> pos < 64 && get_bits_left ( & gb ) > 0 ) {
 dv_decode_ac ( & gb , mb , block ) ;
 if ( mb -> pos < 64 ) break ;
 }
 }
 if ( j >= s -> sys -> bpm ) bit_copy ( & vs_pb , & gb ) ;
 }
 av_dlog ( avctx , "***pass 3 size=%d\n" , put_bits_count ( & vs_pb ) ) ;
 block = & sblock [ 0 ] [ 0 ] ;
 mb = mb_data ;
 init_get_bits ( & gb , vs_bit_buffer , put_bits_count ( & vs_pb ) ) ;
 put_bits32 ( & vs_pb , 0 ) ;
 flush_put_bits ( & vs_pb ) ;
 for ( mb_index = 0 ;
 mb_index < 5 ;
 mb_index ++ ) {
 for ( j = 0 ;
 j < s -> sys -> bpm ;
 j ++ ) {
 if ( mb -> pos < 64 ) {
 av_dlog ( avctx , "start %d:%d\n" , mb_index , j ) ;
 dv_decode_ac ( & gb , mb , block ) ;
 }
 if ( mb -> pos >= 64 && mb -> pos < 127 ) av_log ( avctx , AV_LOG_ERROR , "AC EOB marker is absent pos=%d\n" , mb -> pos ) ;
 block += 64 ;
 mb ++ ;
 }
 }
 block = & sblock [ 0 ] [ 0 ] ;
 mb = mb_data ;
 for ( mb_index = 0 ;
 mb_index < 5 ;
 mb_index ++ ) {
 dv_calculate_mb_xy ( s , work_chunk , mb_index , & mb_x , & mb_y ) ;
 if ( ( s -> sys -> pix_fmt == AV_PIX_FMT_YUV420P ) || ( s -> sys -> pix_fmt == AV_PIX_FMT_YUV411P && mb_x >= ( 704 / 8 ) ) || ( s -> sys -> height >= 720 && mb_y != 134 ) ) {
 y_stride = ( s -> picture . linesize [ 0 ] << ( ( ! is_field_mode [ mb_index ] ) * log2_blocksize ) ) ;
 }
 else {
 y_stride = ( 2 << log2_blocksize ) ;
 }
 y_ptr = s -> picture . data [ 0 ] + ( ( mb_y * s -> picture . linesize [ 0 ] + mb_x ) << log2_blocksize ) ;
 linesize = s -> picture . linesize [ 0 ] << is_field_mode [ mb_index ] ;
 mb [ 0 ] . idct_put ( y_ptr , linesize , block + 0 * 64 ) ;
 if ( s -> sys -> video_stype == 4 ) {
 mb [ 2 ] . idct_put ( y_ptr + ( 1 << log2_blocksize ) , linesize , block + 2 * 64 ) ;
 }
 else {
 mb [ 1 ] . idct_put ( y_ptr + ( 1 << log2_blocksize ) , linesize , block + 1 * 64 ) ;
 mb [ 2 ] . idct_put ( y_ptr + y_stride , linesize , block + 2 * 64 ) ;
 mb [ 3 ] . idct_put ( y_ptr + ( 1 << log2_blocksize ) + y_stride , linesize , block + 3 * 64 ) ;
 }
 mb += 4 ;
 block += 4 * 64 ;
 c_offset = ( ( ( mb_y >> ( s -> sys -> pix_fmt == AV_PIX_FMT_YUV420P ) ) * s -> picture . linesize [ 1 ] + ( mb_x >> ( ( s -> sys -> pix_fmt == AV_PIX_FMT_YUV411P ) ? 2 : 1 ) ) ) << log2_blocksize ) ;
 for ( j = 2 ;
 j ;
 j -- ) {
 uint8_t * c_ptr = s -> picture . data [ j ] + c_offset ;
 if ( s -> sys -> pix_fmt == AV_PIX_FMT_YUV411P && mb_x >= ( 704 / 8 ) ) {
 uint64_t aligned_pixels [ 64 / 8 ] ;
 uint8_t * pixels = ( uint8_t * ) aligned_pixels ;
 uint8_t * c_ptr1 , * ptr1 ;
 int x , y ;
 mb -> idct_put ( pixels , 8 , block ) ;
 for ( y = 0 ;
 y < ( 1 << log2_blocksize ) ;
 y ++ , c_ptr += s -> picture . linesize [ j ] , pixels += 8 ) {
 ptr1 = pixels + ( 1 << ( log2_blocksize - 1 ) ) ;
 c_ptr1 = c_ptr + ( s -> picture . linesize [ j ] << log2_blocksize ) ;
 for ( x = 0 ;
 x < ( 1 << ( log2_blocksize - 1 ) ) ;
 x ++ ) {
 c_ptr [ x ] = pixels [ x ] ;
 c_ptr1 [ x ] = ptr1 [ x ] ;
 }
 }
 block += 64 ;
 mb ++ ;
 }
 else {
 y_stride = ( mb_y == 134 ) ? ( 1 << log2_blocksize ) : s -> picture . linesize [ j ] << ( ( ! is_field_mode [ mb_index ] ) * log2_blocksize ) ;
 linesize = s -> picture . linesize [ j ] << is_field_mode [ mb_index ] ;
 ( mb ++ ) -> idct_put ( c_ptr , linesize , block ) ;
 block += 64 ;
 if ( s -> sys -> bpm == 8 ) {
 ( mb ++ ) -> idct_put ( c_ptr + y_stride , linesize , block ) ;
 block += 64 ;
 }
 }
 }
 }
 return 0 ;
 }


static int add_inbuf(struct virtqueue *vq, struct port_buffer *buf)
{
	struct scatterlist sg[1];
	int ret;

	sg_init_one(sg, buf->buf, buf->size);

	ret = virtqueue_add_inbuf(vq, sg, 1, buf, GFP_ATOMIC);
	virtqueue_kick(vq);
	if (!ret)
		ret = vq->num_free;
	return ret;
}


static void test_wl4435()
{
  MYSQL_STMT *stmt;
  int        rc;
  char query[MAX_TEST_QUERY_LENGTH];

  char       str_data[20][WL4435_STRING_SIZE];
  double     dbl_data[20];
  char       dec_data[20][WL4435_STRING_SIZE];
  int        int_data[20];
  ulong      str_length= WL4435_STRING_SIZE;
  my_bool    is_null;
  MYSQL_BIND ps_params[WL4435_NUM_PARAMS];

  int exec_counter;

  myheader("test_wl4435");
  mct_start_logging("test_wl4435");

  rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1");
  myquery(rc);

  rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p2");
  myquery(rc);

  rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
  myquery(rc);

  rc= mysql_query(mysql, "DROP TABLE IF EXISTS t2");
  myquery(rc);

  rc= mysql_query(mysql, "CREATE TABLE t1(a1 INT, a2 CHAR(32), "
                       "  a3 DOUBLE(4, 2), a4 DECIMAL(3, 1))");
  myquery(rc);

  rc= mysql_query(mysql, "CREATE TABLE t2(b0 INT, b1 INT, b2 CHAR(32), "
                       "  b3 DOUBLE(4, 2), b4 DECIMAL(3, 1))");
  myquery(rc);

  rc= mysql_query(mysql, "INSERT INTO t1 VALUES"
    "(1, '11', 12.34, 56.7), "
    "(2, '12', 56.78, 90.1), "
    "(3, '13', 23.45, 67.8)");
  myquery(rc);

  rc= mysql_query(mysql, "INSERT INTO t2 VALUES"
    "(100, 10, '110', 70.70, 10.1), "
    "(200, 20, '120', 80.80, 20.2), "
    "(300, 30, '130', 90.90, 30.3)");
  myquery(rc);

  rc= mysql_query(mysql,
    "CREATE PROCEDURE p1("
    "   IN v0 INT, "
    "   OUT v_str_1 CHAR(32), "
    "   OUT v_dbl_1 DOUBLE(4, 2), "
    "   OUT v_dec_1 DECIMAL(6, 3), "
    "   OUT v_int_1 INT, "
    "   IN v1 INT, "
    "   INOUT v_str_2 CHAR(64), "
    "   INOUT v_dbl_2 DOUBLE(5, 3), "
    "   INOUT v_dec_2 DECIMAL(7, 4), "
    "   INOUT v_int_2 INT)"
    "BEGIN "
    "   SET v0 = -1; "
    "   SET v1 = -1; "
    "   SET v_str_1 = 'test_1'; "
    "   SET v_dbl_1 = 12.34; "
    "   SET v_dec_1 = 567.891; "
    "   SET v_int_1 = 2345; "
    "   SET v_str_2 = 'test_2'; "
    "   SET v_dbl_2 = 67.891; "
    "   SET v_dec_2 = 234.6789; "
    "   SET v_int_2 = 6789; "
    "   SELECT * FROM t1; "
    "   SELECT * FROM t2; "
    "END");
  myquery(rc);

  rc= mysql_query(mysql,
    "CREATE PROCEDURE p2("
    "   IN i1 VARCHAR(255) CHARACTER SET koi8r, "
    "   OUT o1 VARCHAR(255) CHARACTER SET cp1251, "
    "   OUT o2 VARBINARY(255)) "
    "BEGIN "
    "   SET o1 = i1; "
    "   SET o2 = i1; "
    "END");
  myquery(rc);

  my_stpcpy(query, "CALL p1(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
  stmt= mysql_simple_prepare(mysql, query);
  check_stmt(stmt);

  /* Init PS-parameters. */

  memset(ps_params, 0, sizeof (ps_params));

  /* - v0 -- INT */

  ps_params[0].buffer_type= MYSQL_TYPE_LONG;
  ps_params[0].buffer= (char *) &int_data[0];
  ps_params[0].length= 0;
  ps_params[0].is_null= 0;

  /* - v_str_1 -- CHAR(32) */

  ps_params[1].buffer_type= MYSQL_TYPE_STRING;
  ps_params[1].buffer= (char *) str_data[0];
  ps_params[1].buffer_length= WL4435_STRING_SIZE;
  ps_params[1].length= &str_length;
  ps_params[1].is_null= 0;

  /* - v_dbl_1 -- DOUBLE */

  ps_params[2].buffer_type= MYSQL_TYPE_DOUBLE;
  ps_params[2].buffer= (char *) &dbl_data[0];
  ps_params[2].length= 0;
  ps_params[2].is_null= 0;

  /* - v_dec_1 -- DECIMAL */

  ps_params[3].buffer_type= MYSQL_TYPE_NEWDECIMAL;
  ps_params[3].buffer= (char *) dec_data[0];
  ps_params[3].buffer_length= WL4435_STRING_SIZE;
  ps_params[3].length= 0;
  ps_params[3].is_null= 0;

  /* - v_int_1 -- INT */

  ps_params[4].buffer_type= MYSQL_TYPE_LONG;
  ps_params[4].buffer= (char *) &int_data[0];
  ps_params[4].length= 0;
  ps_params[4].is_null= 0;

  /* - v1 -- INT */

  ps_params[5].buffer_type= MYSQL_TYPE_LONG;
  ps_params[5].buffer= (char *) &int_data[0];
  ps_params[5].length= 0;
  ps_params[5].is_null= 0;

  /* - v_str_2 -- CHAR(32) */

  ps_params[6].buffer_type= MYSQL_TYPE_STRING;
  ps_params[6].buffer= (char *) str_data[0];
  ps_params[6].buffer_length= WL4435_STRING_SIZE;
  ps_params[6].length= &str_length;
  ps_params[6].is_null= 0;

  /* - v_dbl_2 -- DOUBLE */

  ps_params[7].buffer_type= MYSQL_TYPE_DOUBLE;
  ps_params[7].buffer= (char *) &dbl_data[0];
  ps_params[7].length= 0;
  ps_params[7].is_null= 0;

  /* - v_dec_2 -- DECIMAL */

  ps_params[8].buffer_type= MYSQL_TYPE_DECIMAL;
  ps_params[8].buffer= (char *) dec_data[0];
  ps_params[8].buffer_length= WL4435_STRING_SIZE;
  ps_params[8].length= 0;
  ps_params[8].is_null= 0;

  /* - v_int_2 -- INT */

  ps_params[9].buffer_type= MYSQL_TYPE_LONG;
  ps_params[9].buffer= (char *) &int_data[0];
  ps_params[9].length= 0;
  ps_params[9].is_null= 0;

  /* Bind parameters. */

  rc= mysql_stmt_bind_param(stmt, ps_params);

  /* Execute! */

  for (exec_counter= 0; exec_counter < 3; ++exec_counter)
  {
    int i;
    int num_fields;
    MYSQL_BIND *rs_bind;

    mct_log("\nexec_counter: %d\n", (int) exec_counter);

    rc= mysql_stmt_execute(stmt);
    check_execute(stmt, rc);

    while (1)
    {
      MYSQL_FIELD *fields;

      MYSQL_RES *rs_metadata= mysql_stmt_result_metadata(stmt);

      num_fields= mysql_stmt_field_count(stmt);
      fields= mysql_fetch_fields(rs_metadata);

      rs_bind= (MYSQL_BIND *) malloc(sizeof (MYSQL_BIND) * num_fields);
      memset(rs_bind, 0, sizeof (MYSQL_BIND) * num_fields);

      mct_log("num_fields: %d\n", (int) num_fields);

      for (i = 0; i < num_fields; ++i)
      {
        mct_log("  - %d: name: '%s'/'%s'; table: '%s'/'%s'; "
                "db: '%s'; catalog: '%s'; length: %d; max_length: %d; "
                "type: %d; decimals: %d\n",
                (int) i,
                (const char *) fields[i].name,
                (const char *) fields[i].org_name,
                (const char *) fields[i].table,
                (const char *) fields[i].org_table,
                (const char *) fields[i].db,
                (const char *) fields[i].catalog,
                (int) fields[i].length,
                (int) fields[i].max_length,
                (int) fields[i].type,
                (int) fields[i].decimals);

        rs_bind[i].buffer_type= fields[i].type;
        rs_bind[i].is_null= &is_null;

        switch (fields[i].type)
        {
          case MYSQL_TYPE_LONG:
            rs_bind[i].buffer= (char *) &(int_data[i]);
            rs_bind[i].buffer_length= sizeof (int_data);
            break;

          case MYSQL_TYPE_STRING:
            rs_bind[i].buffer= (char *) str_data[i];
            rs_bind[i].buffer_length= WL4435_STRING_SIZE;
            rs_bind[i].length= &str_length;
            break;

          case MYSQL_TYPE_DOUBLE:
            rs_bind[i].buffer= (char *) &dbl_data[i];
            rs_bind[i].buffer_length= sizeof (dbl_data);
            break;

          case MYSQL_TYPE_NEWDECIMAL:
            rs_bind[i].buffer= (char *) dec_data[i];
            rs_bind[i].buffer_length= WL4435_STRING_SIZE;
            rs_bind[i].length= &str_length;
            break;

          default:
            fprintf(stderr, "ERROR: unexpected type: %d.\n", fields[i].type);
            exit(1);
        }
      }

      rc= mysql_stmt_bind_result(stmt, rs_bind);
      check_execute(stmt, rc);

      mct_log("Data:\n");

      while (1)
      {
        int rc= mysql_stmt_fetch(stmt);

        if (rc == 1 || rc == MYSQL_NO_DATA)
          break;

        mct_log(" ");

        for (i = 0; i < num_fields; ++i)
        {
          switch (rs_bind[i].buffer_type)
          {
            case MYSQL_TYPE_LONG:
              mct_log(" int: %ld;",
                      (long) *((int *) rs_bind[i].buffer));
              break;

            case MYSQL_TYPE_STRING:
              mct_log(" str: '%s';",
                      (char *) rs_bind[i].buffer);
              break;

            case MYSQL_TYPE_DOUBLE:
              mct_log(" dbl: %lf;",
                      (double) *((double *) rs_bind[i].buffer));
              break;

            case MYSQL_TYPE_NEWDECIMAL:
              mct_log(" dec: '%s';",
                      (char *) rs_bind[i].buffer);
              break;

            default:
              printf("  unexpected type (%d)\n",
                rs_bind[i].buffer_type);
          }
        }
        mct_log("\n");
      }

      mct_log("EOF\n");

      rc= mysql_stmt_next_result(stmt);
      mct_log("mysql_stmt_next_result(): %d; field_count: %d\n",
              (int) rc, (int) mysql->field_count);

      free(rs_bind);
      mysql_free_result(rs_metadata);

      if (rc > 0)
      {
        printf("Error: %s (errno: %d)\n",
               mysql_stmt_error(stmt), mysql_stmt_errno(stmt));
        DIE(rc > 0);
      }

      if (rc)
        break;

      if (!mysql->field_count)
      {
        /* This is the last OK-packet. No more resultsets. */
        break;
      }
    }

  }

  mysql_stmt_close(stmt);

  mct_close_log();

  rc= mysql_commit(mysql);
  myquery(rc);

  /* i18n part of test case. */

  {
    const char *str_koi8r= "\xee\xd5\x2c\x20\xda\xc1\x20\xd2\xd9\xc2\xc1\xcc\xcb\xd5";
    const char *str_cp1251= "\xcd\xf3\x2c\x20\xe7\xe0\x20\xf0\xfb\xe1\xe0\xeb\xea\xf3";
    char o1_buffer[255];
    ulong o1_length;
    char o2_buffer[255];
    ulong o2_length;

    MYSQL_BIND rs_bind[2];

    my_stpcpy(query, "CALL p2(?, ?, ?)");
    stmt= mysql_simple_prepare(mysql, query);
    check_stmt(stmt);

    /* Init PS-parameters. */

    memset(ps_params, 0, sizeof (ps_params));

    ps_params[0].buffer_type= MYSQL_TYPE_STRING;
    ps_params[0].buffer= (char *) str_koi8r;
    ps_params[0].buffer_length= strlen(str_koi8r);

    ps_params[1].buffer_type= MYSQL_TYPE_STRING;
    ps_params[1].buffer= o1_buffer;
    ps_params[1].buffer_length= 0;

    ps_params[2].buffer_type= MYSQL_TYPE_STRING;
    ps_params[2].buffer= o2_buffer;
    ps_params[2].buffer_length= 0;

    /* Bind parameters. */

    rc= mysql_stmt_bind_param(stmt, ps_params);
    check_execute(stmt, rc);

    /* Prevent converting to character_set_results. */

    rc= mysql_query(mysql, "SET NAMES binary");
    myquery(rc);

    /* Execute statement. */

    rc= mysql_stmt_execute(stmt);
    check_execute(stmt, rc);

    /* Bind result. */

    memset(rs_bind, 0, sizeof (rs_bind));

    rs_bind[0].buffer_type= MYSQL_TYPE_STRING;
    rs_bind[0].buffer= o1_buffer;
    rs_bind[0].buffer_length= sizeof (o1_buffer);
    rs_bind[0].length= &o1_length;

    rs_bind[1].buffer_type= MYSQL_TYPE_BLOB;
    rs_bind[1].buffer= o2_buffer;
    rs_bind[1].buffer_length= sizeof (o2_buffer);
    rs_bind[1].length= &o2_length;

    rc= mysql_stmt_bind_result(stmt, rs_bind);
    check_execute(stmt, rc);

    /* Fetch result. */

    rc= mysql_stmt_fetch(stmt);
    check_execute(stmt, rc);

    /* Check result. */

    DIE_UNLESS(o1_length == strlen(str_cp1251));
    DIE_UNLESS(o2_length == strlen(str_koi8r));
    DIE_UNLESS(!memcmp(o1_buffer, str_cp1251, o1_length));
    DIE_UNLESS(!memcmp(o2_buffer, str_koi8r, o2_length));

    rc= mysql_stmt_fetch(stmt);
    DIE_UNLESS(rc == MYSQL_NO_DATA);

    rc= mysql_stmt_next_result(stmt);
    DIE_UNLESS(rc == 0 && mysql->field_count == 0);

    mysql_stmt_close(stmt);

    rc= mysql_commit(mysql);
    myquery(rc);
  }
}


parsepool(struct scanner *s, struct environment *env)
{
	struct pool *p;
	struct evalstring *val;
	struct string *str;
	char *var, *end;

	p = mkpool(scanname(s));
	scannewline(s);
	while (scanindent(s)) {
		var = scanname(s);
		parselet(s, &val);
		if (strcmp(var, "depth") == 0) {
			str = enveval(env, val);
			p->maxjobs = strtol(str->s, &end, 10);
			if (*end)
				fatal("invalid pool depth '%s'", str->s);
			free(str);
		} else {
			fatal("unexpected pool variable '%s'", var);
		}
	}
	if (!p->maxjobs)
		fatal("pool '%s' has no depth", p->name);
}


bool Textfield::HasCompositionText() const {
  return model_->HasCompositionText();
}


yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0,

                     const int16_t *ubuf[2], const int16_t *vbuf[2],

                     const int16_t *abuf0, uint8_t *dest, int dstW,

                     int uvalpha, int y, enum PixelFormat target,

                     int hasAlpha)

{

    const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];

    int i;

    if (uvalpha < 2048) {

        for (i = 0; i < (dstW >> 1); i++) {

            int Y1 = (buf0[i * 2    ] + 64) >> 7;

            int Y2 = (buf0[i * 2 + 1] + 64) >> 7;

            int U  = (ubuf0[i]        + 64) >> 7;

            int V  = (vbuf0[i]        + 64) >> 7;

            int A1, A2;

            const void *r =  c->table_rV[V + YUVRGB_TABLE_HEADROOM],

                       *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]),

                       *b =  c->table_bU[U + YUVRGB_TABLE_HEADROOM];

            if (hasAlpha) {

                A1 = (abuf0[i * 2    ] + 64) >> 7;

                A2 = (abuf0[i * 2 + 1] + 64) >> 7;

            }

            yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,

                          r, g, b, y, target, hasAlpha);

        }

    } else {

        const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];

        for (i = 0; i < (dstW >> 1); i++) {

            int Y1 = (buf0[i * 2    ]     +  64) >> 7;

            int Y2 = (buf0[i * 2 + 1]     +  64) >> 7;

            int U  = (ubuf0[i] + ubuf1[i] + 128) >> 8;

            int V  = (vbuf0[i] + vbuf1[i] + 128) >> 8;

            int A1, A2;

            const void *r =  c->table_rV[V + YUVRGB_TABLE_HEADROOM],

                       *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]),

                       *b =  c->table_bU[U + YUVRGB_TABLE_HEADROOM];

            if (hasAlpha) {

                A1 = (abuf0[i * 2    ] + 64) >> 7;

                A2 = (abuf0[i * 2 + 1] + 64) >> 7;

            }

            yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,

                          r, g, b, y, target, hasAlpha);

        }

    }

}


PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionCode& ec)
{
    if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) {
        ec = INVALID_STATE_ERR;
        return 0;
    }
    RefPtr<RTCSessionDescriptionDescriptor> descriptor = m_peerHandler->localDescription();
    if (!descriptor)
        return 0;
    RefPtr<RTCSessionDescription> desc = RTCSessionDescription::create(descriptor.release());
    return desc.release();
}


static av_cold int xwd_encode_init(AVCodecContext *avctx)

{

    avctx->coded_frame = av_frame_alloc();

    if (!avctx->coded_frame)

        return AVERROR(ENOMEM);

    return 0;

}


static ut64 baddr(RBinFile *bf) {
	if (!bf || !bf->o || !bf->o->bin_obj) {
		return 8LL;
	}

	RKernelCacheObj *obj = (RKernelCacheObj*) bf->o->bin_obj;
	return MACH0_(get_baddr)(obj->mach0);
}


UsbTabHelper::GetPermissionProvider(RenderFrameHost* render_frame_host) {
  FrameUsbServices* frame_usb_services = GetFrameUsbService(render_frame_host);
  if (!frame_usb_services->permission_provider) {
    frame_usb_services->permission_provider.reset(
        new WebUSBPermissionProvider(render_frame_host));
  }
  return frame_usb_services->permission_provider->GetWeakPtr();
}


void ptirq_intx_ack(struct acrn_vm *vm, uint32_t virt_gsi, enum intx_ctlr vgsi_ctlr)
{
	uint32_t phys_irq;
	struct ptirq_remapping_info *entry;
	DEFINE_INTX_SID(virt_sid, virt_gsi, vgsi_ctlr);

	entry = find_ptirq_entry(PTDEV_INTR_INTX, &virt_sid, vm);
	if (entry != NULL) {
		phys_irq = entry->allocated_pirq;

		/* NOTE: only Level trigger will process EOI/ACK and if we got here
		 * means we have this vioapic or vpic or both enabled
		 */
		switch (vgsi_ctlr) {
		case INTX_CTLR_IOAPIC:
			if (entry->polarity != 0U) {
				vioapic_set_irqline_lock(vm, virt_gsi, GSI_SET_HIGH);
			} else {
				vioapic_set_irqline_lock(vm, virt_gsi, GSI_SET_LOW);
			}
			break;
		case INTX_CTLR_PIC:
			vpic_set_irqline(vm_pic(vm), virt_gsi, GSI_SET_LOW);
			break;
		default:
			/*
			 * In this switch statement, vgsi_ctlr shall either be
			 * INTX_CTLR_IOAPIC or INTX_CTLR_PIC.
			 * Gracefully return if prior case clauses have not been met.
			 */
			break;
		}

		dev_dbg(DBG_LEVEL_PTIRQ, "dev-assign: irq=0x%x acked vr: 0x%x",
				phys_irq, irq_to_vector(phys_irq));
		ioapic_gsi_unmask_irq(phys_irq);
	}
}


static void destroy_raw_packet_qp_rq(struct mlx5_ib_dev *dev,
				     struct mlx5_ib_rq *rq)
{
	mlx5_core_destroy_rq_tracked(dev->mdev, &rq->base.mqp);
}


static int parse_playlist(HLSContext *c, const char *url,
                          struct playlist *pls, AVIOContext *in)
{
    int ret = 0, is_segment = 0, is_variant = 0;
    int64_t duration = 0;
    enum KeyType key_type = KEY_NONE;
    uint8_t iv[16] = "";
    int has_iv = 0;
    char key[MAX_URL_SIZE] = "";
    char line[MAX_URL_SIZE];
    const char *ptr;
    int close_in = 0;
    int64_t seg_offset = 0;
    int64_t seg_size = -1;
    uint8_t *new_url = NULL;
    struct variant_info variant_info;
    char tmp_str[MAX_URL_SIZE];
    struct segment *cur_init_section = NULL;

    if (!in) {
#if 1
        AVDictionary *opts = NULL;
        close_in = 1;
        /* Some HLS servers don't like being sent the range header */
        av_dict_set(&opts, "seekable", "0", 0);

        // broker prior HTTP options that should be consistent across requests
        av_dict_set(&opts, "user-agent", c->user_agent, 0);
        av_dict_set(&opts, "cookies", c->cookies, 0);
        av_dict_set(&opts, "headers", c->headers, 0);

        ret = avio_open2(&in, url, AVIO_FLAG_READ,
                         c->interrupt_callback, &opts);
        av_dict_free(&opts);
        if (ret < 0)
            return ret;
#else
        ret = open_in(c, &in, url);
        if (ret < 0)
            return ret;
        close_in = 1;
#endif
    }

    if (av_opt_get(in, "location", AV_OPT_SEARCH_CHILDREN, &new_url) >= 0)
        url = new_url;

    read_chomp_line(in, line, sizeof(line));
    if (strcmp(line, "#EXTM3U")) {
        ret = AVERROR_INVALIDDATA;
        goto fail;
    }

    if (pls) {
        free_segment_list(pls);
        pls->finished = 0;
        pls->type = PLS_TYPE_UNSPECIFIED;
    }
    while (!avio_feof(in)) {
        read_chomp_line(in, line, sizeof(line));
        if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
            is_variant = 1;
            memset(&variant_info, 0, sizeof(variant_info));
            ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
                               &variant_info);
        } else if (av_strstart(line, "#EXT-X-KEY:", &ptr)) {
            struct key_info info = {{0}};
            ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,
                               &info);
            key_type = KEY_NONE;
            has_iv = 0;
            if (!strcmp(info.method, "AES-128"))
                key_type = KEY_AES_128;
            if (!strcmp(info.method, "SAMPLE-AES"))
                key_type = KEY_SAMPLE_AES;
            if (!strncmp(info.iv, "0x", 2) || !strncmp(info.iv, "0X", 2)) {
                ff_hex_to_data(iv, info.iv + 2);
                has_iv = 1;
            }
            av_strlcpy(key, info.uri, sizeof(key));
        } else if (av_strstart(line, "#EXT-X-MEDIA:", &ptr)) {
            struct rendition_info info = {{0}};
            ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_rendition_args,
                               &info);
            new_rendition(c, &info, url);
        } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
            ret = ensure_playlist(c, &pls, url);
            if (ret < 0)
                goto fail;
            pls->target_duration = atoi(ptr) * AV_TIME_BASE;
        } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
            ret = ensure_playlist(c, &pls, url);
            if (ret < 0)
                goto fail;
            pls->start_seq_no = atoi(ptr);
        } else if (av_strstart(line, "#EXT-X-PLAYLIST-TYPE:", &ptr)) {
            ret = ensure_playlist(c, &pls, url);
            if (ret < 0)
                goto fail;
            if (!strcmp(ptr, "EVENT"))
                pls->type = PLS_TYPE_EVENT;
            else if (!strcmp(ptr, "VOD"))
                pls->type = PLS_TYPE_VOD;
        } else if (av_strstart(line, "#EXT-X-MAP:", &ptr)) {
            struct init_section_info info = {{0}};
            ret = ensure_playlist(c, &pls, url);
            if (ret < 0)
                goto fail;
            ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_init_section_args,
                               &info);
            cur_init_section = new_init_section(pls, &info, url);
        } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
            if (pls)
                pls->finished = 1;
        } else if (av_strstart(line, "#EXTINF:", &ptr)) {
            is_segment = 1;
            duration   = atof(ptr) * AV_TIME_BASE;
        } else if (av_strstart(line, "#EXT-X-BYTERANGE:", &ptr)) {
            seg_size = atoi(ptr);
            ptr = strchr(ptr, '@');
            if (ptr)
                seg_offset = atoi(ptr+1);
        } else if (av_strstart(line, "#", NULL)) {
            continue;
        } else if (line[0]) {
            if (is_variant) {
                if (!new_variant(c, &variant_info, line, url)) {
                    ret = AVERROR(ENOMEM);
                    goto fail;
                }
                is_variant = 0;
            }
            if (is_segment) {
                struct segment *seg;
                if (!pls) {
                    if (!new_variant(c, 0, url, NULL)) {
                        ret = AVERROR(ENOMEM);
                        goto fail;
                    }
                    pls = c->playlists[c->n_playlists - 1];
                }
                seg = av_malloc(sizeof(struct segment));
                if (!seg) {
                    ret = AVERROR(ENOMEM);
                    goto fail;
                }
                seg->duration = duration;
                seg->key_type = key_type;
                if (has_iv) {
                    memcpy(seg->iv, iv, sizeof(iv));
                } else {
                    int seq = pls->start_seq_no + pls->n_segments;
                    memset(seg->iv, 0, sizeof(seg->iv));
                    AV_WB32(seg->iv + 12, seq);
                }

                if (key_type != KEY_NONE) {
                    ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, key);
                    seg->key = av_strdup(tmp_str);
                    if (!seg->key) {
                        av_free(seg);
                        ret = AVERROR(ENOMEM);
                        goto fail;
                    }
                } else {
                    seg->key = NULL;
                }

                ff_make_absolute_url(tmp_str, sizeof(tmp_str), url, line);
                seg->url = av_strdup(tmp_str);
                if (!seg->url) {
                    av_free(seg->key);
                    av_free(seg);
                    ret = AVERROR(ENOMEM);
                    goto fail;
                }

                dynarray_add(&pls->segments, &pls->n_segments, seg);
                is_segment = 0;

                seg->size = seg_size;
                if (seg_size >= 0) {
                    seg->url_offset = seg_offset;
                    seg_offset += seg_size;
                    seg_size = -1;
                } else {
                    seg->url_offset = 0;
                    seg_offset = 0;
                }

                seg->init_section = cur_init_section;
            }
        }
    }
    if (pls)
        pls->last_load_time = av_gettime_relative();

fail:
    av_free(new_url);
    if (close_in)
        avio_close(in);
    return ret;
}


lyp_deviate_del_ext(struct lys_node *target, struct lys_ext_instance *ext)
{
    int n = -1, found = 0;
    char *path;

    while ((n = lys_ext_iter(target->ext, target->ext_size, n + 1, ext->insubstmt)) != -1) {
        if (target->ext[n]->def != ext->def) {
            continue;
        }

        if (ext->def->argument) {
            /* check matching arguments */
            if (!ly_strequal(target->ext[n]->arg_value, ext->arg_value, 1)) {
                continue;
            }
        }

        /* we have the matching extension - remove it */
        ++found;
        lyp_ext_instance_rm(target->module->ctx, &target->ext, &target->ext_size, n);
        --n;
    }

    if (!found) {
        path = lys_path(target, LYS_PATH_FIRST_PREFIX);
        LOGERR(target->module->ctx, LY_EVALID, "Extension deviation: extension \"%s\" to delete not found in \"%s\".",
               ext->def->name, path)
        free(path);
        return EXIT_FAILURE;
    }
    return EXIT_SUCCESS;
}


static ssize_t drop_sync(int fd, size_t size)

{

    ssize_t ret, dropped = size;

    uint8_t *buffer = g_malloc(MIN(65536, size));

    while (size > 0) {

        ret = read_sync(fd, buffer, MIN(65536, size));

        if (ret < 0) {

            g_free(buffer);

            return ret;

        }

        assert(ret <= size);

        size -= ret;

    }

    g_free(buffer);

    return dropped;

}


TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
  TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
  TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);

  const auto* params =
      reinterpret_cast<const TfLiteGatherParams*>(node->builtin_data);
  const TfLiteTensor* input = GetInput(context, node, kInputTensor);
  const TfLiteTensor* positions = GetInput(context, node, kInputPositions);
  TfLiteTensor* output = GetOutput(context, node, kOutputTensor);

  switch (positions->type) {
    case kTfLiteInt64:
    case kTfLiteInt32:
      break;
    default:
      context->ReportError(
          context, "Positions of type '%s' are not supported by gather.",
          TfLiteTypeGetName(positions->type));
      return kTfLiteError;
  }

  // Assign to output the input type.
  output->type = input->type;

  // Check conditions for different types.
  switch (input->type) {
    case kTfLiteFloat32:
    case kTfLiteUInt8:
    case kTfLiteInt8:
    case kTfLiteInt16:
    case kTfLiteInt64:
    case kTfLiteInt32:
    case kTfLiteBool:
      break;
    case kTfLiteString: {
      // Only 1D input is supported.
      TF_LITE_ENSURE_EQ(context, NumDimensions(input), 1);
    } break;
    default:
      context->ReportError(context, "Type '%s' is not supported by gather.",
                           TfLiteTypeGetName(input->type));
      return kTfLiteError;
  }

  int axis = params->axis;
  if (axis < 0) {
    axis += NumDimensions(input);
  }
  TF_LITE_ENSURE(context, 0 <= axis && axis < NumDimensions(input));

  const int num_dimensions =
      NumDimensions(input) + NumDimensions(positions) - 1;
  TfLiteIntArray* output_shape = TfLiteIntArrayCreate(num_dimensions);
  int output_index = 0;
  for (int i = 0; i < axis; ++i) {
    output_shape->data[output_index++] = input->dims->data[i];
  }
  for (int i = 0; i < positions->dims->size; ++i) {
    output_shape->data[output_index++] = positions->dims->data[i];
  }
  for (int i = axis + 1; i < input->dims->size; ++i) {
    output_shape->data[output_index++] = input->dims->data[i];
  }
  return context->ResizeTensor(context, output, output_shape);
}


latin_ptr2len(char_u *p)
{
    return *p == NUL ? 0 : 1;
}


cmsBool ReadMPEElem(struct _cms_typehandler_struct* self,
                    cmsIOHANDLER* io,
                    void* Cargo,
                    cmsUInt32Number n,
                    cmsUInt32Number SizeOfTag)
{
    cmsStageSignature ElementSig;
    cmsTagTypeHandler* TypeHandler;
    cmsUInt32Number nItems;
    cmsPipeline *NewLUT = (cmsPipeline *) Cargo;
    _cmsTagTypePluginChunkType* MPETypePluginChunk  = ( _cmsTagTypePluginChunkType*) _cmsContextGetClientChunk(self->ContextID, MPEPlugin);

    // Take signature and channels for each element.
    if (!_cmsReadUInt32Number(io, (cmsUInt32Number*) &ElementSig)) return FALSE;

    // The reserved placeholder
    if (!_cmsReadUInt32Number(io, NULL)) return FALSE;

    // Read diverse MPE types
    TypeHandler = GetHandler((cmsTagTypeSignature) ElementSig, MPETypePluginChunk ->TagTypes, SupportedMPEtypes);
    if (TypeHandler == NULL)  {

        char String[5];

        _cmsTagSignature2String(String, (cmsTagSignature) ElementSig);

        // An unknown element was found.
        cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown MPE type '%s' found.", String);
        return FALSE;
    }

    // If no read method, just ignore the element (valid for cmsSigBAcsElemType and cmsSigEAcsElemType)
    // Read the MPE. No size is given
    if (TypeHandler ->ReadPtr != NULL) {

        // This is a real element which should be read and processed
        if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, (cmsStage*) TypeHandler ->ReadPtr(self, io, &nItems, SizeOfTag)))
            return FALSE;
    }

    return TRUE;

    cmsUNUSED_PARAMETER(SizeOfTag);
    cmsUNUSED_PARAMETER(n);
}


static int copy_user_offload(struct xfrm_state_offload *xso, struct sk_buff *skb)
{
	struct xfrm_user_offload *xuo;
	struct nlattr *attr;

	attr = nla_reserve(skb, XFRMA_OFFLOAD_DEV, sizeof(*xuo));
	if (attr == NULL)
		return -EMSGSIZE;

	xuo = nla_data(attr);
	memset(xuo, 0, sizeof(*xuo));
	xuo->ifindex = xso->dev->ifindex;
	xuo->flags = xso->flags;

	return 0;
}


  ft_add_renderer( FT_Module  module )
  {
    FT_Library   library = module->library;
    FT_Memory    memory  = library->memory;
    FT_Error     error;
    FT_ListNode  node;

    if ( FT_NEW( node ) )
      goto Exit;

    {
      FT_Renderer         render = FT_RENDERER( module );
      FT_Renderer_Class*  clazz  = (FT_Renderer_Class*)module->clazz;

      render->clazz        = clazz;
      render->glyph_format = clazz->glyph_format;

      /* allocate raster object if needed */
      if ( clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE &&
           clazz->raster_class->raster_new )
      {
        error = clazz->raster_class->raster_new( memory, &render->raster );
        if ( error )
          goto Fail;

        render->raster_render = clazz->raster_class->raster_render;
        render->render        = clazz->render_glyph;
      }

      /* add to list */
      node->data = module;
      FT_List_Add( &library->renderers, node );

      ft_set_current_renderer( library );
    }

  Fail:
    if ( error )
      FT_FREE( node );

  Exit:
    return error;
  }


md_build_attr_append_substr(MD_CTX* ctx, MD_ATTRIBUTE_BUILD* build,
                            MD_TEXTTYPE type, OFF off)
{
    if(build->substr_count >= build->substr_alloc) {
        MD_TEXTTYPE* new_substr_types;
        OFF* new_substr_offsets;

        build->substr_alloc = (build->substr_alloc > 0
                ? build->substr_alloc + build->substr_alloc / 2
                : 8);
        new_substr_types = (MD_TEXTTYPE*) realloc(build->substr_types,
                                    build->substr_alloc * sizeof(MD_TEXTTYPE));
        if(new_substr_types == NULL) {
            MD_LOG("realloc() failed.");
            return -1;
        }
        /* Note +1 to reserve space for final offset (== raw_size). */
        new_substr_offsets = (OFF*) realloc(build->substr_offsets,
                                    (build->substr_alloc+1) * sizeof(OFF));
        if(new_substr_offsets == NULL) {
            MD_LOG("realloc() failed.");
            free(new_substr_types);
            return -1;
        }

        build->substr_types = new_substr_types;
        build->substr_offsets = new_substr_offsets;
    }

    build->substr_types[build->substr_count] = type;
    build->substr_offsets[build->substr_count] = off;
    build->substr_count++;
    return 0;
}


void qmp_output_visitor_cleanup(QmpOutputVisitor *v)

{

    QStackEntry *e, *tmp;

    QTAILQ_FOREACH_SAFE(e, &v->stack, node, tmp) {

        QTAILQ_REMOVE(&v->stack, e, node);

        g_free(e);

    }

    qobject_decref(v->root);

    g_free(v);

}


circle_overbelow(PG_FUNCTION_ARGS)
{
	CIRCLE	   *circle1 = PG_GETARG_CIRCLE_P(0);
	CIRCLE	   *circle2 = PG_GETARG_CIRCLE_P(1);

	PG_RETURN_BOOL(FPle((circle1->center.y + circle1->radius),
						(circle2->center.y + circle2->radius)));
}


int elg_generate ( int algo , unsigned nbits , MPI * skey , MPI * * retfactors ) {
 ELG_secret_key sk ;
 if ( ! is_ELGAMAL ( algo ) ) return G10ERR_PUBKEY_ALGO ;
 generate ( & sk , nbits , retfactors ) ;
 skey [ 0 ] = sk . p ;
 skey [ 1 ] = sk . g ;
 skey [ 2 ] = sk . y ;
 skey [ 3 ] = sk . x ;
 return 0 ;
 }


int32_t EqualizerGetBandLevel(EffectContext *pContext, int32_t band){
 return pContext->pBundledContext->bandGaindB[band] * 100;
}


void WebContentsImpl::CreateNewWidget(int32_t render_process_id,
                                      int32_t route_id,
                                      bool is_fullscreen,
                                      mojom::WidgetPtr widget) {
  RenderProcessHost* process = RenderProcessHost::FromID(render_process_id);
  if (!HasMatchingProcess(&frame_tree_, render_process_id)) {
    ReceivedBadMessage(process, bad_message::WCI_NEW_WIDGET_PROCESS_MISMATCH);
    return;
  }

  RenderWidgetHostImpl* widget_host = new RenderWidgetHostImpl(
      this, process, route_id, std::move(widget), IsHidden());

  RenderWidgetHostViewBase* widget_view =
      static_cast<RenderWidgetHostViewBase*>(
          view_->CreateViewForChildWidget(widget_host));
  if (!widget_view)
    return;
  if (!is_fullscreen)
    widget_view->SetWidgetType(WidgetType::kPopup);
  pending_widget_views_[GlobalRoutingID(render_process_id, route_id)] =
      widget_view;
}


static int dissct_rsl_msg ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , int offset ) {
 guint8 msg_disc , msg_type , sys_info_type ;
 msg_disc = tvb_get_guint8 ( tvb , offset ++ ) >> 1 ;
 msg_type = tvb_get_guint8 ( tvb , offset ) & 0x7f ;
 proto_tree_add_item ( tree , hf_rsl_msg_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
 if ( msg_disc == RSL_MSGDISC_IPACCESS ) {
 offset = dissct_rsl_ipaccess_msg ( tvb , pinfo , tree , offset ) ;
 return offset ;
 }
 offset ++ ;
 switch ( msg_type ) {
 case RSL_MSG_TYPE_DATA_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , TRUE , L3_INF_OTHER ) ;
 break ;
 case RSL_MSG_TYPE_DATA_IND : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , TRUE , L3_INF_OTHER ) ;
 break ;
 case RSL_MSG_TYPE_ERROR_IND : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_rlm_cause ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_TYPE_EST_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_TYPE_EST_CONF : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_EST_IND : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 1 ) offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , FALSE , L3_INF_OTHER ) ;
 break ;
 case RSL_MSG_REL_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_rel_mode ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_REL_CONF : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_REL_IND : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_UNIT_DATA_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , FALSE , L3_INF_OTHER ) ;
 break ;
 case RSL_MSG_BCCH_INFO : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_sys_info_type ( tvb , pinfo , tree , offset , TRUE , & sys_info_type ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_full_bcch_inf ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_starting_time ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_CCCH_LOAD_IND : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_rach_load ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_paging_load ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_CHANRQD : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_req_ref ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_access_delay ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_phy_ctx ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_DELETE_IND : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_full_imm_ass_inf ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_PAGING_CMD : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_paging_grp ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_ms_id ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ch_needed ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_emlpp_prio ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_IMM_ASS_CMD : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_full_imm_ass_inf ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_SMS_BC_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_smscb_inf ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_smscb_ch_ind ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_RF_RES_IND : offset = dissect_rsl_ie_resource_inf ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_SACCH_FILL : offset = dissect_rsl_ie_sys_info_type ( tvb , pinfo , tree , offset , TRUE , & sys_info_type ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , FALSE , ( sys_info_type == 0x48 ) ? L3_INF_SACCH : L3_INF_OTHER ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_starting_time ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_OVERLOAD : offset = dissect_rsl_ie_cause ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_ERROR_REPORT : offset = dissect_rsl_ie_cause ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_message_id ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_err_msg ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_SMS_BC_CMD : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_cb_cmd_type ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_smscb_mess ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_smscb_ch_ind ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_CBCH_LOAD_IND : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_cbch_load_inf ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_smscb_ch_ind ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_NOT_CMD : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_cmd_ind ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_grp_call_ref ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ch_desc ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_nch_drx ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_CHAN_ACTIV : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_act_type ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_ch_mode ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ch_id ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_enc_inf ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ho_ref ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_bs_power ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ms_pow ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_timing_adv ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_phy_ctx ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_uic ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_main_ch_ref ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_multirate_conf ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_multirate_cntrl ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_sup_codec_types ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_tfo_transp_cont ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_CHAN_ACTIV_ACK : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_frame_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_CHAN_ACTIV_N_ACK : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_cause ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_CONN_FAIL : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_cause ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_DEACTIVATE_SACCH : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_ENCR_CMD : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_enc_inf ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_link_id ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , TRUE , L3_INF_OTHER ) ;
 break ;
 case RSL_MSG_HANDODET : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_access_delay ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_MEAS_RES : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_meas_res_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_uplik_meas ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_bs_power ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_l1_inf ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) {
 if ( ( tvb_get_guint8 ( tvb , offset + 3 ) & 0xFE ) == 0x10 ) {
 offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , FALSE , L3_INF_SACCH ) ;
 }
 else {
 offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , FALSE , L3_INF_OTHER ) ;
 }
 }
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ms_timing_offset ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_MODE_MODIFY_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_ch_mode ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_enc_inf ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_main_ch_ref ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_multirate_conf ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_multirate_cntrl ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_sup_codec_types ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_tfo_transp_cont ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_MODE_MODIFY_ACK : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_MODE_MODIFY_NACK : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_cause ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_PHY_CONTEXT_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_PHY_CONTEXT_CONF : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_bs_power ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_ms_pow ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_timing_adv ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_phy_ctx ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_RF_CHAN_REL : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_MS_POWER_CONTROL : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ms_pow ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_BS_POWER_CONTROL : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_bs_power ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_PREPROC_CONFIG : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_PREPROC_MEAS_RES : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_RF_CHAN_REL_ACK : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_SACCH_INFO_MODIFY : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_sys_info_type ( tvb , pinfo , tree , offset , TRUE , & sys_info_type ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_L3_inf ( tvb , pinfo , tree , offset , FALSE , ( sys_info_type == 0x48 ) ? L3_INF_SACCH : L3_INF_OTHER ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_starting_time ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_TALKER_DET : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_LISTENER_DET : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_REMOTE_CODEC_CONF_REP : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_codec_conf ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_sup_codec_types ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_tfo_transp_cont ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_R_T_D_REP : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_rtd ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_PRE_HANDO_NOTIF : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_multirate_cntrl ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_codec_conf ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_tfo_transp_cont ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_MR_CODEC_MOD_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_multirate_conf ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_MR_CODEC_MOD_ACK : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_multirate_conf ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_MR_CODEC_MOD_NACK : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_cause ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_MR_CODEC_MOD_PER : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_multirate_conf ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_TFO_REP : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_tfo_status ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_TFO_MOD_REQ : offset = dissect_rsl_ie_ch_no ( tvb , pinfo , tree , offset , TRUE ) ;
 offset = dissect_rsl_ie_multirate_cntrl ( tvb , pinfo , tree , offset , TRUE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_sup_codec_types ( tvb , pinfo , tree , offset , FALSE ) ;
 if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) offset = dissect_rsl_ie_tfo_transp_cont ( tvb , pinfo , tree , offset , FALSE ) ;
 break ;
 case RSL_MSG_LOC_INF : offset = dissect_rsl_ie_llp_apdu ( tvb , pinfo , tree , offset , TRUE ) ;
 break ;
 case RSL_MSG_TYPE_IPAC_MEAS_PP_DEF : case RSL_MSG_TYPE_IPAC_HO_CAND_INQ : case RSL_MSG_TYPE_IPAC_HO_CAND_RESP : case RSL_MSG_TYPE_IPAC_PDCH_ACT : case RSL_MSG_TYPE_IPAC_PDCH_ACT_ACK : case RSL_MSG_TYPE_IPAC_PDCH_ACT_NACK : case RSL_MSG_TYPE_IPAC_PDCH_DEACT : case RSL_MSG_TYPE_IPAC_PDCH_DEACT_ACK : case RSL_MSG_TYPE_IPAC_PDCH_DEACT_NACK : if ( global_rsl_use_nano_bts ) offset = dissct_rsl_ipaccess_msg ( tvb , pinfo , tree , offset - 1 ) ;
 default : break ;
 }
 return offset ;
 }


static inline Quantum GetPixelGray(const Image *magick_restrict image,
  const Quantum *magick_restrict pixel)
{
  return(pixel[image->channel_map[GrayPixelChannel].offset]);
}


int mongo_env_close_socket( int socket ) {
#ifdef _WIN32
    return closesocket( socket );
#else
    return close( socket );
#endif
}


static int count_new_keys ( int n_key_data , krb5_key_data * key_data ) {
 int n ;
 for ( n = 1 ;
 n < n_key_data ;
 n ++ ) {
 if ( key_data [ n - 1 ] . key_data_kvno != key_data [ n ] . key_data_kvno ) return n ;
 }
 return n_key_data ;
 }


int mutt_socket_read(struct Connection *conn, char *buf, size_t len)
{
  return conn->read(conn, buf, len);
}


static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time)
{
    dprint(3, "%s/%d:\n", __func__, sin->id);
    /* nothing to do */
}


ex_put(exarg_T *eap)
{
    /* ":0put" works like ":1put!". */
    if (eap->line2 == 0)
    {
	eap->line2 = 1;
	eap->forceit = TRUE;
    }
    curwin->w_cursor.lnum = eap->line2;
    do_put(eap->regname, eap->forceit ? BACKWARD : FORWARD, 1L,
						       PUT_LINE|PUT_CURSLINE);
}


static void update_layer_buffer_level ( SVC * svc , int encoded_frame_size ) {
 int temporal_layer = 0 ;
 int current_temporal_layer = svc -> temporal_layer_id ;
 for ( temporal_layer = current_temporal_layer + 1 ;
 temporal_layer < svc -> number_temporal_layers ;
 ++ temporal_layer ) {
 LAYER_CONTEXT * lc = & svc -> layer_context [ temporal_layer ] ;
 RATE_CONTROL * lrc = & lc -> rc ;
 int bits_off_for_this_layer = ( int ) ( lc -> target_bandwidth / lc -> framerate - encoded_frame_size ) ;
 lrc -> bits_off_target += bits_off_for_this_layer ;
 lrc -> bits_off_target = MIN ( lrc -> bits_off_target , lrc -> maximum_buffer_size ) ;
 lrc -> buffer_level = lrc -> bits_off_target ;
 }
 }


static char * keep_pack ( const char * curr_index_name ) {
 static char name [ PATH_MAX ] ;
 static const char * keep_msg = "fast-import" ;
 int keep_fd ;
 keep_fd = odb_pack_keep ( name , sizeof ( name ) , pack_data -> sha1 ) ;
 if ( keep_fd < 0 ) die_errno ( "cannot create keep file" ) ;
 write_or_die ( keep_fd , keep_msg , strlen ( keep_msg ) ) ;
 if ( close ( keep_fd ) ) die_errno ( "failed to write keep file" ) ;
 snprintf ( name , sizeof ( name ) , "%s/pack/pack-%s.pack" , get_object_directory ( ) , sha1_to_hex ( pack_data -> sha1 ) ) ;
 if ( finalize_object_file ( pack_data -> pack_name , name ) ) die ( "cannot store pack file" ) ;
 snprintf ( name , sizeof ( name ) , "%s/pack/pack-%s.idx" , get_object_directory ( ) , sha1_to_hex ( pack_data -> sha1 ) ) ;
 if ( finalize_object_file ( curr_index_name , name ) ) die ( "cannot store index file" ) ;
 free ( ( void * ) curr_index_name ) ;
 return name ;
 }


win_setheight_win(int height, win_T *win)
{
    int		row;

    if (win == curwin)
    {
	// Always keep current window at least one line high, even when
	// 'winminheight' is zero.
	if (height < p_wmh)
	    height = p_wmh;
	if (height == 0)
	    height = 1;
	height += WINBAR_HEIGHT(curwin);
    }

    frame_setheight(win->w_frame, height + win->w_status_height);

    // recompute the window positions
    row = win_comp_pos();

    /*
     * If there is extra space created between the last window and the command
     * line, clear it.
     */
    if (full_screen && msg_scrolled == 0 && row < cmdline_row)
	screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
    cmdline_row = row;
    msg_row = row;
    msg_col = 0;

    redraw_all_later(NOT_VALID);
}


static inline void do_kvm_synchronize_tsc ( CPUState * cpu , run_on_cpu_data arg ) {
 kvm_get_tsc ( cpu ) ;
 }


PHP_FUNCTION(imagecopyresized)
{
	zval *SIM, *DIM;
	zend_long SX, SY, SW, SH, DX, DY, DW, DH;
	gdImagePtr im_dst, im_src;
	int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;

	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
		return;
	}

	if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
		RETURN_FALSE;
	}

	if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
		RETURN_FALSE;
	}

	srcX = SX;
	srcY = SY;
	srcH = SH;
	srcW = SW;
	dstX = DX;
	dstY = DY;
	dstH = DH;
	dstW = DW;

	if (dstW <= 0 || dstH <= 0 || srcW <= 0 || srcH <= 0) {
		php_error_docref(NULL, E_WARNING, "Invalid image dimensions");
		RETURN_FALSE;
	}

	gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
	RETURN_TRUE;
}


static int idcin_decode_init(AVCodecContext *avctx)

{

    IdcinContext *s = avctx->priv_data;

    int i, j, histogram_index = 0;

    unsigned char *histograms;

    s->avctx = avctx;

    avctx->pix_fmt = PIX_FMT_PAL8;

    dsputil_init(&s->dsp, avctx);

    /* make sure the Huffman tables make it */

    if (s->avctx->extradata_size != HUFFMAN_TABLE_SIZE) {

        av_log(s->avctx, AV_LOG_ERROR, "  Id CIN video: expected extradata size of %d\n", HUFFMAN_TABLE_SIZE);

        return -1;

    }

    /* build the 256 Huffman decode trees */

    histograms = (unsigned char *)s->avctx->extradata;

    for (i = 0; i < 256; i++) {

        for(j = 0; j < HUF_TOKENS; j++)

            s->huff_nodes[i][j].count = histograms[histogram_index++];

        huff_build_tree(s, i);

    }

    s->frame.data[0] = NULL;

    return 0;

}


void Document::close(ExceptionState& exception_state) {

  if (ImportLoader()) {
    exception_state.ThrowDOMException(
        kInvalidStateError, "Imported document doesn't support close().");
    return;
  }

  if (!IsHTMLDocument()) {
    exception_state.ThrowDOMException(kInvalidStateError,
                                      "Only HTML documents support close().");
    return;
  }

  if (throw_on_dynamic_markup_insertion_count_) {
    exception_state.ThrowDOMException(
        kInvalidStateError,
        "Custom Element constructor should not use close().");
    return;
  }

  close();
}


 ProcXSendExtensionEvent(ClientPtr client)
 {
    int ret, i;
     DeviceIntPtr dev;
     xEvent *first;
     XEventClass *list;
    struct tmask tmp[EMASKSIZE];

    REQUEST(xSendExtensionEventReq);
    REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);

    if (stuff->length !=
        bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
        (stuff->num_events * bytes_to_int32(sizeof(xEvent))))
        return BadLength;

    ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
    if (ret != Success)
        return ret;

    if (stuff->num_events == 0)
        return ret;

     /* The client's event type must be one defined by an extension. */

     first = ((xEvent *) &stuff[1]);
    for (i = 0; i < stuff->num_events; i++) {
        if (!((EXTENSION_EVENT_BASE <= first[i].u.u.type) &&
            (first[i].u.u.type < lastEvent))) {
            client->errorValue = first[i].u.u.type;
            return BadValue;
        }
     }

     list = (XEventClass *) (first + stuff->num_events);
        return ret;

    ret = (SendEvent(client, dev, stuff->destination,
                     stuff->propagate, (xEvent *) &stuff[1],
                     tmp[stuff->deviceid].mask, stuff->num_events));

    return ret;
}


int xtensa_get_physical_addr(CPUXtensaState *env, bool update_tlb,

        uint32_t vaddr, int is_write, int mmu_idx,

        uint32_t *paddr, uint32_t *page_size, unsigned *access)

{

    if (xtensa_option_enabled(env->config, XTENSA_OPTION_MMU)) {

        return get_physical_addr_mmu(env, update_tlb,

                vaddr, is_write, mmu_idx, paddr, page_size, access, true);

    } else if (xtensa_option_bits_enabled(env->config,

                XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_PROTECTION) |

                XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_TRANSLATION))) {

        return get_physical_addr_region(env, vaddr, is_write, mmu_idx,

                paddr, page_size, access);

    } else {

        *paddr = vaddr;

        *page_size = TARGET_PAGE_SIZE;

        *access = PAGE_READ | PAGE_WRITE | PAGE_EXEC | PAGE_CACHE_BYPASS;

        return 0;

    }

}


void sk_common_release(struct sock *sk)
{
	if (sk->sk_prot->destroy)
		sk->sk_prot->destroy(sk);

	/*
	 * Observation: when sock_common_release is called, processes have
	 * no access to socket. But net still has.
	 * Step one, detach it from networking:
	 *
	 * A. Remove from hash tables.
	 */

	sk->sk_prot->unhash(sk);

	/*
	 * In this point socket cannot receive new packets, but it is possible
	 * that some packets are in flight because some CPU runs receiver and
	 * did hash table lookup before we unhashed socket. They will achieve
	 * receive queue and will be purged by socket destructor.
	 *
	 * Also we still have packets pending on receive queue and probably,
	 * our own packets waiting in device queues. sock_destroy will drain
	 * receive queue, but transmitted packets will delay socket destruction
	 * until the last reference will be released.
	 */

	sock_orphan(sk);

	xfrm_sk_free_policy(sk);

	sk_refcnt_debug_release(sk);

	if (sk->sk_frag.page) {
		put_page(sk->sk_frag.page);
		sk->sk_frag.page = NULL;
	}

	sock_put(sk);
}


void OffscreenCanvasSurfaceImpl::SetBeginFrameSource(
    cc::BeginFrameSource* begin_frame_source) {}