idx
int64
func
string
target
int64
512,754
bool set_fields_as_dependent_processor(void *arg) { if (!(used_tables() & OUTER_REF_TABLE_BIT)) { depended_from= (st_select_lex *) arg; item_equal= NULL; } return 0; }
0
355,632
eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg) { char_u *p; int getnext; exprtype_T type = EXPR_UNKNOWN; int len = 2; int type_is = FALSE; /* * Get the first variable. */ if (eval5(arg, rettv, evalarg) == FAIL) return FAIL; p = eval_next_non_blank(*arg, evalarg, &getnext); type = get_compare_type(p, &len, &type_is); /* * If there is a comparative operator, use it. */ if (type != EXPR_UNKNOWN) { typval_T var2; int ic; int vim9script = in_vim9script(); int evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE); if (getnext) { *arg = eval_next_line(evalarg); p = *arg; } else if (evaluate && vim9script && !VIM_ISWHITE(**arg)) { error_white_both(*arg, len); clear_tv(rettv); return FAIL; } if (vim9script && type_is && (p[len] == '?' || p[len] == '#')) { semsg(_(e_invalid_expression_str), p); clear_tv(rettv); return FAIL; } // extra question mark appended: ignore case if (p[len] == '?') { ic = TRUE; ++len; } // extra '#' appended: match case else if (p[len] == '#') { ic = FALSE; ++len; } // nothing appended: use 'ignorecase' if not in Vim script else ic = vim9script ? FALSE : p_ic; /* * Get the second variable. */ if (evaluate && vim9script && !IS_WHITE_OR_NUL(p[len])) { error_white_both(p, len); clear_tv(rettv); return FAIL; } *arg = skipwhite_and_linebreak(p + len, evalarg); if (eval5(arg, &var2, evalarg) == FAIL) { clear_tv(rettv); return FAIL; } if (evaluate) { int ret; if (vim9script && check_compare_types(type, rettv, &var2) == FAIL) { ret = FAIL; clear_tv(rettv); } else ret = typval_compare(rettv, &var2, type, ic); clear_tv(&var2); return ret; } } return OK; }
0
223,371
static sljit_s32 SLJIT_FUNC do_callout(struct jit_arguments *arguments, pcre2_callout_block *callout_block, PCRE2_SPTR *jit_ovector) { PCRE2_SPTR begin; PCRE2_SIZE *ovector; sljit_u32 oveccount, capture_top; if (arguments->callout == NULL) return 0; SLJIT_COMPILE_ASSERT(sizeof (PCRE2_SIZE) <= sizeof (sljit_sw), pcre2_size_must_be_lower_than_sljit_sw_size); begin = arguments->begin; ovector = (PCRE2_SIZE*)(callout_block + 1); oveccount = callout_block->capture_top; SLJIT_ASSERT(oveccount >= 1); callout_block->version = 2; callout_block->callout_flags = 0; /* Offsets in subject. */ callout_block->subject_length = arguments->end - arguments->begin; callout_block->start_match = jit_ovector[0] - begin; callout_block->current_position = (PCRE2_SPTR)callout_block->offset_vector - begin; callout_block->subject = begin; /* Convert and copy the JIT offset vector to the ovector array. */ callout_block->capture_top = 1; callout_block->offset_vector = ovector; ovector[0] = PCRE2_UNSET; ovector[1] = PCRE2_UNSET; ovector += 2; jit_ovector += 2; capture_top = 1; /* Convert pointers to sizes. */ while (--oveccount != 0) { capture_top++; ovector[0] = (PCRE2_SIZE)(jit_ovector[0] - begin); ovector[1] = (PCRE2_SIZE)(jit_ovector[1] - begin); if (ovector[0] != PCRE2_UNSET) callout_block->capture_top = capture_top; ovector += 2; jit_ovector += 2; } return (arguments->callout)(callout_block, arguments->callout_data); }
0
225,994
static GF_Err ctrn_box_read(GF_Box *s, GF_BitStream *bs) { u32 i, count, flags, first_idx=0; Bool inherit_dur, inherit_size, inherit_flags, inherit_ctso; GF_TrunEntry *ent; GF_TrackFragmentRunBox *ptr = (GF_TrackFragmentRunBox *)s; flags = ptr->flags; ptr->ctrn_flags = flags; ptr->flags = 0; ptr->sample_count = gf_bs_read_u16(bs); ISOM_DECREASE_SIZE(ptr, 2); if (flags & GF_ISOM_TRUN_DATA_OFFSET) { if (flags & GF_ISOM_CTRN_DATAOFFSET_16) { ptr->data_offset = gf_bs_read_u16(bs); ISOM_DECREASE_SIZE(ptr, 2); } else { ptr->data_offset = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4); } ptr->flags |= GF_ISOM_TRUN_DATA_OFFSET; } if (flags & GF_ISOM_CTRN_CTSO_MULTIPLIER) { ptr->ctso_multiplier = gf_bs_read_u16(bs); ISOM_DECREASE_SIZE(ptr, 2); } /*no sample dur/sample_flag/size/ctso for first or following, create a pack sample */ if (! (flags & 0x00FFFF00)) { GF_SAFEALLOC(ent, GF_TrunEntry); if (!ent) return GF_OUT_OF_MEM; ent->nb_pack = ptr->sample_count; gf_list_add(ptr->entries, ent); return GF_OK; } /*allocate all entries*/ for (i=0; i<ptr->sample_count; i++) { GF_SAFEALLOC(ent, GF_TrunEntry); if (!ent) return GF_OUT_OF_MEM; gf_list_add(ptr->entries, ent); } //unpack flags ptr->ctrn_first_dur = (flags>>22) & 0x3; ptr->ctrn_first_size = (flags>>20) & 0x3; ptr->ctrn_first_sample_flags = (flags>>18) & 0x3; ptr->ctrn_first_ctts = (flags>>16) & 0x3; ptr->ctrn_dur = (flags>>14) & 0x3; ptr->ctrn_size = (flags>>12) & 0x3; ptr->ctrn_sample_flags = (flags>>10) & 0x3; ptr->ctrn_ctts = (flags>>8) & 0x3; inherit_dur = flags & GF_ISOM_CTRN_INHERIT_DUR; inherit_size = flags & GF_ISOM_CTRN_INHERIT_SIZE; inherit_flags = flags & GF_ISOM_CTRN_INHERIT_FLAGS; inherit_ctso = flags & GF_ISOM_CTRN_INHERIT_CTSO; if (flags & GF_ISOM_CTRN_FIRST_SAMPLE) { ent = gf_list_get(ptr->entries, 0); first_idx = 1; if (!inherit_dur && ptr->ctrn_first_dur) { ent->Duration = gf_bs_read_int(bs, gf_isom_ctrn_field_size_bits(ptr->ctrn_first_dur) ); ISOM_DECREASE_SIZE(ptr, ctrn_field_size(ptr->ctrn_first_dur) ); } if (!inherit_size && ptr->ctrn_first_size) { ent->size = gf_bs_read_int(bs, gf_isom_ctrn_field_size_bits(ptr->ctrn_first_size) ); ISOM_DECREASE_SIZE(ptr, ctrn_field_size(ptr->ctrn_first_size) ); } if (!inherit_flags && ptr->ctrn_first_sample_flags) { ent->flags = ctrn_read_flags(bs, gf_isom_ctrn_field_size_bits(ptr->ctrn_first_sample_flags) ); ISOM_DECREASE_SIZE(ptr, ctrn_field_size(ptr->ctrn_first_sample_flags) ); } if (!inherit_ctso && ptr->ctrn_first_ctts) { ent->CTS_Offset = gf_bs_read_int(bs, gf_isom_ctrn_field_size_bits(ptr->ctrn_first_ctts) ); ISOM_DECREASE_SIZE(ptr, ctrn_field_size(ptr->ctrn_first_ctts) ); if (ptr->ctso_multiplier) ent->CTS_Offset *= (s32) ptr->ctso_multiplier; } } count = ptr->sample_count - first_idx; if (!inherit_dur && ptr->ctrn_dur) { u32 nbbits = gf_isom_ctrn_field_size_bits(ptr->ctrn_dur); ISOM_DECREASE_SIZE(ptr, count * nbbits / 8); for (i=first_idx; i<ptr->sample_count; i++) { ent = gf_list_get(ptr->entries, i); ent->Duration = gf_bs_read_int(bs, nbbits); } } if (!inherit_size && ptr->ctrn_size) { u32 nbbits = gf_isom_ctrn_field_size_bits(ptr->ctrn_size); ISOM_DECREASE_SIZE(ptr, count * nbbits / 8); for (i=first_idx; i<ptr->sample_count; i++) { ent = gf_list_get(ptr->entries, i); ent->size = gf_bs_read_int(bs, nbbits); } } if (!inherit_flags && ptr->ctrn_sample_flags) { u32 nbbits = gf_isom_ctrn_field_size_bits(ptr->ctrn_sample_flags); ISOM_DECREASE_SIZE(ptr, count * nbbits / 8); for (i=first_idx; i<ptr->sample_count; i++) { ent = gf_list_get(ptr->entries, i); ent->flags = ctrn_read_flags(bs, nbbits); } } if (!inherit_ctso && ptr->ctrn_ctts) { u32 nbbits = gf_isom_ctrn_field_size_bits(ptr->ctrn_ctts); ISOM_DECREASE_SIZE(ptr, count * nbbits / 8); for (i=first_idx; i<ptr->sample_count; i++) { ent = gf_list_get(ptr->entries, i); ent->CTS_Offset = gf_bs_read_int(bs, nbbits); if (ptr->ctso_multiplier) ent->CTS_Offset *= (s32) ptr->ctso_multiplier; } } return GF_OK;
0
359,431
DEFUN (ip_extcommunity_list_expanded, ip_extcommunity_list_expanded_cmd, "ip extcommunity-list <100-500> (deny|permit) .LINE", IP_STR EXTCOMMUNITY_LIST_STR "Extended Community list number (expanded)\n" "Specify community to reject\n" "Specify community to accept\n" "An ordered list as a regular-expression\n") { return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); }
0
224,231
R_API void r_io_bank_free(RIOBank *bank) { if (bank) { r_queue_free (bank->todo); r_list_free (bank->maprefs); r_crbtree_free (bank->submaps); free (bank->name); free (bank); } }
0
522,353
static void CalF77Prc( int64_t BegIdx, int64_t EndIdx, void *prc, int NmbArg, void **ArgTab ) { switch(NmbArg) { case 1 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 1)) = (void (*)(int64_t *, int64_t *, DUP(void *, 1)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 1)); }break; case 2 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 2)) = (void (*)(int64_t *, int64_t *, DUP(void *, 2)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 2)); }break; case 3 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 3)) = (void (*)(int64_t *, int64_t *, DUP(void *, 3)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 3)); }break; case 4 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 4)) = (void (*)(int64_t *, int64_t *, DUP(void *, 4)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 4)); }break; case 5 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 5)) = (void (*)(int64_t *, int64_t *, DUP(void *, 5)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 5)); }break; case 6 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 6)) = (void (*)(int64_t *, int64_t *, DUP(void *, 6)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 6)); }break; case 7 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 7)) = (void (*)(int64_t *, int64_t *, DUP(void *, 7)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 7)); }break; case 8 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 8)) = (void (*)(int64_t *, int64_t *, DUP(void *, 8)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 8)); }break; case 9 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 9)) = (void (*)(int64_t *, int64_t *, DUP(void *, 9)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 9)); }break; case 10 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 10)) = (void (*)(int64_t *, int64_t *, DUP(void *, 10)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 10)); }break; case 11 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 11)) = (void (*)(int64_t *, int64_t *, DUP(void *, 11)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 11)); }break; case 12 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 12)) = (void (*)(int64_t *, int64_t *, DUP(void *, 12)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 12)); }break; case 13 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 13)) = (void (*)(int64_t *, int64_t *, DUP(void *, 13)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 13)); }break; case 14 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 14)) = (void (*)(int64_t *, int64_t *, DUP(void *, 14)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 14)); }break; case 15 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 15)) = (void (*)(int64_t *, int64_t *, DUP(void *, 15)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 15)); }break; case 16 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 16)) = (void (*)(int64_t *, int64_t *, DUP(void *, 16)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 16)); }break; case 17 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 17)) = (void (*)(int64_t *, int64_t *, DUP(void *, 17)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 17)); }break; case 18 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 18)) = (void (*)(int64_t *, int64_t *, DUP(void *, 18)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 18)); }break; case 19 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 19)) = (void (*)(int64_t *, int64_t *, DUP(void *, 19)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 19)); }break; case 20 : { void (*prc1)(int64_t *, int64_t *, DUP(void *, 20)) = (void (*)(int64_t *, int64_t *, DUP(void *, 20)))prc; prc1(&BegIdx, &EndIdx, ARG(ArgTab, 20)); }break; } }
0
488,423
static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, pgoff_t pgoff, unsigned int flags, pte_t orig_pte) { pte_t *page_table; spinlock_t *ptl; struct page *page; pte_t entry; int anon = 0; struct page *dirty_page = NULL; struct vm_fault vmf; int ret; int page_mkwrite = 0; vmf.virtual_address = (void __user *)(address & PAGE_MASK); vmf.pgoff = pgoff; vmf.flags = flags; vmf.page = NULL; ret = vma->vm_ops->fault(vma, &vmf); if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) return ret; /* * For consistency in subsequent calls, make the faulted page always * locked. */ if (unlikely(!(ret & VM_FAULT_LOCKED))) lock_page(vmf.page); else VM_BUG_ON(!PageLocked(vmf.page)); /* * Should we do an early C-O-W break? */ page = vmf.page; if (flags & FAULT_FLAG_WRITE) { if (!(vma->vm_flags & VM_SHARED)) { anon = 1; if (unlikely(anon_vma_prepare(vma))) { ret = VM_FAULT_OOM; goto out; } page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address); if (!page) { ret = VM_FAULT_OOM; goto out; } copy_user_highpage(page, vmf.page, address, vma); __SetPageUptodate(page); } else { /* * If the page will be shareable, see if the backing * address space wants to know that the page is about * to become writable */ if (vma->vm_ops->page_mkwrite) { unlock_page(page); if (vma->vm_ops->page_mkwrite(vma, page) < 0) { ret = VM_FAULT_SIGBUS; anon = 1; /* no anon but release vmf.page */ goto out_unlocked; } lock_page(page); /* * XXX: this is not quite right (racy vs * invalidate) to unlock and relock the page * like this, however a better fix requires * reworking page_mkwrite locking API, which * is better done later. */ if (!page->mapping) { ret = 0; anon = 1; /* no anon but release vmf.page */ goto out; } page_mkwrite = 1; } } } if (mem_cgroup_charge(page, mm, GFP_KERNEL)) { ret = VM_FAULT_OOM; goto out; } page_table = pte_offset_map_lock(mm, pmd, address, &ptl); /* * This silly early PAGE_DIRTY setting removes a race * due to the bad i386 page protection. But it's valid * for other architectures too. * * Note that if write_access is true, we either now have * an exclusive copy of the page, or this is a shared mapping, * so we can make it writable and dirty to avoid having to * handle that later. */ /* Only go through if we didn't race with anybody else... */ if (likely(pte_same(*page_table, orig_pte))) { flush_icache_page(vma, page); entry = mk_pte(page, vma->vm_page_prot); if (flags & FAULT_FLAG_WRITE) entry = maybe_mkwrite(pte_mkdirty(entry), vma); set_pte_at(mm, address, page_table, entry); if (anon) { inc_mm_counter(mm, anon_rss); lru_cache_add_active(page); page_add_new_anon_rmap(page, vma, address); } else { inc_mm_counter(mm, file_rss); page_add_file_rmap(page); if (flags & FAULT_FLAG_WRITE) { dirty_page = page; get_page(dirty_page); } } /* no need to invalidate: a not-present page won't be cached */ update_mmu_cache(vma, address, entry); } else { mem_cgroup_uncharge_page(page); if (anon) page_cache_release(page); else anon = 1; /* no anon but release faulted_page */ } pte_unmap_unlock(page_table, ptl); out: unlock_page(vmf.page); out_unlocked: if (anon) page_cache_release(vmf.page); else if (dirty_page) { if (vma->vm_file) file_update_time(vma->vm_file); set_page_dirty_balance(dirty_page, page_mkwrite); put_page(dirty_page); } return ret; }
0
353,188
void SplashOutputDev::iccTransform(void *data, SplashBitmap *bitmap) { SplashOutImageData *imgData = (SplashOutImageData *)data; int nComps = imgData->colorMap->getNumPixelComps(); unsigned char *colorLine = (unsigned char *) gmalloc(nComps * bitmap->getWidth()); unsigned char *rgbxLine = (imgData->colorMode == splashModeXBGR8) ? (unsigned char *) gmalloc(3 * bitmap->getWidth()) : nullptr; for (int i = 0; i < bitmap->getHeight(); i++) { unsigned char *p = bitmap->getDataPtr() + i * bitmap->getRowSize(); switch (imgData->colorMode) { case splashModeMono1: case splashModeMono8: imgData->colorMap->getGrayLine(p, colorLine, bitmap->getWidth()); memcpy(p, colorLine, nComps * bitmap->getWidth()); break; case splashModeRGB8: case splashModeBGR8: imgData->colorMap->getRGBLine(p, colorLine, bitmap->getWidth()); memcpy(p, colorLine, nComps * bitmap->getWidth()); break; #ifdef SPLASH_CMYK case splashModeCMYK8: imgData->colorMap->getCMYKLine(p, colorLine, bitmap->getWidth()); memcpy(p, colorLine, nComps * bitmap->getWidth()); break; case splashModeDeviceN8: imgData->colorMap->getDeviceNLine(p, colorLine, bitmap->getWidth()); memcpy(p, colorLine, nComps * bitmap->getWidth()); break; #endif case splashModeXBGR8: unsigned char *q; unsigned char *b = p; int x; for (x = 0, q = rgbxLine; x < bitmap->getWidth(); ++x, b+=4) { *q++ = b[2]; *q++ = b[1]; *q++ = b[0]; } imgData->colorMap->getRGBLine(rgbxLine, colorLine, bitmap->getWidth()); b = p; for (x = 0, q = colorLine; x < bitmap->getWidth(); ++x, b+=4) { b[2] = *q++; b[1] = *q++; b[0] = *q++; } break; } } gfree(colorLine); if (rgbxLine != nullptr) gfree(rgbxLine); }
0
463,051
static void sungem_send_packet(SunGEMState *s, const uint8_t *buf, int size) { NetClientState *nc = qemu_get_queue(s->nic); if (s->macregs[MAC_XIFCFG >> 2] & MAC_XIFCFG_LBCK) { qemu_receive_packet(nc, buf, size); } else { qemu_send_packet(nc, buf, size); } }
0
221,150
GF_AV1Config *gf_odf_av1_cfg_read(u8 *dsi, u32 dsi_size) { GF_BitStream *bs = gf_bs_new(dsi, dsi_size, GF_BITSTREAM_READ); GF_AV1Config *cfg = gf_odf_av1_cfg_read_bs(bs); gf_bs_del(bs); return cfg; }
0
402,599
generate_auth_info(cms_context *cms, SECItem *der, char *url) { AuthInfo ai; SECOidData *oid = SECOID_FindOIDByTag(SEC_OID_PKIX_CA_ISSUERS); if (!oid) cmsreterr(-1, cms, "could not get CA issuers OID"); memcpy(&ai.oid, &oid->oid, sizeof (ai.oid)); SECItem urlitem = { .data = (unsigned char *)url, .len = strlen(url), .type = siBuffer }; int rc = make_context_specific(cms, 6, &ai.url, &urlitem); if (rc < 0) return rc; void *ret; SECItem unwrapped; ret = SEC_ASN1EncodeItem(cms->arena, &unwrapped, &ai, AuthInfoTemplate); if (ret == NULL) cmsreterr(-1, cms, "could not encode CA Issuers"); rc = wrap_in_seq(cms, der, &unwrapped, 1); if (rc < 0) return rc; return 0; /* I've no idea how to get SEC_ASN1EncodeItem to spit out the thing * we actually want here. So once again, just force the data to * look correct :( */ if (unwrapped.len < 12) { cms->log(cms, LOG_ERR, "%s:%s:%d generated CA Issuers Info " "cannot possibly be valid", __FILE__, __func__, __LINE__); return -1; } unwrapped.data[12] = 0x86; unwrapped.type = siBuffer; AuthInfo wrapper; oid = SECOID_FindOIDByTag(SEC_OID_X509_AUTH_INFO_ACCESS); if (!oid) cmsreterr(-1, cms, "could not find Auth Info Access OID"); memcpy(&wrapper.oid, &oid->oid, sizeof (ai.oid)); wrap_in_seq(cms, &wrapper.url, &unwrapped, 1); ret = SEC_ASN1EncodeItem(cms->arena, der, &wrapper, AuthInfoWrapperTemplate); if (ret == NULL) cmsreterr(-1, cms, "could not encode CA Issuers OID"); return 0; }
0
359,574
DEFUN (neighbor_shutdown, neighbor_shutdown_cmd, NEIGHBOR_CMD2 "shutdown", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Administratively shut down this neighbor\n") { return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); }
0
307,861
void ciEnv::record_out_of_memory_failure() { // If memory is low, we stop compiling methods. record_method_not_compilable("out of memory"); }
0
299,894
readconf_driver_init( uschar *class, driver_instance **anchor, driver_info *drivers_available, int size_of_info, void *instance_default, int instance_size, optionlist *driver_optionlist, int driver_optionlist_count) { driver_instance **p = anchor; driver_instance *d = NULL; uschar *buffer; while ((buffer = get_config_line()) != NULL) { uschar name[64]; uschar *s; /* Read the first name on the line and test for the start of a new driver. A macro definition indicates the end of the previous driver. If this isn't the start of a new driver, the line will be re-read. */ s = readconf_readname(name, sizeof(name), buffer); /* Handle macro definition, first finishing off the initialization of the previous driver, if any. */ if (isupper(*name) && *s == '=') { if (d != NULL) { if (d->driver_name == NULL) log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "no driver defined for %s \"%s\"", class, d->name); (d->info->init)(d); d = NULL; } read_macro_assignment(buffer); continue; } /* If the line starts with a name terminated by a colon, we are at the start of the definition of a new driver. The rest of the line must be blank. */ if (*s++ == ':') { int i; /* Finish off initializing the previous driver. */ if (d != NULL) { if (d->driver_name == NULL) log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "no driver defined for %s \"%s\"", class, d->name); (d->info->init)(d); } /* Check that we haven't already got a driver of this name */ for (d = *anchor; d != NULL; d = d->next) if (Ustrcmp(name, d->name) == 0) log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "there are two %ss called \"%s\"", class, name); /* Set up a new driver instance data block on the chain, with its default values installed. */ d = store_get(instance_size); memcpy(d, instance_default, instance_size); *p = d; p = &(d->next); d->name = string_copy(name); /* Clear out the "set" bits in the generic options */ for (i = 0; i < driver_optionlist_count; i++) driver_optionlist[i].type &= ~opt_set; /* Check nothing more on this line, then do the next loop iteration. */ while (isspace(*s)) s++; if (*s != 0) extra_chars_error(s, US"driver name ", name, US""); continue; } /* Not the start of a new driver. Give an error if we have not set up a current driver yet. */ if (d == NULL) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "%s name missing", class); /* First look to see if this is a generic option; if it is "driver", initialize the driver. If is it not a generic option, we can look for a private option provided that the driver has been previously set up. */ if (readconf_handle_option(buffer, driver_optionlist, driver_optionlist_count, d, NULL)) { if (d->info == NULL && d->driver_name != NULL) init_driver(d, drivers_available, size_of_info, class); } /* Handle private options - pass the generic block because some may live therein. A flag with each option indicates if it is in the public block. */ else if (d->info != NULL) { readconf_handle_option(buffer, d->info->options, *(d->info->options_count), d, US"option \"%s\" unknown"); } /* The option is not generic and the driver name has not yet been given. */ else log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "option \"%s\" unknown " "(\"driver\" must be specified before any private options)", name); } /* Run the initialization function for the final driver. */ if (d != NULL) { if (d->driver_name == NULL) log_write(0, LOG_PANIC_DIE|LOG_CONFIG, "no driver defined for %s \"%s\"", class, d->name); (d->info->init)(d); } }
0
432,233
static bool flatview_access_valid(struct uc_struct *uc, FlatView *fv, hwaddr addr, hwaddr len, bool is_write, MemTxAttrs attrs) { MemoryRegion *mr; hwaddr l, xlat; while (len > 0) { l = len; mr = flatview_translate(uc, fv, addr, &xlat, &l, is_write, attrs); if (!memory_access_is_direct(mr, is_write)) { l = memory_access_size(mr, l, addr); if (!memory_region_access_valid(uc, mr, xlat, l, is_write, attrs)) { return false; } } len -= l; addr += l; } return true; }
0
234,771
static void close_fs_devices(struct btrfs_fs_devices *fs_devices) { struct btrfs_device *device, *tmp; lockdep_assert_held(&uuid_mutex); if (--fs_devices->opened > 0) return; list_for_each_entry_safe(device, tmp, &fs_devices->devices, dev_list) btrfs_close_one_device(device); WARN_ON(fs_devices->open_devices); WARN_ON(fs_devices->rw_devices); fs_devices->opened = 0; fs_devices->seeding = false; fs_devices->fs_info = NULL; }
0
442,789
static void FindWin32CACert(struct Configurable *config, const char *bundle_file) { /* only check for cert file if "we" support SSL */ if(curlinfo->features & CURL_VERSION_SSL) { DWORD buflen; char *ptr = NULL; char *retval = (char *) malloc(sizeof (TCHAR) * (MAX_PATH + 1)); if (!retval) return; retval[0] = '\0'; buflen = SearchPathA(NULL, bundle_file, NULL, MAX_PATH+2, retval, &ptr); if (buflen > 0) { GetStr(&config->cacert, retval); } free(retval); } }
0
413,655
R_API int r_core_search_value_in_range(RCore *core, RInterval search_itv, ut64 vmin, ut64 vmax, int vsize, inRangeCb cb, void *cb_user) { int i, align = core->search->align, hitctr = 0; bool vinfun = r_config_get_i (core->config, "anal.vinfun"); bool vinfunr = r_config_get_i (core->config, "anal.vinfunrange"); bool analStrings = r_config_get_i (core->config, "anal.strings"); mycore = core; ut8 buf[4096]; ut64 v64, value = 0, size; ut64 from = search_itv.addr, to = r_itv_end (search_itv); ut32 v32; ut16 v16; if (from >= to) { eprintf ("Error: from must be lower than to\n"); return -1; } bool maybeThumb = false; if (align && core->anal->cur && core->anal->cur->arch) { if (!strcmp (core->anal->cur->arch, "arm") && core->anal->bits != 64) { maybeThumb = true; } } if (vmin >= vmax) { eprintf ("Error: vmin must be lower than vmax\n"); return -1; } if (to == UT64_MAX) { eprintf ("Error: Invalid destination boundary\n"); return -1; } r_cons_break_push (NULL, NULL); if (!r_io_is_valid_offset (core->io, from, 0)) { return -1; } while (from < to) { size = R_MIN (to - from, sizeof (buf)); memset (buf, 0xff, sizeof (buf)); // probably unnecessary if (r_cons_is_breaked ()) { goto beach; } bool res = r_io_read_at_mapped (core->io, from, buf, size); if (!res || !memcmp (buf, "\xff\xff\xff\xff", 4) || !memcmp (buf, "\x00\x00\x00\x00", 4)) { if (!isValidAddress (core, from)) { ut64 next = from; if (!r_io_map_locate (core->io, &next, 1, 0)) { from += sizeof (buf); } else { from += (next - from); } continue; } } for (i = 0; i <= (size - vsize); i++) { void *v = (buf + i); ut64 addr = from + i; if (r_cons_is_breaked ()) { goto beach; } if (align && (addr) % align) { continue; } int match = false; int left = size - i; if (vsize > left) { break; } switch (vsize) { case 1: value = *(ut8 *)v; match = (buf[i] >= vmin && buf[i] <= vmax); break; case 2: v16 = *(uut16 *)v; match = (v16 >= vmin && v16 <= vmax); value = v16; break; case 4: v32 = *(uut32 *)v; match = (v32 >= vmin && v32 <= vmax); value = v32; break; case 8: v64 = *(uut64 *)v; match = (v64 >= vmin && v64 <= vmax); value = v64; break; default: eprintf ("Unknown vsize %d\n", vsize); return -1; } if (match && !vinfun) { if (vinfunr) { if (r_anal_get_fcn_in_bounds (core->anal, addr, R_ANAL_FCN_TYPE_NULL)) { match = false; } } else { if (r_anal_get_fcn_in (core->anal, addr, R_ANAL_FCN_TYPE_NULL)) { match = false; } } } if (match && value) { bool isValidMatch = true; if (align && (value % align)) { // ignored .. unless we are analyzing arm/thumb and lower bit is 1 isValidMatch = false; if (maybeThumb && (value & 1)) { isValidMatch = true; } } if (isValidMatch) { cb (core, addr, value, vsize, cb_user); if (analStrings && stringAt (core, addr)) { add_string_ref (mycore, addr, value); } hitctr++; } } } if (size == to-from) { break; } from += size-vsize+1; } beach: r_cons_break_pop (); return hitctr; }
0
473,866
get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, p, end, items); }
0
405,391
static void xfrm_policy_inexact_node_reinsert(struct net *net, struct xfrm_pol_inexact_node *n, struct rb_root *new, u16 family) { struct xfrm_pol_inexact_node *node; struct rb_node **p, *parent; /* we should not have another subtree here */ WARN_ON_ONCE(!RB_EMPTY_ROOT(&n->root)); restart: parent = NULL; p = &new->rb_node; while (*p) { u8 prefixlen; int delta; parent = *p; node = rb_entry(*p, struct xfrm_pol_inexact_node, node); prefixlen = min(node->prefixlen, n->prefixlen); delta = xfrm_policy_addr_delta(&n->addr, &node->addr, prefixlen, family); if (delta < 0) { p = &parent->rb_left; } else if (delta > 0) { p = &parent->rb_right; } else { bool same_prefixlen = node->prefixlen == n->prefixlen; struct xfrm_policy *tmp; hlist_for_each_entry(tmp, &n->hhead, bydst) { tmp->bydst_reinsert = true; hlist_del_rcu(&tmp->bydst); } node->prefixlen = prefixlen; xfrm_policy_inexact_list_reinsert(net, node, family); if (same_prefixlen) { kfree_rcu(n, rcu); return; } rb_erase(*p, new); kfree_rcu(n, rcu); n = node; goto restart; } } rb_link_node_rcu(&n->node, parent, p); rb_insert_color(&n->node, new); }
0
344,819
format_absolute_time(uint64_t t, char *buf, size_t len) { time_t tt = t > SSH_TIME_T_MAX ? SSH_TIME_T_MAX : t; struct tm tm; localtime_r(&tt, &tm); strftime(buf, len, "%Y-%m-%dT%H:%M:%S", &tm); }
0
424,930
static void iwl_trans_pcie_write32(struct iwl_trans *trans, u32 ofs, u32 val) { writel(val, IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs); }
0
383,379
void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c) { int x=0,mx1=0,mx2=0,my1=0,my2=0; long aq,bq,dx,dy,r,rx,ry,a,b; a=w>>1; b=h>>1; gdImageSetPixel(im,mx+a, my, c); gdImageSetPixel(im,mx-a, my, c); mx1 = mx-a;my1 = my; mx2 = mx+a;my2 = my; aq = a * a; bq = b * b; dx = aq << 1; dy = bq << 1; r = a * bq; rx = r << 1; ry = 0; x = a; while (x > 0){ if (r > 0) { my1++;my2--; ry +=dx; r -=ry; } if (r <= 0){ x--; mx1++;mx2--; rx -=dy; r +=rx; } gdImageSetPixel(im,mx1, my1, c); gdImageSetPixel(im,mx1, my2, c); gdImageSetPixel(im,mx2, my1, c); gdImageSetPixel(im,mx2, my2, c); } }
0
225,977
GF_Box *stsd_box_new() { ISOM_DECL_BOX_ALLOC(GF_SampleDescriptionBox, GF_ISOM_BOX_TYPE_STSD); tmp->child_boxes = gf_list_new(); return (GF_Box *)tmp; }
0
359,423
DEFUN (no_neighbor_nexthop_self, no_neighbor_nexthop_self_cmd, NO_NEIGHBOR_CMD2 "next-hop-self", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Disable the next hop calculation for this neighbor\n") { return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); }
0
278,246
get_expr_indent(void) { int indent = -1; char_u *inde_copy; pos_T save_pos; colnr_T save_curswant; int save_set_curswant; int save_State; int use_sandbox = was_set_insecurely((char_u *)"indentexpr", OPT_LOCAL); sctx_T save_sctx = current_sctx; // Save and restore cursor position and curswant, in case it was changed // via :normal commands save_pos = curwin->w_cursor; save_curswant = curwin->w_curswant; save_set_curswant = curwin->w_set_curswant; set_vim_var_nr(VV_LNUM, curwin->w_cursor.lnum); if (use_sandbox) ++sandbox; ++textlock; current_sctx = curbuf->b_p_script_ctx[BV_INDE]; // Need to make a copy, the 'indentexpr' option could be changed while // evaluating it. inde_copy = vim_strsave(curbuf->b_p_inde); if (inde_copy != NULL) { indent = (int)eval_to_number(inde_copy); vim_free(inde_copy); } if (use_sandbox) --sandbox; --textlock; current_sctx = save_sctx; // Restore the cursor position so that 'indentexpr' doesn't need to. // Pretend to be in Insert mode, allow cursor past end of line for "o" // command. save_State = State; State = MODE_INSERT; curwin->w_cursor = save_pos; curwin->w_curswant = save_curswant; curwin->w_set_curswant = save_set_curswant; check_cursor(); State = save_State; // Reset did_throw, unless 'debug' has "throw" and inside a try/catch. if (did_throw && (vim_strchr(p_debug, 't') == NULL || trylevel == 0)) { handle_did_throw(); did_throw = FALSE; } // If there is an error, just keep the current indent. if (indent < 0) indent = get_indent(); return indent; }
0
333,076
match_backref( regsub_T *sub, // pointers to subexpressions int subidx, int *bytelen) // out: length of match in bytes { int len; if (sub->in_use <= subidx) { retempty: // backref was not set, match an empty string *bytelen = 0; return TRUE; } if (REG_MULTI) { if (sub->list.multi[subidx].start_lnum < 0 || sub->list.multi[subidx].end_lnum < 0) goto retempty; if (sub->list.multi[subidx].start_lnum == rex.lnum && sub->list.multi[subidx].end_lnum == rex.lnum) { len = sub->list.multi[subidx].end_col - sub->list.multi[subidx].start_col; if (cstrncmp(rex.line + sub->list.multi[subidx].start_col, rex.input, &len) == 0) { *bytelen = len; return TRUE; } } else { if (match_with_backref( sub->list.multi[subidx].start_lnum, sub->list.multi[subidx].start_col, sub->list.multi[subidx].end_lnum, sub->list.multi[subidx].end_col, bytelen) == RA_MATCH) return TRUE; } } else { if (sub->list.line[subidx].start == NULL || sub->list.line[subidx].end == NULL) goto retempty; len = (int)(sub->list.line[subidx].end - sub->list.line[subidx].start); if (cstrncmp(sub->list.line[subidx].start, rex.input, &len) == 0) { *bytelen = len; return TRUE; } } return FALSE; }
0
445,881
_fr_window_ask_overwrite_dialog (OverwriteData *odata) { gboolean perform_extraction = TRUE; if ((odata->edata->overwrite == FR_OVERWRITE_ASK) && (odata->current_file != NULL)) { const char *base_name; GFile *destination; base_name = _g_path_get_relative_basename_safe ((char *) odata->current_file->data, odata->edata->base_dir, odata->edata->junk_paths); if (base_name != NULL) { destination = g_file_get_child (odata->edata->destination, base_name); g_file_query_info_async (destination, G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, G_PRIORITY_DEFAULT, odata->window->priv->cancellable, query_info_ready_for_overwrite_dialog_cb, odata); g_object_unref (destination); return; } else perform_extraction = FALSE; } if (odata->edata->file_list == NULL) perform_extraction = FALSE; if (perform_extraction) { /* speed optimization: passing NULL when extracting all the * files is faster if the command supports the * propCanExtractAll property. */ if (odata->extract_all) { _g_string_list_free (odata->edata->file_list); odata->edata->file_list = NULL; } odata->edata->overwrite = FR_OVERWRITE_YES; _fr_window_archive_extract_from_edata (odata->window, odata->edata); } else { GtkWidget *d; d = _gtk_message_dialog_new (GTK_WINDOW (odata->window), 0, GTK_STOCK_DIALOG_WARNING, _("Extraction not performed"), NULL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK); fr_window_show_error_dialog (odata->window, d, GTK_WINDOW (odata->window), _("Extraction not performed")); fr_window_stop_batch (odata->window); } g_free (odata); }
0
508,351
TABLE *open_n_lock_single_table(THD *thd, TABLE_LIST *table_l, thr_lock_type lock_type, uint flags, Prelocking_strategy *prelocking_strategy) { TABLE_LIST *save_next_global; DBUG_ENTER("open_n_lock_single_table"); /* Remember old 'next' pointer. */ save_next_global= table_l->next_global; /* Break list. */ table_l->next_global= NULL; /* Set requested lock type. */ table_l->lock_type= lock_type; /* Allow to open real tables only. */ table_l->required_type= FRMTYPE_TABLE; /* Open the table. */ if (open_and_lock_tables(thd, table_l, FALSE, flags, prelocking_strategy)) table_l->table= NULL; /* Just to be sure. */ /* Restore list. */ table_l->next_global= save_next_global; DBUG_RETURN(table_l->table); }
0
366,248
void mnt_set_mountpoint(struct mount *mnt, struct mountpoint *mp, struct mount *child_mnt) { mp->m_count++; mnt_add_count(mnt, 1); /* essentially, that's mntget */ child_mnt->mnt_mountpoint = mp->m_dentry; child_mnt->mnt_parent = mnt; child_mnt->mnt_mp = mp; hlist_add_head(&child_mnt->mnt_mp_list, &mp->m_list); }
0
313,770
nv_left(cmdarg_T *cap) { long n; if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { // <C-Left> and <S-Left> move a word or WORD left if (mod_mask & MOD_MASK_CTRL) cap->arg = 1; nv_bck_word(cap); return; } cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; for (n = cap->count1; n > 0; --n) { if (oneleft() == FAIL) { // <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'. // 'h' wraps to previous line if 'whichwrap' has 'h'. // CURS_LEFT wraps to previous line if 'whichwrap' has '<'. if ( (((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H) && vim_strchr(p_ww, 'b') != NULL) || (cap->cmdchar == 'h' && vim_strchr(p_ww, 'h') != NULL) || (cap->cmdchar == K_LEFT && vim_strchr(p_ww, '<') != NULL)) && curwin->w_cursor.lnum > 1) { --(curwin->w_cursor.lnum); coladvance((colnr_T)MAXCOL); curwin->w_set_curswant = TRUE; // When the NL before the first char has to be deleted we // put the cursor on the NUL after the previous line. // This is a very special case, be careful! // Don't adjust op_end now, otherwise it won't work. if ( (cap->oap->op_type == OP_DELETE || cap->oap->op_type == OP_CHANGE) && !LINEEMPTY(curwin->w_cursor.lnum)) { char_u *cp = ml_get_cursor(); if (*cp != NUL) { if (has_mbyte) curwin->w_cursor.col += (*mb_ptr2len)(cp); else ++curwin->w_cursor.col; } cap->retval |= CA_NO_ADJ_OP_END; } continue; } // Only beep and flush if not moved at all else if (cap->oap->op_type == OP_NOP && n == cap->count1) beep_flush(); break; } } #ifdef FEAT_FOLDING if (n != cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP) foldOpenCursor(); #endif }
0
275,476
njs_vm_retval_string(njs_vm_t *vm, njs_str_t *dst) { if (vm->top_frame == NULL) { /* An exception was thrown during compilation. */ njs_vm_init(vm); } return njs_vm_value_string(vm, dst, &vm->retval); }
0
224,983
conninfo_getval(PQconninfoOption *connOptions, const char *keyword) { PQconninfoOption *option; option = conninfo_find(connOptions, keyword); return option ? option->val : NULL; }
0
223,453
static void do_getucd(compiler_common *common) { /* Search the UCD record for the character comes in TMP1. Returns chartype in TMP1 and UCD offset in TMP2. */ DEFINE_COMPILER; #if PCRE2_CODE_UNIT_WIDTH == 32 struct sljit_jump *jump; #endif #if defined SLJIT_DEBUG && SLJIT_DEBUG /* dummy_ucd_record */ const ucd_record *record = GET_UCD(UNASSIGNED_UTF_CHAR); SLJIT_ASSERT(record->script == ucp_Unknown && record->chartype == ucp_Cn && record->gbprop == ucp_gbOther); SLJIT_ASSERT(record->caseset == 0 && record->other_case == 0); #endif SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && sizeof(ucd_record) == 12); sljit_emit_fast_enter(compiler, RETURN_ADDR, 0); #if PCRE2_CODE_UNIT_WIDTH == 32 if (!common->utf) { jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, MAX_UTF_CODE_POINT + 1); OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, UNASSIGNED_UTF_CHAR); JUMPHERE(jump); } #endif OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 1); OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1)); OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT); OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2)); OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1); OP_SRC(SLJIT_FAST_RETURN, RETURN_ADDR, 0); }
0
264,370
inline const int32* TensorProtoData<qint32>(const TensorProto& t) { static_assert(SaveTypeTraits<qint32>::supported, "Specified type qint32 not supported for Restore"); return reinterpret_cast<const int32*>(t.int_val().data()); }
0
427,238
static void checktoclose (FuncState *fs, int level) { if (level != -1) { /* is there a to-be-closed variable? */ marktobeclosed(fs); luaK_codeABC(fs, OP_TBC, reglevel(fs, level), 0, 0); } }
0
489,214
void hfsplus_cat_build_key(struct super_block *sb, hfsplus_btree_key *key, u32 parent, struct qstr *str) { int len; key->cat.parent = cpu_to_be32(parent); if (str) { hfsplus_asc2uni(sb, &key->cat.name, str->name, str->len); len = be16_to_cpu(key->cat.name.length); } else { key->cat.name.length = 0; len = 0; } key->key_len = cpu_to_be16(6 + 2 * len); }
0
513,017
const Type_handler *type_handler() const { return value_item->type_handler(); }
0
369,190
static inline void io_commit_cqring(struct io_ring_ctx *ctx) { /* order cqe stores with ring update */ smp_store_release(&ctx->rings->cq.tail, ctx->cached_cq_tail); }
0
411,491
copyString(const XML_Char *s, const XML_Memory_Handling_Suite *memsuite) { size_t charsRequired = 0; XML_Char *result; /* First determine how long the string is */ while (s[charsRequired] != 0) { charsRequired++; } /* Include the terminator */ charsRequired++; /* Now allocate space for the copy */ result = memsuite->malloc_fcn(charsRequired * sizeof(XML_Char)); if (result == NULL) return NULL; /* Copy the original into place */ memcpy(result, s, charsRequired * sizeof(XML_Char)); return result; }
0
441,817
SProcXkbLatchLockState(ClientPtr client) { REQUEST(xkbLatchLockStateReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xkbLatchLockStateReq); swaps(&stuff->deviceSpec); swaps(&stuff->groupLatch); return ProcXkbLatchLockState(client); }
0
477,277
static int tipc_aead_init(struct tipc_aead **aead, struct tipc_aead_key *ukey, u8 mode) { struct tipc_tfm *tfm_entry, *head; struct crypto_aead *tfm; struct tipc_aead *tmp; int keylen, err, cpu; int tfm_cnt = 0; if (unlikely(*aead)) return -EEXIST; /* Allocate a new AEAD */ tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC); if (unlikely(!tmp)) return -ENOMEM; /* The key consists of two parts: [AES-KEY][SALT] */ keylen = ukey->keylen - TIPC_AES_GCM_SALT_SIZE; /* Allocate per-cpu TFM entry pointer */ tmp->tfm_entry = alloc_percpu(struct tipc_tfm *); if (!tmp->tfm_entry) { kfree_sensitive(tmp); return -ENOMEM; } /* Make a list of TFMs with the user key data */ do { tfm = crypto_alloc_aead(ukey->alg_name, 0, 0); if (IS_ERR(tfm)) { err = PTR_ERR(tfm); break; } if (unlikely(!tfm_cnt && crypto_aead_ivsize(tfm) != TIPC_AES_GCM_IV_SIZE)) { crypto_free_aead(tfm); err = -ENOTSUPP; break; } err = crypto_aead_setauthsize(tfm, TIPC_AES_GCM_TAG_SIZE); err |= crypto_aead_setkey(tfm, ukey->key, keylen); if (unlikely(err)) { crypto_free_aead(tfm); break; } tfm_entry = kmalloc(sizeof(*tfm_entry), GFP_KERNEL); if (unlikely(!tfm_entry)) { crypto_free_aead(tfm); err = -ENOMEM; break; } INIT_LIST_HEAD(&tfm_entry->list); tfm_entry->tfm = tfm; /* First entry? */ if (!tfm_cnt) { head = tfm_entry; for_each_possible_cpu(cpu) { *per_cpu_ptr(tmp->tfm_entry, cpu) = head; } } else { list_add_tail(&tfm_entry->list, &head->list); } } while (++tfm_cnt < sysctl_tipc_max_tfms); /* Not any TFM is allocated? */ if (!tfm_cnt) { free_percpu(tmp->tfm_entry); kfree_sensitive(tmp); return err; } /* Form a hex string of some last bytes as the key's hint */ bin2hex(tmp->hint, ukey->key + keylen - TIPC_AEAD_HINT_LEN, TIPC_AEAD_HINT_LEN); /* Initialize the other data */ tmp->mode = mode; tmp->cloned = NULL; tmp->authsize = TIPC_AES_GCM_TAG_SIZE; tmp->key = kmemdup(ukey, tipc_aead_key_size(ukey), GFP_KERNEL); memcpy(&tmp->salt, ukey->key + keylen, TIPC_AES_GCM_SALT_SIZE); atomic_set(&tmp->users, 0); atomic64_set(&tmp->seqno, 0); refcount_set(&tmp->refcnt, 1); *aead = tmp; return 0; }
0
393,530
static SQInteger array_resize(HSQUIRRELVM v) { SQObject &o = stack_get(v, 1); SQObject &nsize = stack_get(v, 2); SQObjectPtr fill; if(sq_isnumeric(nsize)) { SQInteger sz = tointeger(nsize); if (sz<0) return sq_throwerror(v, _SC("resizing to negative length")); if(sq_gettop(v) > 2) fill = stack_get(v, 3); _array(o)->Resize(sz,fill); sq_settop(v, 1); return 1; } return sq_throwerror(v, _SC("size must be a number")); }
0
379,672
R_API int r_anal_var_count_args(RAnalFunction *fcn) { r_return_val_if_fail (fcn, 0); // No function implies no variables, but probably mistake int args = 0; void **it; r_pvector_foreach (&fcn->vars, it) { RAnalVar *var = *it; if (var->isarg) { args++; } } return args; }
0
210,252
static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define MonoColorType 1 #define RGBColorType 3 char property[MagickPathExtent]; CINInfo cin; Image *image; MagickBooleanType status; MagickOffsetType offset; QuantumInfo *quantum_info; QuantumType quantum_type; ssize_t i; Quantum *q; size_t length; ssize_t count, y; unsigned char magick[4], *pixels; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* File information. */ offset=0; count=ReadBlob(image,4,magick); offset+=count; if ((count != 4) || ((LocaleNCompare((char *) magick,"\200\052\137\327",4) != 0))) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); memset(&cin,0,sizeof(cin)); image->endian=(magick[0] == 0x80) && (magick[1] == 0x2a) && (magick[2] == 0x5f) && (magick[3] == 0xd7) ? MSBEndian : LSBEndian; cin.file.image_offset=ReadBlobLong(image); offset+=4; cin.file.generic_length=ReadBlobLong(image); offset+=4; cin.file.industry_length=ReadBlobLong(image); offset+=4; cin.file.user_length=ReadBlobLong(image); offset+=4; cin.file.file_size=ReadBlobLong(image); offset+=4; offset+=ReadBlob(image,sizeof(cin.file.version),(unsigned char *) cin.file.version); (void) CopyMagickString(property,cin.file.version,sizeof(cin.file.version)); (void) SetImageProperty(image,"dpx:file.version",property,exception); offset+=ReadBlob(image,sizeof(cin.file.filename),(unsigned char *) cin.file.filename); (void) CopyMagickString(property,cin.file.filename,sizeof(cin.file.filename)); (void) SetImageProperty(image,"dpx:file.filename",property,exception); offset+=ReadBlob(image,sizeof(cin.file.create_date),(unsigned char *) cin.file.create_date); (void) CopyMagickString(property,cin.file.create_date, sizeof(cin.file.create_date)); (void) SetImageProperty(image,"dpx:file.create_date",property,exception); offset+=ReadBlob(image,sizeof(cin.file.create_time),(unsigned char *) cin.file.create_time); (void) CopyMagickString(property,cin.file.create_time, sizeof(cin.file.create_time)); (void) SetImageProperty(image,"dpx:file.create_time",property,exception); offset+=ReadBlob(image,sizeof(cin.file.reserve),(unsigned char *) cin.file.reserve); /* Image information. */ cin.image.orientation=(unsigned char) ReadBlobByte(image); offset++; if (cin.image.orientation != (unsigned char) (~0)) (void) FormatImageProperty(image,"dpx:image.orientation","%d", cin.image.orientation); switch (cin.image.orientation) { default: case 0: image->orientation=TopLeftOrientation; break; case 1: image->orientation=TopRightOrientation; break; case 2: image->orientation=BottomLeftOrientation; break; case 3: image->orientation=BottomRightOrientation; break; case 4: image->orientation=LeftTopOrientation; break; case 5: image->orientation=RightTopOrientation; break; case 6: image->orientation=LeftBottomOrientation; break; case 7: image->orientation=RightBottomOrientation; break; } cin.image.number_channels=(unsigned char) ReadBlobByte(image); offset++; offset+=ReadBlob(image,sizeof(cin.image.reserve1),(unsigned char *) cin.image.reserve1); for (i=0; i < 8; i++) { cin.image.channel[i].designator[0]=(unsigned char) ReadBlobByte(image); offset++; cin.image.channel[i].designator[1]=(unsigned char) ReadBlobByte(image); offset++; cin.image.channel[i].bits_per_pixel=(unsigned char) ReadBlobByte(image); offset++; cin.image.channel[i].reserve=(unsigned char) ReadBlobByte(image); offset++; cin.image.channel[i].pixels_per_line=ReadBlobLong(image); offset+=4; cin.image.channel[i].lines_per_image=ReadBlobLong(image); offset+=4; cin.image.channel[i].min_data=ReadBlobFloat(image); offset+=4; cin.image.channel[i].min_quantity=ReadBlobFloat(image); offset+=4; cin.image.channel[i].max_data=ReadBlobFloat(image); offset+=4; cin.image.channel[i].max_quantity=ReadBlobFloat(image); offset+=4; } cin.image.white_point[0]=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.image.white_point[0]) != MagickFalse) image->chromaticity.white_point.x=cin.image.white_point[0]; cin.image.white_point[1]=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.image.white_point[1]) != MagickFalse) image->chromaticity.white_point.y=cin.image.white_point[1]; cin.image.red_primary_chromaticity[0]=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.image.red_primary_chromaticity[0]) != MagickFalse) image->chromaticity.red_primary.x=cin.image.red_primary_chromaticity[0]; cin.image.red_primary_chromaticity[1]=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.image.red_primary_chromaticity[1]) != MagickFalse) image->chromaticity.red_primary.y=cin.image.red_primary_chromaticity[1]; cin.image.green_primary_chromaticity[0]=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.image.green_primary_chromaticity[0]) != MagickFalse) image->chromaticity.red_primary.x=cin.image.green_primary_chromaticity[0]; cin.image.green_primary_chromaticity[1]=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.image.green_primary_chromaticity[1]) != MagickFalse) image->chromaticity.green_primary.y=cin.image.green_primary_chromaticity[1]; cin.image.blue_primary_chromaticity[0]=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.image.blue_primary_chromaticity[0]) != MagickFalse) image->chromaticity.blue_primary.x=cin.image.blue_primary_chromaticity[0]; cin.image.blue_primary_chromaticity[1]=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.image.blue_primary_chromaticity[1]) != MagickFalse) image->chromaticity.blue_primary.y=cin.image.blue_primary_chromaticity[1]; offset+=ReadBlob(image,sizeof(cin.image.label),(unsigned char *) cin.image.label); (void) CopyMagickString(property,cin.image.label,sizeof(cin.image.label)); (void) SetImageProperty(image,"dpx:image.label",property,exception); offset+=ReadBlob(image,sizeof(cin.image.reserve),(unsigned char *) cin.image.reserve); /* Image data format information. */ cin.data_format.interleave=(unsigned char) ReadBlobByte(image); offset++; cin.data_format.packing=(unsigned char) ReadBlobByte(image); offset++; cin.data_format.sign=(unsigned char) ReadBlobByte(image); offset++; cin.data_format.sense=(unsigned char) ReadBlobByte(image); offset++; cin.data_format.line_pad=ReadBlobLong(image); offset+=4; cin.data_format.channel_pad=ReadBlobLong(image); offset+=4; offset+=ReadBlob(image,sizeof(cin.data_format.reserve),(unsigned char *) cin.data_format.reserve); /* Image origination information. */ cin.origination.x_offset=ReadBlobSignedLong(image); offset+=4; if ((size_t) cin.origination.x_offset != ~0UL) (void) FormatImageProperty(image,"dpx:origination.x_offset","%.20g", (double) cin.origination.x_offset); cin.origination.y_offset=(ssize_t) ReadBlobLong(image); offset+=4; if ((size_t) cin.origination.y_offset != ~0UL) (void) FormatImageProperty(image,"dpx:origination.y_offset","%.20g", (double) cin.origination.y_offset); offset+=ReadBlob(image,sizeof(cin.origination.filename),(unsigned char *) cin.origination.filename); (void) CopyMagickString(property,cin.origination.filename, sizeof(cin.origination.filename)); (void) SetImageProperty(image,"dpx:origination.filename",property,exception); offset+=ReadBlob(image,sizeof(cin.origination.create_date),(unsigned char *) cin.origination.create_date); (void) CopyMagickString(property,cin.origination.create_date, sizeof(cin.origination.create_date)); (void) SetImageProperty(image,"dpx:origination.create_date",property, exception); offset+=ReadBlob(image,sizeof(cin.origination.create_time),(unsigned char *) cin.origination.create_time); (void) CopyMagickString(property,cin.origination.create_time, sizeof(cin.origination.create_time)); (void) SetImageProperty(image,"dpx:origination.create_time",property, exception); offset+=ReadBlob(image,sizeof(cin.origination.device),(unsigned char *) cin.origination.device); (void) CopyMagickString(property,cin.origination.device, sizeof(cin.origination.device)); (void) SetImageProperty(image,"dpx:origination.device",property,exception); offset+=ReadBlob(image,sizeof(cin.origination.model),(unsigned char *) cin.origination.model); (void) CopyMagickString(property,cin.origination.model, sizeof(cin.origination.model)); (void) SetImageProperty(image,"dpx:origination.model",property,exception); (void) memset(cin.origination.serial,0, sizeof(cin.origination.serial)); offset+=ReadBlob(image,sizeof(cin.origination.serial),(unsigned char *) cin.origination.serial); (void) CopyMagickString(property,cin.origination.serial, sizeof(cin.origination.serial)); (void) SetImageProperty(image,"dpx:origination.serial",property,exception); cin.origination.x_pitch=ReadBlobFloat(image); offset+=4; cin.origination.y_pitch=ReadBlobFloat(image); offset+=4; cin.origination.gamma=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.origination.gamma) != MagickFalse) image->gamma=cin.origination.gamma; offset+=ReadBlob(image,sizeof(cin.origination.reserve),(unsigned char *) cin.origination.reserve); if ((cin.file.image_offset > 2048) && (cin.file.user_length != 0)) { int c; /* Image film information. */ cin.film.id=ReadBlobByte(image); offset++; c=cin.film.id; if (c != ~0) (void) FormatImageProperty(image,"dpx:film.id","%d",cin.film.id); cin.film.type=ReadBlobByte(image); offset++; c=cin.film.type; if (c != ~0) (void) FormatImageProperty(image,"dpx:film.type","%d",cin.film.type); cin.film.offset=ReadBlobByte(image); offset++; c=cin.film.offset; if (c != ~0) (void) FormatImageProperty(image,"dpx:film.offset","%d", cin.film.offset); cin.film.reserve1=ReadBlobByte(image); offset++; cin.film.prefix=ReadBlobLong(image); offset+=4; if (cin.film.prefix != ~0UL) (void) FormatImageProperty(image,"dpx:film.prefix","%.20g",(double) cin.film.prefix); cin.film.count=ReadBlobLong(image); offset+=4; offset+=ReadBlob(image,sizeof(cin.film.format),(unsigned char *) cin.film.format); (void) CopyMagickString(property,cin.film.format,sizeof(cin.film.format)); (void) SetImageProperty(image,"dpx:film.format",property,exception); cin.film.frame_position=ReadBlobLong(image); offset+=4; if (cin.film.frame_position != ~0UL) (void) FormatImageProperty(image,"dpx:film.frame_position","%.20g", (double) cin.film.frame_position); cin.film.frame_rate=ReadBlobFloat(image); offset+=4; if (IsFloatDefined(cin.film.frame_rate) != MagickFalse) (void) FormatImageProperty(image,"dpx:film.frame_rate","%g", cin.film.frame_rate); offset+=ReadBlob(image,sizeof(cin.film.frame_id),(unsigned char *) cin.film.frame_id); (void) CopyMagickString(property,cin.film.frame_id, sizeof(cin.film.frame_id)); (void) SetImageProperty(image,"dpx:film.frame_id",property,exception); offset+=ReadBlob(image,sizeof(cin.film.slate_info),(unsigned char *) cin.film.slate_info); (void) CopyMagickString(property,cin.film.slate_info, sizeof(cin.film.slate_info)); (void) SetImageProperty(image,"dpx:film.slate_info",property,exception); offset+=ReadBlob(image,sizeof(cin.film.reserve),(unsigned char *) cin.film.reserve); } if ((cin.file.image_offset > 2048) && (cin.file.user_length != 0)) { StringInfo *profile; /* User defined data. */ if (cin.file.user_length > GetBlobSize(image)) ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); profile=BlobToStringInfo((const unsigned char *) NULL, cin.file.user_length); if (profile == (StringInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); offset+=ReadBlob(image,GetStringInfoLength(profile), GetStringInfoDatum(profile)); (void) SetImageProfile(image,"dpx:user.data",profile,exception); profile=DestroyStringInfo(profile); } image->depth=cin.image.channel[0].bits_per_pixel; image->columns=cin.image.channel[0].pixels_per_line; image->rows=cin.image.channel[0].lines_per_image; if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(image); } if (((MagickSizeType) image->columns*image->rows/8) > GetBlobSize(image)) ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); for ( ; offset < (MagickOffsetType) cin.file.image_offset; offset++) { int c; c=ReadBlobByte(image); if (c == EOF) break; } if (offset < (MagickOffsetType) cin.file.image_offset) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); (void) SetImageBackgroundColor(image,exception); /* Convert CIN raster image to pixel packets. */ quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); SetQuantumQuantum(quantum_info,32); SetQuantumPack(quantum_info,MagickFalse); quantum_type=RGBQuantum; length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue); if (cin.image.number_channels == 1) { quantum_type=GrayQuantum; length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue); } status=SetQuantumPad(image,quantum_info,0); pixels=GetQuantumPixels(quantum_info); for (y=0; y < (ssize_t) image->rows; y++) { const void *stream; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; stream=ReadBlobStream(image,length,pixels,&count); if ((size_t) count != length) break; (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, quantum_type,(unsigned char *) stream,exception); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } SetQuantumImageType(image,quantum_type); quantum_info=DestroyQuantumInfo(quantum_info); if (EOFBlob(image) != MagickFalse) ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); SetImageColorspace(image,LogColorspace,exception); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
1
292,156
methodHandle LinkResolver::resolve_method_statically(Bytecodes::Code code, const constantPoolHandle& pool, int index, TRAPS) { // This method is used only // (1) in C2 from InlineTree::ok_to_inline (via ciMethod::check_call), // and // (2) in Bytecode_invoke::static_target // It appears to fail when applied to an invokeinterface call site. // FIXME: Remove this method and ciMethod::check_call; refactor to use the other LinkResolver entry points. // resolve klass if (code == Bytecodes::_invokedynamic) { Klass* resolved_klass = SystemDictionary::MethodHandle_klass(); Symbol* method_name = vmSymbols::invoke_name(); Symbol* method_signature = pool->signature_ref_at(index); Klass* current_klass = pool->pool_holder(); LinkInfo link_info(resolved_klass, method_name, method_signature, current_klass); return resolve_method(link_info, code, THREAD); } LinkInfo link_info(pool, index, methodHandle(), CHECK_NULL); Klass* resolved_klass = link_info.resolved_klass(); if (pool->has_preresolution() || (resolved_klass == SystemDictionary::MethodHandle_klass() && MethodHandles::is_signature_polymorphic_name(resolved_klass, link_info.name()))) { Method* result = ConstantPool::method_at_if_loaded(pool, index); if (result != NULL) { return methodHandle(THREAD, result); } } if (code == Bytecodes::_invokeinterface) { return resolve_interface_method(link_info, code, THREAD); } else if (code == Bytecodes::_invokevirtual) { return resolve_method(link_info, code, THREAD); } else if (!resolved_klass->is_interface()) { return resolve_method(link_info, code, THREAD); } else { return resolve_interface_method(link_info, code, THREAD); } }
0
521,457
inline uint16 readUnalignedLittleEndianShort (const void* buffer) { auto data = readUnaligned<uint16> (buffer); return ByteOrder::littleEndianShort (&data); }
0
463,159
EXPORTED int annotate_state_commit(annotate_state_t **statep) { int r = 0; if (*statep) r = annotate_commit((*statep)->d); annotate_state_free(statep); return r; }
0
230,289
njs_array_string_add(njs_vm_t *vm, njs_array_t *array, const u_char *start, size_t size, size_t length) { njs_int_t ret; ret = njs_array_expand(vm, array, 0, 1); if (njs_fast_path(ret == NJS_OK)) { return njs_string_new(vm, &array->start[array->length++], start, size, length); } return ret; }
0
314,762
cdf_read_summary_info(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn) { size_t i; const cdf_directory_t *d; static const char name[] = "\05SummaryInformation"; for (i = dir->dir_len; i > 0; i--) if (dir->dir_tab[i - 1].d_type == CDF_DIR_TYPE_USER_STREAM && cdf_namecmp(name, dir->dir_tab[i - 1].d_name, sizeof(name)) == 0) break; if (i == 0) { DPRINTF(("Cannot find summary information section\n")); errno = ESRCH; return -1; } d = &dir->dir_tab[i - 1]; return cdf_read_sector_chain(info, h, sat, ssat, sst, d->d_stream_first_sector, d->d_size, scn); }
0
512,250
Item_time_literal(THD *thd, const Time *ltime, uint dec_arg): Item_temporal_literal(thd, dec_arg), cached_time(*ltime) { DBUG_ASSERT(cached_time.is_valid_time()); max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0); }
0
226,283
GF_Box *vwid_box_new() { ISOM_DECL_BOX_ALLOC(GF_ViewIdentifierBox, GF_ISOM_BOX_TYPE_VWID); return (GF_Box *)tmp;
0
232,336
GF_Err gf_isom_box_parse_ex(GF_Box **outBox, GF_BitStream *bs, u32 parent_type, Bool is_root_box, u64 parent_size) { u32 type, uuid_type, hdr_size, restore_type; u64 size, start, comp_start, end; char uuid[16]; GF_Err e; GF_BitStream *uncomp_bs = NULL; u8 *uncomp_data = NULL; u32 compressed_size=0; GF_Box *newBox; Bool skip_logs = (gf_bs_get_cookie(bs) & GF_ISOM_BS_COOKIE_NO_LOGS ) ? GF_TRUE : GF_FALSE; Bool is_special = GF_TRUE; if ((bs == NULL) || (outBox == NULL) ) return GF_BAD_PARAM; *outBox = NULL; if (gf_bs_available(bs) < 8) { return GF_ISOM_INCOMPLETE_FILE; } comp_start = start = gf_bs_get_position(bs); uuid_type = 0; size = (u64) gf_bs_read_u32(bs); hdr_size = 4; /*fix for some boxes found in some old hinted files*/ if ((size >= 2) && (size <= 4)) { size = 4; type = GF_ISOM_BOX_TYPE_VOID; } else { type = gf_bs_read_u32(bs); hdr_size += 4; /*no size means till end of file - EXCEPT FOR some old QuickTime boxes...*/ if (type == GF_ISOM_BOX_TYPE_TOTL) size = 12; if (!size) { if (is_root_box) { if (!skip_logs) { GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[iso file] Warning Read Box type %s (0x%08X) size 0 reading till the end of file\n", gf_4cc_to_str(type), type)); } size = gf_bs_available(bs) + 8; } else { if (!skip_logs) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Read Box type %s (0x%08X) at position "LLU" has size 0 but is not at root/file level. Forbidden, skipping end of parent box !\n", gf_4cc_to_str(type), type, start)); return GF_SKIP_BOX; } return GF_OK; } } if (is_root_box && (size>=8)) { Bool do_uncompress = GF_FALSE; u8 *compb = NULL; u32 osize = 0; u32 otype = type; if (type==GF_4CC('!', 'm', 'o', 'f')) { do_uncompress = GF_TRUE; type = GF_ISOM_BOX_TYPE_MOOF; } else if (type==GF_4CC('!', 'm', 'o', 'v')) { do_uncompress = GF_TRUE; type = GF_ISOM_BOX_TYPE_MOOV; } else if (type==GF_4CC('!', 's', 'i', 'x')) { do_uncompress = GF_TRUE; type = GF_ISOM_BOX_TYPE_SIDX; } else if (type==GF_4CC('!', 's', 's', 'x')) { do_uncompress = GF_TRUE; type = GF_ISOM_BOX_TYPE_SSIX; } if (do_uncompress) { compb = gf_malloc((u32) (size-8)); compressed_size = (u32) (size - 8); gf_bs_read_data(bs, compb, compressed_size); e = gf_gz_decompress_payload(compb, compressed_size, &uncomp_data, &osize); if (e) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Failed to uncompress payload for box type %s (0x%08X)\n", gf_4cc_to_str(otype), otype)); return e; } //keep size as complete box size for tests below size = osize + 8; uncomp_bs = gf_bs_new(uncomp_data, osize, GF_BITSTREAM_READ); bs = uncomp_bs; start = 0; gf_free(compb); } } } /*handle uuid*/ memset(uuid, 0, 16); if (type == GF_ISOM_BOX_TYPE_UUID ) { if (gf_bs_available(bs) < 16) { return GF_ISOM_INCOMPLETE_FILE; } gf_bs_read_data(bs, uuid, 16); hdr_size += 16; uuid_type = gf_isom_solve_uuid_box(uuid); } //handle large box if (size == 1) { if (gf_bs_available(bs) < 8) { return GF_ISOM_INCOMPLETE_FILE; } size = gf_bs_read_u64(bs); hdr_size += 8; } if (!skip_logs) GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[iso file] Read Box type %s size "LLD" start "LLD"\n", gf_4cc_to_str(type), size, start)); if ( size < hdr_size ) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Box %s size "LLD" less than box header size %d\n", gf_4cc_to_str(type), size, hdr_size)); return GF_ISOM_INVALID_FILE; } //if parent size is given, make sure box fits within parent if (parent_size && (parent_size<size)) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Box %s size "LLU" is larger than remaining parent size "LLU"\n", gf_4cc_to_str(type), size, parent_size )); return GF_ISOM_INVALID_FILE; } restore_type = 0; if ((parent_type==GF_ISOM_BOX_TYPE_STSD) && (type==GF_QT_SUBTYPE_RAW) ) { u64 cookie = gf_bs_get_cookie(bs); restore_type = type; if (cookie & GF_ISOM_BS_COOKIE_VISUAL_TRACK) type = GF_QT_SUBTYPE_RAW_VID; else type = GF_QT_SUBTYPE_RAW_AUD; } //some special boxes (references and track groups) are handled by a single generic box with an associated ref/group type if (parent_type && (parent_type == GF_ISOM_BOX_TYPE_TREF)) { newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_REFT); if (!newBox) return GF_OUT_OF_MEM; ((GF_TrackReferenceTypeBox*)newBox)->reference_type = type; } else if (parent_type && (parent_type == GF_ISOM_BOX_TYPE_IREF)) { newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_REFI); if (!newBox) return GF_OUT_OF_MEM; ((GF_ItemReferenceTypeBox*)newBox)->reference_type = type; } else if (parent_type && (parent_type == GF_ISOM_BOX_TYPE_TRGR)) { newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_TRGT); if (!newBox) return GF_OUT_OF_MEM; ((GF_TrackGroupTypeBox*)newBox)->group_type = type; } else if (parent_type && (parent_type == GF_ISOM_BOX_TYPE_GRPL)) { newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_GRPT); if (!newBox) return GF_OUT_OF_MEM; ((GF_EntityToGroupTypeBox*)newBox)->grouping_type = type; } else { //OK, create the box based on the type is_special = GF_FALSE; newBox = gf_isom_box_new_ex(uuid_type ? uuid_type : type, parent_type, skip_logs, is_root_box); if (!newBox) return GF_OUT_OF_MEM; } //OK, init and read this box if (type==GF_ISOM_BOX_TYPE_UUID && !is_special) { memcpy(((GF_UUIDBox *)newBox)->uuid, uuid, 16); ((GF_UUIDBox *)newBox)->internal_4cc = uuid_type; } if (!newBox->type) newBox->type = type; if (restore_type) newBox->type = restore_type; end = gf_bs_available(bs); if (size - hdr_size > end ) { newBox->size = size - hdr_size - end; *outBox = newBox; return GF_ISOM_INCOMPLETE_FILE; } newBox->size = size - hdr_size; e = gf_isom_full_box_read(newBox, bs); if (!e) e = gf_isom_box_read(newBox, bs); if (e) { if (gf_opts_get_bool("core", "no-check")) e = GF_OK; } newBox->size = size; end = gf_bs_get_position(bs); if (uncomp_bs) { gf_free(uncomp_data); gf_bs_del(uncomp_bs); if (e) { gf_isom_box_del(newBox); *outBox = NULL; return e; } //move size to real bitstream offsets for tests below size -= 8; //remember compressed vs real size info for moof in order to properly recompute data_offset/base_data_offset if (type==GF_ISOM_BOX_TYPE_MOOF) { ((GF_MovieFragmentBox *)newBox)->compressed_diff = (s32)size - (s32)compressed_size; } //remember compressed vs real size info for moov in order to properly recompute chunk offset else if (type==GF_ISOM_BOX_TYPE_MOOV) { ((GF_MovieBox *)newBox)->compressed_diff = (s32)size - (s32)compressed_size; ((GF_MovieBox *)newBox)->file_offset = comp_start; } //remember compressed vs real size info for dump else if (type==GF_ISOM_BOX_TYPE_SIDX) { ((GF_SegmentIndexBox *)newBox)->compressed_diff = (s32)size - (s32)compressed_size; } //remember compressed vs real size info for dump else if (type==GF_ISOM_BOX_TYPE_SSIX) { ((GF_SubsegmentIndexBox *)newBox)->compressed_diff = (s32)size - (s32)compressed_size; } newBox->internal_flags = GF_ISOM_BOX_COMPRESSED; } if (e && (e != GF_ISOM_INCOMPLETE_FILE)) { gf_isom_box_del(newBox); *outBox = NULL; if (is_root_box && (e==GF_SKIP_BOX)) e = GF_ISOM_INVALID_FILE; if (!skip_logs && (e!=GF_SKIP_BOX)) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Read Box \"%s\" (start "LLU") failed (%s) - skipping\n", gf_4cc_to_str(type), start, gf_error_to_string(e))); } //we don't try to reparse known boxes that have been failing (too dangerous) return e; } if (end-start > size) { if (!skip_logs) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Box \"%s\" size "LLU" (start "LLU") invalid (read "LLU")\n", gf_4cc_to_str(type), size, start, (end-start) )); } /*let's still try to load the file since no error was notified*/ gf_bs_seek(bs, start+size); } else if (end-start < size) { u32 to_skip = (u32) (size-(end-start)); if (!skip_logs) { if ((to_skip!=4) || gf_bs_peek_bits(bs, 32, 0)) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Box \"%s\" (start "LLU") has %u extra bytes\n", gf_4cc_to_str(type), start, to_skip)); unused_bytes += to_skip; } } gf_bs_skip_bytes(bs, to_skip); } *outBox = newBox; return e; }
0
512,535
int cmp_item_datetime::cmp_not_null(const Value *val) { DBUG_ASSERT(!val->is_null()); DBUG_ASSERT(val->is_temporal()); return value != pack_time(&val->value.m_time); }
0
389,686
typval_compare_string( typval_T *tv1, typval_T *tv2, exprtype_T type, int ic, int *res) { int i = 0; int val = FALSE; char_u *s1, *s2; char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; if (in_vim9script() && ((tv1->v_type != VAR_STRING && tv1->v_type != VAR_SPECIAL) || (tv2->v_type != VAR_STRING && tv2->v_type != VAR_SPECIAL))) { semsg(_(e_cannot_compare_str_with_str), vartype_name(tv1->v_type), vartype_name(tv2->v_type)); return FAIL; } s1 = tv_get_string_buf(tv1, buf1); s2 = tv_get_string_buf(tv2, buf2); if (type != EXPR_MATCH && type != EXPR_NOMATCH) i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2); switch (type) { case EXPR_IS: if (in_vim9script()) { // Really check it is the same string, not just // the same value. val = tv1->vval.v_string == tv2->vval.v_string; break; } // FALLTHROUGH case EXPR_EQUAL: val = (i == 0); break; case EXPR_ISNOT: if (in_vim9script()) { // Really check it is not the same string, not // just a different value. val = tv1->vval.v_string != tv2->vval.v_string; break; } // FALLTHROUGH case EXPR_NEQUAL: val = (i != 0); break; case EXPR_GREATER: val = (i > 0); break; case EXPR_GEQUAL: val = (i >= 0); break; case EXPR_SMALLER: val = (i < 0); break; case EXPR_SEQUAL: val = (i <= 0); break; case EXPR_MATCH: case EXPR_NOMATCH: val = pattern_match(s2, s1, ic); if (type == EXPR_NOMATCH) val = !val; break; default: break; // avoid gcc warning } *res = val; return OK; }
0
293,760
static RList *carve_kexts(RKernelCacheObj *obj, RBinFile *bf) { struct section_t *sections = NULL; if (!(sections = MACH0_(get_sections) (obj->mach0))) { return NULL; } ut64 pa2va_exec = 0; ut64 pa2va_data = 0; ut64 kmod_start = 0, kmod_end = 0; ut64 kmod_info = 0, kmod_info_end = 0; int incomplete = 4; RKmodInfo *all_infos = NULL; int i = 0; for (; !sections[i].last && incomplete > 0; i++) { if (strstr (sections[i].name, "__TEXT_EXEC.__text")) { pa2va_exec = sections[i].addr - sections[i].offset; incomplete--; } if (strstr (sections[i].name, "__DATA.__data")) { pa2va_data = sections[i].addr - sections[i].offset; incomplete--; } if (strstr (sections[i].name, "__PRELINK_INFO.__kmod_start")) { kmod_start = sections[i].offset; kmod_end = kmod_start + sections[i].size; incomplete--; } if (strstr (sections[i].name, "__PRELINK_INFO.__kmod_info")) { kmod_info = sections[i].offset; kmod_info_end = kmod_info + sections[i].size; incomplete--; } } R_FREE (sections); if (incomplete) { return NULL; } RList *kexts = r_list_newf ((RListFree) &r_kext_free); if (!kexts) { return NULL; } int n_kmod_info = (kmod_info_end - kmod_info) / 8; if (n_kmod_info == 0) { goto beach; } all_infos = R_NEWS0 (RKmodInfo, n_kmod_info); if (!all_infos) { goto beach; } ut8 bytes[8]; int j = 0; for (; j < n_kmod_info; j++) { ut64 entry_offset = j * 8 + kmod_info; if (r_buf_read_at (obj->cache_buf, entry_offset, bytes, 8) < 8) { goto beach; } ut64 kmod_info_paddr = K_RPTR (bytes) - pa2va_data; ut64 field_name = kmod_info_paddr + 0x10; ut64 field_start = kmod_info_paddr + 0xb4; if (r_buf_read_at (obj->cache_buf, field_start, bytes, 8) < 8) { goto beach; } all_infos[j].start = K_RPTR (bytes); if (r_buf_read_at (obj->cache_buf, field_name, (ut8 *) all_infos[j].name, 0x40) < 0x40) { goto beach; } all_infos[j].name[0x40] = 0; } ut64 cursor = kmod_start; for(; cursor < kmod_end; cursor += 8) { ut8 bytes[8]; if (r_buf_read_at (obj->cache_buf, cursor, bytes, 8) < 8) { goto beach; } RKext *kext = R_NEW0 (RKext); if (!kext) { goto beach; } kext->vaddr = K_RPTR (bytes); kext->range.offset = kext->vaddr - pa2va_exec; kext->mach0 = create_kext_mach0 (obj, kext, bf); if (!kext->mach0) { r_kext_free (kext); continue; } r_kext_fill_text_range (kext); kext->vaddr = K_PPTR (kext->vaddr); kext->pa2va_exec = pa2va_exec; kext->pa2va_data = pa2va_data; ut64 text_start = kext->vaddr; ut64 text_end = text_start + kext->text_range.size; if (text_start == text_end) { r_kext_free (kext); continue; } for (j = 0; j < n_kmod_info; j++) { if (text_start > all_infos[j].start || all_infos[j].start >= text_end) { continue; } kext->name = strdup (all_infos[j].name); kext->own_name = true; break; } if (!kext->name) { r_kext_free (kext); continue; } r_list_push (kexts, kext); } R_FREE (all_infos); return kexts; beach: r_list_free (kexts); R_FREE (all_infos); return NULL; }
0
353,230
void SplashOutputDev::updateAll(GfxState *state) { updateLineDash(state); updateLineJoin(state); updateLineCap(state); updateLineWidth(state); updateFlatness(state); updateMiterLimit(state); updateStrokeAdjust(state); updateFillColorSpace(state); updateFillColor(state); updateStrokeColorSpace(state); updateStrokeColor(state); needFontUpdate = true; }
0
220,861
constexpr int min_log_x_output_bits(int input_bits) { return input_bits > 90 ? 7 : input_bits > 44 ? 6 : input_bits > 21 ? 5 : input_bits > 10 ? 4 : input_bits > 4 ? 3 : input_bits > 1 ? 2 : 1; }
0
366,284
static void umount_mnt(struct mount *mnt) { put_mountpoint(unhash_mnt(mnt)); }
0
432,348
static int i2c_ddc_tx(I2CSlave *i2c, uint8_t data) { I2CDDCState *s = I2CDDC(i2c); if (s->firstbyte) { s->reg = data; s->firstbyte = false; DPRINTF("[EDID] Written new pointer: %u\n", data); return 0; } /* Ignore all writes */ s->reg++; return 0; }
0
503,982
void auth_request_var_expand(string_t *dest, const char *str, const struct auth_request *auth_request, auth_request_escape_func_t *escape_func) { auth_request_var_expand_with_table(dest, str, auth_request, auth_request_get_var_expand_table(auth_request, escape_func), escape_func); }
0
387,791
int InstanceKlass::mark_osr_nmethods(const Method* m) { // This is a short non-blocking critical region, so the no safepoint check is ok. MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag); nmethod* osr = osr_nmethods_head(); int found = 0; while (osr != NULL) { assert(osr->is_osr_method(), "wrong kind of nmethod found in chain"); if (osr->method() == m) { osr->mark_for_deoptimization(); found++; } osr = osr->osr_link(); } return found; }
0
513,253
static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select, TABLE *table, const key_map *keys,ha_rows limit) { int error; DBUG_ENTER("get_quick_record_count"); uchar buff[STACK_BUFF_ALLOC]; if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) DBUG_RETURN(0); // Fatal error flag is set if (select) { select->head=table; table->reginfo.impossible_range=0; if ((error= select->test_quick_select(thd, *(key_map *)keys,(table_map) 0, limit, 0, FALSE, TRUE /* remove_where_parts*/)) == 1) DBUG_RETURN(select->quick->records); if (error == -1) { table->reginfo.impossible_range=1; DBUG_RETURN(0); } DBUG_PRINT("warning",("Couldn't use record count on const keypart")); } DBUG_RETURN(HA_POS_ERROR); /* This shouldn't happend */ }
0
198,927
RList *r_bin_ne_get_entrypoints(r_bin_ne_obj_t *bin) { if (!bin->entry_table) { return NULL; } RList *entries = r_list_newf (free); if (!entries) { return NULL; } RList *segments = r_bin_ne_get_segments (bin); if (!segments) { r_list_free (entries); return NULL; } if (bin->ne_header->csEntryPoint) { RBinAddr *entry = R_NEW0 (RBinAddr); if (!entry) { r_list_free (entries); return NULL; } entry->bits = 16; ut32 entry_cs = bin->ne_header->csEntryPoint; RBinSection *s = r_list_get_n (segments, entry_cs - 1); entry->paddr = bin->ne_header->ipEntryPoint + (s? s->paddr: 0); r_list_append (entries, entry); } int off = 0; size_t tableat = bin->header_offset + bin->ne_header->EntryTableOffset; while (off < bin->ne_header->EntryTableLength) { if (tableat + off >= r_buf_size (bin->buf)) { break; } ut8 bundle_length = *(ut8 *)(bin->entry_table + off); if (!bundle_length) { break; } off++; ut8 bundle_type = *(ut8 *)(bin->entry_table + off); off++; int i; for (i = 0; i < bundle_length; i++) { if (tableat + off + 4 >= r_buf_size (bin->buf)) { break; } RBinAddr *entry = R_NEW0 (RBinAddr); if (!entry) { r_list_free (entries); return NULL; } off++; if (!bundle_type) { // Skip off--; free (entry); break; } else if (bundle_type == 0xff) { // moveable off += 2; ut8 segnum = *(bin->entry_table + off); off++; ut16 segoff = *(ut16 *)(bin->entry_table + off); if (segnum > 0) { entry->paddr = (ut64)bin->segment_entries[segnum - 1].offset * bin->alignment + segoff; } } else { // Fixed if (bundle_type < bin->ne_header->SegCount) { entry->paddr = (ut64)bin->segment_entries[bundle_type - 1].offset * bin->alignment + *(ut16 *)(bin->entry_table + off); } } off += 2; r_list_append (entries, entry); } } r_list_free (segments); bin->entries = entries; return entries; }
1
231,653
void registerKnobParamHandler( uint64_t paramId, std::function<void(QuicServerConnectionState*, uint64_t)>&& handler) { registerTransportKnobParamHandler(paramId, std::move(handler)); }
0
427,181
static void exprstat (LexState *ls) { /* stat -> func | assignment */ FuncState *fs = ls->fs; struct LHS_assign v; suffixedexp(ls, &v.v); if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */ v.prev = NULL; restassign(ls, &v, 1); } else { /* stat -> func */ Instruction *inst; check_condition(ls, v.v.k == VCALL, "syntax error"); inst = &getinstruction(fs, &v.v); SETARG_C(*inst, 1); /* call statement uses no results */ } }
0
430,362
int seq_path(struct seq_file *m, const struct path *path, const char *esc) { char *buf; size_t size = seq_get_buf(m, &buf); int res = -1; if (size) { char *p = d_path(path, buf, size); if (!IS_ERR(p)) { char *end = mangle_path(buf, p, esc); if (end) res = end - buf; } } seq_commit(m, res); return res; }
0
225,711
GF_Err ctts_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GF_CompositionOffsetBox *ptr = (GF_CompositionOffsetBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->nb_entries); for (i=0; i<ptr->nb_entries; i++ ) { gf_bs_write_u32(bs, ptr->entries[i].sampleCount); if (ptr->version) { gf_bs_write_int(bs, ptr->entries[i].decodingOffset, 32); } else { gf_bs_write_u32(bs, (u32) ptr->entries[i].decodingOffset); } } return GF_OK; }
0
293,502
static gif_result gif_skip_frame_extensions(gif_animation *gif) { const unsigned char *gif_data, *gif_end; ssize_t gif_bytes; ssize_t block_size; /* Get our buffer position etc. */ gif_data = (const unsigned char *)(gif->gif_data + gif->buffer_position); gif_end = (const unsigned char *)(gif->gif_data + gif->buffer_size); gif_bytes = (gif_end - gif_data); /* Skip the extensions */ while (gif_data < gif_end && gif_data[0] == GIF_EXTENSION_INTRODUCER) { ++gif_data; if (gif_data >= gif_end) { return GIF_INSUFFICIENT_FRAME_DATA; } /* Switch on extension label */ switch(gif_data[0]) { case GIF_EXTENSION_COMMENT: /* Move the pointer to the first data sub-block * 1 byte for the extension label */ ++gif_data; break; default: /* Move the pointer to the first data sub-block 2 bytes * for the extension label and size fields Skip the * extension size itself */ if (gif_data + 1 >= gif_end) { return GIF_INSUFFICIENT_FRAME_DATA; } gif_data += (2 + gif_data[1]); } /* Repeatedly skip blocks until we get a zero block or run out * of data This data is ignored by this gif decoder */ gif_bytes = (gif_end - gif_data); block_size = 0; while (gif_data < gif_end && gif_data[0] != GIF_BLOCK_TERMINATOR) { block_size = gif_data[0] + 1; if ((gif_bytes -= block_size) < 0) { return GIF_INSUFFICIENT_FRAME_DATA; } gif_data += block_size; } ++gif_data; } /* Set buffer position and return */ gif->buffer_position = (gif_data - gif->gif_data); return GIF_OK; }
0
353,184
static void splashOutBlendExclusion(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; #ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; src[i] = 255 - src[i]; } } #endif { for (i = 0; i < splashColorModeNComps[cm]; ++i) { blend[i] = dest[i] + src[i] - (2 * dest[i] * src[i]) / 255; } } #ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; src[i] = 255 - src[i]; blend[i] = 255 - blend[i]; } } if (cm == splashModeDeviceN8) { for (i = 4; i < splashColorModeNComps[cm]; ++i) { if (dest[i] == 0 && src[i] == 0) blend[i] = 0; } } #endif }
0
272,336
generate_auth_info(cms_context *cms, SECItem *der, char *url) { AuthInfo ai; SECOidData *oid = SECOID_FindOIDByTag(SEC_OID_PKIX_CA_ISSUERS); if (!oid) cnreterr(-1, cms, "could not get CA issuers OID"); memcpy(&ai.oid, &oid->oid, sizeof (ai.oid)); SECItem urlitem = { .data = (unsigned char *)url, .len = strlen(url), .type = siBuffer }; int rc = make_context_specific(cms, 6, &ai.url, &urlitem); if (rc < 0) return rc; void *ret; SECItem unwrapped; ret = SEC_ASN1EncodeItem(cms->arena, &unwrapped, &ai, AuthInfoTemplate); if (ret == NULL) cnreterr(-1, cms, "could not encode CA Issuers"); rc = wrap_in_seq(cms, der, &unwrapped, 1); if (rc < 0) return rc; return 0; /* I've no idea how to get SEC_ASN1EncodeItem to spit out the thing * we actually want here. So once again, just force the data to * look correct :( */ if (unwrapped.len < 12) cnreterr(-1, cms, "generated CA Issuers Info cannot possibly be valid"); unwrapped.data[12] = 0x86; unwrapped.type = siBuffer; AuthInfo wrapper; oid = SECOID_FindOIDByTag(SEC_OID_X509_AUTH_INFO_ACCESS); if (!oid) cnreterr(-1, cms, "could not find Auth Info Access OID"); memcpy(&wrapper.oid, &oid->oid, sizeof (ai.oid)); wrap_in_seq(cms, &wrapper.url, &unwrapped, 1); ret = SEC_ASN1EncodeItem(cms->arena, der, &wrapper, AuthInfoWrapperTemplate); if (ret == NULL) cnreterr(-1, cms, "could not encode CA Issuers OID"); return 0; }
0
310,295
clear_status_flags_on_sybil(routerstatus_t *rs) { rs->is_authority = rs->is_exit = rs->is_stable = rs->is_fast = rs->is_running = rs->is_named = rs->is_valid = rs->is_v2_dir = rs->is_hs_dir = rs->is_possible_guard = rs->is_bad_exit = rs->is_bad_directory = 0; /* FFFF we might want some mechanism to check later on if we * missed zeroing any flags: it's easy to add a new flag but * forget to add it to this clause. */ }
0
207,150
static SQInteger thread_call(HSQUIRRELVM v) { SQObjectPtr o = stack_get(v,1); if(sq_type(o) == OT_THREAD) { SQInteger nparams = sq_gettop(v); _thread(o)->Push(_thread(o)->_roottable); for(SQInteger i = 2; i<(nparams+1); i++) sq_move(_thread(o),v,i); if(SQ_SUCCEEDED(sq_call(_thread(o),nparams,SQTrue,SQTrue))) { sq_move(v,_thread(o),-1); sq_pop(_thread(o),1); return 1; } v->_lasterror = _thread(o)->_lasterror; return SQ_ERROR; } return sq_throwerror(v,_SC("wrong parameter")); }
1
314,473
static int FNAME(page_fault)(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) { struct guest_walker walker; int r; unsigned long mmu_seq; bool is_self_change_mapping; pgprintk("%s: addr %lx err %x\n", __func__, fault->addr, fault->error_code); WARN_ON_ONCE(fault->is_tdp); /* * Look up the guest pte for the faulting address. * If PFEC.RSVD is set, this is a shadow page fault. * The bit needs to be cleared before walking guest page tables. */ r = FNAME(walk_addr)(&walker, vcpu, fault->addr, fault->error_code & ~PFERR_RSVD_MASK); /* * The page is not mapped by the guest. Let the guest handle it. */ if (!r) { pgprintk("%s: guest page fault\n", __func__); if (!fault->prefetch) kvm_inject_emulated_page_fault(vcpu, &walker.fault); return RET_PF_RETRY; } fault->gfn = walker.gfn; fault->slot = kvm_vcpu_gfn_to_memslot(vcpu, fault->gfn); if (page_fault_handle_page_track(vcpu, fault)) { shadow_page_table_clear_flood(vcpu, fault->addr); return RET_PF_EMULATE; } r = mmu_topup_memory_caches(vcpu, true); if (r) return r; vcpu->arch.write_fault_to_shadow_pgtable = false; is_self_change_mapping = FNAME(is_self_change_mapping)(vcpu, &walker, fault->user, &vcpu->arch.write_fault_to_shadow_pgtable); if (is_self_change_mapping) fault->max_level = PG_LEVEL_4K; else fault->max_level = walker.level; mmu_seq = vcpu->kvm->mmu_notifier_seq; smp_rmb(); if (kvm_faultin_pfn(vcpu, fault, &r)) return r; if (handle_abnormal_pfn(vcpu, fault, walker.pte_access, &r)) return r; /* * Do not change pte_access if the pfn is a mmio page, otherwise * we will cache the incorrect access into mmio spte. */ if (fault->write && !(walker.pte_access & ACC_WRITE_MASK) && !is_cr0_wp(vcpu->arch.mmu) && !fault->user && fault->slot) { walker.pte_access |= ACC_WRITE_MASK; walker.pte_access &= ~ACC_USER_MASK; /* * If we converted a user page to a kernel page, * so that the kernel can write to it when cr0.wp=0, * then we should prevent the kernel from executing it * if SMEP is enabled. */ if (is_cr4_smep(vcpu->arch.mmu)) walker.pte_access &= ~ACC_EXEC_MASK; } r = RET_PF_RETRY; write_lock(&vcpu->kvm->mmu_lock); if (is_page_fault_stale(vcpu, fault, mmu_seq)) goto out_unlock; r = make_mmu_pages_available(vcpu); if (r) goto out_unlock; r = FNAME(fetch)(vcpu, fault, &walker); out_unlock: write_unlock(&vcpu->kvm->mmu_lock); kvm_release_pfn_clean(fault->pfn); return r; }
0
254,035
static void init_vdev(struct video_device *vdev, int nr) { MARK(); vidioc_fill_name(vdev->name, sizeof(vdev->name), nr); #ifdef V4L2LOOPBACK_WITH_STD vdev->tvnorms = V4L2_STD_ALL; #endif /* V4L2LOOPBACK_WITH_STD */ vdev->vfl_type = VFL_TYPE_VIDEO; vdev->fops = &v4l2_loopback_fops; vdev->ioctl_ops = &v4l2_loopback_ioctl_ops; vdev->release = &video_device_release; vdev->minor = -1; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) vdev->device_caps = V4L2_CAP_DEVICE_CAPS | #ifdef V4L2_CAP_VIDEO_M2M V4L2_CAP_VIDEO_M2M | #endif V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; #endif if (debug > 1) #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 20, 0) vdev->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; #else vdev->dev_debug = V4L2_DEV_DEBUG_IOCTL | V4L2_DEV_DEBUG_IOCTL_ARG; #endif /* since kernel-3.7, there is a new field 'vfl_dir' that has to be * set to VFL_DIR_M2M for bidrectional devices */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) vdev->vfl_dir = VFL_DIR_M2M; #endif MARK(); }
0
513,349
void dbug_serve_apcs(THD *thd, int n_calls) { const char *save_proc_info= thd->proc_info; /* Busy-wait for n_calls APC requests to arrive and be processed */ int n_apcs= thd->apc_target.n_calls_processed + n_calls; while (thd->apc_target.n_calls_processed < n_apcs) { /* This is so that mysqltest knows we're ready to serve requests: */ thd_proc_info(thd, "show_explain_trap"); my_sleep(30000); thd_proc_info(thd, save_proc_info); if (thd->check_killed()) break; } }
0
291,809
__rtrs_get_permit(struct rtrs_clt_sess *clt, enum rtrs_clt_con_type con_type) { size_t max_depth = clt->queue_depth; struct rtrs_permit *permit; int bit; /* * Adapted from null_blk get_tag(). Callers from different cpus may * grab the same bit, since find_first_zero_bit is not atomic. * But then the test_and_set_bit_lock will fail for all the * callers but one, so that they will loop again. * This way an explicit spinlock is not required. */ do { bit = find_first_zero_bit(clt->permits_map, max_depth); if (bit >= max_depth) return NULL; } while (test_and_set_bit_lock(bit, clt->permits_map)); permit = get_permit(clt, bit); WARN_ON(permit->mem_id != bit); permit->cpu_id = raw_smp_processor_id(); permit->con_type = con_type; return permit; }
0
226,267
} GF_Err jp2h_box_read(GF_Box *s,GF_BitStream *bs) { return gf_isom_box_array_read_ex(s, bs, s->type);
0
244,364
void reftype_box_del(GF_Box *s) { GF_TrackReferenceTypeBox *ptr = (GF_TrackReferenceTypeBox *)s; if (!ptr) return; if (ptr->trackIDs) gf_free(ptr->trackIDs); gf_free(ptr); }
0
226,031
GF_Box *npck_box_new() { ISOM_DECL_BOX_ALLOC(GF_NPCKBox, GF_ISOM_BOX_TYPE_NPCK); return (GF_Box *)tmp; }
0
318,940
f_test_null_string(typval_T *argvars UNUSED, typval_T *rettv) { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; }
0
219,943
int callback_glewlwyd_user_update_profile (const struct _u_request * request, struct _u_response * response, void * user_data) { struct config_elements * config = (struct config_elements *)user_data; json_t * j_profile, * j_result; j_profile = ulfius_get_json_body_request(request, NULL); if (j_profile != NULL && json_is_object(j_profile)) { j_result = user_set_profile(config, json_string_value(json_object_get((json_t *)response->shared_data, "username")), j_profile); if (check_result_value(j_result, G_ERROR_PARAM)) { if (json_object_get(j_result, "error") != NULL) { ulfius_set_json_body_response(response, 400, json_object_get(j_result, "error")); } else { response->status = 400; } } else if (!check_result_value(j_result, G_OK)) { y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_user_update_profile - Error user_set_profile"); response->status = 500; } else { y_log_message(Y_LOG_LEVEL_INFO, "Event - User '%s' updated (profile)", json_string_value(json_object_get((json_t *)response->shared_data, "username"))); } json_decref(j_result); } else { response->status = 400; } json_decref(j_profile); return U_CALLBACK_CONTINUE; }
0
389,670
check_for_opt_string_or_list_arg(typval_T *args, int idx) { return (args[idx].v_type == VAR_UNKNOWN || check_for_string_or_list_arg(args, idx)); }
0
436,053
static void io_clean_op(struct io_kiocb *req) { if (req->flags & REQ_F_BUFFER_SELECTED) { switch (req->opcode) { case IORING_OP_READV: case IORING_OP_READ_FIXED: case IORING_OP_READ: kfree((void *)(unsigned long)req->rw.addr); break; case IORING_OP_RECVMSG: case IORING_OP_RECV: kfree(req->sr_msg.kbuf); break; } } if (req->flags & REQ_F_NEED_CLEANUP) { switch (req->opcode) { case IORING_OP_READV: case IORING_OP_READ_FIXED: case IORING_OP_READ: case IORING_OP_WRITEV: case IORING_OP_WRITE_FIXED: case IORING_OP_WRITE: { struct io_async_rw *io = req->async_data; kfree(io->free_iovec); break; } case IORING_OP_RECVMSG: case IORING_OP_SENDMSG: { struct io_async_msghdr *io = req->async_data; kfree(io->free_iov); break; } case IORING_OP_SPLICE: case IORING_OP_TEE: if (!(req->splice.flags & SPLICE_F_FD_IN_FIXED)) io_put_file(req->splice.file_in); break; case IORING_OP_OPENAT: case IORING_OP_OPENAT2: if (req->open.filename) putname(req->open.filename); break; case IORING_OP_RENAMEAT: putname(req->rename.oldpath); putname(req->rename.newpath); break; case IORING_OP_UNLINKAT: putname(req->unlink.filename); break; } } if ((req->flags & REQ_F_POLLED) && req->apoll) { kfree(req->apoll->double_poll); kfree(req->apoll); req->apoll = NULL; } if (req->flags & REQ_F_INFLIGHT) { struct io_uring_task *tctx = req->task->io_uring; atomic_dec(&tctx->inflight_tracked); } if (req->flags & REQ_F_CREDS) put_cred(req->creds); req->flags &= ~IO_REQ_CLEAN_FLAGS;
0
221,153
void gf_odf_dovi_cfg_del(GF_DOVIDecoderConfigurationRecord *cfg) { gf_free(cfg); }
0
256,426
PJ_DEF(pj_status_t) pjmedia_rtcp_get_ntp_time(const pjmedia_rtcp_session *sess, pjmedia_rtcp_ntp_rec *ntp) { /* Seconds between 1900-01-01 to 1970-01-01 */ #define JAN_1970 (2208988800UL) pj_timestamp ts; pj_status_t status; status = pj_get_timestamp(&ts); /* Fill up the high 32bit part */ ntp->hi = (pj_uint32_t)((ts.u64 - sess->ts_base.u64) / sess->ts_freq.u64) + sess->tv_base.sec + JAN_1970; /* Calculate seconds fractions */ ts.u64 = (ts.u64 - sess->ts_base.u64) % sess->ts_freq.u64; pj_assert(ts.u64 < sess->ts_freq.u64); ts.u64 = (ts.u64 << 32) / sess->ts_freq.u64; /* Fill up the low 32bit part */ ntp->lo = ts.u32.lo; #if (defined(PJ_WIN32) && PJ_WIN32!=0) || \ (defined(PJ_WIN64) && PJ_WIN64!=0) || \ (defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0) /* On Win32, since we use QueryPerformanceCounter() as the backend * timestamp API, we need to protect against this bug: * Performance counter value may unexpectedly leap forward * http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q274323 */ { /* * Compare elapsed time reported by timestamp with actual elapsed * time. If the difference is too excessive, then we use system * time instead. */ /* MIN_DIFF needs to be large enough so that "normal" diff caused * by system activity or context switch doesn't trigger the time * correction. */ enum { MIN_DIFF = 400 }; pj_time_val ts_time, elapsed, diff; pj_gettimeofday(&elapsed); ts_time.sec = ntp->hi - sess->tv_base.sec - JAN_1970; ts_time.msec = (long)(ntp->lo * 1000.0 / 0xFFFFFFFF); PJ_TIME_VAL_SUB(elapsed, sess->tv_base); if (PJ_TIME_VAL_LT(ts_time, elapsed)) { diff = elapsed; PJ_TIME_VAL_SUB(diff, ts_time); } else { diff = ts_time; PJ_TIME_VAL_SUB(diff, elapsed); } if (PJ_TIME_VAL_MSEC(diff) >= MIN_DIFF) { TRACE_((sess->name, "RTCP NTP timestamp corrected by %d ms", PJ_TIME_VAL_MSEC(diff))); ntp->hi = elapsed.sec + sess->tv_base.sec + JAN_1970; ntp->lo = (elapsed.msec * 65536 / 1000) << 16; } } #endif return status; }
0
437,329
setup_anchor(Node* node, regex_t* reg, int state, ScanEnv* env) { /* allowed node types in look-behind */ #define ALLOWED_TYPE_IN_LB \ ( NODE_BIT_LIST | NODE_BIT_ALT | NODE_BIT_STRING | NODE_BIT_CCLASS \ | NODE_BIT_CTYPE | NODE_BIT_ANCHOR | NODE_BIT_ENCLOSURE | NODE_BIT_QUANT \ | NODE_BIT_CALL | NODE_BIT_GIMMICK) #define ALLOWED_ENCLOSURE_IN_LB ( 1<<ENCLOSURE_MEMORY | 1<<ENCLOSURE_OPTION ) #define ALLOWED_ENCLOSURE_IN_LB_NOT (1<<ENCLOSURE_OPTION) #define ALLOWED_ANCHOR_IN_LB \ ( ANCHOR_LOOK_BEHIND | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF \ | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUNDARY | ANCHOR_NO_WORD_BOUNDARY \ | ANCHOR_WORD_BEGIN | ANCHOR_WORD_END \ | ANCHOR_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY \ | ANCHOR_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY ) #define ALLOWED_ANCHOR_IN_LB_NOT \ ( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE \ | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUNDARY \ | ANCHOR_NO_WORD_BOUNDARY | ANCHOR_WORD_BEGIN | ANCHOR_WORD_END \ | ANCHOR_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY \ | ANCHOR_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY ) int r; AnchorNode* an = ANCHOR_(node); switch (an->type) { case ANCHOR_PREC_READ: r = setup_tree(NODE_ANCHOR_BODY(an), reg, state, env); break; case ANCHOR_PREC_READ_NOT: r = setup_tree(NODE_ANCHOR_BODY(an), reg, (state | IN_NOT), env); break; case ANCHOR_LOOK_BEHIND: { r = check_type_tree(NODE_ANCHOR_BODY(an), ALLOWED_TYPE_IN_LB, ALLOWED_ENCLOSURE_IN_LB, ALLOWED_ANCHOR_IN_LB); if (r < 0) return r; if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; r = setup_tree(NODE_ANCHOR_BODY(an), reg, state, env); if (r != 0) return r; r = setup_look_behind(node, reg, env); } break; case ANCHOR_LOOK_BEHIND_NOT: { r = check_type_tree(NODE_ANCHOR_BODY(an), ALLOWED_TYPE_IN_LB, ALLOWED_ENCLOSURE_IN_LB_NOT, ALLOWED_ANCHOR_IN_LB_NOT); if (r < 0) return r; if (r > 0) return ONIGERR_INVALID_LOOK_BEHIND_PATTERN; r = setup_tree(NODE_ANCHOR_BODY(an), reg, (state | IN_NOT), env); if (r != 0) return r; r = setup_look_behind(node, reg, env); } break; default: r = 0; break; } return r; }
0
312,383
qf_find_win(qf_info_T *qi) { win_T *win; FOR_ALL_WINDOWS(win) if (is_qf_win(win, qi)) return win; return NULL; }
0
252,313
mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning) { MZ_FILE *pFile; pZip->m_pWrite = mz_zip_file_write_func; pZip->m_pIO_opaque = pZip; if (!mz_zip_writer_init(pZip, size_to_reserve_at_beginning)) return MZ_FALSE; if (NULL == (pFile = MZ_FOPEN(pFilename, "wb"))) { mz_zip_writer_end(pZip); return MZ_FALSE; } pZip->m_pState->m_pFile = pFile; if (size_to_reserve_at_beginning) { mz_uint64 cur_ofs = 0; char buf[4096]; MZ_CLEAR_OBJ(buf); do { size_t n = (size_t)MZ_MIN(sizeof(buf), size_to_reserve_at_beginning); if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_ofs, buf, n) != n) { mz_zip_writer_end(pZip); return MZ_FALSE; } cur_ofs += n; size_to_reserve_at_beginning -= n; } while (size_to_reserve_at_beginning); } return MZ_TRUE; }
0
276,997
fiber_init(mrb_state *mrb, mrb_value self) { static const struct mrb_context mrb_context_zero = { 0 }; struct RFiber *f = fiber_ptr(self); struct mrb_context *c; struct RProc *p; mrb_callinfo *ci; mrb_value blk; size_t slen; mrb_get_args(mrb, "&!", &blk); if (f->cxt) { mrb_raise(mrb, E_RUNTIME_ERROR, "cannot initialize twice"); } p = mrb_proc_ptr(blk); if (MRB_PROC_CFUNC_P(p)) { mrb_raise(mrb, E_FIBER_ERROR, "tried to create Fiber from C defined method"); } c = (struct mrb_context*)mrb_malloc(mrb, sizeof(struct mrb_context)); *c = mrb_context_zero; f->cxt = c; /* initialize VM stack */ slen = FIBER_STACK_INIT_SIZE; if (p->body.irep->nregs > slen) { slen += p->body.irep->nregs; } c->stbase = (mrb_value *)mrb_malloc(mrb, slen*sizeof(mrb_value)); c->stend = c->stbase + slen; { mrb_value *p = c->stbase; mrb_value *pend = c->stend; while (p < pend) { SET_NIL_VALUE(*p); p++; } } /* copy receiver from a block */ c->stbase[0] = mrb->c->ci->stack[0]; /* initialize callinfo stack */ c->cibase = (mrb_callinfo *)mrb_calloc(mrb, FIBER_CI_INIT_SIZE, sizeof(mrb_callinfo)); c->ciend = c->cibase + FIBER_CI_INIT_SIZE; c->ci = c->cibase; /* adjust return callinfo */ ci = c->ci; mrb_vm_ci_target_class_set(ci, MRB_PROC_TARGET_CLASS(p)); mrb_vm_ci_proc_set(ci, p); mrb_field_write_barrier(mrb, (struct RBasic*)mrb_obj_ptr(self), (struct RBasic*)p); ci->stack = c->stbase; ci[1] = ci[0]; c->ci++; /* push dummy callinfo */ c->fib = f; c->status = MRB_FIBER_CREATED; return self; }
0
223,441
static BOOL check_fast_forward_char_pair_simd(compiler_common *common, fast_forward_char_data *chars, int max) { sljit_s32 i, j, max_i = 0, max_j = 0; sljit_u32 max_pri = 0; PCRE2_UCHAR a1, a2, a_pri, b1, b2, b_pri; for (i = max - 1; i >= 1; i--) { if (chars[i].last_count > 2) { a1 = chars[i].chars[0]; a2 = chars[i].chars[1]; a_pri = chars[i].last_count; j = i - max_fast_forward_char_pair_offset(); if (j < 0) j = 0; while (j < i) { b_pri = chars[j].last_count; if (b_pri > 2 && a_pri + b_pri >= max_pri) { b1 = chars[j].chars[0]; b2 = chars[j].chars[1]; if (a1 != b1 && a1 != b2 && a2 != b1 && a2 != b2) { max_pri = a_pri + b_pri; max_i = i; max_j = j; } } j++; } } } if (max_pri == 0) return FALSE; fast_forward_char_pair_simd(common, max_i, chars[max_i].chars[0], chars[max_i].chars[1], max_j, chars[max_j].chars[0], chars[max_j].chars[1]); return TRUE; }
0
512,591
void fix_charset_and_length_from_str_value(const String &str, Derivation dv) { fix_charset_and_length(str.charset(), dv, Metadata(&str)); }
0
356,711
void Statement::Work_AfterRun(napi_env e, napi_status status, void* data) { std::unique_ptr<RunBaton> baton(static_cast<RunBaton*>(data)); Statement* stmt = baton->stmt; Napi::Env env = stmt->Env(); Napi::HandleScope scope(env); if (stmt->status != SQLITE_ROW && stmt->status != SQLITE_DONE) { Error(baton.get()); } else { // Fire callbacks. Napi::Function cb = baton->callback.Value(); if (!cb.IsUndefined() && cb.IsFunction()) { (stmt->Value()).Set(Napi::String::New(env, "lastID"), Napi::Number::New(env, baton->inserted_id)); (stmt->Value()).Set( Napi::String::New(env, "changes"), Napi::Number::New(env, baton->changes)); Napi::Value argv[] = { env.Null() }; TRY_CATCH_CALL(stmt->Value(), cb, 1, argv); } } STATEMENT_END(); }
0
261,390
de265_error read_slice_segment_data(thread_context* tctx) { setCtbAddrFromTS(tctx); de265_image* img = tctx->img; const pic_parameter_set& pps = img->get_pps(); const seq_parameter_set& sps = img->get_sps(); slice_segment_header* shdr = tctx->shdr; bool success = initialize_CABAC_at_slice_segment_start(tctx); if (!success) { return DE265_ERROR_UNSPECIFIED_DECODING_ERROR; } init_CABAC_decoder_2(&tctx->cabac_decoder); //printf("-----\n"); bool first_slice_substream = !shdr->dependent_slice_segment_flag; int substream=0; enum DecodeResult result; do { int ctby = tctx->CtbY; // check whether entry_points[] are correct in the bitstream if (substream>0) { if (substream-1 >= tctx->shdr->entry_point_offset.size() || tctx->cabac_decoder.bitstream_curr - tctx->cabac_decoder.bitstream_start -2 /* -2 because of CABAC init */ != tctx->shdr->entry_point_offset[substream-1]) { tctx->decctx->add_warning(DE265_WARNING_INCORRECT_ENTRY_POINT_OFFSET, true); } } substream++; result = decode_substream(tctx, false, first_slice_substream); if (result == Decode_EndOfSliceSegment || result == Decode_Error) { break; } first_slice_substream = false; if (pps.tiles_enabled_flag) { initialize_CABAC_models(tctx); } } while (true); return DE265_OK; }
0
225,124
void CreateNgrams(const tstring* data, tstring* output, int num_ngrams, int ngram_width) const { for (int ngram_index = 0; ngram_index < num_ngrams; ++ngram_index) { int pad_width = get_pad_width(ngram_width); int left_padding = std::max(0, pad_width - ngram_index); int right_padding = std::max(0, pad_width - (num_ngrams - (ngram_index + 1))); int num_tokens = ngram_width - (left_padding + right_padding); int data_start_index = left_padding > 0 ? 0 : ngram_index - pad_width; // Calculate the total expected size of the ngram so we can reserve the // correct amount of space in the string. int ngram_size = 0; // Size of the left padding. ngram_size += left_padding * left_pad_.length(); // Size of the tokens. for (int n = 0; n < num_tokens; ++n) { ngram_size += data[data_start_index + n].length(); } // Size of the right padding. ngram_size += right_padding * right_pad_.length(); // Size of the separators. int num_separators = left_padding + right_padding + num_tokens - 1; ngram_size += num_separators * separator_.length(); // Build the ngram. tstring* ngram = &output[ngram_index]; ngram->reserve(ngram_size); for (int n = 0; n < left_padding; ++n) { ngram->append(left_pad_); ngram->append(separator_); } // Only output first num_tokens - 1 pairs of data and separator for (int n = 0; n < num_tokens - 1; ++n) { ngram->append(data[data_start_index + n]); ngram->append(separator_); } // Handle case when there are no tokens or no right padding as these can // result in consecutive separators. if (num_tokens > 0) { // If we have tokens, then output last and then pair each separator with // the right padding that follows, to ensure ngram ends either with the // token or with the right pad. ngram->append(data[data_start_index + num_tokens - 1]); for (int n = 0; n < right_padding; ++n) { ngram->append(separator_); ngram->append(right_pad_); } } else { // If we don't have tokens, then the last item inserted into the ngram // has been the separator from the left padding loop above. Hence, // output right pad and separator and make sure to finish with a // padding, not a separator. for (int n = 0; n < right_padding - 1; ++n) { ngram->append(right_pad_); ngram->append(separator_); } ngram->append(right_pad_); } // In debug mode only: validate that we've reserved enough space for the // ngram. DCHECK_EQ(ngram_size, ngram->size()); } }
0
344,242
l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { CallInfo *ci = L->ci; const char *msg; va_list argp; luaC_checkGC(L); /* error message uses memory */ va_start(argp, fmt); msg = luaO_pushvfstring(L, fmt, argp); /* format message */ va_end(argp); if (isLua(ci)) { /* if Lua function, add source:line information */ luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci)); setobjs2s(L, L->top - 2, L->top - 1); /* remove 'msg' from the stack */ L->top--; } luaG_errormsg(L); }
0
198,161
static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image, *image2=NULL, *rotated_image; register Quantum *q; unsigned int status; MATHeader MATLAB_HDR; size_t size; size_t CellType; QuantumInfo *quantum_info; ImageInfo *clone_info; int i; ssize_t ldblk; unsigned char *BImgBuff = NULL; double MinVal, MaxVal; unsigned z, z2; unsigned Frames; int logging; int sample_size; MagickOffsetType filepos=0x80; BlobInfo *blob; size_t one; unsigned int (*ReadBlobXXXLong)(Image *image); unsigned short (*ReadBlobXXXShort)(Image *image); void (*ReadBlobDoublesXXX)(Image * image, size_t len, double *data); void (*ReadBlobFloatsXXX)(Image * image, size_t len, float *data); assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); logging = LogMagickEvent(CoderEvent,GetMagickModule(),"enter"); /* Open image file. */ image = AcquireImage(image_info,exception); status = OpenBlob(image_info, image, ReadBinaryBlobMode, exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read MATLAB image. */ clone_info=CloneImageInfo(image_info); if(ReadBlob(image,124,(unsigned char *) &MATLAB_HDR.identific) != 124) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); MATLAB_HDR.Version = ReadBlobLSBShort(image); if(ReadBlob(image,2,(unsigned char *) &MATLAB_HDR.EndianIndicator) != 2) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule()," Endian %c%c", MATLAB_HDR.EndianIndicator[0],MATLAB_HDR.EndianIndicator[1]); if (!strncmp(MATLAB_HDR.EndianIndicator, "IM", 2)) { ReadBlobXXXLong = ReadBlobLSBLong; ReadBlobXXXShort = ReadBlobLSBShort; ReadBlobDoublesXXX = ReadBlobDoublesLSB; ReadBlobFloatsXXX = ReadBlobFloatsLSB; image->endian = LSBEndian; } else if (!strncmp(MATLAB_HDR.EndianIndicator, "MI", 2)) { ReadBlobXXXLong = ReadBlobMSBLong; ReadBlobXXXShort = ReadBlobMSBShort; ReadBlobDoublesXXX = ReadBlobDoublesMSB; ReadBlobFloatsXXX = ReadBlobFloatsMSB; image->endian = MSBEndian; } else goto MATLAB_KO; /* unsupported endian */ if (strncmp(MATLAB_HDR.identific, "MATLAB", 6)) MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader"); filepos = TellBlob(image); while(!EOFBlob(image)) /* object parser loop */ { Frames = 1; (void) SeekBlob(image,filepos,SEEK_SET); /* printf("pos=%X\n",TellBlob(image)); */ MATLAB_HDR.DataType = ReadBlobXXXLong(image); if(EOFBlob(image)) break; MATLAB_HDR.ObjectSize = ReadBlobXXXLong(image); if(EOFBlob(image)) break; filepos += MATLAB_HDR.ObjectSize + 4 + 4; image2 = image; #if defined(MAGICKCORE_ZLIB_DELEGATE) if(MATLAB_HDR.DataType == miCOMPRESSED) { image2 = DecompressBlock(image,MATLAB_HDR.ObjectSize,clone_info,exception); if(image2==NULL) continue; MATLAB_HDR.DataType = ReadBlobXXXLong(image2); /* replace compressed object type. */ } #endif if(MATLAB_HDR.DataType!=miMATRIX) continue; /* skip another objects. */ MATLAB_HDR.unknown1 = ReadBlobXXXLong(image2); MATLAB_HDR.unknown2 = ReadBlobXXXLong(image2); MATLAB_HDR.unknown5 = ReadBlobXXXLong(image2); MATLAB_HDR.StructureClass = MATLAB_HDR.unknown5 & 0xFF; MATLAB_HDR.StructureFlag = (MATLAB_HDR.unknown5>>8) & 0xFF; MATLAB_HDR.unknown3 = ReadBlobXXXLong(image2); if(image!=image2) MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); /* ??? don't understand why ?? */ MATLAB_HDR.unknown4 = ReadBlobXXXLong(image2); MATLAB_HDR.DimFlag = ReadBlobXXXLong(image2); MATLAB_HDR.SizeX = ReadBlobXXXLong(image2); MATLAB_HDR.SizeY = ReadBlobXXXLong(image2); switch(MATLAB_HDR.DimFlag) { case 8: z2=z=1; break; /* 2D matrix*/ case 12: z2=z = ReadBlobXXXLong(image2); /* 3D matrix RGB*/ (void) ReadBlobXXXLong(image2); if(z!=3) ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); break; case 16: z2=z = ReadBlobXXXLong(image2); /* 4D matrix animation */ if(z!=3 && z!=1) ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); Frames = ReadBlobXXXLong(image2); break; default: ThrowReaderException(CoderError, "MultidimensionalMatricesAreNotSupported"); } MATLAB_HDR.Flag1 = ReadBlobXXXShort(image2); MATLAB_HDR.NameFlag = ReadBlobXXXShort(image2); if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), "MATLAB_HDR.StructureClass %d",MATLAB_HDR.StructureClass); if (MATLAB_HDR.StructureClass != mxCHAR_CLASS && MATLAB_HDR.StructureClass != mxSINGLE_CLASS && /* float + complex float */ MATLAB_HDR.StructureClass != mxDOUBLE_CLASS && /* double + complex double */ MATLAB_HDR.StructureClass != mxINT8_CLASS && MATLAB_HDR.StructureClass != mxUINT8_CLASS && /* uint8 + uint8 3D */ MATLAB_HDR.StructureClass != mxINT16_CLASS && MATLAB_HDR.StructureClass != mxUINT16_CLASS && /* uint16 + uint16 3D */ MATLAB_HDR.StructureClass != mxINT32_CLASS && MATLAB_HDR.StructureClass != mxUINT32_CLASS && /* uint32 + uint32 3D */ MATLAB_HDR.StructureClass != mxINT64_CLASS && MATLAB_HDR.StructureClass != mxUINT64_CLASS) /* uint64 + uint64 3D */ ThrowReaderException(CoderError,"UnsupportedCellTypeInTheMatrix"); switch (MATLAB_HDR.NameFlag) { case 0: size = ReadBlobXXXLong(image2); /* Object name string size */ size = 4 * (ssize_t) ((size + 3 + 1) / 4); (void) SeekBlob(image2, size, SEEK_CUR); break; case 1: case 2: case 3: case 4: (void) ReadBlob(image2, 4, (unsigned char *) &size); /* Object name string */ break; default: goto MATLAB_KO; } CellType = ReadBlobXXXLong(image2); /* Additional object type */ if (logging) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "MATLAB_HDR.CellType: %.20g",(double) CellType); (void) ReadBlob(image2, 4, (unsigned char *) &size); /* data size */ NEXT_FRAME: switch (CellType) { case miINT8: case miUINT8: sample_size = 8; if(MATLAB_HDR.StructureFlag & FLAG_LOGICAL) image->depth = 1; else image->depth = 8; /* Byte type cell */ ldblk = (ssize_t) MATLAB_HDR.SizeX; break; case miINT16: case miUINT16: sample_size = 16; image->depth = 16; /* Word type cell */ ldblk = (ssize_t) (2 * MATLAB_HDR.SizeX); break; case miINT32: case miUINT32: sample_size = 32; image->depth = 32; /* Dword type cell */ ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX); break; case miINT64: case miUINT64: sample_size = 64; image->depth = 64; /* Qword type cell */ ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX); break; case miSINGLE: sample_size = 32; image->depth = 32; /* double type cell */ (void) SetImageOption(clone_info,"quantum:format","floating-point"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex float type cell */ } ldblk = (ssize_t) (4 * MATLAB_HDR.SizeX); break; case miDOUBLE: sample_size = 64; image->depth = 64; /* double type cell */ (void) SetImageOption(clone_info,"quantum:format","floating-point"); DisableMSCWarning(4127) if (sizeof(double) != 8) RestoreMSCWarning ThrowReaderException(CoderError, "IncompatibleSizeOfDouble"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex double type cell */ } ldblk = (ssize_t) (8 * MATLAB_HDR.SizeX); break; default: ThrowReaderException(CoderError, "UnsupportedCellTypeInTheMatrix"); } (void) sample_size; image->columns = MATLAB_HDR.SizeX; image->rows = MATLAB_HDR.SizeY; quantum_info=AcquireQuantumInfo(clone_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); one=1; image->colors = one << image->depth; if (image->columns == 0 || image->rows == 0) goto MATLAB_KO; /* Image is gray when no complex flag is set and 2D Matrix */ if ((MATLAB_HDR.DimFlag == 8) && ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) { image->type=GrayscaleType; SetImageColorspace(image,GRAYColorspace,exception); } /* If ping is true, then only set image size and colors without reading any image data. */ if (image_info->ping) { size_t temp = image->columns; image->columns = image->rows; image->rows = temp; goto done_reading; /* !!!!!! BAD !!!! */ } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); /* ----- Load raster data ----- */ BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(double)); /* Ldblk was set in the check phase */ if (BImgBuff == NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); MinVal = 0; MaxVal = 0; if (CellType==miDOUBLE || CellType==miSINGLE) /* Find Min and Max Values for floats */ { CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &quantum_info->minimum, &quantum_info->maximum); } /* Main loop for reading all scanlines */ if(z==1) z=0; /* read grey scanlines */ /* else read color scanlines */ do { for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception); if (q == (Quantum *) NULL) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT set image pixels returns unexpected NULL on a row %u.", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto done_reading; /* Skip image rotation, when cannot set image pixels */ } if(ReadBlob(image2,ldblk,(unsigned char *)BImgBuff) != (ssize_t) ldblk) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT cannot read scanrow %u from a file.", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto ExitLoop; } if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL)) { FixLogical((unsigned char *)BImgBuff,ldblk); if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0) { ImportQuantumPixelsFailed: if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT failed to ImportQuantumPixels for a row %u", (unsigned)(MATLAB_HDR.SizeY-i-1)); break; } } else { if(ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,z2qtype[z],BImgBuff,exception) <= 0) goto ImportQuantumPixelsFailed; if (z<=1 && /* fix only during a last pass z==0 || z==1 */ (CellType==miINT8 || CellType==miINT16 || CellType==miINT32 || CellType==miINT64)) FixSignedValues(image,q,MATLAB_HDR.SizeX); } if (!SyncAuthenticPixels(image,exception)) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT failed to sync image pixels for a row %u", (unsigned)(MATLAB_HDR.SizeY-i-1)); goto ExitLoop; } } } while(z-- >= 2); ExitLoop: /* Read complex part of numbers here */ if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* Find Min and Max Values for complex parts of floats */ CellType = ReadBlobXXXLong(image2); /* Additional object type */ i = ReadBlobXXXLong(image2); /* size of a complex part - toss away*/ if (CellType==miDOUBLE || CellType==miSINGLE) { CalcMinMax(image2, image_info->endian, MATLAB_HDR.SizeX, MATLAB_HDR.SizeY, CellType, ldblk, BImgBuff, &MinVal, &MaxVal); } if (CellType==miDOUBLE) for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { ReadBlobDoublesXXX(image2, ldblk, (double *)BImgBuff); InsertComplexDoubleRow(image, (double *)BImgBuff, i, MinVal, MaxVal, exception); } if (CellType==miSINGLE) for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { ReadBlobFloatsXXX(image2, ldblk, (float *)BImgBuff); InsertComplexFloatRow(image,(float *)BImgBuff,i,MinVal,MaxVal, exception); } } /* Image is gray when no complex flag is set and 2D Matrix AGAIN!!! */ if ((MATLAB_HDR.DimFlag == 8) && ((MATLAB_HDR.StructureFlag & FLAG_COMPLEX) == 0)) image->type=GrayscaleType; if (image->depth == 1) image->type=BilevelType; if(image2==image) image2 = NULL; /* Remove shadow copy to an image before rotation. */ /* Rotate image. */ rotated_image = RotateImage(image, 90.0, exception); if (rotated_image != (Image *) NULL) { /* Remove page offsets added by RotateImage */ rotated_image->page.x=0; rotated_image->page.y=0; blob = rotated_image->blob; rotated_image->blob = image->blob; rotated_image->colors = image->colors; image->blob = blob; AppendImageToList(&image,rotated_image); DeleteImageFromList(&image); } done_reading: if(image2!=NULL) if(image2!=image) { DeleteImageFromList(&image2); if(clone_info) { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } } } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (image->next == (Image *) NULL) break; image=SyncNextImageInList(image); image->columns=image->rows=0; image->colors=0; /* row scan buffer is no longer needed */ RelinquishMagickMemory(BImgBuff); BImgBuff = NULL; if(--Frames>0) { z = z2; if(image2==NULL) image2 = image; goto NEXT_FRAME; } if ((image2!=NULL) && (image2!=image)) /* Does shadow temporary decompressed image exist? */ { /* CloseBlob(image2); */ DeleteImageFromList(&image2); if(clone_info) { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } } } } clone_info=DestroyImageInfo(clone_info); RelinquishMagickMemory(BImgBuff); CloseBlob(image); { Image *p; ssize_t scene=0; /* Rewind list, removing any empty images while rewinding. */ p=image; image=NULL; while (p != (Image *) NULL) { Image *tmp=p; if ((p->rows == 0) || (p->columns == 0)) { p=p->previous; DeleteImageFromList(&tmp); } else { image=p; p=p->previous; } } /* Fix scene numbers */ for (p=image; p != (Image *) NULL; p=p->next) p->scene=scene++; } if(clone_info != NULL) /* cleanup garbage file from compression */ { if(clone_info->file) { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } DestroyImageInfo(clone_info); clone_info = NULL; } if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(),"return"); if(image==NULL) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); return (image); }
1
359,532
DEFUN (neighbor_advertise_interval, neighbor_advertise_interval_cmd, NEIGHBOR_CMD "advertisement-interval <0-600>", NEIGHBOR_STR NEIGHBOR_ADDR_STR "Minimum interval between sending BGP routing updates\n" "time in seconds\n") { return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); }
0
95,904
void AddSetMsiMarkerWorkItem(const InstallerState& installer_state, BrowserDistribution* dist, bool set, WorkItemList* work_item_list) { DCHECK(work_item_list); DWORD msi_value = set ? 1 : 0; WorkItem* set_msi_work_item = work_item_list->AddSetRegValueWorkItem( installer_state.root_key(), dist->GetStateKey(), google_update::kRegMSIField, msi_value, true); DCHECK(set_msi_work_item); set_msi_work_item->set_ignore_failure(true); set_msi_work_item->set_log_message("Could not write MSI marker!"); }
0