idx
int64
func
string
target
int64
424,965
static ssize_t iwl_dbgfs_interrupt_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { struct iwl_trans *trans = file->private_data; struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct isr_statistics *isr_stats = &trans_pcie->isr_stats; int pos = 0; char *buf; int bufsz = 24 * 64; /* 24 items * 64 char per item */ ssize_t ret; buf = kzalloc(bufsz, GFP_KERNEL); if (!buf) return -ENOMEM; pos += scnprintf(buf + pos, bufsz - pos, "Interrupt Statistics Report:\n"); pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n", isr_stats->hw); pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n", isr_stats->sw); if (isr_stats->sw || isr_stats->hw) { pos += scnprintf(buf + pos, bufsz - pos, "\tLast Restarting Code: 0x%X\n", isr_stats->err_code); } #ifdef CONFIG_IWLWIFI_DEBUG pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n", isr_stats->sch); pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n", isr_stats->alive); #endif pos += scnprintf(buf + pos, bufsz - pos, "HW RF KILL switch toggled:\t %u\n", isr_stats->rfkill); pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n", isr_stats->ctkill); pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n", isr_stats->wakeup); pos += scnprintf(buf + pos, bufsz - pos, "Rx command responses:\t\t %u\n", isr_stats->rx); pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n", isr_stats->tx); pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n", isr_stats->unhandled); ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); kfree(buf); return ret; }
0
473,970
big5_mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc) { return onigenc_mbn_mbc_to_code(enc, p, end); }
0
486,824
static void gem_phy_write(CadenceGEMState *s, unsigned reg_num, uint16_t val) { DB_PRINT("reg: %d value: 0x%04x\n", reg_num, val); switch (reg_num) { case PHY_REG_CONTROL: if (val & PHY_REG_CONTROL_RST) { /* Phy reset */ gem_phy_reset(s); val &= ~(PHY_REG_CONTROL_RST | PHY_REG_CONTROL_LOOP); s->phy_loop = 0; } if (val & PHY_REG_CONTROL_ANEG) { /* Complete autonegotiation immediately */ val &= ~(PHY_REG_CONTROL_ANEG | PHY_REG_CONTROL_ANRESTART); s->phy_regs[PHY_REG_STATUS] |= PHY_REG_STATUS_ANEGCMPL; } if (val & PHY_REG_CONTROL_LOOP) { DB_PRINT("PHY placed in loopback\n"); s->phy_loop = 1; } else { s->phy_loop = 0; } break; } s->phy_regs[reg_num] = val; }
0
398,547
static int expand_cu(RzBinDwarfCompUnit *cu) { RzBinDwarfDie *tmp; if (!cu || cu->capacity == 0 || cu->capacity != cu->count) { return -EINVAL; } tmp = (RzBinDwarfDie *)realloc(cu->dies, cu->capacity * 2 * sizeof(RzBinDwarfDie)); if (!tmp) { return -ENOMEM; } memset((ut8 *)tmp + cu->capacity * sizeof(RzBinDwarfDie), 0, cu->capacity * sizeof(RzBinDwarfDie)); cu->dies = tmp; cu->capacity *= 2; return 0; }
0
503,849
SCM_DEFINE (scm_symlink, "symlink", 2, 0, 0, (SCM oldpath, SCM newpath), "Create a symbolic link named @var{newpath} with the value\n" "(i.e., pointing to) @var{oldpath}. The return value is\n" "unspecified.") #define FUNC_NAME s_scm_symlink { int val; STRING2_SYSCALL (oldpath, c_oldpath, newpath, c_newpath, val = symlink (c_oldpath, c_newpath)); if (val != 0) SCM_SYSERROR; return SCM_UNSPECIFIED; }
0
413,706
static int fcnlist_gather_metadata(RAnal *anal, RList *fcns) { RListIter *iter; RAnalFunction *fcn; RList *xrefs; r_list_foreach (fcns, iter, fcn) { // Count the number of references and number of calls RListIter *callrefiter; RAnalRef *ref; RList *refs = r_anal_function_get_refs (fcn); int numcallrefs = 0; r_list_foreach (refs, callrefiter, ref) { if (ref->type == R_ANAL_REF_TYPE_CALL) { numcallrefs++; } } r_list_free (refs); fcn->meta.numcallrefs = numcallrefs; xrefs = r_anal_xrefs_get (anal, fcn->addr); fcn->meta.numrefs = xrefs? xrefs->length: 0; r_list_free (xrefs); } // TODO: Determine sgnc, sgec return 0; }
0
326,640
clear_nochange_fflags(struct archive_write_disk *a) { mode_t mode = archive_entry_mode(a->entry); const int nochange_flags = 0 #ifdef SF_IMMUTABLE | SF_IMMUTABLE #endif #ifdef UF_IMMUTABLE | UF_IMMUTABLE #endif #ifdef SF_APPEND | SF_APPEND #endif #ifdef UF_APPEND | UF_APPEND #endif #ifdef EXT2_APPEND_FL | EXT2_APPEND_FL #endif #ifdef EXT2_IMMUTABLE_FL | EXT2_IMMUTABLE_FL #endif ; return (set_fflags_platform(a, a->fd, a->name, mode, 0, nochange_flags)); }
0
220,243
Node::NodeClass Node::GetNodeClassForOp(const std::string& ts) { static const absl::flat_hash_map<std::string, Node::NodeClass>* kNodeClassTable = #define REF_CLASS(key, value) \ {key, value}, { "Ref" key, value } new absl::flat_hash_map<std::string, Node::NodeClass>({ // Keep in same order as NodeClass values REF_CLASS("Switch", NC_SWITCH), REF_CLASS("_SwitchN", NC_SWITCH), REF_CLASS("Merge", NC_MERGE), REF_CLASS("Enter", NC_ENTER), REF_CLASS("Exit", NC_EXIT), REF_CLASS("NextIteration", NC_NEXT_ITERATION), {"LoopCond", NC_LOOP_COND}, {"ControlTrigger", NC_CONTROL_TRIGGER}, {"_Send", NC_SEND}, {"_HostSend", NC_HOST_SEND}, {"_Recv", NC_RECV}, {"_HostRecv", NC_HOST_RECV}, {"Const", NC_CONSTANT}, {"HostConst", NC_CONSTANT}, {"Variable", NC_VARIABLE}, {"VariableV2", NC_VARIABLE}, REF_CLASS("Identity", NC_IDENTITY), {"GetSessionHandle", NC_GET_SESSION_HANDLE}, {"GetSessionHandleV2", NC_GET_SESSION_HANDLE}, {"GetSessionTensor", NC_GET_SESSION_TENSOR}, {"DeleteSessionTensor", NC_DELETE_SESSION_TENSOR}, {"Size", NC_METADATA}, {"Shape", NC_METADATA}, {"Rank", NC_METADATA}, {"_ScopedAllocator", NC_SCOPED_ALLOCATOR}, {"CollectiveReduce", NC_COLLECTIVE}, {"CollectiveBcastSend", NC_COLLECTIVE}, {"CollectiveBcastRecv", NC_COLLECTIVE}, {"CollectiveGather", NC_COLLECTIVE}, {"FakeParam", NC_FAKE_PARAM}, {"PartitionedCall", NC_PARTITIONED_CALL}, {"StatefulPartitionedCall", NC_PARTITIONED_CALL}, {"SymbolicGradient", NC_SYMBOLIC_GRADIENT}, {"If", NC_IF}, {"StatelessIf", NC_IF}, {"While", NC_WHILE}, {"StatelessWhile", NC_WHILE}, {"Case", NC_CASE}, {"StatelessCase", NC_CASE}, // Not using the constants defined in FunctionLibraryDefinition // for the // 4 ops below because android inference library does not link // tf.function related files. {"_Arg", NC_ARG}, {"_DeviceArg", NC_ARG}, {"_Retval", NC_RETVAL}, {"_DeviceRetval", NC_RETVAL}, {"_XlaMerge", NC_MERGE}, }); #undef REF_CLASS auto it = kNodeClassTable->find(ts); if (it != kNodeClassTable->end()) { return it->second; } else { return NC_OTHER; } }
0
220,814
Integer CeilQuotient(Integer a, Integer b) { return (a + b - 1) / b; }
0
274,864
void ConfigureBuiltinOp(BuiltinOperator op) { switch (op) { case BuiltinOperator_EQUAL: { SetBuiltinOp(op, BuiltinOptions_EqualOptions, CreateEqualOptions(builder_).Union()); break; } case BuiltinOperator_NOT_EQUAL: { SetBuiltinOp(op, BuiltinOptions_NotEqualOptions, CreateNotEqualOptions(builder_).Union()); break; } case BuiltinOperator_GREATER: { SetBuiltinOp(op, BuiltinOptions_GreaterOptions, CreateGreaterOptions(builder_).Union()); break; } case BuiltinOperator_GREATER_EQUAL: { SetBuiltinOp(op, BuiltinOptions_GreaterEqualOptions, CreateGreaterEqualOptions(builder_).Union()); break; } case BuiltinOperator_LESS: { SetBuiltinOp(op, BuiltinOptions_LessOptions, CreateLessOptions(builder_).Union()); break; } case BuiltinOperator_LESS_EQUAL: { SetBuiltinOp(op, BuiltinOptions_LessEqualOptions, CreateLessEqualOptions(builder_).Union()); break; } default: { FAIL() << "We shouldn't get here."; } } }
0
220,936
GF_Err mpgviddmx_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool is_remove) { Bool was_mpeg12; const GF_PropertyValue *p; GF_MPGVidDmxCtx *ctx = gf_filter_get_udta(filter); if (is_remove) { ctx->ipid = NULL; if (ctx->opid) { gf_filter_pid_remove(ctx->opid); ctx->opid = NULL; } return GF_OK; } if (! gf_filter_pid_check_caps(pid)) return GF_NOT_SUPPORTED; ctx->ipid = pid; ctx->cur_fps = ctx->fps; if (!ctx->fps.num || !ctx->fps.den) { ctx->cur_fps.num = 25000; ctx->cur_fps.den = 1000; } p = gf_filter_pid_get_property(pid, GF_PROP_PID_TIMESCALE); if (p) { ctx->timescale = ctx->cur_fps.num = p->value.uint; ctx->cur_fps.den = 0; p = gf_filter_pid_get_property(pid, GF_PROP_PID_FPS); if (p) { ctx->cur_fps = p->value.frac; } p = gf_filter_pid_get_property_str(pid, "nocts"); if (p && p->value.boolean) ctx->recompute_cts = GF_TRUE; } was_mpeg12 = ctx->is_mpg12; p = gf_filter_pid_get_property(pid, GF_PROP_PID_CODECID); if (p) { switch (p->value.uint) { case GF_CODECID_MPEG1: case GF_CODECID_MPEG2_422: case GF_CODECID_MPEG2_SNR: case GF_CODECID_MPEG2_HIGH: case GF_CODECID_MPEG2_MAIN: case GF_CODECID_MPEG2_SIMPLE: case GF_CODECID_MPEG2_SPATIAL: ctx->is_mpg12 = GF_TRUE; break; } } else { p = gf_filter_pid_get_property(pid, GF_PROP_PID_MIME); if (p && p->value.string && (strstr(p->value.string, "m1v") || strstr(p->value.string, "m2v")) ) ctx->is_mpg12 = GF_TRUE; else { p = gf_filter_pid_get_property(pid, GF_PROP_PID_FILE_EXT); if (p && p->value.string && (strstr(p->value.string, "m1v") || strstr(p->value.string, "m2v")) ) ctx->is_mpg12 = GF_TRUE; } } if (ctx->vparser && (was_mpeg12 != ctx->is_mpg12)) { gf_m4v_parser_del_no_bs(ctx->vparser); ctx->vparser = NULL; } if (ctx->timescale && !ctx->opid) { ctx->opid = gf_filter_pid_new(filter); gf_filter_pid_copy_properties(ctx->opid, ctx->ipid); gf_filter_pid_set_property(ctx->opid, GF_PROP_PID_UNFRAMED, NULL); } return GF_OK; }
0
382,784
gdIOCtx * gdNewDynamicCtxEx (int initialSize, void *data, int freeOKFlag) { dpIOCtx *ctx; dynamicPtr *dp; ctx = (dpIOCtx *) gdMalloc (sizeof (dpIOCtx)); dp = newDynamic(initialSize, data, freeOKFlag); ctx->dp = dp; ctx->ctx.getC = dynamicGetchar; ctx->ctx.putC = dynamicPutchar; ctx->ctx.getBuf = dynamicGetbuf; ctx->ctx.putBuf = dynamicPutbuf; ctx->ctx.seek = dynamicSeek; ctx->ctx.tell = dynamicTell; ctx->ctx.gd_free = gdFreeDynamicCtx; return (gdIOCtx *) ctx; }
0
353,170
void SplashOutputDev::doUpdateFont(GfxState *state) { GfxFont *gfxFont; GfxFontLoc *fontLoc; GfxFontType fontType; SplashOutFontFileID *id = nullptr; SplashFontFile *fontFile; SplashFontSrc *fontsrc = nullptr; FoFiTrueType *ff; GooString *fileName; char *tmpBuf; int tmpBufLen; int *codeToGID; const double *textMat; double m11, m12, m21, m22, fontSize; int faceIndex = 0; SplashCoord mat[4]; int n, i; bool recreateFont = false; bool doAdjustFontMatrix = false; needFontUpdate = false; font = nullptr; fileName = nullptr; tmpBuf = nullptr; fontLoc = nullptr; if (!(gfxFont = state->getFont())) { goto err1; } fontType = gfxFont->getType(); if (fontType == fontType3) { goto err1; } // sanity-check the font size - skip anything larger than 10 inches // (this avoids problems allocating memory for the font cache) if (state->getTransformedFontSize() > 10 * (state->getHDPI() + state->getVDPI())) { goto err1; } // check the font file cache reload: delete id; delete fontLoc; fontLoc = nullptr; if (fontsrc && !fontsrc->isFile) { fontsrc->unref(); fontsrc = nullptr; } id = new SplashOutFontFileID(gfxFont->getID()); if ((fontFile = fontEngine->getFontFile(id))) { delete id; } else { if (!(fontLoc = gfxFont->locateFont((xref) ? xref : doc->getXRef(), nullptr))) { error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } // embedded font if (fontLoc->locType == gfxFontLocEmbedded) { // if there is an embedded font, read it to memory tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : doc->getXRef(), &tmpBufLen); if (! tmpBuf) goto err2; // external font } else { // gfxFontLocExternal fileName = fontLoc->path; fontType = fontLoc->fontType; doAdjustFontMatrix = true; } fontsrc = new SplashFontSrc; if (fileName) fontsrc->setFile(fileName, false); else fontsrc->setBuf(tmpBuf, tmpBufLen, true); // load the font file switch (fontType) { case fontType1: if (!(fontFile = fontEngine->loadType1Font( id, fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; } break; case fontType1C: if (!(fontFile = fontEngine->loadType1CFont( id, fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; } break; case fontType1COT: if (!(fontFile = fontEngine->loadOpenTypeT1CFont( id, fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; } break; case fontTrueType: case fontTrueTypeOT: if (fileName) ff = FoFiTrueType::load(fileName->c_str()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (ff) { codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff); n = 256; delete ff; // if we're substituting for a non-TrueType font, we need to mark // all notdef codes as "do not draw" (rather than drawing TrueType // notdef glyphs) if (gfxFont->getType() != fontTrueType && gfxFont->getType() != fontTrueTypeOT) { for (i = 0; i < 256; ++i) { if (codeToGID[i] == 0) { codeToGID[i] = -1; } } } } else { codeToGID = nullptr; n = 0; } if (!(fontFile = fontEngine->loadTrueTypeFont( id, fontsrc, codeToGID, n))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; } break; case fontCIDType0: case fontCIDType0C: if (!(fontFile = fontEngine->loadCIDFont( id, fontsrc))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; } break; case fontCIDType0COT: if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); codeToGID = (int *)gmallocn(n, sizeof(int)); memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), n * sizeof(int)); } else { codeToGID = nullptr; n = 0; } if (!(fontFile = fontEngine->loadOpenTypeCFFFont( id, fontsrc, codeToGID, n))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; } break; case fontCIDType2: case fontCIDType2OT: codeToGID = nullptr; n = 0; if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); if (n) { codeToGID = (int *)gmallocn(n, sizeof(int)); memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), n * sizeof(int)); } } else { if (fileName) ff = FoFiTrueType::load(fileName->c_str()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (! ff) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n); delete ff; } if (!(fontFile = fontEngine->loadTrueTypeFont( id, fontsrc, codeToGID, n, faceIndex))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; } break; default: // this shouldn't happen goto err2; } fontFile->doAdjustMatrix = doAdjustFontMatrix; } // get the font matrix textMat = state->getTextMat(); fontSize = state->getFontSize(); m11 = textMat[0] * fontSize * state->getHorizScaling(); m12 = textMat[1] * fontSize * state->getHorizScaling(); m21 = textMat[2] * fontSize; m22 = textMat[3] * fontSize; // create the scaled font mat[0] = m11; mat[1] = m12; mat[2] = m21; mat[3] = m22; font = fontEngine->getFont(fontFile, mat, splash->getMatrix()); // for substituted fonts: adjust the font matrix -- compare the // width of 'm' in the original font and the substituted font if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) { double w1, w2, w3; CharCode code; const char *name; for (code = 0; code < 256; ++code) { if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) && name[0] == 'm' && name[1] == '\0') { break; } } if (code < 256) { w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code); w2 = font->getGlyphAdvance(code); w3 = ((Gfx8BitFont *)gfxFont)->getWidth(0); if (!gfxFont->isSymbolic() && w2 > 0 && w1 > w3) { // if real font is substantially narrower than substituted // font, reduce the font size accordingly if (w1 > 0.01 && w1 < 0.9 * w2) { w1 /= w2; m11 *= w1; m21 *= w1; recreateFont = true; } } } } if (recreateFont) { mat[0] = m11; mat[1] = m12; mat[2] = m21; mat[3] = m22; font = fontEngine->getFont(fontFile, mat, splash->getMatrix()); } delete fontLoc; if (fontsrc && !fontsrc->isFile) fontsrc->unref(); return; err2: delete id; delete fontLoc; err1: if (fontsrc && !fontsrc->isFile) fontsrc->unref(); return; }
0
234,209
add_abbrev (unsigned long number, unsigned long tag, int children, abbrev_list * list) { abbrev_entry * entry; entry = (abbrev_entry *) xmalloc (sizeof (*entry)); entry->number = number; entry->tag = tag; entry->children = children; entry->first_attr = NULL; entry->last_attr = NULL; entry->next = NULL; assert (list != NULL); if (list->first_abbrev == NULL) list->first_abbrev = entry; else list->last_abbrev->next = entry; list->last_abbrev = entry; }
0
413,615
R_API RCoreAnalStats* r_core_anal_get_stats(RCore *core, ut64 from, ut64 to, ut64 step) { RAnalFunction *F; RAnalBlock *B; RBinSymbol *S; RListIter *iter, *iter2; RCoreAnalStats *as = NULL; int piece, as_size, blocks; ut64 at; if (from == to || from == UT64_MAX || to == UT64_MAX) { eprintf ("Cannot alloc for this range\n"); return NULL; } as = R_NEW0 (RCoreAnalStats); if (!as) { return NULL; } if (step < 1) { step = 1; } blocks = (to - from) / step; as_size = (1 + blocks) * sizeof (RCoreAnalStatsItem); as->block = malloc (as_size); if (!as->block) { free (as); return NULL; } memset (as->block, 0, as_size); for (at = from; at < to; at += step) { RIOMap *map = r_io_map_get_at (core->io, at); piece = (at - from) / step; as->block[piece].perm = map ? map->perm: (core->io->desc ? core->io->desc->perm: 0); } // iter all flags struct block_flags_stat_t u = { .step = step, .from = from, .as = as }; r_flag_foreach_range (core->flags, from, to + 1, block_flags_stat, &u); // iter all functions r_list_foreach (core->anal->fcns, iter, F) { if (F->addr < from || F->addr > to) { continue; } piece = (F->addr - from) / step; as->block[piece].functions++; ut64 last_piece = R_MIN ((F->addr + r_anal_function_linear_size (F) - 1) / step, blocks - 1); for (; piece <= last_piece; piece++) { as->block[piece].in_functions++; } // iter all basic blocks r_list_foreach (F->bbs, iter2, B) { if (B->addr < from || B->addr > to) { continue; } piece = (B->addr - from) / step; as->block[piece].blocks++; } } // iter all symbols r_list_foreach (r_bin_get_symbols (core->bin), iter, S) { if (S->vaddr < from || S->vaddr > to) { continue; } piece = (S->vaddr - from) / step; as->block[piece].symbols++; } RPVector *metas = to > from ? r_meta_get_all_intersect (core->anal, from, to - from, R_META_TYPE_ANY) : NULL; if (metas) { void **it; r_pvector_foreach (metas, it) { RIntervalNode *node = *it; RAnalMetaItem *mi = node->data; if (node->start < from || node->end > to) { continue; } piece = (node->start - from) / step; switch (mi->type) { case R_META_TYPE_STRING: as->block[piece].strings++; break; case R_META_TYPE_COMMENT: as->block[piece].comments++; break; default: break; } } r_pvector_free (metas); } return as; }
0
273,070
ringbuffer_write(struct ringbuffer *buf, const void* src, size_t srclen) { int remaining; if (buf->write_avail == 0 || srclen == 0) return 0; if (srclen > buf->write_avail) srclen = buf->write_avail; remaining = buf->size - buf->write_pos; if (srclen > remaining) { memcpy(buf->buffer + buf->write_pos, src, remaining); memcpy(buf->buffer, src + remaining, srclen - remaining); } else { memcpy(buf->buffer + buf->write_pos, src, srclen); } buf->write_pos = (buf->write_pos + srclen) % buf->size; buf->write_avail -= srclen; buf->read_avail += srclen; return srclen; }
0
313,791
nv_put(cmdarg_T *cap) { nv_put_opt(cap, FALSE); }
0
401,525
void update_process_times(int user_tick) { struct task_struct *p = current; /* Note: this timer irq context must be accounted for as well. */ account_process_tick(p, user_tick); run_local_timers(); rcu_sched_clock_irq(user_tick); #ifdef CONFIG_IRQ_WORK if (in_irq()) irq_work_tick(); #endif scheduler_tick(); if (IS_ENABLED(CONFIG_POSIX_TIMERS)) run_posix_cpu_timers(); /* The current CPU might make use of net randoms without receiving IRQs * to renew them often enough. Let's update the net_rand_state from a * non-constant value that's not affine to the number of calls to make * sure it's updated when there's some activity (we don't care in idle). */ this_cpu_add(net_rand_state.s1, rol32(jiffies, 24) + user_tick); }
0
253,601
smb2_get_credits(struct mid_q_entry *mid) { return mid->credits_received; }
0
328,918
R_API RBinJavaAttrInfo *r_bin_java_annotation_default_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) { ut64 offset = 0; if (sz < 8) { return NULL; } RBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset); offset += 6; if (attr && sz >= offset) { attr->type = R_BIN_JAVA_ATTR_TYPE_ANNOTATION_DEFAULT_ATTR; attr->info.annotation_default_attr.default_value = r_bin_java_element_value_new (buffer + offset, sz - offset, buf_offset + offset); if (attr->info.annotation_default_attr.default_value) { offset += attr->info.annotation_default_attr.default_value->size; } } r_bin_java_print_annotation_default_attr_summary (attr); return attr; }
0
269,303
static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){ SnowContext *s = c->avctx->priv_data; const int offset[3]= { y*c-> stride + x, ((y*c->uvstride + x)>>s->chroma_h_shift), ((y*c->uvstride + x)>>s->chroma_h_shift), }; int i; for(i=0; i<3; i++){ c->src[0][i]= src [i]; c->ref[0][i]= ref [i] + offset[i]; } av_assert2(!ref_index); }
0
468,377
g_socket_client_connect_to_host_async (GSocketClient *client, const gchar *host_and_port, guint16 default_port, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { GSocketConnectable *connectable; GError *error; error = NULL; connectable = g_network_address_parse (host_and_port, default_port, &error); if (connectable == NULL) { g_task_report_error (client, callback, user_data, g_socket_client_connect_to_host_async, error); } else { g_socket_client_connect_async (client, connectable, cancellable, callback, user_data); g_object_unref (connectable); } }
0
229,235
void cql_server::response::serialize(const event::schema_change& event, uint8_t version) { if (version >= 3) { write_string(to_string(event.change)); write_string(to_string(event.target)); write_string(event.keyspace); switch (event.target) { case event::schema_change::target_type::KEYSPACE: break; case event::schema_change::target_type::TYPE: case event::schema_change::target_type::TABLE: write_string(event.arguments[0]); break; case event::schema_change::target_type::FUNCTION: case event::schema_change::target_type::AGGREGATE: write_string(event.arguments[0]); write_string_list(std::vector<sstring>(event.arguments.begin() + 1, event.arguments.end())); break; } } else { switch (event.target) { // FIXME: Should we handle FUNCTION and AGGREGATE the same way as type? // FIXME: How do we get here? Can a client using v2 know about UDF? case event::schema_change::target_type::TYPE: case event::schema_change::target_type::FUNCTION: case event::schema_change::target_type::AGGREGATE: // The v1/v2 protocol is unable to represent these changes. Tell the // client that the keyspace was updated instead. write_string(to_string(event::schema_change::change_type::UPDATED)); write_string(event.keyspace); write_string(""); break; case event::schema_change::target_type::TABLE: case event::schema_change::target_type::KEYSPACE: write_string(to_string(event.change)); write_string(event.keyspace); if (event.target == event::schema_change::target_type::TABLE) { write_string(event.arguments[0]); } else { write_string(""); } } } }
0
310,161
EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T *ntext, int num) { int i; TR(TRACE_CHARPUT, ("EmitRange %d:%s", num, _nc_viscbuf(ntext, num))); if (erase_chars || repeat_char) { while (num > 0) { int runcount; NCURSES_CH_T ntext0; while (num > 1 && !CharEq(ntext[0], ntext[1])) { PutChar(NCURSES_SP_ARGx CHREF(ntext[0])); ntext++; num--; } ntext0 = ntext[0]; if (num == 1) { PutChar(NCURSES_SP_ARGx CHREF(ntext0)); return 0; } runcount = 2; while (runcount < num && CharEq(ntext[runcount], ntext0)) runcount++; /* * The cost expression in the middle isn't exactly right. * _cup_ch_cost is an upper bound on the cost for moving to the * end of the erased area, but not the cost itself (which we * can't compute without emitting the move). This may result * in erase_chars not getting used in some situations for * which it would be marginally advantageous. */ if (erase_chars && runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost && can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) { UpdateAttrs(SP_PARM, ntext0); NCURSES_PUTP2("erase_chars", TIPARM_1(erase_chars, runcount)); /* * If this is the last part of the given interval, * don't bother moving cursor, since it can be the * last update on the line. */ if (runcount < num) { GoTo(NCURSES_SP_ARGx SP_PARM->_cursrow, SP_PARM->_curscol + runcount); } else { return 1; /* cursor stays in the middle */ } } else if (repeat_char != 0 && #if BSD_TPUTS !isdigit(UChar(CharOf(ntext0))) && #endif #if USE_WIDEC_SUPPORT (!SP_PARM->_screen_unicode && (CharOf(ntext0) < ((AttrOf(ntext0) & A_ALTCHARSET) ? ACS_LEN : 256))) && #endif runcount > SP_PARM->_rep_cost) { NCURSES_CH_T temp; bool wrap_possible = (SP_PARM->_curscol + runcount >= screen_columns(SP_PARM)); int rep_count = runcount; if (wrap_possible) rep_count--; UpdateAttrs(SP_PARM, ntext0); temp = ntext0; if ((AttrOf(temp) & A_ALTCHARSET) && SP_PARM->_acs_map != 0 && (SP_PARM->_acs_map[CharOf(temp)] & A_CHARTEXT) != 0) { SetChar(temp, (SP_PARM->_acs_map[CharOf(ntext0)] & A_CHARTEXT), AttrOf(ntext0) | A_ALTCHARSET); } NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx TIPARM_2(repeat_char, CharOf(temp), rep_count), 1, NCURSES_SP_NAME(_nc_outch)); SP_PARM->_curscol += rep_count; if (wrap_possible) PutChar(NCURSES_SP_ARGx CHREF(ntext0)); } else { for (i = 0; i < runcount; i++) PutChar(NCURSES_SP_ARGx CHREF(ntext[i])); } ntext += runcount; num -= runcount; } return 0; } for (i = 0; i < num; i++) PutChar(NCURSES_SP_ARGx CHREF(ntext[i])); return 0; }
0
139,226
gfx::Rect OverlayWindowViews::GetVideoBounds() { return video_bounds_; }
0
338,128
bool WasmBinaryBuilder::maybeVisitSIMDBinary(Expression*& out, uint32_t code) { Binary* curr; switch (code) { case BinaryConsts::I8x16Eq: curr = allocator.alloc<Binary>(); curr->op = EqVecI8x16; break; case BinaryConsts::I8x16Ne: curr = allocator.alloc<Binary>(); curr->op = NeVecI8x16; break; case BinaryConsts::I8x16LtS: curr = allocator.alloc<Binary>(); curr->op = LtSVecI8x16; break; case BinaryConsts::I8x16LtU: curr = allocator.alloc<Binary>(); curr->op = LtUVecI8x16; break; case BinaryConsts::I8x16GtS: curr = allocator.alloc<Binary>(); curr->op = GtSVecI8x16; break; case BinaryConsts::I8x16GtU: curr = allocator.alloc<Binary>(); curr->op = GtUVecI8x16; break; case BinaryConsts::I8x16LeS: curr = allocator.alloc<Binary>(); curr->op = LeSVecI8x16; break; case BinaryConsts::I8x16LeU: curr = allocator.alloc<Binary>(); curr->op = LeUVecI8x16; break; case BinaryConsts::I8x16GeS: curr = allocator.alloc<Binary>(); curr->op = GeSVecI8x16; break; case BinaryConsts::I8x16GeU: curr = allocator.alloc<Binary>(); curr->op = GeUVecI8x16; break; case BinaryConsts::I16x8Eq: curr = allocator.alloc<Binary>(); curr->op = EqVecI16x8; break; case BinaryConsts::I16x8Ne: curr = allocator.alloc<Binary>(); curr->op = NeVecI16x8; break; case BinaryConsts::I16x8LtS: curr = allocator.alloc<Binary>(); curr->op = LtSVecI16x8; break; case BinaryConsts::I16x8LtU: curr = allocator.alloc<Binary>(); curr->op = LtUVecI16x8; break; case BinaryConsts::I16x8GtS: curr = allocator.alloc<Binary>(); curr->op = GtSVecI16x8; break; case BinaryConsts::I16x8GtU: curr = allocator.alloc<Binary>(); curr->op = GtUVecI16x8; break; case BinaryConsts::I16x8LeS: curr = allocator.alloc<Binary>(); curr->op = LeSVecI16x8; break; case BinaryConsts::I16x8LeU: curr = allocator.alloc<Binary>(); curr->op = LeUVecI16x8; break; case BinaryConsts::I16x8GeS: curr = allocator.alloc<Binary>(); curr->op = GeSVecI16x8; break; case BinaryConsts::I16x8GeU: curr = allocator.alloc<Binary>(); curr->op = GeUVecI16x8; break; case BinaryConsts::I32x4Eq: curr = allocator.alloc<Binary>(); curr->op = EqVecI32x4; break; case BinaryConsts::I32x4Ne: curr = allocator.alloc<Binary>(); curr->op = NeVecI32x4; break; case BinaryConsts::I32x4LtS: curr = allocator.alloc<Binary>(); curr->op = LtSVecI32x4; break; case BinaryConsts::I32x4LtU: curr = allocator.alloc<Binary>(); curr->op = LtUVecI32x4; break; case BinaryConsts::I32x4GtS: curr = allocator.alloc<Binary>(); curr->op = GtSVecI32x4; break; case BinaryConsts::I32x4GtU: curr = allocator.alloc<Binary>(); curr->op = GtUVecI32x4; break; case BinaryConsts::I32x4LeS: curr = allocator.alloc<Binary>(); curr->op = LeSVecI32x4; break; case BinaryConsts::I32x4LeU: curr = allocator.alloc<Binary>(); curr->op = LeUVecI32x4; break; case BinaryConsts::I32x4GeS: curr = allocator.alloc<Binary>(); curr->op = GeSVecI32x4; break; case BinaryConsts::I32x4GeU: curr = allocator.alloc<Binary>(); curr->op = GeUVecI32x4; break; case BinaryConsts::I64x2Eq: curr = allocator.alloc<Binary>(); curr->op = EqVecI64x2; break; case BinaryConsts::I64x2Ne: curr = allocator.alloc<Binary>(); curr->op = NeVecI64x2; break; case BinaryConsts::I64x2LtS: curr = allocator.alloc<Binary>(); curr->op = LtSVecI64x2; break; case BinaryConsts::I64x2GtS: curr = allocator.alloc<Binary>(); curr->op = GtSVecI64x2; break; case BinaryConsts::I64x2LeS: curr = allocator.alloc<Binary>(); curr->op = LeSVecI64x2; break; case BinaryConsts::I64x2GeS: curr = allocator.alloc<Binary>(); curr->op = GeSVecI64x2; break; case BinaryConsts::F32x4Eq: curr = allocator.alloc<Binary>(); curr->op = EqVecF32x4; break; case BinaryConsts::F32x4Ne: curr = allocator.alloc<Binary>(); curr->op = NeVecF32x4; break; case BinaryConsts::F32x4Lt: curr = allocator.alloc<Binary>(); curr->op = LtVecF32x4; break; case BinaryConsts::F32x4Gt: curr = allocator.alloc<Binary>(); curr->op = GtVecF32x4; break; case BinaryConsts::F32x4Le: curr = allocator.alloc<Binary>(); curr->op = LeVecF32x4; break; case BinaryConsts::F32x4Ge: curr = allocator.alloc<Binary>(); curr->op = GeVecF32x4; break; case BinaryConsts::F64x2Eq: curr = allocator.alloc<Binary>(); curr->op = EqVecF64x2; break; case BinaryConsts::F64x2Ne: curr = allocator.alloc<Binary>(); curr->op = NeVecF64x2; break; case BinaryConsts::F64x2Lt: curr = allocator.alloc<Binary>(); curr->op = LtVecF64x2; break; case BinaryConsts::F64x2Gt: curr = allocator.alloc<Binary>(); curr->op = GtVecF64x2; break; case BinaryConsts::F64x2Le: curr = allocator.alloc<Binary>(); curr->op = LeVecF64x2; break; case BinaryConsts::F64x2Ge: curr = allocator.alloc<Binary>(); curr->op = GeVecF64x2; break; case BinaryConsts::V128And: curr = allocator.alloc<Binary>(); curr->op = AndVec128; break; case BinaryConsts::V128Or: curr = allocator.alloc<Binary>(); curr->op = OrVec128; break; case BinaryConsts::V128Xor: curr = allocator.alloc<Binary>(); curr->op = XorVec128; break; case BinaryConsts::V128Andnot: curr = allocator.alloc<Binary>(); curr->op = AndNotVec128; break; case BinaryConsts::I8x16Add: curr = allocator.alloc<Binary>(); curr->op = AddVecI8x16; break; case BinaryConsts::I8x16AddSatS: curr = allocator.alloc<Binary>(); curr->op = AddSatSVecI8x16; break; case BinaryConsts::I8x16AddSatU: curr = allocator.alloc<Binary>(); curr->op = AddSatUVecI8x16; break; case BinaryConsts::I8x16Sub: curr = allocator.alloc<Binary>(); curr->op = SubVecI8x16; break; case BinaryConsts::I8x16SubSatS: curr = allocator.alloc<Binary>(); curr->op = SubSatSVecI8x16; break; case BinaryConsts::I8x16SubSatU: curr = allocator.alloc<Binary>(); curr->op = SubSatUVecI8x16; break; case BinaryConsts::I8x16MinS: curr = allocator.alloc<Binary>(); curr->op = MinSVecI8x16; break; case BinaryConsts::I8x16MinU: curr = allocator.alloc<Binary>(); curr->op = MinUVecI8x16; break; case BinaryConsts::I8x16MaxS: curr = allocator.alloc<Binary>(); curr->op = MaxSVecI8x16; break; case BinaryConsts::I8x16MaxU: curr = allocator.alloc<Binary>(); curr->op = MaxUVecI8x16; break; case BinaryConsts::I8x16AvgrU: curr = allocator.alloc<Binary>(); curr->op = AvgrUVecI8x16; break; case BinaryConsts::I16x8Add: curr = allocator.alloc<Binary>(); curr->op = AddVecI16x8; break; case BinaryConsts::I16x8AddSatS: curr = allocator.alloc<Binary>(); curr->op = AddSatSVecI16x8; break; case BinaryConsts::I16x8AddSatU: curr = allocator.alloc<Binary>(); curr->op = AddSatUVecI16x8; break; case BinaryConsts::I16x8Sub: curr = allocator.alloc<Binary>(); curr->op = SubVecI16x8; break; case BinaryConsts::I16x8SubSatS: curr = allocator.alloc<Binary>(); curr->op = SubSatSVecI16x8; break; case BinaryConsts::I16x8SubSatU: curr = allocator.alloc<Binary>(); curr->op = SubSatUVecI16x8; break; case BinaryConsts::I16x8Mul: curr = allocator.alloc<Binary>(); curr->op = MulVecI16x8; break; case BinaryConsts::I16x8MinS: curr = allocator.alloc<Binary>(); curr->op = MinSVecI16x8; break; case BinaryConsts::I16x8MinU: curr = allocator.alloc<Binary>(); curr->op = MinUVecI16x8; break; case BinaryConsts::I16x8MaxS: curr = allocator.alloc<Binary>(); curr->op = MaxSVecI16x8; break; case BinaryConsts::I16x8MaxU: curr = allocator.alloc<Binary>(); curr->op = MaxUVecI16x8; break; case BinaryConsts::I16x8AvgrU: curr = allocator.alloc<Binary>(); curr->op = AvgrUVecI16x8; break; case BinaryConsts::I16x8Q15mulrSatS: curr = allocator.alloc<Binary>(); curr->op = Q15MulrSatSVecI16x8; break; case BinaryConsts::I16x8ExtmulLowI8x16S: curr = allocator.alloc<Binary>(); curr->op = ExtMulLowSVecI16x8; break; case BinaryConsts::I16x8ExtmulHighI8x16S: curr = allocator.alloc<Binary>(); curr->op = ExtMulHighSVecI16x8; break; case BinaryConsts::I16x8ExtmulLowI8x16U: curr = allocator.alloc<Binary>(); curr->op = ExtMulLowUVecI16x8; break; case BinaryConsts::I16x8ExtmulHighI8x16U: curr = allocator.alloc<Binary>(); curr->op = ExtMulHighUVecI16x8; break; case BinaryConsts::I32x4Add: curr = allocator.alloc<Binary>(); curr->op = AddVecI32x4; break; case BinaryConsts::I32x4Sub: curr = allocator.alloc<Binary>(); curr->op = SubVecI32x4; break; case BinaryConsts::I32x4Mul: curr = allocator.alloc<Binary>(); curr->op = MulVecI32x4; break; case BinaryConsts::I32x4MinS: curr = allocator.alloc<Binary>(); curr->op = MinSVecI32x4; break; case BinaryConsts::I32x4MinU: curr = allocator.alloc<Binary>(); curr->op = MinUVecI32x4; break; case BinaryConsts::I32x4MaxS: curr = allocator.alloc<Binary>(); curr->op = MaxSVecI32x4; break; case BinaryConsts::I32x4MaxU: curr = allocator.alloc<Binary>(); curr->op = MaxUVecI32x4; break; case BinaryConsts::I32x4DotI16x8S: curr = allocator.alloc<Binary>(); curr->op = DotSVecI16x8ToVecI32x4; break; case BinaryConsts::I32x4ExtmulLowI16x8S: curr = allocator.alloc<Binary>(); curr->op = ExtMulLowSVecI32x4; break; case BinaryConsts::I32x4ExtmulHighI16x8S: curr = allocator.alloc<Binary>(); curr->op = ExtMulHighSVecI32x4; break; case BinaryConsts::I32x4ExtmulLowI16x8U: curr = allocator.alloc<Binary>(); curr->op = ExtMulLowUVecI32x4; break; case BinaryConsts::I32x4ExtmulHighI16x8U: curr = allocator.alloc<Binary>(); curr->op = ExtMulHighUVecI32x4; break; case BinaryConsts::I64x2Add: curr = allocator.alloc<Binary>(); curr->op = AddVecI64x2; break; case BinaryConsts::I64x2Sub: curr = allocator.alloc<Binary>(); curr->op = SubVecI64x2; break; case BinaryConsts::I64x2Mul: curr = allocator.alloc<Binary>(); curr->op = MulVecI64x2; break; case BinaryConsts::I64x2ExtmulLowI32x4S: curr = allocator.alloc<Binary>(); curr->op = ExtMulLowSVecI64x2; break; case BinaryConsts::I64x2ExtmulHighI32x4S: curr = allocator.alloc<Binary>(); curr->op = ExtMulHighSVecI64x2; break; case BinaryConsts::I64x2ExtmulLowI32x4U: curr = allocator.alloc<Binary>(); curr->op = ExtMulLowUVecI64x2; break; case BinaryConsts::I64x2ExtmulHighI32x4U: curr = allocator.alloc<Binary>(); curr->op = ExtMulHighUVecI64x2; break; case BinaryConsts::F32x4Add: curr = allocator.alloc<Binary>(); curr->op = AddVecF32x4; break; case BinaryConsts::F32x4Sub: curr = allocator.alloc<Binary>(); curr->op = SubVecF32x4; break; case BinaryConsts::F32x4Mul: curr = allocator.alloc<Binary>(); curr->op = MulVecF32x4; break; case BinaryConsts::F32x4Div: curr = allocator.alloc<Binary>(); curr->op = DivVecF32x4; break; case BinaryConsts::F32x4Min: curr = allocator.alloc<Binary>(); curr->op = MinVecF32x4; break; case BinaryConsts::F32x4Max: curr = allocator.alloc<Binary>(); curr->op = MaxVecF32x4; break; case BinaryConsts::F32x4Pmin: curr = allocator.alloc<Binary>(); curr->op = PMinVecF32x4; break; case BinaryConsts::F32x4Pmax: curr = allocator.alloc<Binary>(); curr->op = PMaxVecF32x4; break; case BinaryConsts::F64x2Add: curr = allocator.alloc<Binary>(); curr->op = AddVecF64x2; break; case BinaryConsts::F64x2Sub: curr = allocator.alloc<Binary>(); curr->op = SubVecF64x2; break; case BinaryConsts::F64x2Mul: curr = allocator.alloc<Binary>(); curr->op = MulVecF64x2; break; case BinaryConsts::F64x2Div: curr = allocator.alloc<Binary>(); curr->op = DivVecF64x2; break; case BinaryConsts::F64x2Min: curr = allocator.alloc<Binary>(); curr->op = MinVecF64x2; break; case BinaryConsts::F64x2Max: curr = allocator.alloc<Binary>(); curr->op = MaxVecF64x2; break; case BinaryConsts::F64x2Pmin: curr = allocator.alloc<Binary>(); curr->op = PMinVecF64x2; break; case BinaryConsts::F64x2Pmax: curr = allocator.alloc<Binary>(); curr->op = PMaxVecF64x2; break; case BinaryConsts::I8x16NarrowI16x8S: curr = allocator.alloc<Binary>(); curr->op = NarrowSVecI16x8ToVecI8x16; break; case BinaryConsts::I8x16NarrowI16x8U: curr = allocator.alloc<Binary>(); curr->op = NarrowUVecI16x8ToVecI8x16; break; case BinaryConsts::I16x8NarrowI32x4S: curr = allocator.alloc<Binary>(); curr->op = NarrowSVecI32x4ToVecI16x8; break; case BinaryConsts::I16x8NarrowI32x4U: curr = allocator.alloc<Binary>(); curr->op = NarrowUVecI32x4ToVecI16x8; break; case BinaryConsts::I8x16Swizzle: curr = allocator.alloc<Binary>(); curr->op = SwizzleVec8x16; break; case BinaryConsts::I8x16RelaxedSwizzle: curr = allocator.alloc<Binary>(); curr->op = RelaxedSwizzleVec8x16; break; case BinaryConsts::F32x4RelaxedMin: curr = allocator.alloc<Binary>(); curr->op = RelaxedMinVecF32x4; break; case BinaryConsts::F32x4RelaxedMax: curr = allocator.alloc<Binary>(); curr->op = RelaxedMaxVecF32x4; break; case BinaryConsts::F64x2RelaxedMin: curr = allocator.alloc<Binary>(); curr->op = RelaxedMinVecF64x2; break; case BinaryConsts::F64x2RelaxedMax: curr = allocator.alloc<Binary>(); curr->op = RelaxedMaxVecF64x2; break; default: return false; } BYN_TRACE("zz node: Binary\n"); curr->right = popNonVoidExpression(); curr->left = popNonVoidExpression(); curr->finalize(); out = curr; return true; }
0
300,812
static void tsk_advance_rx_queue(struct sock *sk) { trace_tipc_sk_advance_rx(sk, NULL, TIPC_DUMP_SK_RCVQ, " "); kfree_skb(__skb_dequeue(&sk->sk_receive_queue)); }
0
387,879
bool InstanceKlass::is_override(const methodHandle& super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS) { // Private methods can not be overridden if (super_method->is_private()) { return false; } // If super method is accessible, then override if ((super_method->is_protected()) || (super_method->is_public())) { return true; } // Package-private methods are not inherited outside of package assert(super_method->is_package_private(), "must be package private"); return(is_same_class_package(targetclassloader(), targetclassname)); }
0
401,489
void timers_update_nohz(void) { schedule_work(&timer_update_work); }
0
424,896
static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans) { struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); int err; lockdep_assert_held(&trans_pcie->mutex); err = iwl_pcie_prepare_card_hw(trans); if (err) { IWL_ERR(trans, "Error while preparing HW: %d\n", err); return err; } err = iwl_trans_pcie_clear_persistence_bit(trans); if (err) return err; iwl_trans_pcie_sw_reset(trans); err = iwl_pcie_apm_init(trans); if (err) return err; iwl_pcie_init_msix(trans_pcie); /* From now on, the op_mode will be kept updated about RF kill state */ iwl_enable_rfkill_int(trans); trans_pcie->opmode_down = false; /* Set is_down to false here so that...*/ trans_pcie->is_down = false; /* ...rfkill can call stop_device and set it false if needed */ iwl_pcie_check_hw_rf_kill(trans); return 0; }
0
353,126
void SplashGouraudPattern::getParameterizedColor(double colorinterp, SplashColorMode mode, SplashColorPtr dest) { GfxColor src; GfxColorSpace* srcColorSpace = shading->getColorSpace(); int colorComps = 3; #ifdef SPLASH_CMYK if (mode == splashModeCMYK8) colorComps=4; else if (mode == splashModeDeviceN8) colorComps=4 + SPOT_NCOMPS; #endif shading->getParameterizedColor(colorinterp, &src); if (bDirectColorTranslation) { for (int m = 0; m < colorComps; ++m) dest[m] = colToByte(src.c[m]); } else { convertGfxShortColor(dest, mode, srcColorSpace, &src); } }
0
377,475
static RCoreSymCacheElementHdr *r_coresym_cache_element_header_new(RBuffer *buf, size_t off, int bits) { RCoreSymCacheElementHdr *hdr = R_NEW0 (RCoreSymCacheElementHdr); if (hdr && r_buf_fread_at (buf, off, (ut8 *)hdr, "13i16c5i", 1) == sizeof (RCoreSymCacheElementHdr)) { return hdr; } free (hdr); return NULL; }
0
434,079
check_arg_idx(win_T *win) { if (WARGCOUNT(win) > 1 && !editing_arg_idx(win)) { // We are not editing the current entry in the argument list. // Set "arg_had_last" if we are editing the last one. win->w_arg_idx_invalid = TRUE; if (win->w_arg_idx != WARGCOUNT(win) - 1 && arg_had_last == FALSE && ALIST(win) == &global_alist && GARGCOUNT > 0 && win->w_arg_idx < GARGCOUNT && (win->w_buffer->b_fnum == GARGLIST[GARGCOUNT - 1].ae_fnum || (win->w_buffer->b_ffname != NULL && (fullpathcmp(alist_name(&GARGLIST[GARGCOUNT - 1]), win->w_buffer->b_ffname, TRUE, TRUE) & FPC_SAME)))) arg_had_last = TRUE; } else { // We are editing the current entry in the argument list. // Set "arg_had_last" if it's also the last one win->w_arg_idx_invalid = FALSE; if (win->w_arg_idx == WARGCOUNT(win) - 1 && win->w_alist == &global_alist) arg_had_last = TRUE; } }
0
482,649
static inline u_int8_t xt_family(const struct xt_action_param *par) { return par->state->pf; }
0
252,308
static void hufPackEncTable( const long long *hcode, // i : encoding table [HUF_ENCSIZE] int im, // i : min hcode index int iM, // i : max hcode index char **pcode) // o: ptr to packed table (updated) { char *p = *pcode; long long c = 0; int lc = 0; for (; im <= iM; im++) { int l = hufLength(hcode[im]); if (l == 0) { int zerun = 1; while ((im < iM) && (zerun < LONGEST_LONG_RUN)) { if (hufLength(hcode[im + 1]) > 0) break; im++; zerun++; } if (zerun >= 2) { if (zerun >= SHORTEST_LONG_RUN) { outputBits(6, LONG_ZEROCODE_RUN, c, lc, p); outputBits(8, zerun - SHORTEST_LONG_RUN, c, lc, p); } else { outputBits(6, SHORT_ZEROCODE_RUN + zerun - 2, c, lc, p); } continue; } } outputBits(6, l, c, lc, p); } if (lc > 0) *p++ = (unsigned char)(c << (8 - lc)); *pcode = p; }
0
226,380
GF_Err chnl_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_ChannelLayoutBox *ptr = (GF_ChannelLayoutBox *) s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u8(bs, ptr->layout.stream_structure); if (ptr->layout.stream_structure & 1) { gf_bs_write_u8(bs, ptr->layout.definedLayout); if (ptr->layout.definedLayout==0) { u32 i; for (i=0; i<ptr->layout.channels_count; i++) { gf_bs_write_u8(bs, ptr->layout.layouts[i].position); if (ptr->layout.layouts[i].position==126) { gf_bs_write_int(bs, ptr->layout.layouts[i].azimuth, 16); gf_bs_write_int(bs, ptr->layout.layouts[i].elevation, 8); } } } else { gf_bs_write_u64(bs, ptr->layout.omittedChannelsMap); } } if (ptr->layout.stream_structure & 2) { gf_bs_write_u8(bs, ptr->layout.object_count); } return GF_OK;
0
474,089
st_cleanup_safe(st_table *table, st_data_t never) { st_table_entry *ptr, **last, *tmp; st_index_t i; if (table->entries_packed) { st_index_t i = 0, j = 0; while ((st_data_t)table->bins[i*2] != never) { if (i++ == table->num_entries) return; } for (j = i; ++i < table->num_entries;) { if ((st_data_t)table->bins[i*2] == never) continue; table->bins[j*2] = table->bins[i*2]; table->bins[j*2+1] = table->bins[i*2+1]; j++; } table->num_entries = j; return; } for (i = 0; i < table->num_bins; i++) { ptr = *(last = &table->bins[i]); while (ptr != 0) { if (ptr->key == never) { tmp = ptr; *last = ptr = ptr->next; free(tmp); } else { ptr = *(last = &ptr->next); } } } }
0
249,988
GF_Err WriteToFile(GF_ISOFile *movie, Bool for_fragments) { MovieWriter mw; GF_Err e = GF_OK; if (!movie) return GF_BAD_PARAM; if (movie->openMode == GF_ISOM_OPEN_READ) return GF_BAD_PARAM; e = gf_isom_insert_copyright(movie); if (e) return e; memset(&mw, 0, sizeof(mw)); mw.movie = movie; if (movie->moov) { u32 i; GF_TrackBox *trak; if (gf_sys_is_test_mode()) { movie->moov->mvhd->creationTime = 0; movie->moov->mvhd->modificationTime = 0; } i=0; while ( (trak = gf_list_enum(movie->moov->trackList, &i))) { if (gf_sys_is_test_mode()) { trak->Header->creationTime = 0; trak->Header->modificationTime = 0; if (trak->Media->handler->nameUTF8 && strstr(trak->Media->handler->nameUTF8, "@GPAC")) { gf_free(trak->Media->handler->nameUTF8); trak->Media->handler->nameUTF8 = gf_strdup("MediaHandler"); } trak->Media->mediaHeader->creationTime = 0; trak->Media->mediaHeader->modificationTime = 0; } if (trak->chunk_cache) { gf_isom_flush_chunk(trak, GF_TRUE); } } } //capture mode: we don't need a new bitstream if (movie->openMode == GF_ISOM_OPEN_WRITE) { if (!strcmp(movie->fileName, "_gpac_isobmff_redirect")) { GF_BitStream *bs, *moov_bs=NULL; u64 mdat_end = gf_bs_get_position(movie->editFileMap->bs); u64 mdat_start = movie->mdat->bsOffset; u64 mdat_size = mdat_end - mdat_start; if (for_fragments) { if (!movie->on_block_out) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[ISOBMFF] Missing output block callback, cannot write\n")); return GF_BAD_PARAM; } bs = gf_bs_new_cbk(movie->on_block_out, movie->on_block_out_usr_data, movie->on_block_out_block_size); e = WriteFlat(&mw, 0, bs, GF_TRUE, GF_TRUE, NULL); movie->fragmented_file_pos = gf_bs_get_position(bs); gf_bs_del(bs); return e; } //seek at end in case we had a read of the file gf_bs_seek(movie->editFileMap->bs, gf_bs_get_size(movie->editFileMap->bs) ); if ((movie->storageMode==GF_ISOM_STORE_FASTSTART) && mdat_start && mdat_size) { moov_bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); } //write as non-seekable e = WriteFlat(&mw, 0, movie->editFileMap->bs, GF_TRUE, GF_FALSE, moov_bs); movie->fragmented_file_pos = gf_bs_get_position(movie->editFileMap->bs); if (mdat_start && mdat_size) { u8 data[16]; if (!movie->on_block_out) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[ISOBMFF] Missing output block patch callback, cannot patch mdat size in flat storage\n")); return GF_BAD_PARAM; } //create a patch packet for mdat covering out 16 bytes (cf FlushCapture) bs = gf_bs_new(data, 16, GF_BITSTREAM_WRITE); gf_bs_write_u32(bs, (mdat_size>0xFFFFFFFF) ? 1 : (u32) mdat_size); gf_bs_write_u32(bs, GF_ISOM_BOX_TYPE_MDAT); if (mdat_size>0xFFFFFFFF) gf_bs_write_u64(bs, mdat_size); else gf_bs_write_u64(bs, 0); gf_bs_del(bs); movie->on_block_patch(movie->on_block_out_usr_data, data, 16, mdat_start, GF_FALSE); } if (moov_bs) { u8 *moov_data; u32 moov_size; gf_bs_get_content(moov_bs, &moov_data, &moov_size); gf_bs_del(moov_bs); movie->on_block_patch(movie->on_block_out_usr_data, moov_data, moov_size, mdat_start, GF_TRUE); gf_free(moov_data); } } else { GF_BitStream *moov_bs = NULL; if ((movie->storageMode==GF_ISOM_STORE_STREAMABLE) || (movie->storageMode==GF_ISOM_STORE_FASTSTART) ) { moov_bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); } e = WriteFlat(&mw, 0, movie->editFileMap->bs, GF_FALSE, GF_FALSE, moov_bs); if (moov_bs) { u8 *moov_data; u32 moov_size; gf_bs_get_content(moov_bs, &moov_data, &moov_size); gf_bs_del(moov_bs); if (!e) e = gf_bs_insert_data(movie->editFileMap->bs, moov_data, moov_size, movie->mdat->bsOffset); gf_free(moov_data); } } } else { FILE *stream=NULL; Bool is_stdout = GF_FALSE; GF_BitStream *bs=NULL; if (!strcmp(movie->finalName, "_gpac_isobmff_redirect")) { if (!movie->on_block_out) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[ISOBMFF] Missing output block callback, cannot write\n")); return GF_BAD_PARAM; } bs = gf_bs_new_cbk(movie->on_block_out, movie->on_block_out_usr_data, movie->on_block_out_block_size); is_stdout = GF_TRUE; } else { if (!strcmp(movie->finalName, "std")) is_stdout = GF_TRUE; //OK, we need a new bitstream stream = is_stdout ? stdout : gf_fopen(movie->finalName, "w+b"); if (!stream) return GF_IO_ERR; bs = gf_bs_from_file(stream, GF_BITSTREAM_WRITE); } if (!bs) { if (!is_stdout) gf_fclose(stream); return GF_OUT_OF_MEM; } switch (movie->storageMode) { case GF_ISOM_STORE_TIGHT: case GF_ISOM_STORE_INTERLEAVED: e = WriteInterleaved(&mw, bs, 0); break; case GF_ISOM_STORE_DRIFT_INTERLEAVED: e = WriteInterleaved(&mw, bs, 1); break; case GF_ISOM_STORE_STREAMABLE: e = WriteFlat(&mw, 1, bs, is_stdout, GF_FALSE, NULL); break; default: e = WriteFlat(&mw, 0, bs, is_stdout, GF_FALSE, NULL); break; } gf_bs_del(bs); if (!is_stdout) gf_fclose(stream); } if (mw.buffer) gf_free(mw.buffer); if (mw.nb_done<mw.total_samples) { mw.nb_done = mw.total_samples; muxer_report_progress(&mw); } return e; }
0
224,161
void Compute(OpKernelContext* ctx) override { StagingMap<Ordered>* map = nullptr; OP_REQUIRES_OK(ctx, GetStagingMap(ctx, def(), &map)); core::ScopedUnref scope(map); OP_REQUIRES_OK(ctx, map->clear()); }
0
459,141
static int tc_chain_fill_node(const struct tcf_proto_ops *tmplt_ops, void *tmplt_priv, u32 chain_index, struct net *net, struct sk_buff *skb, struct tcf_block *block, u32 portid, u32 seq, u16 flags, int event) { unsigned char *b = skb_tail_pointer(skb); const struct tcf_proto_ops *ops; struct nlmsghdr *nlh; struct tcmsg *tcm; void *priv; ops = tmplt_ops; priv = tmplt_priv; nlh = nlmsg_put(skb, portid, seq, event, sizeof(*tcm), flags); if (!nlh) goto out_nlmsg_trim; tcm = nlmsg_data(nlh); tcm->tcm_family = AF_UNSPEC; tcm->tcm__pad1 = 0; tcm->tcm__pad2 = 0; tcm->tcm_handle = 0; if (block->q) { tcm->tcm_ifindex = qdisc_dev(block->q)->ifindex; tcm->tcm_parent = block->q->handle; } else { tcm->tcm_ifindex = TCM_IFINDEX_MAGIC_BLOCK; tcm->tcm_block_index = block->index; } if (nla_put_u32(skb, TCA_CHAIN, chain_index)) goto nla_put_failure; if (ops) { if (nla_put_string(skb, TCA_KIND, ops->kind)) goto nla_put_failure; if (ops->tmplt_dump(skb, net, priv) < 0) goto nla_put_failure; } nlh->nlmsg_len = skb_tail_pointer(skb) - b; return skb->len; out_nlmsg_trim: nla_put_failure: nlmsg_trim(skb, b); return -EMSGSIZE; }
0
353,178
static int getLum(int r, int g, int b) { return (int)(0.3 * r + 0.59 * g + 0.11 * b); }
0
514,289
bool Multiupdate_prelocking_strategy::handle_end(THD *thd) { DBUG_ENTER("Multiupdate_prelocking_strategy::handle_end"); if (done) DBUG_RETURN(0); LEX *lex= thd->lex; SELECT_LEX *select_lex= &lex->select_lex; TABLE_LIST *table_list= lex->query_tables, *tl; done= true; if (mysql_handle_derived(lex, DT_INIT) || mysql_handle_derived(lex, DT_MERGE_FOR_INSERT) || mysql_handle_derived(lex, DT_PREPARE)) DBUG_RETURN(1); /* setup_tables() need for VIEWs. JOIN::prepare() will call setup_tables() second time, but this call will do nothing (there are check for second call in setup_tables()). */ if (setup_tables_and_check_access(thd, &select_lex->context, &select_lex->top_join_list, table_list, select_lex->leaf_tables, FALSE, UPDATE_ACL, SELECT_ACL, TRUE)) DBUG_RETURN(1); List<Item> *fields= &lex->select_lex.item_list; if (setup_fields_with_no_wrap(thd, Ref_ptr_array(), *fields, MARK_COLUMNS_WRITE, 0, 0)) DBUG_RETURN(1); // Check if we have a view in the list ... for (tl= table_list; tl ; tl= tl->next_local) if (tl->view) break; // ... and pass this knowlage in check_fields call if (check_fields(thd, *fields, tl != NULL )) DBUG_RETURN(1); table_map tables_for_update= thd->table_map_for_update= get_table_map(fields); if (unsafe_key_update(select_lex->leaf_tables, tables_for_update)) DBUG_RETURN(1); /* Setup timestamp handling and locking mode */ List_iterator<TABLE_LIST> ti(select_lex->leaf_tables); const bool using_lock_tables= thd->locked_tables_mode != LTM_NONE; while ((tl= ti++)) { TABLE *table= tl->table; if (tl->is_jtbm()) continue; /* if table will be updated then check that it is unique */ if (table->map & tables_for_update) { if (!tl->single_table_updatable() || check_key_in_view(thd, tl)) { my_error(ER_NON_UPDATABLE_TABLE, MYF(0), tl->top_table()->alias.str, "UPDATE"); DBUG_RETURN(1); } DBUG_PRINT("info",("setting table `%s` for update", tl->top_table()->alias.str)); /* If table will be updated we should not downgrade lock for it and leave it as is. */ tl->updating= 1; if (tl->belong_to_view) tl->belong_to_view->updating= 1; if (extend_table_list(thd, tl, this, has_prelocking_list)) DBUG_RETURN(1); } else { DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias.str)); /* If we are using the binary log, we need TL_READ_NO_INSERT to get correct order of statements. Otherwise, we use a TL_READ lock to improve performance. We don't downgrade metadata lock from SW to SR in this case as there is no guarantee that the same ticket is not used by another table instance used by this statement which is going to be write-locked (for example, trigger to be invoked might try to update this table). Last argument routine_modifies_data for read_lock_type_for_table() is ignored, as prelocking placeholder will never be set here. */ DBUG_ASSERT(tl->prelocking_placeholder == false); thr_lock_type lock_type= read_lock_type_for_table(thd, lex, tl, true); if (using_lock_tables) tl->lock_type= lock_type; else tl->set_lock_type(thd, lock_type); } } /* Check access privileges for tables being updated or read. Note that unlike in the above loop we need to iterate here not only through all leaf tables but also through all view hierarchy. */ for (tl= table_list; tl; tl= tl->next_local) { bool not_used= false; if (tl->is_jtbm()) continue; if (multi_update_check_table_access(thd, tl, tables_for_update, &not_used)) DBUG_RETURN(TRUE); } /* check single table update for view compound from several tables */ for (tl= table_list; tl; tl= tl->next_local) { TABLE_LIST *for_update= 0; if (tl->is_jtbm()) continue; if (tl->is_merged_derived() && tl->check_single_table(&for_update, tables_for_update, tl)) { my_error(ER_VIEW_MULTIUPDATE, MYF(0), tl->view_db.str, tl->view_name.str); DBUG_RETURN(1); } } DBUG_RETURN(0); }
0
413,596
static void fcn_list_bbs(RAnalFunction *fcn) { RAnalBlock *bbi; RListIter *iter; r_list_foreach (fcn->bbs, iter, bbi) { r_cons_printf ("afb+ 0x%08" PFMT64x " 0x%08" PFMT64x " %" PFMT64u " ", fcn->addr, bbi->addr, bbi->size); r_cons_printf ("0x%08"PFMT64x" ", bbi->jump); r_cons_printf ("0x%08"PFMT64x, bbi->fail); if (bbi->diff) { if (bbi->diff->type == R_ANAL_DIFF_TYPE_MATCH) { r_cons_printf (" m"); } else if (bbi->diff->type == R_ANAL_DIFF_TYPE_UNMATCH) { r_cons_printf (" u"); } else { r_cons_printf (" n"); } } r_cons_printf ("\n"); } }
0
318,949
f_test_null_function(typval_T *argvars UNUSED, typval_T *rettv) { rettv->v_type = VAR_FUNC; rettv->vval.v_string = NULL; }
0
492,683
vte_sequence_handler_al (VteTerminal *terminal, GValueArray *params) { VteScreen *screen; long start, end, param, i; GValue *value; /* Find out which part of the screen we're messing with. */ screen = terminal->pvt->screen; start = screen->cursor_current.row; if (screen->scrolling_restricted) { end = screen->insert_delta + screen->scrolling_region.end; } else { end = screen->insert_delta + terminal->row_count - 1; } /* Extract any parameters. */ param = 1; if ((params != NULL) && (params->n_values > 0)) { value = g_value_array_get_nth(params, 0); if (G_VALUE_HOLDS_LONG(value)) { param = g_value_get_long(value); } } /* Insert the right number of lines. */ for (i = 0; i < param; i++) { /* Clear a line off the end of the region and add one to the * top of the region. */ _vte_terminal_ring_remove (terminal, end); _vte_terminal_ring_insert (terminal, start, TRUE); /* Adjust the scrollbars if necessary. */ _vte_terminal_adjust_adjustments(terminal); } /* Update the display. */ _vte_terminal_scroll_region(terminal, start, end - start + 1, param); /* We've modified the display. Make a note of it. */ terminal->pvt->text_deleted_flag = TRUE; }
0
248,245
DLLIMPORT int cfg_setnbool(cfg_t *cfg, const char *name, cfg_bool_t value, unsigned int index) { return cfg_opt_setnbool(cfg_getopt(cfg, name), value, index); }
0
413,336
PHP_METHOD(snmp, setSecurity) { php_snmp_object *snmp_object; zval *object = getThis(); char *a1 = "", *a2 = "", *a3 = "", *a4 = "", *a5 = "", *a6 = "", *a7 = ""; int a1_len = 0, a2_len = 0, a3_len = 0, a4_len = 0, a5_len = 0, a6_len = 0, a7_len = 0; int argc = ZEND_NUM_ARGS(); snmp_object = (php_snmp_object *)zend_object_store_get_object(object TSRMLS_CC); if (zend_parse_parameters(argc TSRMLS_CC, "s|ssssss", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len, &a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len) == FAILURE) { RETURN_FALSE; } if (netsnmp_session_set_security(snmp_object->session, a1, a2, a3, a4, a5, a6, a7 TSRMLS_CC)) { /* Warning message sent already, just bail out */ RETURN_FALSE; } RETURN_TRUE; }
0
293,536
PJ_DEF(int) pj_scan_stricmp( pj_scanner *scanner, const char *s, int len) { if (scanner->curptr + len > scanner->end) { pj_scan_syntax_err(scanner); return -1; } return pj_ansi_strnicmp(scanner->curptr, s, len); }
0
345,212
static void set_inverse_transl(struct vc_data *conp, struct uni_pagedir *p, int i) { int j, glyph; unsigned short *t = translations[i]; unsigned char *q; if (!p) return; q = p->inverse_translations[i]; if (!q) { q = p->inverse_translations[i] = kmalloc(MAX_GLYPH, GFP_KERNEL); if (!q) return; } memset(q, 0, MAX_GLYPH); for (j = 0; j < E_TABSZ; j++) { glyph = conv_uni_to_pc(conp, t[j]); if (glyph >= 0 && glyph < MAX_GLYPH && q[glyph] < 32) { /* prefer '-' above SHY etc. */ q[glyph] = j; } } }
0
369,111
static void kiocb_done(struct io_kiocb *req, ssize_t ret, unsigned int issue_flags) { struct io_async_rw *io = req->async_data; /* add previously done IO, if any */ if (req_has_async_data(req) && io->bytes_done > 0) { if (ret < 0) ret = io->bytes_done; else ret += io->bytes_done; } if (req->flags & REQ_F_CUR_POS) req->file->f_pos = req->rw.kiocb.ki_pos; if (ret >= 0 && (req->rw.kiocb.ki_complete == io_complete_rw)) __io_complete_rw(req, ret, issue_flags); else io_rw_done(&req->rw.kiocb, ret); if (req->flags & REQ_F_REISSUE) { req->flags &= ~REQ_F_REISSUE; if (io_resubmit_prep(req)) io_req_task_queue_reissue(req); else io_req_task_queue_fail(req, ret); } }
0
225,833
void ftyp_box_del(GF_Box *s) { GF_FileTypeBox *ptr = (GF_FileTypeBox *) s; if (ptr->altBrand) gf_free(ptr->altBrand); gf_free(ptr); }
0
264,413
struct Cookie *Curl_cookie_getlist(struct Curl_easy *data, struct CookieInfo *c, const char *host, const char *path, bool secure) { struct Cookie *newco; struct Cookie *co; struct Cookie *mainco = NULL; size_t matches = 0; bool is_ip; const size_t myhash = cookiehash(host); if(!c || !c->cookies[myhash]) return NULL; /* no cookie struct or no cookies in the struct */ /* at first, remove expired cookies */ remove_expired(c); /* check if host is an IP(v4|v6) address */ is_ip = Curl_host_is_ipnum(host); co = c->cookies[myhash]; while(co) { /* if the cookie requires we're secure we must only continue if we are! */ if(co->secure?secure:TRUE) { /* now check if the domain is correct */ if(!co->domain || (co->tailmatch && !is_ip && tailmatch(co->domain, host)) || ((!co->tailmatch || is_ip) && strcasecompare(host, co->domain)) ) { /* * the right part of the host matches the domain stuff in the * cookie data */ /* * now check the left part of the path with the cookies path * requirement */ if(!co->spath || pathmatch(co->spath, path) ) { /* * and now, we know this is a match and we should create an * entry for the return-linked-list */ newco = dup_cookie(co); if(newco) { /* then modify our next */ newco->next = mainco; /* point the main to us */ mainco = newco; matches++; if(matches >= MAX_COOKIE_SEND_AMOUNT) { infof(data, "Included max number of cookies (%zu) in request!", matches); break; } } else goto fail; } } } co = co->next; } if(matches) { /* * Now we need to make sure that if there is a name appearing more than * once, the longest specified path version comes first. To make this * the swiftest way, we just sort them all based on path length. */ struct Cookie **array; size_t i; /* alloc an array and store all cookie pointers */ array = malloc(sizeof(struct Cookie *) * matches); if(!array) goto fail; co = mainco; for(i = 0; co; co = co->next) array[i++] = co; /* now sort the cookie pointers in path length order */ qsort(array, matches, sizeof(struct Cookie *), cookie_sort); /* remake the linked list order according to the new order */ mainco = array[0]; /* start here */ for(i = 0; i<matches-1; i++) array[i]->next = array[i + 1]; array[matches-1]->next = NULL; /* terminate the list */ free(array); /* remove the temporary data again */ } return mainco; /* return the new list */ fail: /* failure, clear up the allocated chain and return NULL */ Curl_cookie_freelist(mainco); return NULL; }
0
452,262
static char *php_xsl_xslt_string_to_xpathexpr(const char *str TSRMLS_DC) { const xmlChar *string = (const xmlChar *)str; xmlChar *value; int str_len; str_len = xmlStrlen(string) + 3; if (xmlStrchr(string, '"')) { if (xmlStrchr(string, '\'')) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create XPath expression (string contains both quote and double-quotes)"); return NULL; } value = (xmlChar*) safe_emalloc (str_len, sizeof(xmlChar), 0); snprintf(value, str_len, "'%s'", string); } else { value = (xmlChar*) safe_emalloc (str_len, sizeof(xmlChar), 0); snprintf(value, str_len, "\"%s\"", string); } return (char *) value; }
0
234,835
static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) { struct btrfs_fs_devices *fs_devices; struct btrfs_device *device; struct btrfs_device *orig_dev; int ret = 0; fs_devices = alloc_fs_devices(orig->fsid, NULL); if (IS_ERR(fs_devices)) return fs_devices; mutex_lock(&orig->device_list_mutex); fs_devices->total_devices = orig->total_devices; list_for_each_entry(orig_dev, &orig->devices, dev_list) { struct rcu_string *name; device = btrfs_alloc_device(NULL, &orig_dev->devid, orig_dev->uuid); if (IS_ERR(device)) { ret = PTR_ERR(device); goto error; } /* * This is ok to do without rcu read locked because we hold the * uuid mutex so nothing we touch in here is going to disappear. */ if (orig_dev->name) { name = rcu_string_strdup(orig_dev->name->str, GFP_KERNEL); if (!name) { btrfs_free_device(device); ret = -ENOMEM; goto error; } rcu_assign_pointer(device->name, name); } list_add(&device->dev_list, &fs_devices->devices); device->fs_devices = fs_devices; fs_devices->num_devices++; } mutex_unlock(&orig->device_list_mutex); return fs_devices; error: mutex_unlock(&orig->device_list_mutex); free_fs_devices(fs_devices); return ERR_PTR(ret); }
0
314,496
PJ_DEF(pj_status_t) pjmedia_sdp_validate2(const pjmedia_sdp_session *sdp, pj_bool_t strict) { unsigned i; const pj_str_t STR_RTPMAP = { "rtpmap", 6 }; CHECK( sdp != NULL, PJ_EINVAL); /* Validate origin line. */ CHECK( sdp->origin.user.slen != 0, PJMEDIA_SDP_EINORIGIN); CHECK( pj_strcmp2(&sdp->origin.net_type, "IN")==0, PJMEDIA_SDP_EINORIGIN); CHECK( pj_strcmp2(&sdp->origin.addr_type, "IP4")==0 || pj_strcmp2(&sdp->origin.addr_type, "IP6")==0, PJMEDIA_SDP_EINORIGIN); CHECK( sdp->origin.addr.slen != 0, PJMEDIA_SDP_EINORIGIN); /* Validate subject line. */ CHECK( sdp->name.slen != 0, PJMEDIA_SDP_EINNAME); /* Ignore start and stop time. */ /* If session level connection info is present, validate it. */ if (sdp->conn) { pj_status_t status = validate_sdp_conn(sdp->conn); if (status != PJ_SUCCESS) return status; } /* Validate each media. */ for (i=0; i<sdp->media_count; ++i) { const pjmedia_sdp_media *m = sdp->media[i]; unsigned j; /* Validate the m= line. */ CHECK( m->desc.media.slen != 0, PJMEDIA_SDP_EINMEDIA); CHECK( m->desc.transport.slen != 0, PJMEDIA_SDP_EINMEDIA); CHECK( m->desc.fmt_count != 0 || m->desc.port==0, PJMEDIA_SDP_ENOFMT); /* If media level connection info is present, validate it. */ if (m->conn) { pj_status_t status = validate_sdp_conn(m->conn); if (status != PJ_SUCCESS) return status; } /* If media doesn't have connection info, then connection info * must be present in the session. */ if (m->conn == NULL) { if (sdp->conn == NULL) if (strict || m->desc.port != 0) return PJMEDIA_SDP_EMISSINGCONN; } /* Verify payload type. */ for (j=0; j<m->desc.fmt_count; ++j) { /* Arrgh noo!! Payload type can be non-numeric!! * RTC based programs sends "null" for instant messaging! */ if (pj_isdigit(*m->desc.fmt[j].ptr)) { unsigned long pt; pj_status_t status = pj_strtoul3(&m->desc.fmt[j], &pt, 10); /* Payload type is between 0 and 127. */ CHECK( status == PJ_SUCCESS && pt <= 127, PJMEDIA_SDP_EINPT); /* If port is not zero, then for each dynamic payload type, an * rtpmap attribute must be specified. */ if (m->desc.port != 0 && pt >= 96) { const pjmedia_sdp_attr *a; a = pjmedia_sdp_media_find_attr(m, &STR_RTPMAP, &m->desc.fmt[j]); CHECK( a != NULL, PJMEDIA_SDP_EMISSINGRTPMAP); } } } } /* Looks good. */ return PJ_SUCCESS; }
0
329,918
composite_tristrip (void *_dst, cairo_operator_t op, cairo_surface_t *abstract_src, int src_x, int src_y, int dst_x, int dst_y, const cairo_rectangle_int_t *extents, cairo_antialias_t antialias, cairo_tristrip_t *strip) { cairo_image_surface_t *dst = (cairo_image_surface_t *) _dst; cairo_image_source_t *src = (cairo_image_source_t *) abstract_src; pixman_image_t *mask; pixman_format_code_t format; TRACE ((stderr, "%s\n", __FUNCTION__)); if (strip->num_points < 3) return CAIRO_STATUS_SUCCESS; if (1) { /* pixman doesn't eliminate self-intersecting triangles/edges */ cairo_int_status_t status; cairo_traps_t traps; int n; _cairo_traps_init (&traps); for (n = 0; n < strip->num_points; n++) { cairo_point_t p[4]; p[0] = strip->points[0]; p[1] = strip->points[1]; p[2] = strip->points[2]; p[3] = strip->points[0]; _cairo_traps_tessellate_convex_quad (&traps, p); } status = composite_traps (_dst, op, abstract_src, src_x, src_y, dst_x, dst_y, extents, antialias, &traps); _cairo_traps_fini (&traps); return status; } format = antialias == CAIRO_ANTIALIAS_NONE ? PIXMAN_a1 : PIXMAN_a8; if (dst->pixman_format == format && (abstract_src == NULL || (op == CAIRO_OPERATOR_ADD && src->is_opaque_solid))) { _pixman_image_add_tristrip (dst->pixman_image, dst_x, dst_y, strip); return CAIRO_STATUS_SUCCESS; } mask = pixman_image_create_bits (format, extents->width, extents->height, NULL, 0); if (unlikely (mask == NULL)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); _pixman_image_add_tristrip (mask, extents->x, extents->y, strip); pixman_image_composite32 (_pixman_operator (op), src->pixman_image, mask, dst->pixman_image, extents->x + src_x, extents->y + src_y, 0, 0, extents->x - dst_x, extents->y - dst_y, extents->width, extents->height); pixman_image_unref (mask); return CAIRO_STATUS_SUCCESS; }
0
201,006
static int FNAME(cmpxchg_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, pt_element_t __user *ptep_user, unsigned index, pt_element_t orig_pte, pt_element_t new_pte) { int npages; pt_element_t ret; pt_element_t *table; struct page *page; npages = get_user_pages_fast((unsigned long)ptep_user, 1, FOLL_WRITE, &page); if (likely(npages == 1)) { table = kmap_atomic(page); ret = CMPXCHG(&table[index], orig_pte, new_pte); kunmap_atomic(table); kvm_release_page_dirty(page); } else { struct vm_area_struct *vma; unsigned long vaddr = (unsigned long)ptep_user & PAGE_MASK; unsigned long pfn; unsigned long paddr; mmap_read_lock(current->mm); vma = find_vma_intersection(current->mm, vaddr, vaddr + PAGE_SIZE); if (!vma || !(vma->vm_flags & VM_PFNMAP)) { mmap_read_unlock(current->mm); return -EFAULT; } pfn = ((vaddr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; paddr = pfn << PAGE_SHIFT; table = memremap(paddr, PAGE_SIZE, MEMREMAP_WB); if (!table) { mmap_read_unlock(current->mm); return -EFAULT; } ret = CMPXCHG(&table[index], orig_pte, new_pte); memunmap(table); mmap_read_unlock(current->mm); } return (ret != orig_pte); }
1
412,099
resp_addr_get_action(const struct resp_addr* addr) { return addr ? addr->action : respip_none; }
0
196,801
GF_Err gf_hinter_finalize(GF_ISOFile *file, GF_SDP_IODProfile IOD_Profile, u32 bandwidth) { u32 i, sceneT, odT, descIndex, size, size64; GF_InitialObjectDescriptor *iod; GF_SLConfig slc; GF_ISOSample *samp; Bool remove_ocr; u8 *buffer; char buf64[5000], sdpLine[5100]; gf_isom_sdp_clean(file); if (bandwidth) { sprintf(buf64, "b=AS:%d", bandwidth); gf_isom_sdp_add_line(file, buf64); } //xtended attribute for copyright if (gf_sys_is_test_mode()) { sprintf(buf64, "a=x-copyright: %s", "MP4/3GP File hinted with GPAC - (c) Telecom ParisTech (http://gpac.io)"); } else { sprintf(buf64, "a=x-copyright: MP4/3GP File hinted with GPAC %s - %s", gf_gpac_version(), gf_gpac_copyright() ); } gf_isom_sdp_add_line(file, buf64); if (IOD_Profile == GF_SDP_IOD_NONE) return GF_OK; odT = sceneT = 0; for (i=0; i<gf_isom_get_track_count(file); i++) { if (!gf_isom_is_track_in_root_od(file, i+1)) continue; switch (gf_isom_get_media_type(file,i+1)) { case GF_ISOM_MEDIA_OD: odT = i+1; break; case GF_ISOM_MEDIA_SCENE: sceneT = i+1; break; } } remove_ocr = 0; if (IOD_Profile == GF_SDP_IOD_ISMA_STRICT) { IOD_Profile = GF_SDP_IOD_ISMA; remove_ocr = 1; } /*if we want ISMA like iods, we need at least BIFS */ if ( (IOD_Profile == GF_SDP_IOD_ISMA) && !sceneT ) return GF_BAD_PARAM; /*do NOT change PLs, we assume they are correct*/ iod = (GF_InitialObjectDescriptor *) gf_isom_get_root_od(file); if (!iod) return GF_NOT_SUPPORTED; /*rewrite an IOD with good SL config - embbed data if possible*/ if (IOD_Profile == GF_SDP_IOD_ISMA) { GF_ESD *esd; Bool is_ok = 1; while (gf_list_count(iod->ESDescriptors)) { esd = (GF_ESD*)gf_list_get(iod->ESDescriptors, 0); gf_odf_desc_del((GF_Descriptor *) esd); gf_list_rem(iod->ESDescriptors, 0); } /*get OD esd, and embbed stream data if possible*/ if (odT) { esd = gf_isom_get_esd(file, odT, 1); if (gf_isom_get_sample_count(file, odT)==1) { samp = gf_isom_get_sample(file, odT, 1, &descIndex); if (samp && gf_hinter_can_embbed_data(samp->data, samp->dataLength, GF_STREAM_OD)) { InitSL_NULL(&slc); slc.predefined = 0; slc.hasRandomAccessUnitsOnlyFlag = 1; slc.timeScale = slc.timestampResolution = gf_isom_get_media_timescale(file, odT); slc.OCRResolution = 1000; slc.startCTS = samp->DTS+samp->CTS_Offset; slc.startDTS = samp->DTS; //set the SL for future extraction gf_isom_set_extraction_slc(file, odT, 1, &slc); size64 = gf_base64_encode(samp->data, samp->dataLength, buf64, 2000); buf64[size64] = 0; sprintf(sdpLine, "data:application/mpeg4-od-au;base64,%s", buf64); if (esd->decoderConfig) { esd->decoderConfig->avgBitrate = 0; esd->decoderConfig->bufferSizeDB = samp->dataLength; esd->decoderConfig->maxBitrate = 0; } size64 = (u32) strlen(sdpLine)+1; esd->URLString = (char*)gf_malloc(sizeof(char) * size64); strcpy(esd->URLString, sdpLine); } else { GF_LOG(GF_LOG_WARNING, GF_LOG_RTP, ("[rtp hinter] OD sample too large to be embedded in IOD - ISMA disabled\n")); is_ok = 0; } gf_isom_sample_del(&samp); } if (remove_ocr) esd->OCRESID = 0; else if (esd->OCRESID == esd->ESID) esd->OCRESID = 0; //OK, add this to our IOD gf_list_add(iod->ESDescriptors, esd); } esd = gf_isom_get_esd(file, sceneT, 1); if (gf_isom_get_sample_count(file, sceneT)==1) { samp = gf_isom_get_sample(file, sceneT, 1, &descIndex); if (samp && gf_hinter_can_embbed_data(samp->data, samp->dataLength, GF_STREAM_SCENE)) { slc.timeScale = slc.timestampResolution = gf_isom_get_media_timescale(file, sceneT); slc.OCRResolution = 1000; slc.startCTS = samp->DTS+samp->CTS_Offset; slc.startDTS = samp->DTS; //set the SL for future extraction gf_isom_set_extraction_slc(file, sceneT, 1, &slc); //encode in Base64 the sample size64 = gf_base64_encode(samp->data, samp->dataLength, buf64, 2000); buf64[size64] = 0; sprintf(sdpLine, "data:application/mpeg4-bifs-au;base64,%s", buf64); if (esd->decoderConfig) { esd->decoderConfig->avgBitrate = 0; esd->decoderConfig->bufferSizeDB = samp->dataLength; esd->decoderConfig->maxBitrate = 0; } esd->URLString = (char*)gf_malloc(sizeof(char) * (strlen(sdpLine)+1)); strcpy(esd->URLString, sdpLine); } else { GF_LOG(GF_LOG_ERROR, GF_LOG_RTP, ("[rtp hinter] Scene description sample too large to be embedded in IOD - ISMA disabled\n")); is_ok = 0; } gf_isom_sample_del(&samp); } if (remove_ocr) esd->OCRESID = 0; else if (esd->OCRESID == esd->ESID) esd->OCRESID = 0; gf_list_add(iod->ESDescriptors, esd); if (is_ok) { u32 has_a, has_v, has_i_a, has_i_v; has_a = has_v = has_i_a = has_i_v = 0; for (i=0; i<gf_isom_get_track_count(file); i++) { esd = gf_isom_get_esd(file, i+1, 1); if (!esd) continue; if (esd->decoderConfig) { if (esd->decoderConfig->streamType==GF_STREAM_VISUAL) { if (esd->decoderConfig->objectTypeIndication==GF_CODECID_MPEG4_PART2) has_i_v ++; else has_v++; } else if (esd->decoderConfig->streamType==GF_STREAM_AUDIO) { if (esd->decoderConfig->objectTypeIndication==GF_CODECID_AAC_MPEG4) has_i_a ++; else has_a++; } } gf_odf_desc_del((GF_Descriptor *)esd); } /*only 1 MPEG-4 visual max and 1 MPEG-4 audio max for ISMA compliancy*/ if (!has_v && !has_a && (has_i_v<=1) && (has_i_a<=1)) { sprintf(sdpLine, "a=isma-compliance:1,1.0,1"); gf_isom_sdp_add_line(file, sdpLine); } } } //encode the IOD buffer = NULL; size = 0; gf_odf_desc_write((GF_Descriptor *) iod, &buffer, &size); gf_odf_desc_del((GF_Descriptor *)iod); //encode in Base64 the iod size64 = gf_base64_encode(buffer, size, buf64, 2000); buf64[size64] = 0; gf_free(buffer); sprintf(sdpLine, "a=mpeg4-iod:\"data:application/mpeg4-iod;base64,%s\"", buf64); gf_isom_sdp_add_line(file, sdpLine); return GF_OK; }
1
463,155
static void annotate_state_free(annotate_state_t **statep) { annotate_state_t *state = *statep; if (!state) return; annotate_state_finish(state); annotate_state_unset_scope(state); free(state); *statep = NULL; }
0
436,094
static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer) { struct io_timeout_data *data = container_of(timer, struct io_timeout_data, timer); struct io_kiocb *prev, *req = data->req; struct io_ring_ctx *ctx = req->ctx; unsigned long flags; spin_lock_irqsave(&ctx->completion_lock, flags); prev = req->timeout.head; req->timeout.head = NULL; /* * We don't expect the list to be empty, that will only happen if we * race with the completion of the linked work. */ if (prev) { io_remove_next_linked(prev); if (!req_ref_inc_not_zero(prev)) prev = NULL; } spin_unlock_irqrestore(&ctx->completion_lock, flags); if (prev) { io_async_find_and_cancel(ctx, req, prev->user_data, -ETIME); io_put_req_deferred(prev, 1); io_put_req_deferred(req, 1); } else { io_req_complete_post(req, -ETIME, 0); } return HRTIMER_NORESTART;
0
512,564
bool get_time(THD *thd, MYSQL_TIME *ltime) { return get_date(thd, ltime, Time::Options(thd)); }
0
512,547
Item_string(THD *thd, CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE): Item_literal(thd) { collation.set(cs, dv); max_length= 0; set_name(thd, NULL, 0, system_charset_info); decimals= NOT_FIXED_DEC; }
0
400,718
ssize_t __import_iovec(int type, const struct iovec __user *uvec, unsigned nr_segs, unsigned fast_segs, struct iovec **iovp, struct iov_iter *i, bool compat) { ssize_t total_len = 0; unsigned long seg; struct iovec *iov; iov = iovec_from_user(uvec, nr_segs, fast_segs, *iovp, compat); if (IS_ERR(iov)) { *iovp = NULL; return PTR_ERR(iov); } /* * According to the Single Unix Specification we should return EINVAL if * an element length is < 0 when cast to ssize_t or if the total length * would overflow the ssize_t return value of the system call. * * Linux caps all read/write calls to MAX_RW_COUNT, and avoids the * overflow case. */ for (seg = 0; seg < nr_segs; seg++) { ssize_t len = (ssize_t)iov[seg].iov_len; if (!access_ok(iov[seg].iov_base, len)) { if (iov != *iovp) kfree(iov); *iovp = NULL; return -EFAULT; } if (len > MAX_RW_COUNT - total_len) { len = MAX_RW_COUNT - total_len; iov[seg].iov_len = len; } total_len += len; } iov_iter_init(i, type, iov, nr_segs, total_len); if (iov == *iovp) *iovp = NULL; else *iovp = iov; return total_len; }
0
346,472
do_in_runtimepath( char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie) { return do_in_path_and_pp(p_rtp, name, flags, callback, cookie); }
0
443,157
static sector_t jfs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping, block, jfs_get_block); }
0
259,298
static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { #define DDTS_SIZE 20 uint8_t buf[DDTS_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; AVStream *st = NULL; uint32_t frame_duration_code = 0; uint32_t channel_layout_code = 0; GetBitContext gb; int ret; if ((ret = ffio_read_size(pb, buf, DDTS_SIZE)) < 0) return ret; init_get_bits(&gb, buf, 8 * DDTS_SIZE); if (c->fc->nb_streams < 1) { return 0; } st = c->fc->streams[c->fc->nb_streams-1]; st->codecpar->sample_rate = get_bits_long(&gb, 32); if (st->codecpar->sample_rate <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate); return AVERROR_INVALIDDATA; } skip_bits_long(&gb, 32); /* max bitrate */ st->codecpar->bit_rate = get_bits_long(&gb, 32); st->codecpar->bits_per_coded_sample = get_bits(&gb, 8); frame_duration_code = get_bits(&gb, 2); skip_bits(&gb, 30); /* various fields */ channel_layout_code = get_bits(&gb, 16); st->codecpar->frame_size = (frame_duration_code == 0) ? 512 : (frame_duration_code == 1) ? 1024 : (frame_duration_code == 2) ? 2048 : (frame_duration_code == 3) ? 4096 : 0; if (channel_layout_code > 0xff) { av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel layout\n"); } av_channel_layout_uninit(&st->codecpar->ch_layout); av_channel_layout_from_mask(&st->codecpar->ch_layout, ((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) | ((channel_layout_code & 0x2) ? AV_CH_FRONT_LEFT : 0) | ((channel_layout_code & 0x2) ? AV_CH_FRONT_RIGHT : 0) | ((channel_layout_code & 0x4) ? AV_CH_SIDE_LEFT : 0) | ((channel_layout_code & 0x4) ? AV_CH_SIDE_RIGHT : 0) | ((channel_layout_code & 0x8) ? AV_CH_LOW_FREQUENCY : 0)); return 0; }
0
253,703
static unsigned int ccp_empty_queue_buf(struct ccp_data *data) { return ccp_queue_buf(data, 1); }
0
487,610
int __kprobes atomic_notifier_call_chain(struct atomic_notifier_head *nh, unsigned long val, void *v) { int ret; rcu_read_lock(); ret = notifier_call_chain(&nh->head, val, v); rcu_read_unlock(); return ret; }
0
254,022
static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { struct v4l2_loopback_device *dev = v4l2loopback_getdevice(file); int devnr = ((struct v4l2loopback_private *)video_get_drvdata(dev->vdev))->devicenr; __u32 capabilities = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; strlcpy(cap->driver, "v4l2 loopback", sizeof(cap->driver)); vidioc_fill_name(cap->card, sizeof(cap->card), devnr); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:v4l2loopback-%03d", devnr); #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) /* since 3.1.0, the v4l2-core system is supposed to set the version */ cap->version = V4L2LOOPBACK_VERSION_CODE; #endif #ifdef V4L2_CAP_VIDEO_M2M capabilities |= V4L2_CAP_VIDEO_M2M; #endif /* V4L2_CAP_VIDEO_M2M */ if (dev->announce_all_caps) { capabilities |= V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT; } else { if (dev->ready_for_capture) { capabilities |= V4L2_CAP_VIDEO_CAPTURE; } if (dev->ready_for_output) { capabilities |= V4L2_CAP_VIDEO_OUTPUT; } } dev->vdev->device_caps = cap->device_caps = cap->capabilities = capabilities; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) cap->capabilities |= V4L2_CAP_DEVICE_CAPS; #endif memset(cap->reserved, 0, sizeof(cap->reserved)); return 0; }
0
458,992
HTTP_create(void *p, uint16_t nhttp, unsigned len) { struct http *hp; hp = p; hp->magic = HTTP_MAGIC; hp->hd = (void*)(hp + 1); hp->shd = nhttp; hp->hdf = (void*)(hp->hd + nhttp); assert((unsigned char*)p + len == hp->hdf + PRNDUP(nhttp)); return (hp); }
0
307,869
void ciEnv::dump_replay_data(outputStream* out) { GUARDED_VM_ENTRY( MutexLocker ml(Compile_lock); dump_replay_data_unsafe(out); ) }
0
487,625
asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit __user *rlim) { if (resource >= RLIM_NLIMITS) return -EINVAL; else { struct rlimit value; task_lock(current->group_leader); value = current->signal->rlim[resource]; task_unlock(current->group_leader); return copy_to_user(rlim, &value, sizeof(*rlim)) ? -EFAULT : 0; } }
0
200,113
static Image *ReadMATImageV4(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { typedef struct { unsigned char Type[4]; unsigned int nRows; unsigned int nCols; unsigned int imagf; unsigned int nameLen; } MAT4_HDR; long ldblk; EndianType endian; Image *rotated_image; MagickBooleanType status; MAT4_HDR HDR; QuantumInfo *quantum_info; QuantumFormatType format_type; register ssize_t i; ssize_t count, y; unsigned char *pixels; unsigned int depth; quantum_info=(QuantumInfo *) NULL; (void) SeekBlob(image,0,SEEK_SET); while (EOFBlob(image) == MagickFalse) { /* Object parser loop. */ ldblk=ReadBlobLSBLong(image); if ((ldblk > 9999) || (ldblk < 0)) break; HDR.Type[3]=ldblk % 10; ldblk /= 10; /* T digit */ HDR.Type[2]=ldblk % 10; ldblk /= 10; /* P digit */ HDR.Type[1]=ldblk % 10; ldblk /= 10; /* O digit */ HDR.Type[0]=ldblk; /* M digit */ if (HDR.Type[3] != 0) break; /* Data format */ if (HDR.Type[2] != 0) break; /* Always 0 */ if (HDR.Type[0] == 0) { HDR.nRows=ReadBlobLSBLong(image); HDR.nCols=ReadBlobLSBLong(image); HDR.imagf=ReadBlobLSBLong(image); HDR.nameLen=ReadBlobLSBLong(image); endian=LSBEndian; } else { HDR.nRows=ReadBlobMSBLong(image); HDR.nCols=ReadBlobMSBLong(image); HDR.imagf=ReadBlobMSBLong(image); HDR.nameLen=ReadBlobMSBLong(image); endian=MSBEndian; } if ((HDR.imagf != 0) && (HDR.imagf != 1)) break; if (HDR.nameLen > 0xFFFF) return(DestroyImageList(image)); for (i=0; i < (ssize_t) HDR.nameLen; i++) { int byte; /* Skip matrix name. */ byte=ReadBlobByte(image); if (byte == EOF) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } } image->columns=(size_t) HDR.nRows; image->rows=(size_t) HDR.nCols; if ((image->columns == 0) || (image->rows == 0)) return(DestroyImageList(image)); if (image_info->ping != MagickFalse) { Swap(image->columns,image->rows); if(HDR.imagf==1) ldblk *= 2; SeekBlob(image, HDR.nCols*ldblk, SEEK_CUR); if ((image->columns == 0) || (image->rows == 0)) return(image->previous == (Image *) NULL ? DestroyImageList(image) : image); goto skip_reading_current; } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); (void) SetImageBackgroundColor(image,exception); (void) SetImageColorspace(image,GRAYColorspace,exception); quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) return(DestroyImageList(image)); switch(HDR.Type[1]) { case 0: format_type=FloatingPointQuantumFormat; depth=64; break; case 1: format_type=FloatingPointQuantumFormat; depth=32; break; case 2: format_type=UnsignedQuantumFormat; depth=16; break; case 3: format_type=SignedQuantumFormat; depth=16; break; case 4: format_type=UnsignedQuantumFormat; depth=8; break; default: format_type=UnsignedQuantumFormat; depth=8; break; } image->depth=depth; if (HDR.Type[0] != 0) SetQuantumEndian(image,quantum_info,MSBEndian); status=SetQuantumFormat(image,quantum_info,format_type); status=SetQuantumDepth(image,quantum_info,depth); status=SetQuantumEndian(image,quantum_info,endian); SetQuantumScale(quantum_info,1.0); pixels=(unsigned char *) GetQuantumPixels(quantum_info); for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; count=ReadBlob(image,depth/8*image->columns,(char *) pixels); if (count == -1) break; q=QueueAuthenticPixels(image,0,image->rows-y-1,image->columns,1, exception); if (q == (Quantum *) NULL) break; (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, GrayQuantum,pixels,exception); if ((HDR.Type[1] == 2) || (HDR.Type[1] == 3)) FixSignedValues(image,q,(int) image->columns); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } if (HDR.imagf == 1) for (y=0; y < (ssize_t) image->rows; y++) { /* Read complex pixels. */ count=ReadBlob(image,depth/8*image->columns,(char *) pixels); if (count == -1) break; if (HDR.Type[1] == 0) InsertComplexDoubleRow(image,(double *) pixels,y,0,0,exception); else InsertComplexFloatRow(image,(float *) pixels,y,0,0,exception); } if (quantum_info != (QuantumInfo *) NULL) quantum_info=DestroyQuantumInfo(quantum_info); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } rotated_image=RotateImage(image,90.0,exception); if (rotated_image != (Image *) NULL) { rotated_image->page.x=0; rotated_image->page.y=0; rotated_image->colors = image->colors; DestroyBlob(rotated_image); rotated_image->blob=ReferenceBlob(image->blob); AppendImageToList(&image,rotated_image); DeleteImageFromList(&image); } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; /* Allocate next image structure. */ skip_reading_current: AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { status=MagickFalse; break; } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } (void) CloseBlob(image); if (status == MagickFalse) return(DestroyImageList(image)); return(GetFirstImageInList(image)); }
1
498,105
void cgit_snapshot_link(const char *name, const char *title, const char *class, const char *head, const char *rev, const char *archivename) { reporevlink("snapshot", name, title, class, head, rev, archivename); }
0
225,982
GF_Err chnl_box_read(GF_Box *s,GF_BitStream *bs) { GF_ChannelLayoutBox *ptr = (GF_ChannelLayoutBox *) s; ISOM_DECREASE_SIZE(s, 1) ptr->layout.stream_structure = gf_bs_read_u8(bs); if (ptr->layout.stream_structure & 1) { ISOM_DECREASE_SIZE(s, 1) ptr->layout.definedLayout = gf_bs_read_u8(bs); if (ptr->layout.definedLayout) { u32 remain = (u32) ptr->size; if (ptr->layout.stream_structure & 2) remain--; ptr->layout.channels_count = 0; while (remain) { ISOM_DECREASE_SIZE(s, 1) ptr->layout.layouts[ptr->layout.channels_count].position = gf_bs_read_u8(bs); remain--; if (ptr->layout.layouts[ptr->layout.channels_count].position == 126) { ISOM_DECREASE_SIZE(s, 3) ptr->layout.layouts[ptr->layout.channels_count].azimuth = gf_bs_read_int(bs, 16); ptr->layout.layouts[ptr->layout.channels_count].elevation = gf_bs_read_int(bs, 8); remain-=3; } } } else { ISOM_DECREASE_SIZE(s, 8) ptr->layout.omittedChannelsMap = gf_bs_read_u64(bs); } } if (ptr->layout.stream_structure & 2) { ISOM_DECREASE_SIZE(s, 1) ptr->layout.object_count = gf_bs_read_u8(bs); } return GF_OK;
0
384,125
raptor_xml_writer_set_option(raptor_xml_writer *xml_writer, raptor_option option, char* string, int integer) { return raptor_object_options_set_option(&xml_writer->options, option, string, integer); }
0
387,609
static inline void remove_hash_entries(struct snd_card *card, struct snd_kcontrol *kcontrol) { }
0
326,085
coll_get_char(void) { long nr = -1; switch (*regparse++) { case 'd': nr = getdecchrs(); break; case 'o': nr = getoctchrs(); break; case 'x': nr = gethexchrs(2); break; case 'u': nr = gethexchrs(4); break; case 'U': nr = gethexchrs(8); break; } if (nr < 0 || nr > INT_MAX) { // If getting the number fails be backwards compatible: the character // is a backslash. --regparse; nr = '\\'; } return nr; }
0
275,976
uECC_VLI_API void uECC_vli_modAdd(uECC_word_t *result, const uECC_word_t *left, const uECC_word_t *right, const uECC_word_t *mod, wordcount_t num_words) { uECC_word_t carry = uECC_vli_add(result, left, right, num_words); if (carry || uECC_vli_cmp_unsafe(mod, result, num_words) != 1) { /* result > mod (result = mod + remainder), so subtract mod to get remainder. */ uECC_vli_sub(result, result, mod, num_words); } }
0
432,092
store_word( spellinfo_T *spin, char_u *word, int flags, // extra flags, WF_BANNED int region, // supported region(s) char_u *pfxlist, // list of prefix IDs or NULL int need_affix) // only store word with affix ID { int len = (int)STRLEN(word); int ct = captype(word, word + len); char_u foldword[MAXWLEN]; int res = OK; char_u *p; // Avoid adding illegal bytes to the word tree. if (!valid_spell_word(word, word + len)) return FAIL; (void)spell_casefold(curwin, word, len, foldword, MAXWLEN); for (p = pfxlist; res == OK; ++p) { if (!need_affix || (p != NULL && *p != NUL)) res = tree_add_word(spin, foldword, spin->si_foldroot, ct | flags, region, p == NULL ? 0 : *p); if (p == NULL || *p == NUL) break; } ++spin->si_foldwcount; if (res == OK && (ct == WF_KEEPCAP || (flags & WF_KEEPCAP))) { for (p = pfxlist; res == OK; ++p) { if (!need_affix || (p != NULL && *p != NUL)) res = tree_add_word(spin, word, spin->si_keeproot, flags, region, p == NULL ? 0 : *p); if (p == NULL || *p == NUL) break; } ++spin->si_keepwcount; } return res; }
0
369,206
static inline void __io_req_complete(struct io_kiocb *req, unsigned issue_flags, s32 res, u32 cflags) { if (issue_flags & IO_URING_F_COMPLETE_DEFER) io_req_complete_state(req, res, cflags); else io_req_complete_post(req, res, cflags); }
0
241,048
static int host_convert(char *hostname, char *ip_str, size_t ip_size) { struct addrinfo *result = NULL, hints = {0}; int re = -1; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; re = getaddrinfo(hostname, NULL, &hints, &result); if (re == 0) { struct in_addr addr = ((struct sockaddr_in *)result->ai_addr)->sin_addr; const char *re_ntop = inet_ntop(AF_INET, &addr, ip_str, ip_size); if (re_ntop == NULL) { re = -1; } } freeaddrinfo(result); return re; }
0
246,475
static ut32 r_bin_wasm_get_start(RBinWasmObj *bin) { if (bin->g_start == UT32_MAX) { RBinWasmSection *sec = section_by_id_unique (bin->g_sections, R_BIN_WASM_SECTION_START); if (sec) { RBuffer *b = bin->buf; r_buf_seek (b, sec->payload_data, R_BUF_SET); ut64 bound = r_buf_tell (b) + sec->payload_len - 1; if (!consume_u32_r (b, bound, &bin->g_start)) { bin->g_start = UT32_MAX; } } } return bin->g_start; }
0
437,690
static inline u16 carrier_freq_to_clock_divider(unsigned int freq) { return count_to_clock_divider( DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, freq * 16)); }
0
225,738
GF_Box *smhd_box_new() { ISOM_DECL_BOX_ALLOC(GF_SoundMediaHeaderBox, GF_ISOM_BOX_TYPE_SMHD); return (GF_Box *)tmp; }
0
309,929
main(int argc, char *argv[]) { int ch; int fg, bg; double r; double c; #if HAVE_USE_DEFAULT_COLORS bool d_option = FALSE; #endif int m_option = 2; int r_option = 0; int s_option = 1; size_t need; char *my_env; while ((ch = getopt(argc, argv, "T:dem:r:s:")) != -1) { switch (ch) { case 'T': need = 6 + strlen(optarg); my_env = malloc(need); _nc_SPRINTF(my_env, _nc_SLIMIT(need) "TERM=%s", optarg); putenv(my_env); break; #if HAVE_USE_DEFAULT_COLORS case 'd': d_option = TRUE; break; #endif #if HAVE_USE_ENV case 'e': use_env(TRUE); break; #endif case 'm': m_option = atoi(optarg); break; case 'r': r_option = atoi(optarg); break; case 's': s_option = atoi(optarg); break; default: usage(); break; } } srand((unsigned) time(0)); SetupAlarm(r_option); InitAndCatch(initscr(), onsig); if (has_colors()) { start_color(); #if HAVE_USE_DEFAULT_COLORS if (d_option) use_default_colors(); #endif for (fg = 0; fg < COLORS; fg++) { for (bg = 0; bg < COLORS; bg++) { int pair; if (interrupted) { cleanup(); ExitProgram(EXIT_FAILURE); } pair = mypair(fg, bg); if (pair > 0) init_pair((short) pair, (short) fg, (short) bg); } } } r = (double) (LINES - (m_option * 2)); c = (double) (COLS - (m_option * 2)); started = time((time_t *) 0); fg = COLOR_WHITE; bg = COLOR_BLACK; while (!interrupted) { int x = (int) (c * ranf()) + m_option; int y = (int) (r * ranf()) + m_option; int p = (ranf() > 0.9) ? '*' : ' '; move(y, x); if (has_colors()) { int z = (int) (ranf() * COLORS); if (ranf() > 0.01) { set_colors(fg = z, bg); attron(COLOR_PAIR(mypair(fg, bg))); } else { set_colors(fg, bg = z); if (s_option) napms(s_option); } } else { if (ranf() <= 0.01) { if (ranf() > 0.6) { attron(A_REVERSE); } else { attroff(A_REVERSE); } if (s_option) napms(s_option); } } AddCh(p); refresh(); ++total_chars; } cleanup(); ExitProgram(EXIT_SUCCESS); }
0
226,236
GF_Box *elng_box_new() { ISOM_DECL_BOX_ALLOC(GF_MediaBox, GF_ISOM_BOX_TYPE_ELNG); return (GF_Box *)tmp; }
0
206,921
regmatch( char_u *scan, // Current node. proftime_T *tm UNUSED, // timeout limit or NULL int *timed_out UNUSED) // flag set on timeout or NULL { char_u *next; // Next node. int op; int c; regitem_T *rp; int no; int status; // one of the RA_ values: #ifdef FEAT_RELTIME int tm_count = 0; #endif // Make "regstack" and "backpos" empty. They are allocated and freed in // bt_regexec_both() to reduce malloc()/free() calls. regstack.ga_len = 0; backpos.ga_len = 0; // Repeat until "regstack" is empty. for (;;) { // Some patterns may take a long time to match, e.g., "\([a-z]\+\)\+Q". // Allow interrupting them with CTRL-C. fast_breakcheck(); #ifdef DEBUG if (scan != NULL && regnarrate) { mch_errmsg((char *)regprop(scan)); mch_errmsg("(\n"); } #endif // Repeat for items that can be matched sequentially, without using the // regstack. for (;;) { if (got_int || scan == NULL) { status = RA_FAIL; break; } #ifdef FEAT_RELTIME // Check for timeout once in a 100 times to avoid overhead. if (tm != NULL && ++tm_count == 100) { tm_count = 0; if (profile_passed_limit(tm)) { if (timed_out != NULL) *timed_out = TRUE; status = RA_FAIL; break; } } #endif status = RA_CONT; #ifdef DEBUG if (regnarrate) { mch_errmsg((char *)regprop(scan)); mch_errmsg("...\n"); # ifdef FEAT_SYN_HL if (re_extmatch_in != NULL) { int i; mch_errmsg(_("External submatches:\n")); for (i = 0; i < NSUBEXP; i++) { mch_errmsg(" \""); if (re_extmatch_in->matches[i] != NULL) mch_errmsg((char *)re_extmatch_in->matches[i]); mch_errmsg("\"\n"); } } # endif } #endif next = regnext(scan); op = OP(scan); // Check for character class with NL added. if (!rex.reg_line_lbr && WITH_NL(op) && REG_MULTI && *rex.input == NUL && rex.lnum <= rex.reg_maxline) { reg_nextline(); } else if (rex.reg_line_lbr && WITH_NL(op) && *rex.input == '\n') { ADVANCE_REGINPUT(); } else { if (WITH_NL(op)) op -= ADD_NL; if (has_mbyte) c = (*mb_ptr2char)(rex.input); else c = *rex.input; switch (op) { case BOL: if (rex.input != rex.line) status = RA_NOMATCH; break; case EOL: if (c != NUL) status = RA_NOMATCH; break; case RE_BOF: // We're not at the beginning of the file when below the first // line where we started, not at the start of the line or we // didn't start at the first line of the buffer. if (rex.lnum != 0 || rex.input != rex.line || (REG_MULTI && rex.reg_firstlnum > 1)) status = RA_NOMATCH; break; case RE_EOF: if (rex.lnum != rex.reg_maxline || c != NUL) status = RA_NOMATCH; break; case CURSOR: // Check if the buffer is in a window and compare the // rex.reg_win->w_cursor position to the match position. if (rex.reg_win == NULL || (rex.lnum + rex.reg_firstlnum != rex.reg_win->w_cursor.lnum) || ((colnr_T)(rex.input - rex.line) != rex.reg_win->w_cursor.col)) status = RA_NOMATCH; break; case RE_MARK: // Compare the mark position to the match position. { int mark = OPERAND(scan)[0]; int cmp = OPERAND(scan)[1]; pos_T *pos; pos = getmark_buf(rex.reg_buf, mark, FALSE); if (pos == NULL // mark doesn't exist || pos->lnum <= 0) // mark isn't set in reg_buf { status = RA_NOMATCH; } else { colnr_T pos_col = pos->lnum == rex.lnum + rex.reg_firstlnum && pos->col == MAXCOL ? (colnr_T)STRLEN(reg_getline( pos->lnum - rex.reg_firstlnum)) : pos->col; if ((pos->lnum == rex.lnum + rex.reg_firstlnum ? (pos_col == (colnr_T)(rex.input - rex.line) ? (cmp == '<' || cmp == '>') : (pos_col < (colnr_T)(rex.input - rex.line) ? cmp != '>' : cmp != '<')) : (pos->lnum < rex.lnum + rex.reg_firstlnum ? cmp != '>' : cmp != '<'))) status = RA_NOMATCH; } } break; case RE_VISUAL: if (!reg_match_visual()) status = RA_NOMATCH; break; case RE_LNUM: if (!REG_MULTI || !re_num_cmp((long_u)(rex.lnum + rex.reg_firstlnum), scan)) status = RA_NOMATCH; break; case RE_COL: if (!re_num_cmp((long_u)(rex.input - rex.line) + 1, scan)) status = RA_NOMATCH; break; case RE_VCOL: if (!re_num_cmp((long_u)win_linetabsize( rex.reg_win == NULL ? curwin : rex.reg_win, rex.line, (colnr_T)(rex.input - rex.line)) + 1, scan)) status = RA_NOMATCH; break; case BOW: // \<word; rex.input points to w if (c == NUL) // Can't match at end of line status = RA_NOMATCH; else if (has_mbyte) { int this_class; // Get class of current and previous char (if it exists). this_class = mb_get_class_buf(rex.input, rex.reg_buf); if (this_class <= 1) status = RA_NOMATCH; // not on a word at all else if (reg_prev_class() == this_class) status = RA_NOMATCH; // previous char is in same word } else { if (!vim_iswordc_buf(c, rex.reg_buf) || (rex.input > rex.line && vim_iswordc_buf(rex.input[-1], rex.reg_buf))) status = RA_NOMATCH; } break; case EOW: // word\>; rex.input points after d if (rex.input == rex.line) // Can't match at start of line status = RA_NOMATCH; else if (has_mbyte) { int this_class, prev_class; // Get class of current and previous char (if it exists). this_class = mb_get_class_buf(rex.input, rex.reg_buf); prev_class = reg_prev_class(); if (this_class == prev_class || prev_class == 0 || prev_class == 1) status = RA_NOMATCH; } else { if (!vim_iswordc_buf(rex.input[-1], rex.reg_buf) || (rex.input[0] != NUL && vim_iswordc_buf(c, rex.reg_buf))) status = RA_NOMATCH; } break; // Matched with EOW case ANY: // ANY does not match new lines. if (c == NUL) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case IDENT: if (!vim_isIDc(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case SIDENT: if (VIM_ISDIGIT(*rex.input) || !vim_isIDc(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case KWORD: if (!vim_iswordp_buf(rex.input, rex.reg_buf)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case SKWORD: if (VIM_ISDIGIT(*rex.input) || !vim_iswordp_buf(rex.input, rex.reg_buf)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case FNAME: if (!vim_isfilec(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case SFNAME: if (VIM_ISDIGIT(*rex.input) || !vim_isfilec(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case PRINT: if (!vim_isprintc(PTR2CHAR(rex.input))) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case SPRINT: if (VIM_ISDIGIT(*rex.input) || !vim_isprintc(PTR2CHAR(rex.input))) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case WHITE: if (!VIM_ISWHITE(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NWHITE: if (c == NUL || VIM_ISWHITE(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case DIGIT: if (!ri_digit(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NDIGIT: if (c == NUL || ri_digit(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case HEX: if (!ri_hex(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NHEX: if (c == NUL || ri_hex(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case OCTAL: if (!ri_octal(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NOCTAL: if (c == NUL || ri_octal(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case WORD: if (!ri_word(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NWORD: if (c == NUL || ri_word(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case HEAD: if (!ri_head(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NHEAD: if (c == NUL || ri_head(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case ALPHA: if (!ri_alpha(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NALPHA: if (c == NUL || ri_alpha(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case LOWER: if (!ri_lower(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NLOWER: if (c == NUL || ri_lower(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case UPPER: if (!ri_upper(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case NUPPER: if (c == NUL || ri_upper(c)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case EXACTLY: { int len; char_u *opnd; opnd = OPERAND(scan); // Inline the first byte, for speed. if (*opnd != *rex.input && (!rex.reg_ic || (!enc_utf8 && MB_TOLOWER(*opnd) != MB_TOLOWER(*rex.input)))) status = RA_NOMATCH; else if (*opnd == NUL) { // match empty string always works; happens when "~" is // empty. } else { if (opnd[1] == NUL && !(enc_utf8 && rex.reg_ic)) { len = 1; // matched a single byte above } else { // Need to match first byte again for multi-byte. len = (int)STRLEN(opnd); if (cstrncmp(opnd, rex.input, &len) != 0) status = RA_NOMATCH; } // Check for following composing character, unless %C // follows (skips over all composing chars). if (status != RA_NOMATCH && enc_utf8 && UTF_COMPOSINGLIKE(rex.input, rex.input + len) && !rex.reg_icombine && OP(next) != RE_COMPOSING) { // raaron: This code makes a composing character get // ignored, which is the correct behavior (sometimes) // for voweled Hebrew texts. status = RA_NOMATCH; } if (status != RA_NOMATCH) rex.input += len; } } break; case ANYOF: case ANYBUT: if (c == NUL) status = RA_NOMATCH; else if ((cstrchr(OPERAND(scan), c) == NULL) == (op == ANYOF)) status = RA_NOMATCH; else ADVANCE_REGINPUT(); break; case MULTIBYTECODE: if (has_mbyte) { int i, len; char_u *opnd; int opndc = 0, inpc; opnd = OPERAND(scan); // Safety check (just in case 'encoding' was changed since // compiling the program). if ((len = (*mb_ptr2len)(opnd)) < 2) { status = RA_NOMATCH; break; } if (enc_utf8) opndc = utf_ptr2char(opnd); if (enc_utf8 && utf_iscomposing(opndc)) { // When only a composing char is given match at any // position where that composing char appears. status = RA_NOMATCH; for (i = 0; rex.input[i] != NUL; i += utf_ptr2len(rex.input + i)) { inpc = utf_ptr2char(rex.input + i); if (!utf_iscomposing(inpc)) { if (i > 0) break; } else if (opndc == inpc) { // Include all following composing chars. len = i + utfc_ptr2len(rex.input + i); status = RA_MATCH; break; } } } else for (i = 0; i < len; ++i) if (opnd[i] != rex.input[i]) { status = RA_NOMATCH; break; } rex.input += len; } else status = RA_NOMATCH; break; case RE_COMPOSING: if (enc_utf8) { // Skip composing characters. while (utf_iscomposing(utf_ptr2char(rex.input))) MB_CPTR_ADV(rex.input); } break; case NOTHING: break; case BACK: { int i; backpos_T *bp; // When we run into BACK we need to check if we don't keep // looping without matching any input. The second and later // times a BACK is encountered it fails if the input is still // at the same position as the previous time. // The positions are stored in "backpos" and found by the // current value of "scan", the position in the RE program. bp = (backpos_T *)backpos.ga_data; for (i = 0; i < backpos.ga_len; ++i) if (bp[i].bp_scan == scan) break; if (i == backpos.ga_len) { // First time at this BACK, make room to store the pos. if (ga_grow(&backpos, 1) == FAIL) status = RA_FAIL; else { // get "ga_data" again, it may have changed bp = (backpos_T *)backpos.ga_data; bp[i].bp_scan = scan; ++backpos.ga_len; } } else if (reg_save_equal(&bp[i].bp_pos)) // Still at same position as last time, fail. status = RA_NOMATCH; if (status != RA_FAIL && status != RA_NOMATCH) reg_save(&bp[i].bp_pos, &backpos); } break; case MOPEN + 0: // Match start: \zs case MOPEN + 1: // \( case MOPEN + 2: case MOPEN + 3: case MOPEN + 4: case MOPEN + 5: case MOPEN + 6: case MOPEN + 7: case MOPEN + 8: case MOPEN + 9: { no = op - MOPEN; cleanup_subexpr(); rp = regstack_push(RS_MOPEN, scan); if (rp == NULL) status = RA_FAIL; else { rp->rs_no = no; save_se(&rp->rs_un.sesave, &rex.reg_startpos[no], &rex.reg_startp[no]); // We simply continue and handle the result when done. } } break; case NOPEN: // \%( case NCLOSE: // \) after \%( if (regstack_push(RS_NOPEN, scan) == NULL) status = RA_FAIL; // We simply continue and handle the result when done. break; #ifdef FEAT_SYN_HL case ZOPEN + 1: case ZOPEN + 2: case ZOPEN + 3: case ZOPEN + 4: case ZOPEN + 5: case ZOPEN + 6: case ZOPEN + 7: case ZOPEN + 8: case ZOPEN + 9: { no = op - ZOPEN; cleanup_zsubexpr(); rp = regstack_push(RS_ZOPEN, scan); if (rp == NULL) status = RA_FAIL; else { rp->rs_no = no; save_se(&rp->rs_un.sesave, &reg_startzpos[no], &reg_startzp[no]); // We simply continue and handle the result when done. } } break; #endif case MCLOSE + 0: // Match end: \ze case MCLOSE + 1: // \) case MCLOSE + 2: case MCLOSE + 3: case MCLOSE + 4: case MCLOSE + 5: case MCLOSE + 6: case MCLOSE + 7: case MCLOSE + 8: case MCLOSE + 9: { no = op - MCLOSE; cleanup_subexpr(); rp = regstack_push(RS_MCLOSE, scan); if (rp == NULL) status = RA_FAIL; else { rp->rs_no = no; save_se(&rp->rs_un.sesave, &rex.reg_endpos[no], &rex.reg_endp[no]); // We simply continue and handle the result when done. } } break; #ifdef FEAT_SYN_HL case ZCLOSE + 1: // \) after \z( case ZCLOSE + 2: case ZCLOSE + 3: case ZCLOSE + 4: case ZCLOSE + 5: case ZCLOSE + 6: case ZCLOSE + 7: case ZCLOSE + 8: case ZCLOSE + 9: { no = op - ZCLOSE; cleanup_zsubexpr(); rp = regstack_push(RS_ZCLOSE, scan); if (rp == NULL) status = RA_FAIL; else { rp->rs_no = no; save_se(&rp->rs_un.sesave, &reg_endzpos[no], &reg_endzp[no]); // We simply continue and handle the result when done. } } break; #endif case BACKREF + 1: case BACKREF + 2: case BACKREF + 3: case BACKREF + 4: case BACKREF + 5: case BACKREF + 6: case BACKREF + 7: case BACKREF + 8: case BACKREF + 9: { int len; no = op - BACKREF; cleanup_subexpr(); if (!REG_MULTI) // Single-line regexp { if (rex.reg_startp[no] == NULL || rex.reg_endp[no] == NULL) { // Backref was not set: Match an empty string. len = 0; } else { // Compare current input with back-ref in the same // line. len = (int)(rex.reg_endp[no] - rex.reg_startp[no]); if (cstrncmp(rex.reg_startp[no], rex.input, &len) != 0) status = RA_NOMATCH; } } else // Multi-line regexp { if (rex.reg_startpos[no].lnum < 0 || rex.reg_endpos[no].lnum < 0) { // Backref was not set: Match an empty string. len = 0; } else { if (rex.reg_startpos[no].lnum == rex.lnum && rex.reg_endpos[no].lnum == rex.lnum) { // Compare back-ref within the current line. len = rex.reg_endpos[no].col - rex.reg_startpos[no].col; if (cstrncmp(rex.line + rex.reg_startpos[no].col, rex.input, &len) != 0) status = RA_NOMATCH; } else { // Messy situation: Need to compare between two // lines. int r = match_with_backref( rex.reg_startpos[no].lnum, rex.reg_startpos[no].col, rex.reg_endpos[no].lnum, rex.reg_endpos[no].col, &len); if (r != RA_MATCH) status = r; } } } // Matched the backref, skip over it. rex.input += len; } break; #ifdef FEAT_SYN_HL case ZREF + 1: case ZREF + 2: case ZREF + 3: case ZREF + 4: case ZREF + 5: case ZREF + 6: case ZREF + 7: case ZREF + 8: case ZREF + 9: { int len; cleanup_zsubexpr(); no = op - ZREF; if (re_extmatch_in != NULL && re_extmatch_in->matches[no] != NULL) { len = (int)STRLEN(re_extmatch_in->matches[no]); if (cstrncmp(re_extmatch_in->matches[no], rex.input, &len) != 0) status = RA_NOMATCH; else rex.input += len; } else { // Backref was not set: Match an empty string. } } break; #endif case BRANCH: { if (OP(next) != BRANCH) // No choice. next = OPERAND(scan); // Avoid recursion. else { rp = regstack_push(RS_BRANCH, scan); if (rp == NULL) status = RA_FAIL; else status = RA_BREAK; // rest is below } } break; case BRACE_LIMITS: { if (OP(next) == BRACE_SIMPLE) { bl_minval = OPERAND_MIN(scan); bl_maxval = OPERAND_MAX(scan); } else if (OP(next) >= BRACE_COMPLEX && OP(next) < BRACE_COMPLEX + 10) { no = OP(next) - BRACE_COMPLEX; brace_min[no] = OPERAND_MIN(scan); brace_max[no] = OPERAND_MAX(scan); brace_count[no] = 0; } else { internal_error("BRACE_LIMITS"); status = RA_FAIL; } } break; case BRACE_COMPLEX + 0: case BRACE_COMPLEX + 1: case BRACE_COMPLEX + 2: case BRACE_COMPLEX + 3: case BRACE_COMPLEX + 4: case BRACE_COMPLEX + 5: case BRACE_COMPLEX + 6: case BRACE_COMPLEX + 7: case BRACE_COMPLEX + 8: case BRACE_COMPLEX + 9: { no = op - BRACE_COMPLEX; ++brace_count[no]; // If not matched enough times yet, try one more if (brace_count[no] <= (brace_min[no] <= brace_max[no] ? brace_min[no] : brace_max[no])) { rp = regstack_push(RS_BRCPLX_MORE, scan); if (rp == NULL) status = RA_FAIL; else { rp->rs_no = no; reg_save(&rp->rs_un.regsave, &backpos); next = OPERAND(scan); // We continue and handle the result when done. } break; } // If matched enough times, may try matching some more if (brace_min[no] <= brace_max[no]) { // Range is the normal way around, use longest match if (brace_count[no] <= brace_max[no]) { rp = regstack_push(RS_BRCPLX_LONG, scan); if (rp == NULL) status = RA_FAIL; else { rp->rs_no = no; reg_save(&rp->rs_un.regsave, &backpos); next = OPERAND(scan); // We continue and handle the result when done. } } } else { // Range is backwards, use shortest match first if (brace_count[no] <= brace_min[no]) { rp = regstack_push(RS_BRCPLX_SHORT, scan); if (rp == NULL) status = RA_FAIL; else { reg_save(&rp->rs_un.regsave, &backpos); // We continue and handle the result when done. } } } } break; case BRACE_SIMPLE: case STAR: case PLUS: { regstar_T rst; // Lookahead to avoid useless match attempts when we know // what character comes next. if (OP(next) == EXACTLY) { rst.nextb = *OPERAND(next); if (rex.reg_ic) { if (MB_ISUPPER(rst.nextb)) rst.nextb_ic = MB_TOLOWER(rst.nextb); else rst.nextb_ic = MB_TOUPPER(rst.nextb); } else rst.nextb_ic = rst.nextb; } else { rst.nextb = NUL; rst.nextb_ic = NUL; } if (op != BRACE_SIMPLE) { rst.minval = (op == STAR) ? 0 : 1; rst.maxval = MAX_LIMIT; } else { rst.minval = bl_minval; rst.maxval = bl_maxval; } // When maxval > minval, try matching as much as possible, up // to maxval. When maxval < minval, try matching at least the // minimal number (since the range is backwards, that's also // maxval!). rst.count = regrepeat(OPERAND(scan), rst.maxval); if (got_int) { status = RA_FAIL; break; } if (rst.minval <= rst.maxval ? rst.count >= rst.minval : rst.count >= rst.maxval) { // It could match. Prepare for trying to match what // follows. The code is below. Parameters are stored in // a regstar_T on the regstack. if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) { emsg(_(e_pattern_uses_more_memory_than_maxmempattern)); status = RA_FAIL; } else if (ga_grow(&regstack, sizeof(regstar_T)) == FAIL) status = RA_FAIL; else { regstack.ga_len += sizeof(regstar_T); rp = regstack_push(rst.minval <= rst.maxval ? RS_STAR_LONG : RS_STAR_SHORT, scan); if (rp == NULL) status = RA_FAIL; else { *(((regstar_T *)rp) - 1) = rst; status = RA_BREAK; // skip the restore bits } } } else status = RA_NOMATCH; } break; case NOMATCH: case MATCH: case SUBPAT: rp = regstack_push(RS_NOMATCH, scan); if (rp == NULL) status = RA_FAIL; else { rp->rs_no = op; reg_save(&rp->rs_un.regsave, &backpos); next = OPERAND(scan); // We continue and handle the result when done. } break; case BEHIND: case NOBEHIND: // Need a bit of room to store extra positions. if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) { emsg(_(e_pattern_uses_more_memory_than_maxmempattern)); status = RA_FAIL; } else if (ga_grow(&regstack, sizeof(regbehind_T)) == FAIL) status = RA_FAIL; else { regstack.ga_len += sizeof(regbehind_T); rp = regstack_push(RS_BEHIND1, scan); if (rp == NULL) status = RA_FAIL; else { // Need to save the subexpr to be able to restore them // when there is a match but we don't use it. save_subexpr(((regbehind_T *)rp) - 1); rp->rs_no = op; reg_save(&rp->rs_un.regsave, &backpos); // First try if what follows matches. If it does then we // check the behind match by looping. } } break; case BHPOS: if (REG_MULTI) { if (behind_pos.rs_u.pos.col != (colnr_T)(rex.input - rex.line) || behind_pos.rs_u.pos.lnum != rex.lnum) status = RA_NOMATCH; } else if (behind_pos.rs_u.ptr != rex.input) status = RA_NOMATCH; break; case NEWL: if ((c != NUL || !REG_MULTI || rex.lnum > rex.reg_maxline || rex.reg_line_lbr) && (c != '\n' || !rex.reg_line_lbr)) status = RA_NOMATCH; else if (rex.reg_line_lbr) ADVANCE_REGINPUT(); else reg_nextline(); break; case END: status = RA_MATCH; // Success! break; default: iemsg(_(e_corrupted_regexp_program)); #ifdef DEBUG printf("Illegal op code %d\n", op); #endif status = RA_FAIL; break; } } // If we can't continue sequentially, break the inner loop. if (status != RA_CONT) break; // Continue in inner loop, advance to next item. scan = next; } // end of inner loop // If there is something on the regstack execute the code for the state. // If the state is popped then loop and use the older state. while (regstack.ga_len > 0 && status != RA_FAIL) { rp = (regitem_T *)((char *)regstack.ga_data + regstack.ga_len) - 1; switch (rp->rs_state) { case RS_NOPEN: // Result is passed on as-is, simply pop the state. regstack_pop(&scan); break; case RS_MOPEN: // Pop the state. Restore pointers when there is no match. if (status == RA_NOMATCH) restore_se(&rp->rs_un.sesave, &rex.reg_startpos[rp->rs_no], &rex.reg_startp[rp->rs_no]); regstack_pop(&scan); break; #ifdef FEAT_SYN_HL case RS_ZOPEN: // Pop the state. Restore pointers when there is no match. if (status == RA_NOMATCH) restore_se(&rp->rs_un.sesave, &reg_startzpos[rp->rs_no], &reg_startzp[rp->rs_no]); regstack_pop(&scan); break; #endif case RS_MCLOSE: // Pop the state. Restore pointers when there is no match. if (status == RA_NOMATCH) restore_se(&rp->rs_un.sesave, &rex.reg_endpos[rp->rs_no], &rex.reg_endp[rp->rs_no]); regstack_pop(&scan); break; #ifdef FEAT_SYN_HL case RS_ZCLOSE: // Pop the state. Restore pointers when there is no match. if (status == RA_NOMATCH) restore_se(&rp->rs_un.sesave, &reg_endzpos[rp->rs_no], &reg_endzp[rp->rs_no]); regstack_pop(&scan); break; #endif case RS_BRANCH: if (status == RA_MATCH) // this branch matched, use it regstack_pop(&scan); else { if (status != RA_BREAK) { // After a non-matching branch: try next one. reg_restore(&rp->rs_un.regsave, &backpos); scan = rp->rs_scan; } if (scan == NULL || OP(scan) != BRANCH) { // no more branches, didn't find a match status = RA_NOMATCH; regstack_pop(&scan); } else { // Prepare to try a branch. rp->rs_scan = regnext(scan); reg_save(&rp->rs_un.regsave, &backpos); scan = OPERAND(scan); } } break; case RS_BRCPLX_MORE: // Pop the state. Restore pointers when there is no match. if (status == RA_NOMATCH) { reg_restore(&rp->rs_un.regsave, &backpos); --brace_count[rp->rs_no]; // decrement match count } regstack_pop(&scan); break; case RS_BRCPLX_LONG: // Pop the state. Restore pointers when there is no match. if (status == RA_NOMATCH) { // There was no match, but we did find enough matches. reg_restore(&rp->rs_un.regsave, &backpos); --brace_count[rp->rs_no]; // continue with the items after "\{}" status = RA_CONT; } regstack_pop(&scan); if (status == RA_CONT) scan = regnext(scan); break; case RS_BRCPLX_SHORT: // Pop the state. Restore pointers when there is no match. if (status == RA_NOMATCH) // There was no match, try to match one more item. reg_restore(&rp->rs_un.regsave, &backpos); regstack_pop(&scan); if (status == RA_NOMATCH) { scan = OPERAND(scan); status = RA_CONT; } break; case RS_NOMATCH: // Pop the state. If the operand matches for NOMATCH or // doesn't match for MATCH/SUBPAT, we fail. Otherwise backup, // except for SUBPAT, and continue with the next item. if (status == (rp->rs_no == NOMATCH ? RA_MATCH : RA_NOMATCH)) status = RA_NOMATCH; else { status = RA_CONT; if (rp->rs_no != SUBPAT) // zero-width reg_restore(&rp->rs_un.regsave, &backpos); } regstack_pop(&scan); if (status == RA_CONT) scan = regnext(scan); break; case RS_BEHIND1: if (status == RA_NOMATCH) { regstack_pop(&scan); regstack.ga_len -= sizeof(regbehind_T); } else { // The stuff after BEHIND/NOBEHIND matches. Now try if // the behind part does (not) match before the current // position in the input. This must be done at every // position in the input and checking if the match ends at // the current position. // save the position after the found match for next reg_save(&(((regbehind_T *)rp) - 1)->save_after, &backpos); // Start looking for a match with operand at the current // position. Go back one character until we find the // result, hitting the start of the line or the previous // line (for multi-line matching). // Set behind_pos to where the match should end, BHPOS // will match it. Save the current value. (((regbehind_T *)rp) - 1)->save_behind = behind_pos; behind_pos = rp->rs_un.regsave; rp->rs_state = RS_BEHIND2; reg_restore(&rp->rs_un.regsave, &backpos); scan = OPERAND(rp->rs_scan) + 4; } break; case RS_BEHIND2: // Looping for BEHIND / NOBEHIND match. if (status == RA_MATCH && reg_save_equal(&behind_pos)) { // found a match that ends where "next" started behind_pos = (((regbehind_T *)rp) - 1)->save_behind; if (rp->rs_no == BEHIND) reg_restore(&(((regbehind_T *)rp) - 1)->save_after, &backpos); else { // But we didn't want a match. Need to restore the // subexpr, because what follows matched, so they have // been set. status = RA_NOMATCH; restore_subexpr(((regbehind_T *)rp) - 1); } regstack_pop(&scan); regstack.ga_len -= sizeof(regbehind_T); } else { long limit; // No match or a match that doesn't end where we want it: Go // back one character. May go to previous line once. no = OK; limit = OPERAND_MIN(rp->rs_scan); if (REG_MULTI) { if (limit > 0 && ((rp->rs_un.regsave.rs_u.pos.lnum < behind_pos.rs_u.pos.lnum ? (colnr_T)STRLEN(rex.line) : behind_pos.rs_u.pos.col) - rp->rs_un.regsave.rs_u.pos.col >= limit)) no = FAIL; else if (rp->rs_un.regsave.rs_u.pos.col == 0) { if (rp->rs_un.regsave.rs_u.pos.lnum < behind_pos.rs_u.pos.lnum || reg_getline( --rp->rs_un.regsave.rs_u.pos.lnum) == NULL) no = FAIL; else { reg_restore(&rp->rs_un.regsave, &backpos); rp->rs_un.regsave.rs_u.pos.col = (colnr_T)STRLEN(rex.line); } } else { if (has_mbyte) { char_u *line = reg_getline(rp->rs_un.regsave.rs_u.pos.lnum); rp->rs_un.regsave.rs_u.pos.col -= (*mb_head_off)(line, line + rp->rs_un.regsave.rs_u.pos.col - 1) + 1; } else --rp->rs_un.regsave.rs_u.pos.col; } } else { if (rp->rs_un.regsave.rs_u.ptr == rex.line) no = FAIL; else { MB_PTR_BACK(rex.line, rp->rs_un.regsave.rs_u.ptr); if (limit > 0 && (long)(behind_pos.rs_u.ptr - rp->rs_un.regsave.rs_u.ptr) > limit) no = FAIL; } } if (no == OK) { // Advanced, prepare for finding match again. reg_restore(&rp->rs_un.regsave, &backpos); scan = OPERAND(rp->rs_scan) + 4; if (status == RA_MATCH) { // We did match, so subexpr may have been changed, // need to restore them for the next try. status = RA_NOMATCH; restore_subexpr(((regbehind_T *)rp) - 1); } } else { // Can't advance. For NOBEHIND that's a match. behind_pos = (((regbehind_T *)rp) - 1)->save_behind; if (rp->rs_no == NOBEHIND) { reg_restore(&(((regbehind_T *)rp) - 1)->save_after, &backpos); status = RA_MATCH; } else { // We do want a proper match. Need to restore the // subexpr if we had a match, because they may have // been set. if (status == RA_MATCH) { status = RA_NOMATCH; restore_subexpr(((regbehind_T *)rp) - 1); } } regstack_pop(&scan); regstack.ga_len -= sizeof(regbehind_T); } } break; case RS_STAR_LONG: case RS_STAR_SHORT: { regstar_T *rst = ((regstar_T *)rp) - 1; if (status == RA_MATCH) { regstack_pop(&scan); regstack.ga_len -= sizeof(regstar_T); break; } // Tried once already, restore input pointers. if (status != RA_BREAK) reg_restore(&rp->rs_un.regsave, &backpos); // Repeat until we found a position where it could match. for (;;) { if (status != RA_BREAK) { // Tried first position already, advance. if (rp->rs_state == RS_STAR_LONG) { // Trying for longest match, but couldn't or // didn't match -- back up one char. if (--rst->count < rst->minval) break; if (rex.input == rex.line) { // backup to last char of previous line --rex.lnum; rex.line = reg_getline(rex.lnum); // Just in case regrepeat() didn't count // right. if (rex.line == NULL) break; rex.input = rex.line + STRLEN(rex.line); fast_breakcheck(); } else MB_PTR_BACK(rex.line, rex.input); } else { // Range is backwards, use shortest match first. // Careful: maxval and minval are exchanged! // Couldn't or didn't match: try advancing one // char. if (rst->count == rst->minval || regrepeat(OPERAND(rp->rs_scan), 1L) == 0) break; ++rst->count; } if (got_int) break; } else status = RA_NOMATCH; // If it could match, try it. if (rst->nextb == NUL || *rex.input == rst->nextb || *rex.input == rst->nextb_ic) { reg_save(&rp->rs_un.regsave, &backpos); scan = regnext(rp->rs_scan); status = RA_CONT; break; } } if (status != RA_CONT) { // Failed. regstack_pop(&scan); regstack.ga_len -= sizeof(regstar_T); status = RA_NOMATCH; } } break; } // If we want to continue the inner loop or didn't pop a state // continue matching loop if (status == RA_CONT || rp == (regitem_T *) ((char *)regstack.ga_data + regstack.ga_len) - 1) break; } // May need to continue with the inner loop, starting at "scan". if (status == RA_CONT) continue; // If the regstack is empty or something failed we are done. if (regstack.ga_len == 0 || status == RA_FAIL) { if (scan == NULL) { // We get here only if there's trouble -- normally "case END" is // the terminating point. iemsg(_(e_corrupted_regexp_program)); #ifdef DEBUG printf("Premature EOL\n"); #endif } return (status == RA_MATCH); } } // End of loop until the regstack is empty. // NOTREACHED }
1
513,291
int join_init_read_record(JOIN_TAB *tab) { /* Note: the query plan tree for the below operations is constructed in save_agg_explain_data. */ if (tab->distinct && tab->remove_duplicates()) // Remove duplicates. return 1; if (tab->filesort && tab->sort_table()) // Sort table. return 1; DBUG_EXECUTE_IF("kill_join_init_read_record", tab->join->thd->set_killed(KILL_QUERY);); if (tab->select && tab->select->quick && tab->select->quick->reset()) { /* Ensures error status is propagated back to client */ report_error(tab->table, tab->join->thd->killed ? HA_ERR_QUERY_INTERRUPTED : HA_ERR_OUT_OF_MEM); return 1; } /* make sure we won't get ER_QUERY_INTERRUPTED from any code below */ DBUG_EXECUTE_IF("kill_join_init_read_record", tab->join->thd->reset_killed();); if (!tab->preread_init_done && tab->preread_init()) return 1; if (init_read_record(&tab->read_record, tab->join->thd, tab->table, tab->select, tab->filesort_result, 1,1, FALSE)) return 1; return (*tab->read_record.read_record)(&tab->read_record); }
0
276,917
static int i2c_get_cur_bus(struct udevice **busp) { #ifdef CONFIG_I2C_SET_DEFAULT_BUS_NUM if (!i2c_cur_bus) { if (cmd_i2c_set_bus_num(CONFIG_I2C_DEFAULT_BUS_NUMBER)) { printf("Default I2C bus %d not found\n", CONFIG_I2C_DEFAULT_BUS_NUMBER); return -ENODEV; } } #endif if (!i2c_cur_bus) { puts("No I2C bus selected\n"); return -ENODEV; } *busp = i2c_cur_bus; return 0; }
0
349,900
static u32 hw_atl_utils_mif_addr_get(struct aq_hw_s *self) { return aq_hw_read_reg(self, HW_ATL_MIF_ADDR); }
0
369,403
static void tctx_task_work(struct callback_head *cb) { bool uring_locked = false; struct io_ring_ctx *ctx = NULL; struct io_uring_task *tctx = container_of(cb, struct io_uring_task, task_work); while (1) { struct io_wq_work_node *node1, *node2; if (!tctx->task_list.first && !tctx->prior_task_list.first && uring_locked) io_submit_flush_completions(ctx); spin_lock_irq(&tctx->task_lock); node1 = tctx->prior_task_list.first; node2 = tctx->task_list.first; INIT_WQ_LIST(&tctx->task_list); INIT_WQ_LIST(&tctx->prior_task_list); if (!node2 && !node1) tctx->task_running = false; spin_unlock_irq(&tctx->task_lock); if (!node2 && !node1) break; if (node1) handle_prev_tw_list(node1, &ctx, &uring_locked); if (node2) handle_tw_list(node2, &ctx, &uring_locked); cond_resched(); } ctx_flush_and_put(ctx, &uring_locked); /* relaxed read is enough as only the task itself sets ->in_idle */ if (unlikely(atomic_read(&tctx->in_idle))) io_uring_drop_tctx_refs(current); }
0
273,058
linear_regression(double *m, double *b, double *r2, const double *x, const double *y, int n) { double x_val; double sum_x = 0; double sum_x2 = 0; double sum_y = 0; double sum_y2 = 0; double sum_xy = 0; double denom; int i; for (i = 0; i < n; i++) { x_val = x ? x[i] : (double)i; sum_x += x_val; sum_x2 += x_val * x_val; sum_y += y[i]; sum_y2 += y[i] * y[i]; sum_xy += x_val * y[i]; } denom = (n * sum_x2 - sum_x * sum_x); if (denom == 0) return -1; *m = (n * sum_xy - sum_x * sum_y) / denom; *b = (sum_y * sum_x2 - sum_x * sum_xy) / denom; if (r2) *r2 = (sum_xy - (sum_x * sum_y)/n) * (sum_xy - (sum_x * sum_y)/n) / ((sum_x2 - (sum_x * sum_x)/n) * (sum_y2 - (sum_y * sum_y)/n)); return 0; }
0
462,310
status_do_fonts(stream * s, pcl_state_t * pcs, pcl_data_storage_t storage, bool extended) { gs_const_string key; void *value; pl_dict_enum_t denum; int res; pl_dict_enum_begin(&pcs->soft_fonts, &denum); while (pl_dict_enum_next(&denum, &key, &value)) { uint id = (key.data[0] << 8) + key.data[1]; if ((((pl_font_t *) value)->storage & storage) != 0 || (storage == 0 && pcs->font == (pl_font_t *) value) ) { res = status_put_font(s, pcs, id, id, (pl_font_t *) value, (storage != 0 ? -1 : pcs->font_selected), extended); if (res != 0) return res; } } return 0; }
0
326,599
set_xattrs(struct archive_write_disk *a) { static int warning_done = 0; /* If there aren't any extended attributes, then it's okay not * to extract them, otherwise, issue a single warning. */ if (archive_entry_xattr_count(a->entry) != 0 && !warning_done) { warning_done = 1; archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Cannot restore extended attributes on this system"); return (ARCHIVE_WARN); } /* Warning was already emitted; suppress further warnings. */ return (ARCHIVE_OK); }
0
225,548
void TfLiteTensorRealloc(size_t num_bytes, TfLiteTensor* tensor) { if (tensor->allocation_type != kTfLiteDynamic && tensor->allocation_type != kTfLitePersistentRo) { return; } // TODO(b/145340303): Tensor data should be aligned. if (!tensor->data.raw) { tensor->data.raw = (char*)malloc(num_bytes); } else if (num_bytes > tensor->bytes) { tensor->data.raw = (char*)realloc(tensor->data.raw, num_bytes); } tensor->bytes = num_bytes; }
0
384,536
static ut64 read_uleb128(ut8 **p, ut8 *end) { const char *error = NULL; ut64 v; *p = (ut8 *)r_uleb128 (*p, end - *p, &v, &error); if (error) { eprintf ("%s", error); R_FREE (error); return UT64_MAX; } return v; }
0
405,338
struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, const struct flowi *fl, const struct sock *sk, int flags) { struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk, flags | XFRM_LOOKUP_QUEUE | XFRM_LOOKUP_KEEP_DST_REF); if (PTR_ERR(dst) == -EREMOTE) return make_blackhole(net, dst_orig->ops->family, dst_orig); if (IS_ERR(dst)) dst_release(dst_orig); return dst; }
0
369,381
static int io_rsrc_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT))) return -EINVAL; if (sqe->ioprio || sqe->rw_flags || sqe->splice_fd_in) return -EINVAL; req->rsrc_update.offset = READ_ONCE(sqe->off); req->rsrc_update.nr_args = READ_ONCE(sqe->len); if (!req->rsrc_update.nr_args) return -EINVAL; req->rsrc_update.arg = READ_ONCE(sqe->addr); return 0;
0