idx
int64
func
string
target
int64
487,624
asmlinkage long sys_sethostname(char __user *name, int len) { int errno; char tmp[__NEW_UTS_LEN]; if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (len < 0 || len > __NEW_UTS_LEN) return -EINVAL; down_write(&uts_sem); errno = -EFAULT; if (!copy_from_user(tmp, name, len)) { memcpy(utsname()->nodename, tmp, len); utsname()->nodename[len] = 0; errno = 0; } up_write(&uts_sem); return errno; }
0
204,711
static int ldb_wildcard_compare(struct ldb_context *ldb, const struct ldb_parse_tree *tree, const struct ldb_val value, bool *matched) { const struct ldb_schema_attribute *a; struct ldb_val val; struct ldb_val cnk; struct ldb_val *chunk; uint8_t *save_p = NULL; unsigned int c = 0; a = ldb_schema_attribute_by_name(ldb, tree->u.substring.attr); if (!a) { return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; } if (tree->u.substring.chunks == NULL) { *matched = false; return LDB_SUCCESS; } if (a->syntax->canonicalise_fn(ldb, ldb, &value, &val) != 0) { return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; } save_p = val.data; cnk.data = NULL; if ( ! tree->u.substring.start_with_wildcard ) { chunk = tree->u.substring.chunks[c]; if (a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto mismatch; /* This deals with wildcard prefix searches on binary attributes (eg objectGUID) */ if (cnk.length > val.length) { goto mismatch; } /* * Empty strings are returned as length 0. Ensure * we can cope with this. */ if (cnk.length == 0) { goto mismatch; } if (memcmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) goto mismatch; val.length -= cnk.length; val.data += cnk.length; c++; talloc_free(cnk.data); cnk.data = NULL; } while (tree->u.substring.chunks[c]) { uint8_t *p; chunk = tree->u.substring.chunks[c]; if(a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto mismatch; /* * Empty strings are returned as length 0. Ensure * we can cope with this. */ if (cnk.length == 0) { goto mismatch; } /* * Values might be binary blobs. Don't use string * search, but memory search instead. */ p = memmem((const void *)val.data,val.length, (const void *)cnk.data, cnk.length); if (p == NULL) goto mismatch; /* * At this point we know cnk.length <= val.length as * otherwise there could be no match */ if ( (! tree->u.substring.chunks[c + 1]) && (! tree->u.substring.end_with_wildcard) ) { uint8_t *g; uint8_t *end = val.data + val.length; do { /* greedy */ /* * haystack is a valid pointer in val * because the memmem() can only * succeed if the needle (cnk.length) * is <= haystacklen * * p will be a pointer at least * cnk.length from the end of haystack */ uint8_t *haystack = p + cnk.length; size_t haystacklen = end - (haystack); g = memmem(haystack, haystacklen, (const uint8_t *)cnk.data, cnk.length); if (g) { p = g; } } while(g); } val.length = val.length - (p - (uint8_t *)(val.data)) - cnk.length; val.data = (uint8_t *)(p + cnk.length); c++; talloc_free(cnk.data); cnk.data = NULL; } /* last chunk may not have reached end of string */ if ( (! tree->u.substring.end_with_wildcard) && (*(val.data) != 0) ) goto mismatch; talloc_free(save_p); *matched = true; return LDB_SUCCESS; mismatch: *matched = false; talloc_free(save_p); talloc_free(cnk.data); return LDB_SUCCESS; }
1
162,556
void WebProcessProxy::addExistingWebPage(WebPageProxy* webPage, uint64_t pageID) { m_pageMap.set(pageID, webPage); globalPageMap().set(pageID, webPage); #if PLATFORM(MAC) if (pageIsProcessSuppressible(webPage)) m_processSuppressiblePages.add(pageID); updateProcessSuppressionState(); #endif }
0
359,338
DEFUN (clear_ip_bgp_as_soft_in, clear_ip_bgp_as_soft_in_cmd, "clear ip bgp <1-65535> soft in", CLEAR_STR IP_STR BGP_STR "Clear peers with the AS number\n" "Soft reconfig\n" "Soft reconfig inbound update\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, BGP_CLEAR_SOFT_IN, argv[0]); }
0
276,966
PreventStartCodeEmulation(const AP4_UI08* payload, AP4_Size payload_size, AP4_DataBuffer& output) { output.Reserve(payload_size*2); // more than enough AP4_Size output_size = 0; AP4_UI08* buffer = output.UseData(); unsigned int zero_counter = 0; for (unsigned int i = 0; i < payload_size; i++) { if (zero_counter == 2) { if (payload[i] == 0 || payload[i] == 1 || payload[i] == 2 || payload[i] == 3) { buffer[output_size++] = 3; zero_counter = 0; } } buffer[output_size++] = payload[i]; if (payload[i] == 0) { ++zero_counter; } else { zero_counter = 0; } } output.SetDataSize(output_size); }
0
261,415
void read_sao(thread_context* tctx, int xCtb,int yCtb, int CtbAddrInSliceSeg) { slice_segment_header* shdr = tctx->shdr; de265_image* img = tctx->img; const seq_parameter_set& sps = img->get_sps(); const pic_parameter_set& pps = img->get_pps(); logtrace(LogSlice,"# read_sao(%d,%d)\n",xCtb,yCtb); sao_info saoinfo; memset(&saoinfo,0,sizeof(sao_info)); logtrace(LogSlice,"sizeof saoinfo: %d\n",sizeof(sao_info)); char sao_merge_left_flag = 0; char sao_merge_up_flag = 0; if (xCtb>0) { //char leftCtbInSliceSeg = (CtbAddrInSliceSeg>0); char leftCtbInSliceSeg = (tctx->CtbAddrInRS > shdr->SliceAddrRS); char leftCtbInTile = (pps.TileIdRS[xCtb + yCtb * sps.PicWidthInCtbsY] == pps.TileIdRS[xCtb-1 + yCtb * sps.PicWidthInCtbsY]); if (leftCtbInSliceSeg && leftCtbInTile) { sao_merge_left_flag = decode_sao_merge_flag(tctx); logtrace(LogSlice,"sao_merge_left_flag: %d\n",sao_merge_left_flag); } } if (yCtb>0 && sao_merge_left_flag==0) { logtrace(LogSlice,"CtbAddrInRS:%d PicWidthInCtbsY:%d slice_segment_address:%d\n", tctx->CtbAddrInRS, sps.PicWidthInCtbsY, shdr->slice_segment_address); char upCtbInSliceSeg = (tctx->CtbAddrInRS - sps.PicWidthInCtbsY) >= shdr->SliceAddrRS; char upCtbInTile = (pps.TileIdRS[xCtb + yCtb * sps.PicWidthInCtbsY] == pps.TileIdRS[xCtb + (yCtb-1) * sps.PicWidthInCtbsY]); if (upCtbInSliceSeg && upCtbInTile) { sao_merge_up_flag = decode_sao_merge_flag(tctx); logtrace(LogSlice,"sao_merge_up_flag: %d\n",sao_merge_up_flag); } } if (!sao_merge_up_flag && !sao_merge_left_flag) { int nChroma = 3; if (sps.ChromaArrayType == CHROMA_MONO) nChroma=1; for (int cIdx=0; cIdx<nChroma; cIdx++) { if ((shdr->slice_sao_luma_flag && cIdx==0) || (shdr->slice_sao_chroma_flag && cIdx>0)) { uint8_t SaoTypeIdx = 0; if (cIdx==0) { char sao_type_idx_luma = decode_sao_type_idx(tctx); logtrace(LogSlice,"sao_type_idx_luma: %d\n", sao_type_idx_luma); saoinfo.SaoTypeIdx = SaoTypeIdx = sao_type_idx_luma; } else if (cIdx==1) { char sao_type_idx_chroma = decode_sao_type_idx(tctx); logtrace(LogSlice,"sao_type_idx_chroma: %d\n", sao_type_idx_chroma); SaoTypeIdx = sao_type_idx_chroma; saoinfo.SaoTypeIdx |= SaoTypeIdx<<(2*1); saoinfo.SaoTypeIdx |= SaoTypeIdx<<(2*2); // set for both chroma components } else { // SaoTypeIdx = 0 SaoTypeIdx = (saoinfo.SaoTypeIdx >> (2*cIdx)) & 0x3; } if (SaoTypeIdx != 0) { for (int i=0;i<4;i++) { saoinfo.saoOffsetVal[cIdx][i] = decode_sao_offset_abs(tctx, img->get_bit_depth(cIdx)); logtrace(LogSlice,"saoOffsetVal[%d][%d] = %d\n",cIdx,i, saoinfo.saoOffsetVal[cIdx][i]); } int sign[4]; if (SaoTypeIdx==1) { for (int i=0;i<4;i++) { if (saoinfo.saoOffsetVal[cIdx][i] != 0) { sign[i] = decode_sao_offset_sign(tctx) ? -1 : 1; } else { sign[i] = 0; // not really required, but compiler warns about uninitialized values } } saoinfo.sao_band_position[cIdx] = decode_sao_band_position(tctx); } else { uint8_t SaoEoClass = 0; sign[0] = sign[1] = 1; sign[2] = sign[3] = -1; if (cIdx==0) { saoinfo.SaoEoClass = SaoEoClass = decode_sao_class(tctx); } else if (cIdx==1) { SaoEoClass = decode_sao_class(tctx); saoinfo.SaoEoClass |= SaoEoClass << (2*1); saoinfo.SaoEoClass |= SaoEoClass << (2*2); } logtrace(LogSlice,"SaoEoClass[%d] = %d\n",cIdx,SaoEoClass); } int log2OffsetScale; if (cIdx==0) { log2OffsetScale = pps.range_extension.log2_sao_offset_scale_luma; } else { log2OffsetScale = pps.range_extension.log2_sao_offset_scale_chroma; } for (int i=0;i<4;i++) { saoinfo.saoOffsetVal[cIdx][i] = sign[i]*(saoinfo.saoOffsetVal[cIdx][i] << log2OffsetScale); } } } } img->set_sao_info(xCtb,yCtb, &saoinfo); } if (sao_merge_left_flag) { img->set_sao_info(xCtb,yCtb, img->get_sao_info(xCtb-1,yCtb)); } if (sao_merge_up_flag) { img->set_sao_info(xCtb,yCtb, img->get_sao_info(xCtb,yCtb-1)); } }
0
175,776
bool QuotaManager::ResetUsageTracker(StorageType type) { switch (type) { case kStorageTypeTemporary: if (temporary_usage_tracker_->IsWorking()) return false; temporary_usage_tracker_.reset( new UsageTracker(clients_, kStorageTypeTemporary, special_storage_policy_)); return true; case kStorageTypePersistent: if (persistent_usage_tracker_->IsWorking()) return false; persistent_usage_tracker_.reset( new UsageTracker(clients_, kStorageTypePersistent, special_storage_policy_)); return true; default: NOTREACHED(); } return true; }
0
508,769
static int rr_unpack_from_buffer(READ_RECORD *info) { if (info->cache_pos == info->cache_end) return -1; /* End of buffer */ (*info->unpack)(info->addon_field, info->cache_pos, info->cache_end); info->cache_pos+= info->ref_length; return 0; }
0
261,759
void RtmpProtocol::reset() { ////////////ChunkSize//////////// _chunk_size_in = DEFAULT_CHUNK_LEN; _chunk_size_out = DEFAULT_CHUNK_LEN; ////////////Acknowledgement//////////// _bytes_sent = 0; _bytes_sent_last = 0; _windows_size = 0; ///////////PeerBandwidth/////////// _bandwidth = 2500000; _band_limit_type = 2; ////////////Chunk//////////// _map_chunk_data.clear(); _now_stream_index = 0; _now_chunk_id = 0; //////////Invoke Request////////// _send_req_id = 0; //////////Rtmp parser////////// HttpRequestSplitter::reset(); _stream_index = STREAM_CONTROL; _next_step_func = [this](const char *data, size_t len) { return handle_C0C1(data, len); }; }
0
247,291
explicit MklRequantizationRangePerChannelOp(OpKernelConstruction* ctx) : OpKernel(ctx) { OP_REQUIRES_OK(ctx, ctx->GetAttr("clip_value_max", &clip_value_max_)); }
0
335,433
do_one_cmd( char_u **cmdlinep, int flags, #ifdef FEAT_EVAL cstack_T *cstack, #endif char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie) // argument for fgetline() { char_u *p; linenr_T lnum; long n; char *errormsg = NULL; // error message char_u *after_modifier = NULL; exarg_T ea; // Ex command arguments cmdmod_T save_cmdmod; int save_reg_executing = reg_executing; int save_pending_end_reg_executing = pending_end_reg_executing; int ni; // set when Not Implemented char_u *cmd; int starts_with_colon = FALSE; #ifdef FEAT_EVAL int may_have_range; int vim9script; int did_set_expr_line = FALSE; #endif int sourcing = flags & DOCMD_VERBOSE; CLEAR_FIELD(ea); ea.line1 = 1; ea.line2 = 1; #ifdef FEAT_EVAL ++ex_nesting_level; #endif // When the last file has not been edited :q has to be typed twice. if (quitmore #ifdef FEAT_EVAL // avoid that a function call in 'statusline' does this && !getline_equal(fgetline, cookie, get_func_line) #endif // avoid that an autocommand, e.g. QuitPre, does this && !getline_equal(fgetline, cookie, getnextac)) --quitmore; /* * Reset browse, confirm, etc.. They are restored when returning, for * recursive calls. */ save_cmdmod = cmdmod; // "#!anything" is handled like a comment. if ((*cmdlinep)[0] == '#' && (*cmdlinep)[1] == '!') goto doend; /* * 1. Skip comment lines and leading white space and colons. * 2. Handle command modifiers. */ // The "ea" structure holds the arguments that can be used. ea.cmd = *cmdlinep; ea.cmdlinep = cmdlinep; ea.getline = fgetline; ea.cookie = cookie; #ifdef FEAT_EVAL ea.cstack = cstack; starts_with_colon = *skipwhite(ea.cmd) == ':'; #endif if (parse_command_modifiers(&ea, &errormsg, &cmdmod, FALSE) == FAIL) goto doend; apply_cmdmod(&cmdmod); #ifdef FEAT_EVAL vim9script = in_vim9script(); #endif after_modifier = ea.cmd; #ifdef FEAT_EVAL ea.skip = did_emsg || got_int || did_throw || (cstack->cs_idx >= 0 && !(cstack->cs_flags[cstack->cs_idx] & CSF_ACTIVE)); #else ea.skip = (if_level > 0); #endif /* * 3. Skip over the range to find the command. Let "p" point to after it. * * We need the command to know what kind of range it uses. */ cmd = ea.cmd; #ifdef FEAT_EVAL // In Vim9 script a colon is required before the range. This may also be // after command modifiers. if (vim9script && (flags & DOCMD_RANGEOK) == 0) { may_have_range = FALSE; for (p = ea.cmd; p >= *cmdlinep; --p) { if (*p == ':') may_have_range = TRUE; if (p < ea.cmd && !VIM_ISWHITE(*p)) break; } } else may_have_range = TRUE; if (may_have_range) #endif ea.cmd = skip_range(ea.cmd, TRUE, NULL); #ifdef FEAT_EVAL if (vim9script && !may_have_range) { if (ea.cmd == cmd + 1 && *cmd == '$') // should be "$VAR = val" --ea.cmd; p = find_ex_command(&ea, NULL, lookup_scriptitem, NULL); if (ea.cmdidx == CMD_SIZE) { char_u *ar = skip_range(ea.cmd, TRUE, NULL); // If a ':' before the range is missing, give a clearer error // message. if (ar > ea.cmd && !ea.skip) { semsg(_(e_colon_required_before_range_str), ea.cmd); goto doend; } } } else #endif p = find_ex_command(&ea, NULL, NULL, NULL); #ifdef FEAT_EVAL # ifdef FEAT_PROFILE // Count this line for profiling if skip is TRUE. if (do_profiling == PROF_YES && (!ea.skip || cstack->cs_idx == 0 || (cstack->cs_idx > 0 && (cstack->cs_flags[cstack->cs_idx - 1] & CSF_ACTIVE)))) { int skip = did_emsg || got_int || did_throw; if (ea.cmdidx == CMD_catch) skip = !skip && !(cstack->cs_idx >= 0 && (cstack->cs_flags[cstack->cs_idx] & CSF_THROWN) && !(cstack->cs_flags[cstack->cs_idx] & CSF_CAUGHT)); else if (ea.cmdidx == CMD_else || ea.cmdidx == CMD_elseif) skip = skip || !(cstack->cs_idx >= 0 && !(cstack->cs_flags[cstack->cs_idx] & (CSF_ACTIVE | CSF_TRUE))); else if (ea.cmdidx == CMD_finally) skip = FALSE; else if (ea.cmdidx != CMD_endif && ea.cmdidx != CMD_endfor && ea.cmdidx != CMD_endtry && ea.cmdidx != CMD_endwhile) skip = ea.skip; if (!skip) { if (getline_equal(fgetline, cookie, get_func_line)) func_line_exec(getline_cookie(fgetline, cookie)); else if (getline_equal(fgetline, cookie, getsourceline)) script_line_exec(); } } # endif // May go to debug mode. If this happens and the ">quit" debug command is // used, throw an interrupt exception and skip the next command. dbg_check_breakpoint(&ea); if (!ea.skip && got_int) { ea.skip = TRUE; (void)do_intthrow(cstack); } #endif /* * 4. parse a range specifier of the form: addr [,addr] [;addr] .. * * where 'addr' is: * * % (entire file) * $ [+-NUM] * 'x [+-NUM] (where x denotes a currently defined mark) * . [+-NUM] * [+-NUM].. * NUM * * The ea.cmd pointer is updated to point to the first character following the * range spec. If an initial address is found, but no second, the upper bound * is equal to the lower. */ // ea.addr_type for user commands is set by find_ucmd if (!IS_USER_CMDIDX(ea.cmdidx)) { if (ea.cmdidx != CMD_SIZE) ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type; else ea.addr_type = ADDR_LINES; // :wincmd range depends on the argument. if (ea.cmdidx == CMD_wincmd && p != NULL) get_wincmd_addr_type(skipwhite(p), &ea); #ifdef FEAT_QUICKFIX // :.cc in quickfix window uses line number if ((ea.cmdidx == CMD_cc || ea.cmdidx == CMD_ll) && bt_quickfix(curbuf)) ea.addr_type = ADDR_OTHER; #endif } ea.cmd = cmd; #ifdef FEAT_EVAL if (!may_have_range) ea.line1 = ea.line2 = default_address(&ea); else #endif if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL) goto doend; /* * 5. Parse the command. */ /* * Skip ':' and any white space */ ea.cmd = skipwhite(ea.cmd); while (*ea.cmd == ':') ea.cmd = skipwhite(ea.cmd + 1); /* * If we got a line, but no command, then go to the line. * If we find a '|' or '\n' we set ea.nextcmd. */ if (*ea.cmd == NUL || comment_start(ea.cmd, starts_with_colon) || (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) { /* * strange vi behaviour: * ":3" jumps to line 3 * ":3|..." prints line 3 (not in Vim9 script) * ":|" prints current line (not in Vim9 script) */ if (ea.skip) // skip this if inside :if goto doend; errormsg = ex_range_without_command(&ea); goto doend; } // If this looks like an undefined user command and there are CmdUndefined // autocommands defined, trigger the matching autocommands. if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip && ASCII_ISUPPER(*ea.cmd) && has_cmdundefined()) { int ret; p = ea.cmd; while (ASCII_ISALNUM(*p)) ++p; p = vim_strnsave(ea.cmd, p - ea.cmd); ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); vim_free(p); // If the autocommands did something and didn't cause an error, try // finding the command again. p = (ret #ifdef FEAT_EVAL && !aborting() #endif ) ? find_ex_command(&ea, NULL, NULL, NULL) : ea.cmd; } if (p == NULL) { if (!ea.skip) errormsg = _(e_ambiguous_use_of_user_defined_command); goto doend; } // Check for wrong commands. if (*p == '!' && ea.cmd[1] == 0151 && ea.cmd[0] == 78 && !IS_USER_CMDIDX(ea.cmdidx)) { errormsg = uc_fun_cmd(); goto doend; } if (ea.cmdidx == CMD_SIZE) { if (!ea.skip) { STRCPY(IObuff, _(e_not_an_editor_command)); if (!sourcing) { // If the modifier was parsed OK the error must be in the // following command if (after_modifier != NULL) append_command(after_modifier); else append_command(*cmdlinep); } errormsg = (char *)IObuff; did_emsg_syntax = TRUE; } goto doend; } ni = (!IS_USER_CMDIDX(ea.cmdidx) && (cmdnames[ea.cmdidx].cmd_func == ex_ni #ifdef HAVE_EX_SCRIPT_NI || cmdnames[ea.cmdidx].cmd_func == ex_script_ni #endif )); #ifndef FEAT_EVAL /* * When the expression evaluation is disabled, recognize the ":if" and * ":endif" commands and ignore everything in between it. */ if (ea.cmdidx == CMD_if) ++if_level; if (if_level) { if (ea.cmdidx == CMD_endif) --if_level; goto doend; } #endif // forced commands if (*p == '!' && ea.cmdidx != CMD_substitute && ea.cmdidx != CMD_smagic && ea.cmdidx != CMD_snomagic) { ++p; ea.forceit = TRUE; } else ea.forceit = FALSE; /* * 6. Parse arguments. Then check for errors. */ if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; if (!ea.skip) { #ifdef HAVE_SANDBOX if (sandbox != 0 && !(ea.argt & EX_SBOXOK)) { // Command not allowed in sandbox. errormsg = _(e_not_allowed_in_sandbox); goto doend; } #endif if (restricted != 0 && (ea.argt & EX_RESTRICT)) { errormsg = _(e_command_not_allowed_in_rvim); goto doend; } if (!curbuf->b_p_ma && (ea.argt & EX_MODIFY)) { // Command not allowed in non-'modifiable' buffer errormsg = _(e_cannot_make_changes_modifiable_is_off); goto doend; } if (!IS_USER_CMDIDX(ea.cmdidx)) { #ifdef FEAT_CMDWIN if (cmdwin_type != 0 && !(ea.argt & EX_CMDWIN)) { // Command not allowed in the command line window errormsg = _(e_invalid_in_cmdline_window); goto doend; } #endif if (text_locked() && !(ea.argt & EX_LOCK_OK)) { // Command not allowed when text is locked errormsg = _(get_text_locked_msg()); goto doend; } } // Disallow editing another buffer when "curbuf_lock" is set. // Do allow ":checktime" (it is postponed). // Do allow ":edit" (check for an argument later). // Do allow ":file" with no arguments (check for an argument later). if (!(ea.argt & (EX_CMDWIN | EX_LOCK_OK)) && ea.cmdidx != CMD_checktime && ea.cmdidx != CMD_edit && ea.cmdidx != CMD_file && !IS_USER_CMDIDX(ea.cmdidx) && curbuf_locked()) goto doend; if (!ni && !(ea.argt & EX_RANGE) && ea.addr_count > 0) { errormsg = _(e_no_range_allowed); goto doend; } } if (!ni && !(ea.argt & EX_BANG) && ea.forceit) { errormsg = _(e_no_bang_allowed); goto doend; } /* * Don't complain about the range if it is not used * (could happen if line_count is accidentally set to 0). */ if (!ea.skip && !ni && (ea.argt & EX_RANGE)) { /* * If the range is backwards, ask for confirmation and, if given, swap * ea.line1 & ea.line2 so it's forwards again. * When global command is busy, don't ask, will fail below. */ if (!global_busy && ea.line1 > ea.line2) { if (msg_silent == 0) { if (sourcing || exmode_active) { errormsg = _(e_backwards_range_given); goto doend; } if (ask_yesno((char_u *) _("Backwards range given, OK to swap"), FALSE) != 'y') goto doend; } lnum = ea.line1; ea.line1 = ea.line2; ea.line2 = lnum; } if ((errormsg = invalid_range(&ea)) != NULL) goto doend; } if ((ea.addr_type == ADDR_OTHER) && ea.addr_count == 0) // default is 1, not cursor ea.line2 = 1; correct_range(&ea); #ifdef FEAT_FOLDING if (((ea.argt & EX_WHOLEFOLD) || ea.addr_count >= 2) && !global_busy && ea.addr_type == ADDR_LINES) { // Put the first line at the start of a closed fold, put the last line // at the end of a closed fold. (void)hasFolding(ea.line1, &ea.line1, NULL); (void)hasFolding(ea.line2, NULL, &ea.line2); } #endif #ifdef FEAT_QUICKFIX /* * For the ":make" and ":grep" commands we insert the 'makeprg'/'grepprg' * option here, so things like % get expanded. */ p = replace_makeprg(&ea, p, cmdlinep); if (p == NULL) goto doend; #endif /* * Skip to start of argument. * Don't do this for the ":!" command, because ":!! -l" needs the space. */ if (ea.cmdidx == CMD_bang) ea.arg = p; else ea.arg = skipwhite(p); // ":file" cannot be run with an argument when "curbuf_lock" is set if (ea.cmdidx == CMD_file && *ea.arg != NUL && curbuf_locked()) goto doend; /* * Check for "++opt=val" argument. * Must be first, allow ":w ++enc=utf8 !cmd" */ if (ea.argt & EX_ARGOPT) while (ea.arg[0] == '+' && ea.arg[1] == '+') if (getargopt(&ea) == FAIL && !ni) { errormsg = _(e_invalid_argument); goto doend; } if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update) { if (*ea.arg == '>') // append { if (*++ea.arg != '>') // typed wrong { errormsg = _(e_use_w_or_w_gt_gt); goto doend; } ea.arg = skipwhite(ea.arg + 1); ea.append = TRUE; } else if (*ea.arg == '!' && ea.cmdidx == CMD_write) // :w !filter { ++ea.arg; ea.usefilter = TRUE; } } if (ea.cmdidx == CMD_read) { if (ea.forceit) { ea.usefilter = TRUE; // :r! filter if ea.forceit ea.forceit = FALSE; } else if (*ea.arg == '!') // :r !filter { ++ea.arg; ea.usefilter = TRUE; } } if (ea.cmdidx == CMD_lshift || ea.cmdidx == CMD_rshift) { ea.amount = 1; while (*ea.arg == *ea.cmd) // count number of '>' or '<' { ++ea.arg; ++ea.amount; } ea.arg = skipwhite(ea.arg); } /* * Check for "+command" argument, before checking for next command. * Don't do this for ":read !cmd" and ":write !cmd". */ if ((ea.argt & EX_CMDARG) && !ea.usefilter) ea.do_ecmd_cmd = getargcmd(&ea.arg); /* * For commands that do not use '|' inside their argument: Check for '|' to * separate commands and '"' or '#' to start comments. * * Otherwise: Check for <newline> to end a shell command. * Also do this for ":read !cmd", ":write !cmd" and ":global". * Also do this inside a { - } block after :command and :autocmd. * Any others? */ if ((ea.argt & EX_TRLBAR) && !ea.usefilter) { separate_nextcmd(&ea, FALSE); } else if (ea.cmdidx == CMD_bang || ea.cmdidx == CMD_terminal || ea.cmdidx == CMD_global || ea.cmdidx == CMD_vglobal || ea.usefilter #ifdef FEAT_EVAL || inside_block(&ea) #endif ) { for (p = ea.arg; *p; ++p) { // Remove one backslash before a newline, so that it's possible to // pass a newline to the shell and also a newline that is preceded // with a backslash. This makes it impossible to end a shell // command in a backslash, but that doesn't appear useful. // Halving the number of backslashes is incompatible with previous // versions. if (*p == '\\' && p[1] == '\n') STRMOVE(p, p + 1); else if (*p == '\n' && !(ea.argt & EX_EXPR_ARG)) { ea.nextcmd = p + 1; *p = NUL; break; } } } if ((ea.argt & EX_DFLALL) && ea.addr_count == 0) address_default_all(&ea); // accept numbered register only when no count allowed (:put) if ( (ea.argt & EX_REGSTR) && *ea.arg != NUL // Do not allow register = for user commands && (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') && !((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg))) { #ifndef FEAT_CLIPBOARD // check these explicitly for a more specific error message if (*ea.arg == '*' || *ea.arg == '+') { errormsg = _(e_invalid_register_name); goto doend; } #endif if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put && !IS_USER_CMDIDX(ea.cmdidx)))) { ea.regname = *ea.arg++; #ifdef FEAT_EVAL // for '=' register: accept the rest of the line as an expression if (ea.arg[-1] == '=' && ea.arg[0] != NUL) { if (!ea.skip) { set_expr_line(vim_strsave(ea.arg), &ea); did_set_expr_line = TRUE; } ea.arg += STRLEN(ea.arg); } #endif ea.arg = skipwhite(ea.arg); } } /* * Check for a count. When accepting a EX_BUFNAME, don't use "123foo" as a * count, it's a buffer name. */ if ((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg) && (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg + 1)) == NUL || VIM_ISWHITE(*p))) { n = getdigits_quoted(&ea.arg); ea.arg = skipwhite(ea.arg); if (n <= 0 && !ni && (ea.argt & EX_ZEROR) == 0) { errormsg = _(e_positive_count_required); goto doend; } if (ea.addr_type != ADDR_LINES) // e.g. :buffer 2, :sleep 3 { ea.line2 = n; if (ea.addr_count == 0) ea.addr_count = 1; } else { ea.line1 = ea.line2; if (ea.line2 >= LONG_MAX - (n - 1)) ea.line2 = LONG_MAX; // avoid overflow else ea.line2 += n - 1; ++ea.addr_count; /* * Be vi compatible: no error message for out of range. */ if (ea.line2 > curbuf->b_ml.ml_line_count) ea.line2 = curbuf->b_ml.ml_line_count; } } /* * Check for flags: 'l', 'p' and '#'. */ if (ea.argt & EX_FLAGS) get_flags(&ea); if (!ni && !(ea.argt & EX_EXTRA) && *ea.arg != NUL && *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0)) { // no arguments allowed but there is something errormsg = ex_errmsg(e_trailing_characters_str, ea.arg); goto doend; } if (!ni && (ea.argt & EX_NEEDARG) && *ea.arg == NUL) { errormsg = _(e_argument_required); goto doend; } #ifdef FEAT_EVAL /* * Skip the command when it's not going to be executed. * The commands like :if, :endif, etc. always need to be executed. * Also make an exception for commands that handle a trailing command * themselves. */ if (ea.skip) { switch (ea.cmdidx) { // commands that need evaluation case CMD_while: case CMD_endwhile: case CMD_for: case CMD_endfor: case CMD_if: case CMD_elseif: case CMD_else: case CMD_endif: case CMD_try: case CMD_catch: case CMD_finally: case CMD_endtry: case CMD_function: case CMD_def: break; // Commands that handle '|' themselves. Check: A command should // either have the EX_TRLBAR flag, appear in this list or appear in // the list at ":help :bar". case CMD_aboveleft: case CMD_and: case CMD_belowright: case CMD_botright: case CMD_browse: case CMD_call: case CMD_confirm: case CMD_const: case CMD_delfunction: case CMD_djump: case CMD_dlist: case CMD_dsearch: case CMD_dsplit: case CMD_echo: case CMD_echoerr: case CMD_echomsg: case CMD_echon: case CMD_eval: case CMD_execute: case CMD_filter: case CMD_final: case CMD_help: case CMD_hide: case CMD_ijump: case CMD_ilist: case CMD_isearch: case CMD_isplit: case CMD_keepalt: case CMD_keepjumps: case CMD_keepmarks: case CMD_keeppatterns: case CMD_leftabove: case CMD_let: case CMD_lockmarks: case CMD_lockvar: case CMD_lua: case CMD_match: case CMD_mzscheme: case CMD_noautocmd: case CMD_noswapfile: case CMD_perl: case CMD_psearch: case CMD_py3: case CMD_python3: case CMD_python: case CMD_return: case CMD_rightbelow: case CMD_ruby: case CMD_silent: case CMD_smagic: case CMD_snomagic: case CMD_substitute: case CMD_syntax: case CMD_tab: case CMD_tcl: case CMD_throw: case CMD_tilde: case CMD_topleft: case CMD_unlet: case CMD_unlockvar: case CMD_var: case CMD_verbose: case CMD_vertical: case CMD_wincmd: break; default: goto doend; } } #endif if (ea.argt & EX_XFILE) { if (expand_filename(&ea, cmdlinep, &errormsg) == FAIL) goto doend; } /* * Accept buffer name. Cannot be used at the same time with a buffer * number. Don't do this for a user command. */ if ((ea.argt & EX_BUFNAME) && *ea.arg != NUL && ea.addr_count == 0 && !IS_USER_CMDIDX(ea.cmdidx)) { /* * :bdelete, :bwipeout and :bunload take several arguments, separated * by spaces: find next space (skipping over escaped characters). * The others take one argument: ignore trailing spaces. */ if (ea.cmdidx == CMD_bdelete || ea.cmdidx == CMD_bwipeout || ea.cmdidx == CMD_bunload) p = skiptowhite_esc(ea.arg); else { p = ea.arg + STRLEN(ea.arg); while (p > ea.arg && VIM_ISWHITE(p[-1])) --p; } ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & EX_BUFUNL) != 0, FALSE, FALSE); if (ea.line2 < 0) // failed goto doend; ea.addr_count = 1; ea.arg = skipwhite(p); } // The :try command saves the emsg_silent flag, reset it here when // ":silent! try" was used, it should only apply to :try itself. if (ea.cmdidx == CMD_try && cmdmod.cmod_did_esilent > 0) { emsg_silent -= cmdmod.cmod_did_esilent; if (emsg_silent < 0) emsg_silent = 0; cmdmod.cmod_did_esilent = 0; } /* * 7. Execute the command. */ if (IS_USER_CMDIDX(ea.cmdidx)) { /* * Execute a user-defined command. */ do_ucmd(&ea); } else { /* * Call the function to execute the builtin command. */ ea.errmsg = NULL; (cmdnames[ea.cmdidx].cmd_func)(&ea); if (ea.errmsg != NULL) errormsg = ea.errmsg; } #ifdef FEAT_EVAL // Set flag that any command was executed, used by ex_vim9script(). // Not if this was a command that wasn't executed or :endif. if (sourcing_a_script(&ea) && current_sctx.sc_sid > 0 && ea.cmdidx != CMD_endif && (cstack->cs_idx < 0 || (cstack->cs_flags[cstack->cs_idx] & CSF_ACTIVE))) SCRIPT_ITEM(current_sctx.sc_sid)->sn_state = SN_STATE_HAD_COMMAND; /* * If the command just executed called do_cmdline(), any throw or ":return" * or ":finish" encountered there must also check the cstack of the still * active do_cmdline() that called this do_one_cmd(). Rethrow an uncaught * exception, or reanimate a returned function or finished script file and * return or finish it again. */ if (need_rethrow) do_throw(cstack); else if (check_cstack) { if (source_finished(fgetline, cookie)) do_finish(&ea, TRUE); else if (getline_equal(fgetline, cookie, get_func_line) && current_func_returned()) do_return(&ea, TRUE, FALSE, NULL); } need_rethrow = check_cstack = FALSE; #endif doend: if (curwin->w_cursor.lnum == 0) // can happen with zero line number { curwin->w_cursor.lnum = 1; curwin->w_cursor.col = 0; } if (errormsg != NULL && *errormsg != NUL && !did_emsg) { if (sourcing || !KeyTyped) { if (errormsg != (char *)IObuff) { STRCPY(IObuff, errormsg); errormsg = (char *)IObuff; } append_command(*cmdlinep); } emsg(errormsg); } #ifdef FEAT_EVAL do_errthrow(cstack, (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx)) ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL); if (did_set_expr_line) set_expr_line(NULL, NULL); #endif undo_cmdmod(&cmdmod); cmdmod = save_cmdmod; reg_executing = save_reg_executing; pending_end_reg_executing = save_pending_end_reg_executing; if (ea.nextcmd && *ea.nextcmd == NUL) // not really a next command ea.nextcmd = NULL; #ifdef FEAT_EVAL --ex_nesting_level; vim_free(ea.cmdline_tofree); #endif return ea.nextcmd; }
0
230,312
njs_array_alloc(njs_vm_t *vm, njs_bool_t flat, uint64_t length, uint32_t spare) { uint64_t size; njs_int_t ret; njs_array_t *array; njs_value_t value; if (njs_slow_path(length > UINT32_MAX)) { goto overflow; } array = njs_mp_alloc(vm->mem_pool, sizeof(njs_array_t)); if (njs_slow_path(array == NULL)) { goto memory_error; } size = length + spare; if (flat || size <= NJS_ARRAY_LARGE_OBJECT_LENGTH) { array->data = njs_mp_align(vm->mem_pool, sizeof(njs_value_t), size * sizeof(njs_value_t)); if (njs_slow_path(array->data == NULL)) { goto memory_error; } } else { array->data = NULL; } array->start = array->data; njs_lvlhsh_init(&array->object.hash); array->object.shared_hash = vm->shared->array_instance_hash; array->object.__proto__ = &vm->prototypes[NJS_OBJ_TYPE_ARRAY].object; array->object.slots = NULL; array->object.type = NJS_ARRAY; array->object.shared = 0; array->object.extensible = 1; array->object.error_data = 0; array->object.fast_array = (array->data != NULL); if (njs_fast_path(array->object.fast_array)) { array->size = size; array->length = length; } else { array->size = 0; array->length = 0; njs_set_array(&value, array); ret = njs_array_length_redefine(vm, &value, length); if (njs_slow_path(ret != NJS_OK)) { return NULL; } } return array; memory_error: njs_memory_error(vm); return NULL; overflow: njs_range_error(vm, "Invalid array length"); return NULL; }
0
343,145
static struct ip_esp_hdr *esp6_output_udp_encap(struct sk_buff *skb, int encap_type, struct esp_info *esp, __be16 sport, __be16 dport) { struct udphdr *uh; __be32 *udpdata32; unsigned int len; len = skb->len + esp->tailen - skb_transport_offset(skb); if (len > U16_MAX) return ERR_PTR(-EMSGSIZE); uh = (struct udphdr *)esp->esph; uh->source = sport; uh->dest = dport; uh->len = htons(len); uh->check = 0; *skb_mac_header(skb) = IPPROTO_UDP; if (encap_type == UDP_ENCAP_ESPINUDP_NON_IKE) { udpdata32 = (__be32 *)(uh + 1); udpdata32[0] = udpdata32[1] = 0; return (struct ip_esp_hdr *)(udpdata32 + 2); } return (struct ip_esp_hdr *)(uh + 1); }
0
204,032
static void virtbt_rx_handle(struct virtio_bluetooth *vbt, struct sk_buff *skb) { __u8 pkt_type; pkt_type = *((__u8 *) skb->data); skb_pull(skb, 1); switch (pkt_type) { case HCI_EVENT_PKT: case HCI_ACLDATA_PKT: case HCI_SCODATA_PKT: case HCI_ISODATA_PKT: hci_skb_pkt_type(skb) = pkt_type; hci_recv_frame(vbt->hdev, skb); break; } }
1
409,411
term_append_lines(int line_count) { OUT_STR(tgoto((char *)T_CAL, 0, line_count)); }
0
312,406
qf_find_first_entry_in_buf(qf_list_T *qfl, int bnr, int *errornr) { qfline_T *qfp = NULL; int idx = 0; // Find the first entry in this file FOR_ALL_QFL_ITEMS(qfl, qfp, idx) if (qfp->qf_fnum == bnr) break; *errornr = idx; return qfp; }
0
225,861
GF_Box *trak_box_new() { ISOM_DECL_BOX_ALLOC(GF_TrackBox, GF_ISOM_BOX_TYPE_TRAK); return (GF_Box *)tmp;
0
513,255
add_key_field(JOIN *join, KEY_FIELD **key_fields,uint and_level, Item_bool_func *cond, Field *field, bool eq_func, Item **value, uint num_values, table_map usable_tables, SARGABLE_PARAM **sargables, uint row_col_no= 0) { uint optimize= 0; if (eq_func && ((join->is_allowed_hash_join_access() && field->hash_join_is_possible() && !(field->table->pos_in_table_list->is_materialized_derived() && field->table->is_created())) || (field->table->pos_in_table_list->is_materialized_derived() && !field->table->is_created() && !(field->flags & BLOB_FLAG)))) { optimize= KEY_OPTIMIZE_EQ; } else if (!(field->flags & PART_KEY_FLAG)) { // Don't remove column IS NULL on a LEFT JOIN table if (eq_func && (*value)->type() == Item::NULL_ITEM && field->table->maybe_null && !field->null_ptr) { optimize= KEY_OPTIMIZE_EXISTS; DBUG_ASSERT(num_values == 1); } } if (optimize != KEY_OPTIMIZE_EXISTS) { table_map used_tables=0; bool optimizable=0; for (uint i=0; i<num_values; i++) { Item *curr_val; if (row_col_no && value[i]->real_item()->type() == Item::ROW_ITEM) { Item_row *value_tuple= (Item_row *) (value[i]->real_item()); curr_val= value_tuple->element_index(row_col_no - 1); } else curr_val= value[i]; table_map value_used_tables= curr_val->used_tables(); used_tables|= value_used_tables; if (!(value_used_tables & (field->table->map | RAND_TABLE_BIT))) optimizable=1; } if (!optimizable) return; if (!(usable_tables & field->table->map)) { if (!eq_func || (*value)->type() != Item::NULL_ITEM || !field->table->maybe_null || field->null_ptr) return; // Can't use left join optimize optimize= KEY_OPTIMIZE_EXISTS; } else { JOIN_TAB *stat=field->table->reginfo.join_tab; key_map possible_keys=field->get_possible_keys(); possible_keys.intersect(field->table->keys_in_use_for_query); stat[0].keys.merge(possible_keys); // Add possible keys /* Save the following cases: Field op constant Field LIKE constant where constant doesn't start with a wildcard Field = field2 where field2 is in a different table Field op formula Field IS NULL Field IS NOT NULL Field BETWEEN ... Field IN ... */ if (field->flags & PART_KEY_FLAG) stat[0].key_dependent|=used_tables; bool is_const=1; for (uint i=0; i<num_values; i++) { Item *curr_val; if (row_col_no && value[i]->real_item()->type() == Item::ROW_ITEM) { Item_row *value_tuple= (Item_row *) (value[i]->real_item()); curr_val= value_tuple->element_index(row_col_no - 1); } else curr_val= value[i]; if (!(is_const&= curr_val->const_item())) break; } if (is_const) { stat[0].const_keys.merge(possible_keys); bitmap_set_bit(&field->table->cond_set, field->field_index); } else if (!eq_func) { /* Save info to be able check whether this predicate can be considered as sargable for range analisis after reading const tables. We do not save info about equalities as update_const_equal_items will take care of updating info on keys from sargable equalities. */ (*sargables)--; (*sargables)->field= field; (*sargables)->arg_value= value; (*sargables)->num_values= num_values; } if (!eq_func) // eq_func is NEVER true when num_values > 1 return; } } /* For the moment eq_func is always true. This slot is reserved for future extensions where we want to remembers other things than just eq comparisons */ DBUG_ASSERT(eq_func); /* Store possible eq field */ (*key_fields)->field= field; (*key_fields)->eq_func= eq_func; (*key_fields)->val= *value; (*key_fields)->cond= cond; (*key_fields)->level= and_level; (*key_fields)->optimize= optimize; /* If the condition has form "tbl.keypart = othertbl.field" and othertbl.field can be NULL, there will be no matches if othertbl.field has NULL value. We use null_rejecting in add_not_null_conds() to add 'othertbl.field IS NOT NULL' to tab->select_cond. */ { Item *real= (*value)->real_item(); if (((cond->functype() == Item_func::EQ_FUNC) || (cond->functype() == Item_func::MULT_EQUAL_FUNC)) && (real->type() == Item::FIELD_ITEM) && ((Item_field*)real)->field->maybe_null()) (*key_fields)->null_rejecting= true; else (*key_fields)->null_rejecting= false; } (*key_fields)->cond_guard= NULL; (*key_fields)->sj_pred_no= get_semi_join_select_list_index(field); (*key_fields)++; }
0
310,088
NCURSES_SP_NAME(reset_color_pairs) (NCURSES_SP_DCL0) { if (SP_PARM != 0) { if (SP_PARM->_color_pairs) { _nc_free_ordered_pairs(SP_PARM); free(SP_PARM->_color_pairs); SP_PARM->_color_pairs = 0; SP_PARM->_pair_alloc = 0; ReservePairs(SP_PARM, 16); clearok(CurScreen(SP_PARM), TRUE); touchwin(StdScreen(SP_PARM)); } } }
0
359,541
DEFUN (neighbor_remove_private_as, neighbor_remove_private_as_cmd, NEIGHBOR_CMD2 "remove-private-AS", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Remove private AS number from outbound updates\n") { return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), PEER_FLAG_REMOVE_PRIVATE_AS); }
0
349,523
static void virtbt_rx_done(struct virtqueue *vq) { struct virtio_bluetooth *vbt = vq->vdev->priv; schedule_work(&vbt->rx); }
0
236,154
GF_Err tsel_box_size(GF_Box *s) { GF_TrackSelectionBox *ptr = (GF_TrackSelectionBox *) s; ptr->size += 4 + (4*ptr->attributeListCount); return GF_OK; }
0
316,943
static inline u32 task_sid_subj(const struct task_struct *task) { u32 sid; rcu_read_lock(); sid = cred_sid(rcu_dereference(task->cred)); rcu_read_unlock(); return sid; }
0
234,746
void __cold btrfs_assign_next_active_device(struct btrfs_device *device, struct btrfs_device *next_device) { struct btrfs_fs_info *fs_info = device->fs_info; if (!next_device) next_device = btrfs_find_next_active_device(fs_info->fs_devices, device); ASSERT(next_device); if (fs_info->sb->s_bdev && (fs_info->sb->s_bdev == device->bdev)) fs_info->sb->s_bdev = next_device->bdev; if (fs_info->fs_devices->latest_bdev == device->bdev) fs_info->fs_devices->latest_bdev = next_device->bdev; }
0
226,136
GF_Err esds_box_size(GF_Box *s) { u32 descSize = 0; GF_ESDBox *ptr = (GF_ESDBox *)s; //make sure we write with no ESID and no OCRESID if (ptr->desc) { ptr->desc->ESID = 0; ptr->desc->OCRESID = 0; } descSize = gf_odf_desc_size((GF_Descriptor *)ptr->desc); ptr->size += descSize; return GF_OK; }
0
336,609
SPICE_GNUC_VISIBLE int spice_server_migrate_info(SpiceServer *reds, const char* dest, int port, int secure_port, const char* cert_subject) { spice_debug("trace"); spice_assert(!reds->migration_interface); if (!reds_set_migration_dest_info(reds, dest, port, secure_port, cert_subject)) { return -1; } return 0; }
0
369,871
static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct task_struct *task; char buffer[PROC_NUMBUF]; unsigned long flags; int oom_score_adj; int err; memset(buffer, 0, sizeof(buffer)); if (count > sizeof(buffer) - 1) count = sizeof(buffer) - 1; if (copy_from_user(buffer, buf, count)) { err = -EFAULT; goto out; } err = kstrtoint(strstrip(buffer), 0, &oom_score_adj); if (err) goto out; if (oom_score_adj < OOM_SCORE_ADJ_MIN || oom_score_adj > OOM_SCORE_ADJ_MAX) { err = -EINVAL; goto out; } task = get_proc_task(file->f_path.dentry->d_inode); if (!task) { err = -ESRCH; goto out; } task_lock(task); if (!task->mm) { err = -EINVAL; goto err_task_lock; } if (!lock_task_sighand(task, &flags)) { err = -ESRCH; goto err_task_lock; } if (oom_score_adj < task->signal->oom_score_adj_min && !capable(CAP_SYS_RESOURCE)) { err = -EACCES; goto err_sighand; } task->signal->oom_score_adj = oom_score_adj; if (has_capability_noaudit(current, CAP_SYS_RESOURCE)) task->signal->oom_score_adj_min = oom_score_adj; trace_oom_score_adj_update(task); /* * Scale /proc/pid/oom_adj appropriately ensuring that OOM_DISABLE is * always attainable. */ if (task->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) task->signal->oom_adj = OOM_DISABLE; else task->signal->oom_adj = (oom_score_adj * OOM_ADJUST_MAX) / OOM_SCORE_ADJ_MAX; err_sighand: unlock_task_sighand(task, &flags); err_task_lock: task_unlock(task); put_task_struct(task); out: return err < 0 ? err : count; }
0
428,229
static CURLcode parseurlandfillconn(struct SessionHandle *data, struct connectdata *conn, bool *prot_missing, char **userp, char **passwdp, char **optionsp) { char *at; char *fragment; char *path = data->state.path; char *query; int rc; char protobuf[16] = ""; const char *protop = ""; CURLcode result; bool rebuild_url = FALSE; *prot_missing = FALSE; /* We might pass the entire URL into the request so we need to make sure * there are no bad characters in there.*/ if(strpbrk(data->change.url, "\r\n")) { failf(data, "Illegal characters found in URL"); return CURLE_URL_MALFORMAT; } /************************************************************* * Parse the URL. * * We need to parse the url even when using the proxy, because we will need * the hostname and port in case we are trying to SSL connect through the * proxy -- and we don't know if we will need to use SSL until we parse the * url ... ************************************************************/ if((2 == sscanf(data->change.url, "%15[^:]:%[^\n]", protobuf, path)) && Curl_raw_equal(protobuf, "file")) { if(path[0] == '/' && path[1] == '/') { /* Allow omitted hostname (e.g. file:/<path>). This is not strictly * speaking a valid file: URL by RFC 1738, but treating file:/<path> as * file://localhost/<path> is similar to how other schemes treat missing * hostnames. See RFC 1808. */ /* This cannot be done with strcpy() in a portable manner, since the memory areas overlap! */ memmove(path, path + 2, strlen(path + 2)+1); } /* * we deal with file://<host>/<path> differently since it supports no * hostname other than "localhost" and "127.0.0.1", which is unique among * the URL protocols specified in RFC 1738 */ if(path[0] != '/') { /* the URL included a host name, we ignore host names in file:// URLs as the standards don't define what to do with them */ char *ptr=strchr(path, '/'); if(ptr) { /* there was a slash present RFC1738 (section 3.1, page 5) says: The rest of the locator consists of data specific to the scheme, and is known as the "url-path". It supplies the details of how the specified resource can be accessed. Note that the "/" between the host (or port) and the url-path is NOT part of the url-path. As most agents use file://localhost/foo to get '/foo' although the slash preceding foo is a separator and not a slash for the path, a URL as file://localhost//foo must be valid as well, to refer to the same file with an absolute path. */ if(ptr[1] && ('/' == ptr[1])) /* if there was two slashes, we skip the first one as that is then used truly as a separator */ ptr++; /* This cannot be made with strcpy, as the memory chunks overlap! */ memmove(path, ptr, strlen(ptr)+1); } } protop = "file"; /* protocol string */ } else { /* clear path */ path[0]=0; if(2 > sscanf(data->change.url, "%15[^\n:]://%[^\n/?]%[^\n]", protobuf, conn->host.name, path)) { /* * The URL was badly formatted, let's try the browser-style _without_ * protocol specified like 'http://'. */ rc = sscanf(data->change.url, "%[^\n/?]%[^\n]", conn->host.name, path); if(1 > rc) { /* * We couldn't even get this format. * djgpp 2.04 has a sscanf() bug where 'conn->host.name' is * assigned, but the return value is EOF! */ #if defined(__DJGPP__) && (DJGPP_MINOR == 4) if(!(rc == -1 && *conn->host.name)) #endif { failf(data, "<url> malformed"); return CURLE_URL_MALFORMAT; } } /* * Since there was no protocol part specified, we guess what protocol it * is based on the first letters of the server name. */ /* Note: if you add a new protocol, please update the list in * lib/version.c too! */ if(checkprefix("FTP.", conn->host.name)) protop = "ftp"; else if(checkprefix("DICT.", conn->host.name)) protop = "DICT"; else if(checkprefix("LDAP.", conn->host.name)) protop = "LDAP"; else if(checkprefix("IMAP.", conn->host.name)) protop = "IMAP"; else if(checkprefix("SMTP.", conn->host.name)) protop = "smtp"; else if(checkprefix("POP3.", conn->host.name)) protop = "pop3"; else { protop = "http"; } *prot_missing = TRUE; /* not given in URL */ } else protop = protobuf; } /* We search for '?' in the host name (but only on the right side of a * @-letter to allow ?-letters in username and password) to handle things * like http://example.com?param= (notice the missing '/'). */ at = strchr(conn->host.name, '@'); if(at) query = strchr(at+1, '?'); else query = strchr(conn->host.name, '?'); if(query) { /* We must insert a slash before the '?'-letter in the URL. If the URL had a slash after the '?', that is where the path currently begins and the '?string' is still part of the host name. We must move the trailing part from the host name and put it first in the path. And have it all prefixed with a slash. */ size_t hostlen = strlen(query); size_t pathlen = strlen(path); /* move the existing path plus the zero byte forward, to make room for the host-name part */ memmove(path+hostlen+1, path, pathlen+1); /* now copy the trailing host part in front of the existing path */ memcpy(path+1, query, hostlen); path[0]='/'; /* prepend the missing slash */ rebuild_url = TRUE; *query=0; /* now cut off the hostname at the ? */ } else if(!path[0]) { /* if there's no path set, use a single slash */ strcpy(path, "/"); rebuild_url = TRUE; } /* If the URL is malformatted (missing a '/' after hostname before path) we * insert a slash here. The only letter except '/' we accept to start a path * is '?'. */ if(path[0] == '?') { /* We need this function to deal with overlapping memory areas. We know that the memory area 'path' points to is 'urllen' bytes big and that is bigger than the path. Use +1 to move the zero byte too. */ memmove(&path[1], path, strlen(path)+1); path[0] = '/'; rebuild_url = TRUE; } else { /* sanitise paths and remove ../ and ./ sequences according to RFC3986 */ char *newp = Curl_dedotdotify(path); if(!newp) return CURLE_OUT_OF_MEMORY; if(strcmp(newp, path)) { rebuild_url = TRUE; free(data->state.pathbuffer); data->state.pathbuffer = newp; data->state.path = newp; path = newp; } else free(newp); } /* * "rebuild_url" means that one or more URL components have been modified so * we need to generate an updated full version. We need the corrected URL * when communicating over HTTP proxy and we don't know at this point if * we're using a proxy or not. */ if(rebuild_url) { char *reurl; size_t plen = strlen(path); /* new path, should be 1 byte longer than the original */ size_t urllen = strlen(data->change.url); /* original URL length */ size_t prefixlen = strlen(conn->host.name); if(!*prot_missing) prefixlen += strlen(protop) + strlen("://"); reurl = malloc(urllen + 2); /* 2 for zerobyte + slash */ if(!reurl) return CURLE_OUT_OF_MEMORY; /* copy the prefix */ memcpy(reurl, data->change.url, prefixlen); /* append the trailing piece + zerobyte */ memcpy(&reurl[prefixlen], path, plen + 1); /* possible free the old one */ if(data->change.url_alloc) { Curl_safefree(data->change.url); data->change.url_alloc = FALSE; } infof(data, "Rebuilt URL to: %s\n", reurl); data->change.url = reurl; data->change.url_alloc = TRUE; /* free this later */ } /* * Parse the login details from the URL and strip them out of * the host name */ result = parse_url_login(data, conn, userp, passwdp, optionsp); if(result) return result; if(conn->host.name[0] == '[') { /* This looks like an IPv6 address literal. See if there is an address scope if there is no location header */ char *percent = strchr(conn->host.name, '%'); if(percent) { unsigned int identifier_offset = 3; char *endp; unsigned long scope; if(strncmp("%25", percent, 3) != 0) { infof(data, "Please URL encode %% as %%25, see RFC 6874.\n"); identifier_offset = 1; } scope = strtoul(percent + identifier_offset, &endp, 10); if(*endp == ']') { /* The address scope was well formed. Knock it out of the hostname. */ memmove(percent, endp, strlen(endp)+1); conn->scope_id = (unsigned int)scope; } else { /* Zone identifier is not numeric */ #if defined(HAVE_NET_IF_H) && defined(IFNAMSIZ) && defined(HAVE_IF_NAMETOINDEX) char ifname[IFNAMSIZ + 2]; char *square_bracket; unsigned int scopeidx = 0; strncpy(ifname, percent + identifier_offset, IFNAMSIZ + 2); /* Ensure nullbyte termination */ ifname[IFNAMSIZ + 1] = '\0'; square_bracket = strchr(ifname, ']'); if(square_bracket) { /* Remove ']' */ *square_bracket = '\0'; scopeidx = if_nametoindex(ifname); if(scopeidx == 0) { infof(data, "Invalid network interface: %s; %s\n", ifname, strerror(errno)); } } if(scopeidx > 0) { char *p = percent + identifier_offset + strlen(ifname); /* Remove zone identifier from hostname */ memmove(percent, p, strlen(p) + 1); conn->scope_id = scopeidx; } else #endif /* HAVE_NET_IF_H && IFNAMSIZ */ infof(data, "Invalid IPv6 address format\n"); } } } if(data->set.scope_id) /* Override any scope that was set above. */ conn->scope_id = data->set.scope_id; /* Remove the fragment part of the path. Per RFC 2396, this is always the last part of the URI. We are looking for the first '#' so that we deal gracefully with non conformant URI such as http://example.com#foo#bar. */ fragment = strchr(path, '#'); if(fragment) { *fragment = 0; /* we know the path part ended with a fragment, so we know the full URL string does too and we need to cut it off from there so it isn't used over proxy */ fragment = strchr(data->change.url, '#'); if(fragment) *fragment = 0; } /* * So if the URL was A://B/C#D, * protop is A * conn->host.name is B * data->state.path is /C */ return findprotocol(data, conn, protop); }
0
254,007
static int vidioc_try_fmt_out(struct file *file, void *priv, struct v4l2_format *fmt) { struct v4l2_loopback_device *dev; MARK(); dev = v4l2loopback_getdevice(file); /* TODO(vasaka) loopback does not care about formats writer want to set, * maybe it is a good idea to restrict format somehow */ if (dev->ready_for_capture) { fmt->fmt.pix = dev->pix_format; } else { __u32 w = fmt->fmt.pix.width; __u32 h = fmt->fmt.pix.height; __u32 pixfmt = fmt->fmt.pix.pixelformat; const struct v4l2l_format *format = format_by_fourcc(pixfmt); if (w > max_width) w = max_width; if (h > max_height) h = max_height; dprintk("trying image %dx%d\n", w, h); if (w < 1) w = V4L2LOOPBACK_SIZE_DEFAULT_WIDTH; if (h < 1) h = V4L2LOOPBACK_SIZE_DEFAULT_HEIGHT; if (NULL == format) format = &formats[0]; pix_format_set_size(&fmt->fmt.pix, format, w, h); fmt->fmt.pix.pixelformat = format->fourcc; fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; if (V4L2_FIELD_ANY == fmt->fmt.pix.field) fmt->fmt.pix.field = V4L2_FIELD_NONE; /* FIXXME: try_fmt should never modify the device-state */ dev->pix_format = fmt->fmt.pix; } return 0; }
0
195,740
bool SampleInterleavedLSScan::ParseMCU(void) { #if ACCUSOFT_CODE int lines = m_ulRemaining[0]; // total number of MCU lines processed. UBYTE preshift = m_ucLowBit + FractionalColorBitsOf(); struct Line *line[4]; UBYTE cx; // // If a DNL marker is present, the number of remaining lines is zero. Fix it. if (m_pFrame->HeightOf() == 0) { assert(lines == 0); lines = 8; } // // A "MCU" in respect to the code organization is eight lines. if (lines > 8) { lines = 8; } if (m_pFrame->HeightOf() > 0) m_ulRemaining[0] -= lines; assert(lines > 0); assert(m_ucCount < 4); // // Fill the line pointers. for(cx = 0;cx < m_ucCount;cx++) { line[cx] = CurrentLine(cx); } // Loop over lines and columns do { LONG length = m_ulWidth[0]; LONG *lp[4]; // Get the line pointers and initialize the internal backup lines. for(cx = 0;cx < m_ucCount;cx++) { lp[cx] = line[cx]->m_pData; StartLine(cx); } if (BeginReadMCU(m_Stream.ByteStreamOf())) { // No error handling strategy. No RST in scans. Bummer! do { LONG a[4],b[4],c[4],d[4]; // neighbouring values. LONG d1[4],d2[4],d3[4]; // local gradients. bool isrun = true; for(cx = 0;cx < m_ucCount;cx++) { GetContext(cx,a[cx],b[cx],c[cx],d[cx]); d1[cx] = d[cx] - b[cx]; // compute local gradients d2[cx] = b[cx] - c[cx]; d3[cx] = c[cx] - a[cx]; // // Run mode only if the run condition is met for all components if (isrun && !isRunMode(d1[cx],d2[cx],d3[cx])) isrun = false; } if (isrun) { LONG run = DecodeRun(length,m_lRunIndex[0]); // // Now fill the data. while(run) { // Update so that the next process gets the correct value. // There is one sample per component. for(cx = 0;cx < m_ucCount;cx++) { UpdateContext(cx,a[cx]); // And insert the value into the target line as well. *lp[cx]++ = a[cx] << preshift; } run--,length--; // As long as there are pixels on the line. } // // More data on the line? I.e. the run did not cover the full m_lJ samples? // Now decode the run interruption sample. The rtype is here always zero. if (length) { bool negative; // the sign variable LONG errval; // the prediction error LONG merr; // the mapped error (symbol) LONG rx; // the reconstructed value UBYTE k; // golomb parameter // // Decode the interrupting pixels. for(cx = 0;cx < m_ucCount;cx++) { // Get the neighbourhood. GetContext(cx,a[cx],b[cx],c[cx],d[cx]); // The prediction mode is always false, but the sign information // is required. negative = a[cx] > b[cx]; // Get the golomb parameter for run interruption coding. k = GolombParameter(false); // Golomb-decode the error symbol. It is always using the common // run index. merr = GolombDecode(k,m_lLimit - m_lJ[m_lRunIndex[0]] - 1); // Inverse the error mapping procedure. errval = InverseErrorMapping(merr,ErrorMappingOffset(false,merr != 0,k)); // Compute the reconstructed value. rx = Reconstruct(negative,b[cx],errval); // Update so that the next process gets the correct value. UpdateContext(cx,rx); // Fill in the value into the line *lp[cx]++ = rx << preshift; // Update the variables of the run mode. UpdateState(false,errval); } // Update the run index now. This is not part of // EncodeRun because the non-reduced run-index is // required for the golomb coder length limit. if (m_lRunIndex[0] > 0) m_lRunIndex[0]--; } else break; // end of line. } else { UWORD ctxt; bool negative; // the sign variable. LONG px; // the predicted variable. LONG rx; // the reconstructed value. LONG errval; // the error value. LONG merr; // the mapped error value. UBYTE k; // the Golomb parameter. // for(cx = 0;cx < m_ucCount;cx++) { // Quantize the gradients. d1[cx] = QuantizedGradient(d1[cx]); d2[cx] = QuantizedGradient(d2[cx]); d3[cx] = QuantizedGradient(d3[cx]); // Compute the context. ctxt = Context(negative,d1[cx],d2[cx],d3[cx]); // Compute the predicted value. px = Predict(a[cx],b[cx],c[cx]); // Correct the prediction. px = CorrectPrediction(ctxt,negative,px); // Compute the golomb parameter k from the context. k = GolombParameter(ctxt); // Decode the error symbol. merr = GolombDecode(k,m_lLimit); // Inverse the error symbol into an error value. errval = InverseErrorMapping(merr,ErrorMappingOffset(ctxt,k)); // Update the variables. UpdateState(ctxt,errval); // Compute the reconstructed value. rx = Reconstruct(negative,px,errval); // Update so that the next process gets the correct value. UpdateContext(cx,rx); // And insert the value into the target line as well. *lp[cx]++ = rx << preshift; } } } while(--length); } // No error handling here. // // Advance the line pointers. for(cx = 0;cx < m_ucCount;cx++) { EndLine(cx); line[cx] = line[cx]->m_pNext; } // } while(--lines); // // If this is the last line, gobble up all the // bits from bitstuffing the last byte may have left. // As SkipStuffing is idempotent, we can also do that // all the time. m_Stream.SkipStuffing(); #endif return false; }
1
254,710
njs_typed_array_get_i8(const void *a) { return *(const int8_t *) a; }
0
314,754
cdf_unpack_header(cdf_header_t *h, char *buf) { size_t i; size_t len = 0; CDF_UNPACK(h->h_magic); CDF_UNPACKA(h->h_uuid); CDF_UNPACK(h->h_revision); CDF_UNPACK(h->h_version); CDF_UNPACK(h->h_byte_order); CDF_UNPACK(h->h_sec_size_p2); CDF_UNPACK(h->h_short_sec_size_p2); CDF_UNPACKA(h->h_unused0); CDF_UNPACK(h->h_num_sectors_in_sat); CDF_UNPACK(h->h_secid_first_directory); CDF_UNPACKA(h->h_unused1); CDF_UNPACK(h->h_min_size_standard_stream); CDF_UNPACK(h->h_secid_first_sector_in_short_sat); CDF_UNPACK(h->h_num_sectors_in_short_sat); CDF_UNPACK(h->h_secid_first_sector_in_master_sat); CDF_UNPACK(h->h_num_sectors_in_master_sat); for (i = 0; i < __arraycount(h->h_master_sat); i++) CDF_UNPACK(h->h_master_sat[i]); }
0
401,562
static void entropy_timer(struct timer_list *t) { credit_entropy_bits(&input_pool, 1); }
0
221,467
add_document_portal_args (FlatpakBwrap *bwrap, const char *app_id, char **out_mount_path) { g_autoptr(GDBusConnection) session_bus = NULL; g_autofree char *doc_mount_path = NULL; session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); if (session_bus) { g_autoptr(GError) local_error = NULL; g_autoptr(GDBusMessage) reply = NULL; g_autoptr(GDBusMessage) msg = g_dbus_message_new_method_call ("org.freedesktop.portal.Documents", "/org/freedesktop/portal/documents", "org.freedesktop.portal.Documents", "GetMountPoint"); g_dbus_message_set_body (msg, g_variant_new ("()")); reply = g_dbus_connection_send_message_with_reply_sync (session_bus, msg, G_DBUS_SEND_MESSAGE_FLAGS_NONE, 30000, NULL, NULL, NULL); if (reply) { if (g_dbus_message_to_gerror (reply, &local_error)) { if (g_error_matches (local_error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)) g_debug ("Document portal not available, not mounting /run/flatpak/doc"); else g_message ("Can't get document portal: %s", local_error->message); } else { static const char dst_path[] = "/run/flatpak/doc"; g_autofree char *src_path = NULL; g_variant_get (g_dbus_message_get_body (reply), "(^ay)", &doc_mount_path); src_path = g_strdup_printf ("%s/by-app/%s", doc_mount_path, app_id); flatpak_bwrap_add_args (bwrap, "--bind", src_path, dst_path, NULL); flatpak_bwrap_add_runtime_dir_member (bwrap, "doc"); } } } *out_mount_path = g_steal_pointer (&doc_mount_path); }
0
294,566
of2str(int of) { int s, h, m; decode_offset(of, s, h, m); return rb_enc_sprintf(rb_usascii_encoding(), "%c%02d:%02d", s, h, m); }
0
387,736
void FieldPrinter::do_field(fieldDescriptor* fd) { _st->print(BULLET); if (_obj == NULL) { fd->print_on(_st); _st->cr(); } else { fd->print_on_for(_st, _obj); _st->cr(); } }
0
369,973
static int map_files_d_revalidate(struct dentry *dentry, struct nameidata *nd) { unsigned long vm_start, vm_end; bool exact_vma_exists = false; struct mm_struct *mm = NULL; struct task_struct *task; const struct cred *cred; struct inode *inode; int status = 0; if (nd && nd->flags & LOOKUP_RCU) return -ECHILD; if (!capable(CAP_SYS_ADMIN)) { status = -EACCES; goto out_notask; } inode = dentry->d_inode; task = get_proc_task(inode); if (!task) goto out_notask; if (!ptrace_may_access(task, PTRACE_MODE_READ)) goto out; mm = get_task_mm(task); if (!mm) goto out; if (!dname_to_vma_addr(dentry, &vm_start, &vm_end)) { down_read(&mm->mmap_sem); exact_vma_exists = !!find_exact_vma(mm, vm_start, vm_end); up_read(&mm->mmap_sem); } mmput(mm); if (exact_vma_exists) { if (task_dumpable(task)) { rcu_read_lock(); cred = __task_cred(task); inode->i_uid = cred->euid; inode->i_gid = cred->egid; rcu_read_unlock(); } else { inode->i_uid = 0; inode->i_gid = 0; } security_task_to_inode(task, inode); status = 1; } out: put_task_struct(task); out_notask: if (status <= 0) d_drop(dentry); return status; }
0
262,030
ServiceProtoQueryAliases(ServiceConnection *conn, ProtoRequest *req) { VGAuthError err; gchar *packet; int num; ServiceAlias *aList; /* * The alias code will do argument validation. */ err = ServiceAliasQueryAliases(req->reqData.queryAliases.userName, &num, &aList); if (err != VGAUTH_E_OK) { packet = Proto_MakeErrorReply(conn, req, err, "queryAliases failed"); } else { int i; gchar *endPacket; packet = g_markup_printf_escaped(VGAUTH_QUERYALIASES_REPLY_FORMAT_START, req->sequenceNumber); // now the aliases for (i = 0; i < num; i++) { gchar *certPacket; int j; certPacket = g_markup_printf_escaped(VGAUTH_ALIAS_FORMAT_START, aList[i].pemCert); packet = Proto_ConcatXMLStrings(packet, certPacket); for (j = 0; j < aList[i].num; j++) { gchar *aiPacket; ServiceAliasInfo *ai = &(aList[i].infos[j]); if (ai->type == SUBJECT_TYPE_ANY) { aiPacket = g_markup_printf_escaped(VGAUTH_ANYALIASINFO_FORMAT, ai->comment); } else if (ai->type == SUBJECT_TYPE_NAMED) { aiPacket = g_markup_printf_escaped(VGAUTH_NAMEDALIASINFO_FORMAT, ai->name, ai->comment); } else { aiPacket = NULL; ASSERT(0); } packet = Proto_ConcatXMLStrings(packet, aiPacket); } packet = Proto_ConcatXMLStrings(packet, g_markup_printf_escaped(VGAUTH_ALIAS_FORMAT_END)); } // now the end of the reply endPacket = g_markup_printf_escaped(VGAUTH_QUERYALIASES_REPLY_FORMAT_END); packet = Proto_ConcatXMLStrings(packet, endPacket); ServiceAliasFreeAliasList(num, aList); } err = ServiceNetworkWriteData(conn, strlen(packet), packet); if (err != VGAUTH_E_OK) { Warning("%s: failed to send QueryAliases reply\n", __FUNCTION__); } g_free(packet); return err; }
0
371,185
static pyc_object *get_complex_object(RzBinPycObj *pyc, RzBuffer *buffer) { pyc_object *ret = NULL; bool error = false; ut32 n1 = 0; ut32 n2 = 0; ret = RZ_NEW0(pyc_object); if (!ret) { return NULL; } if ((pyc->magic_int & 0xffff) <= 62061) { n1 = get_ut8(buffer, &error); } else { n1 = get_st32(buffer, &error); } if (error || UT32_ADD_OVFCHK(n1, 1)) { free(ret); return NULL; } ut8 *s1 = malloc(n1 + 1); if (!s1) { return NULL; } /* object contain string representation of the number */ if (rz_buf_read(buffer, s1, n1) != n1) { RZ_FREE(s1); RZ_FREE(ret); return NULL; } s1[n1] = '\0'; if ((pyc->magic_int & 0xffff) <= 62061) { n2 = get_ut8(buffer, &error); } else { n2 = get_st32(buffer, &error); } if (error || UT32_ADD_OVFCHK(n2, 1)) { return NULL; } ut8 *s2 = malloc(n2 + 1); if (!s2) { return NULL; } /* object contain string representation of the number */ if (rz_buf_read(buffer, s2, n2) != n2) { RZ_FREE(s1); RZ_FREE(s2); RZ_FREE(ret); return NULL; } s2[n2] = '\0'; ret->type = TYPE_COMPLEX; ret->data = rz_str_newf("%s+%sj", s1, s2); RZ_FREE(s1); RZ_FREE(s2); if (!ret->data) { RZ_FREE(ret); return NULL; } return ret; }
0
221,652
bool disjointComparisonTypes(Type A, Type B) { if (!A.isPrimitive() || !B.isPrimitive()) return false; // Check if types are disjoint. return Type::intersectTy(A, B).isNoType(); }
0
405,346
struct dst_entry *__xfrm_dst_lookup(struct net *net, int tos, int oif, const xfrm_address_t *saddr, const xfrm_address_t *daddr, int family, u32 mark) { const struct xfrm_policy_afinfo *afinfo; struct dst_entry *dst; afinfo = xfrm_policy_get_afinfo(family); if (unlikely(afinfo == NULL)) return ERR_PTR(-EAFNOSUPPORT); dst = afinfo->dst_lookup(net, tos, oif, saddr, daddr, mark); rcu_read_unlock(); return dst; }
0
231,040
void vQueueDelete( QueueHandle_t xQueue ) { Queue_t * const pxQueue = xQueue; configASSERT( pxQueue ); traceQUEUE_DELETE( pxQueue ); #if ( configQUEUE_REGISTRY_SIZE > 0 ) { vQueueUnregisterQueue( pxQueue ); } #endif #if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 0 ) ) { /* The queue can only have been allocated dynamically - free it * again. */ vPortFree( pxQueue ); } #elif ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) { /* The queue could have been allocated statically or dynamically, so * check before attempting to free the memory. */ if( pxQueue->ucStaticallyAllocated == ( uint8_t ) pdFALSE ) { vPortFree( pxQueue ); } else { mtCOVERAGE_TEST_MARKER(); } } #else /* if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 0 ) ) */ { /* The queue must have been statically allocated, so is not going to be * deleted. Avoid compiler warnings about the unused parameter. */ ( void ) pxQueue; } #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ }
0
234,195
display_debug_loc (struct dwarf_section *section, void *file) { unsigned char *start = section->start, *vstart = NULL; dwarf_vma bytes; unsigned char *section_begin = start; unsigned int num_loc_list = 0; dwarf_vma last_offset = 0; dwarf_vma last_view = 0; unsigned int first = 0; unsigned int i; unsigned int j; int seen_first_offset = 0; int locs_sorted = 1; unsigned char *next = start, *vnext = vstart; unsigned int *array = NULL; const char *suffix = strrchr (section->name, '.'); bool is_dwo = false; int is_loclists = strstr (section->name, "debug_loclists") != NULL; dwarf_vma expected_start = 0; if (suffix && strcmp (suffix, ".dwo") == 0) is_dwo = true; bytes = section->size; if (bytes == 0) { printf (_("\nThe %s section is empty.\n"), section->name); return 0; } if (is_loclists) { unsigned char *hdrptr = section_begin; dwarf_vma ll_length; unsigned short ll_version; unsigned char *end = section_begin + section->size; unsigned char address_size, segment_selector_size; uint32_t offset_entry_count; SAFE_BYTE_GET_AND_INC (ll_length, hdrptr, 4, end); if (ll_length == 0xffffffff) SAFE_BYTE_GET_AND_INC (ll_length, hdrptr, 8, end); SAFE_BYTE_GET_AND_INC (ll_version, hdrptr, 2, end); if (ll_version != 5) { warn (_("The %s section contains corrupt or " "unsupported version number: %d.\n"), section->name, ll_version); return 0; } SAFE_BYTE_GET_AND_INC (address_size, hdrptr, 1, end); SAFE_BYTE_GET_AND_INC (segment_selector_size, hdrptr, 1, end); if (segment_selector_size != 0) { warn (_("The %s section contains " "unsupported segment selector size: %d.\n"), section->name, segment_selector_size); return 0; } SAFE_BYTE_GET_AND_INC (offset_entry_count, hdrptr, 4, end); if (offset_entry_count != 0) return display_offset_entry_loclists (section); expected_start = hdrptr - section_begin; } if (load_debug_info (file) == 0) { warn (_("Unable to load/parse the .debug_info section, so cannot interpret the %s section.\n"), section->name); return 0; } /* Check the order of location list in .debug_info section. If offsets of location lists are in the ascending order, we can use `debug_information' directly. */ for (i = 0; i < num_debug_info_entries; i++) { unsigned int num; num = debug_information [i].num_loc_offsets; if (num > num_loc_list) num_loc_list = num; /* Check if we can use `debug_information' directly. */ if (locs_sorted && num != 0) { if (!seen_first_offset) { /* This is the first location list. */ last_offset = debug_information [i].loc_offsets [0]; last_view = debug_information [i].loc_views [0]; first = i; seen_first_offset = 1; j = 1; } else j = 0; for (; j < num; j++) { if (last_offset > debug_information [i].loc_offsets [j] || (last_offset == debug_information [i].loc_offsets [j] && last_view > debug_information [i].loc_views [j])) { locs_sorted = 0; break; } last_offset = debug_information [i].loc_offsets [j]; last_view = debug_information [i].loc_views [j]; } } } if (!seen_first_offset) error (_("No location lists in .debug_info section!\n")); if (debug_information [first].num_loc_offsets > 0 && debug_information [first].loc_offsets [0] != expected_start && debug_information [first].loc_views [0] != expected_start) warn (_("Location lists in %s section start at 0x%s rather than 0x%s\n"), section->name, dwarf_vmatoa ("x", debug_information [first].loc_offsets [0]), dwarf_vmatoa ("x", expected_start)); if (!locs_sorted) array = (unsigned int *) xcmalloc (num_loc_list, sizeof (unsigned int)); introduce (section, false); if (reloc_at (section, 0)) printf (_(" Warning: This section has relocations - addresses seen here may not be accurate.\n\n")); printf (_(" Offset Begin End Expression\n")); seen_first_offset = 0; for (i = first; i < num_debug_info_entries; i++) { dwarf_vma offset, voffset; dwarf_vma base_address; unsigned int k; int has_frame_base; if (!locs_sorted) { for (k = 0; k < debug_information [i].num_loc_offsets; k++) array[k] = k; loc_offsets = debug_information [i].loc_offsets; loc_views = debug_information [i].loc_views; qsort (array, debug_information [i].num_loc_offsets, sizeof (*array), loc_offsets_compar); } int adjacent_view_loclists = 1; for (k = 0; k < debug_information [i].num_loc_offsets; k++) { j = locs_sorted ? k : array[k]; if (k && (debug_information [i].loc_offsets [locs_sorted ? k - 1 : array [k - 1]] == debug_information [i].loc_offsets [j]) && (debug_information [i].loc_views [locs_sorted ? k - 1 : array [k - 1]] == debug_information [i].loc_views [j])) continue; has_frame_base = debug_information [i].have_frame_base [j]; offset = debug_information [i].loc_offsets [j]; next = section_begin + offset; voffset = debug_information [i].loc_views [j]; if (voffset != vm1) vnext = section_begin + voffset; else vnext = NULL; base_address = debug_information [i].base_address; if (vnext && vnext < next) { vstart = vnext; display_view_pair_list (section, &vstart, i, next); if (start == vnext) start = vstart; } if (!seen_first_offset || !adjacent_view_loclists) seen_first_offset = 1; else { if (start < next) warn (_("There is a hole [0x%lx - 0x%lx] in %s section.\n"), (unsigned long) (start - section_begin), (unsigned long) offset, section->name); else if (start > next) warn (_("There is an overlap [0x%lx - 0x%lx] in %s section.\n"), (unsigned long) (start - section_begin), (unsigned long) offset, section->name); } start = next; vstart = vnext; if (offset >= bytes) { warn (_("Offset 0x%lx is bigger than %s section size.\n"), (unsigned long) offset, section->name); continue; } if (vnext && voffset >= bytes) { warn (_("View Offset 0x%lx is bigger than %s section size.\n"), (unsigned long) voffset, section->name); continue; } if (!is_loclists) { if (is_dwo) display_loc_list_dwo (section, &start, i, offset, &vstart, has_frame_base); else display_loc_list (section, &start, i, offset, base_address, &vstart, has_frame_base); } else { if (is_dwo) warn (_("DWO is not yet supported.\n")); else display_loclists_list (section, &start, i, offset, base_address, &vstart, has_frame_base); } /* FIXME: this arrangement is quite simplistic. Nothing requires locview lists to be adjacent to corresponding loclists, and a single loclist could be augmented by different locview lists, and vice-versa, unlikely as it is that it would make sense to do so. Hopefully we'll have view pair support built into loclists before we ever need to address all these possibilities. */ if (adjacent_view_loclists && vnext && vnext != start && vstart != next) { adjacent_view_loclists = 0; warn (_("Hole and overlap detection requires adjacent view lists and loclists.\n")); } if (vnext && vnext == start) display_view_pair_list (section, &start, i, vstart); } } if (start < section->start + section->size) warn (ngettext ("There is %ld unused byte at the end of section %s\n", "There are %ld unused bytes at the end of section %s\n", (long) (section->start + section->size - start)), (long) (section->start + section->size - start), section->name); putchar ('\n'); free (array); return 1; }
0
437,686
static inline unsigned int clock_divider_to_ns(unsigned int divider) { /* Period of the Rx or Tx clock in ns */ return DIV_ROUND_CLOSEST((divider + 1) * 1000, CX23888_IR_REFCLK_FREQ / 1000000); }
0
387,563
static int snd_ctl_find_hole(struct snd_card *card, unsigned int count) { unsigned int iter = 100000; while (snd_ctl_remove_numid_conflict(card, count)) { if (--iter == 0) { /* this situation is very unlikely */ dev_err(card->dev, "unable to allocate new control numid\n"); return -ENOMEM; } } return 0; }
0
459,144
static struct tcf_proto *tcf_proto_create(const char *kind, u32 protocol, u32 prio, struct tcf_chain *chain, bool rtnl_held, struct netlink_ext_ack *extack) { struct tcf_proto *tp; int err; tp = kzalloc(sizeof(*tp), GFP_KERNEL); if (!tp) return ERR_PTR(-ENOBUFS); tp->ops = tcf_proto_lookup_ops(kind, rtnl_held, extack); if (IS_ERR(tp->ops)) { err = PTR_ERR(tp->ops); goto errout; } tp->classify = tp->ops->classify; tp->protocol = protocol; tp->prio = prio; tp->chain = chain; spin_lock_init(&tp->lock); refcount_set(&tp->refcnt, 1); err = tp->ops->init(tp); if (err) { module_put(tp->ops->owner); goto errout; } return tp; errout: kfree(tp); return ERR_PTR(err); }
0
309,936
main(int argc, char *argv[]) { int c, tc = FALSE; while ((c = getopt(argc, argv, "c")) != EOF) switch (c) { case 'c': tc = TRUE; break; } curr_line = 0; for (;;) { char buf[BUFSIZ]; ++curr_line; if (fgets(buf, sizeof(buf), stdin) == 0) break; buf[strlen(buf) - 1] = '\0'; _nc_set_source(buf); if (tc) { char *cp = _nc_infotocap("to termcap", buf, 1); if (cp) (void) fputs(cp, stdout); } else (void) fputs(_nc_captoinfo("to terminfo", buf, 1), stdout); (void) putchar('\n'); } return (0); }
0
476,104
static struct usb_gadget_strings **get_containers_gs( struct usb_gadget_string_container *uc) { return (struct usb_gadget_strings **)uc->stash; }
0
222,489
bool FunctionDefsEqual(const FunctionDef& f1, const FunctionDef& f2) { if (!OpDefEqual(f1.signature(), f2.signature())) return false; std::map<string, AttrValue> f1_attrs = GetSetAttrs(f1); std::map<string, AttrValue> f2_attrs = GetSetAttrs(f2); if (f1_attrs.size() != f2_attrs.size()) return false; for (const auto& iter1 : f1_attrs) { auto iter2 = f2_attrs.find(iter1.first); if (iter2 == f2_attrs.end()) return false; if (!AreAttrValuesEqual(iter1.second, iter2->second)) return false; } if (!EqualRepeatedNodeDef(f1.node_def(), f2.node_def(), nullptr)) { return false; } std::map<string, string> ret1(f1.ret().begin(), f1.ret().end()); std::map<string, string> ret2(f2.ret().begin(), f2.ret().end()); if (ret1 != ret2) return false; std::map<string, string> control_ret1(f1.control_ret().begin(), f1.control_ret().end()); std::map<string, string> control_ret2(f2.control_ret().begin(), f2.control_ret().end()); if (control_ret1 != control_ret2) return false; return true; }
0
238,783
get_line_and_copy(linenr_T lnum, char_u *buf) { char_u *line = ml_get(lnum); vim_strncpy(buf, line, LSIZE - 1); return buf; }
0
238,493
static int do_check_common(struct bpf_verifier_env *env, int subprog) { bool pop_log = !(env->log.level & BPF_LOG_LEVEL2); struct bpf_verifier_state *state; struct bpf_reg_state *regs; int ret, i; env->prev_linfo = NULL; env->pass_cnt++; state = kzalloc(sizeof(struct bpf_verifier_state), GFP_KERNEL); if (!state) return -ENOMEM; state->curframe = 0; state->speculative = false; state->branches = 1; state->frame[0] = kzalloc(sizeof(struct bpf_func_state), GFP_KERNEL); if (!state->frame[0]) { kfree(state); return -ENOMEM; } env->cur_state = state; init_func_state(env, state->frame[0], BPF_MAIN_FUNC /* callsite */, 0 /* frameno */, subprog); regs = state->frame[state->curframe]->regs; if (subprog || env->prog->type == BPF_PROG_TYPE_EXT) { ret = btf_prepare_func_args(env, subprog, regs); if (ret) goto out; for (i = BPF_REG_1; i <= BPF_REG_5; i++) { if (regs[i].type == PTR_TO_CTX) mark_reg_known_zero(env, regs, i); else if (regs[i].type == SCALAR_VALUE) mark_reg_unknown(env, regs, i); else if (base_type(regs[i].type) == PTR_TO_MEM) { const u32 mem_size = regs[i].mem_size; mark_reg_known_zero(env, regs, i); regs[i].mem_size = mem_size; regs[i].id = ++env->id_gen; } } } else { /* 1st arg to a function */ regs[BPF_REG_1].type = PTR_TO_CTX; mark_reg_known_zero(env, regs, BPF_REG_1); ret = btf_check_subprog_arg_match(env, subprog, regs); if (ret == -EFAULT) /* unlikely verifier bug. abort. * ret == 0 and ret < 0 are sadly acceptable for * main() function due to backward compatibility. * Like socket filter program may be written as: * int bpf_prog(struct pt_regs *ctx) * and never dereference that ctx in the program. * 'struct pt_regs' is a type mismatch for socket * filter that should be using 'struct __sk_buff'. */ goto out; } ret = do_check(env); out: /* check for NULL is necessary, since cur_state can be freed inside * do_check() under memory pressure. */ if (env->cur_state) { free_verifier_state(env->cur_state, true); env->cur_state = NULL; } while (!pop_stack(env, NULL, NULL, false)); if (!ret && pop_log) bpf_vlog_reset(&env->log, 0); free_states(env); return ret; }
0
294,388
canon(VALUE x) { if (RB_TYPE_P(x, T_RATIONAL)) { VALUE den = rb_rational_den(x); if (FIXNUM_P(den) && FIX2LONG(den) == 1) return rb_rational_num(x); } return x; }
0
442,568
from_physical(QXLPHYSICAL physical) { return (void *)(uintptr_t) physical; }
0
281,627
void CLASS phase_one_flat_field (int is_float, int nc) { ushort head[8]; unsigned wide, y, x, c, rend, cend, row, col; float *mrow, num, mult[4]; read_shorts (head, 8); wide = head[2] / head[4]; mrow = (float *) calloc (nc*wide, sizeof *mrow); merror (mrow, "phase_one_flat_field()"); for (y=0; y < head[3] / head[5]; y++) { for (x=0; x < wide; x++) for (c=0; c < nc; c+=2) { num = is_float ? getreal(11) : get2()/32768.0; if (y==0) mrow[c*wide+x] = num; else mrow[(c+1)*wide+x] = (num - mrow[c*wide+x]) / head[5]; } if (y==0) continue; rend = head[1] + y*head[5]; for (row = rend-head[5]; row < raw_height && row < rend; row++) { for (x=1; x < wide; x++) { for (c=0; c < nc; c+=2) { mult[c] = mrow[c*wide+x-1]; mult[c+1] = (mrow[c*wide+x] - mult[c]) / head[4]; } cend = head[0] + x*head[4]; for (col = cend-head[4]; col < raw_width && col < cend; col++) { c = nc > 2 ? FC(row-top_margin,col-left_margin) : 0; if (!(c & 1)) { c = RAW(row,col) * mult[c]; RAW(row,col) = LIM(c,0,65535); } for (c=0; c < nc; c+=2) mult[c] += mult[c+1]; } } for (x=0; x < wide; x++) for (c=0; c < nc; c+=2) mrow[c*wide+x] += mrow[(c+1)*wide+x]; } } free (mrow); }
0
264,719
bool MaybeReplaceRankOp(const Node* n, const std::vector<PartialTensorShape>& input_shapes, std::unordered_map<const Node*, std::vector<Tensor>>* shape_replacement_map) { CHECK_EQ(input_shapes.size(), 1); if (input_shapes[0].unknown_rank()) { return false; } Tensor t(DT_INT32, TensorShape({})); t.scalar<int32>()() = input_shapes[0].dims(); shape_replacement_map->insert({n, {t}}); return true; }
0
417,125
bool PlayerGeneric::isInitialized() const { if (mixer) return mixer->isInitialized(); return false; }
0
343,163
static int esp4_err(struct sk_buff *skb, u32 info) { struct net *net = dev_net(skb->dev); const struct iphdr *iph = (const struct iphdr *)skb->data; struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data+(iph->ihl<<2)); struct xfrm_state *x; switch (icmp_hdr(skb)->type) { case ICMP_DEST_UNREACH: if (icmp_hdr(skb)->code != ICMP_FRAG_NEEDED) return 0; break; case ICMP_REDIRECT: break; default: return 0; } x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET); if (!x) return 0; if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) ipv4_update_pmtu(skb, net, info, 0, IPPROTO_ESP); else ipv4_redirect(skb, net, 0, IPPROTO_ESP); xfrm_state_put(x); return 0; }
0
223,465
static SLJIT_INLINE PCRE2_SPTR compile_control_verb_matchingpath(compiler_common *common, PCRE2_SPTR cc, backtrack_common *parent) { DEFINE_COMPILER; backtrack_common *backtrack; PCRE2_UCHAR opcode = *cc; PCRE2_SPTR ccend = cc + 1; if (opcode == OP_COMMIT_ARG || opcode == OP_PRUNE_ARG || opcode == OP_SKIP_ARG || opcode == OP_THEN_ARG) ccend += 2 + cc[1]; PUSH_BACKTRACK(sizeof(backtrack_common), cc, NULL); if (opcode == OP_SKIP) { allocate_stack(common, 1); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0); return ccend; } if (opcode == OP_COMMIT_ARG || opcode == OP_PRUNE_ARG || opcode == OP_THEN_ARG) { if (HAS_VIRTUAL_REGISTERS) OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2)); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0); OP1(SLJIT_MOV, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? TMP1 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0); } return ccend; }
0
289,312
static void snd_pcm_oss_look_for_setup(struct snd_pcm *pcm, int stream, const char *task_name, struct snd_pcm_oss_setup *rsetup) { struct snd_pcm_oss_setup *setup; mutex_lock(&pcm->streams[stream].oss.setup_mutex); do { for (setup = pcm->streams[stream].oss.setup_list; setup; setup = setup->next) { if (!strcmp(setup->task_name, task_name)) goto out; } } while ((task_name = strip_task_path(task_name)) != NULL); out: if (setup) *rsetup = *setup; mutex_unlock(&pcm->streams[stream].oss.setup_mutex); }
0
223,416
static PCRE2_SPTR compile_iterator_matchingpath(compiler_common *common, PCRE2_SPTR cc, backtrack_common *parent) { DEFINE_COMPILER; backtrack_common *backtrack; PCRE2_UCHAR opcode; PCRE2_UCHAR type; sljit_u32 max = 0, exact; sljit_s32 early_fail_ptr = PRIVATE_DATA(cc + 1); sljit_s32 early_fail_type; BOOL charpos_enabled; PCRE2_UCHAR charpos_char; unsigned int charpos_othercasebit; PCRE2_SPTR end; jump_list *no_match = NULL; jump_list *no_char1_match = NULL; struct sljit_jump *jump = NULL; struct sljit_label *label; int private_data_ptr = PRIVATE_DATA(cc); int base = (private_data_ptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_SP); int offset0 = (private_data_ptr == 0) ? STACK(0) : private_data_ptr; int offset1 = (private_data_ptr == 0) ? STACK(1) : private_data_ptr + (int)sizeof(sljit_sw); int tmp_base, tmp_offset; #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 BOOL use_tmp; #endif PUSH_BACKTRACK(sizeof(char_iterator_backtrack), cc, NULL); early_fail_type = (early_fail_ptr & 0x7); early_fail_ptr >>= 3; /* During recursion, these optimizations are disabled. */ if (common->early_fail_start_ptr == 0 && common->fast_forward_bc_ptr == NULL) { early_fail_ptr = 0; early_fail_type = type_skip; } SLJIT_ASSERT(common->fast_forward_bc_ptr != NULL || early_fail_ptr == 0 || (early_fail_ptr >= common->early_fail_start_ptr && early_fail_ptr <= common->early_fail_end_ptr)); if (early_fail_type == type_fail) add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), early_fail_ptr)); cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &exact, &end); if (type != OP_EXTUNI) { tmp_base = TMP3; tmp_offset = 0; } else { tmp_base = SLJIT_MEM1(SLJIT_SP); tmp_offset = POSSESSIVE0; } /* Handle fixed part first. */ if (exact > 1) { SLJIT_ASSERT(early_fail_ptr == 0); if (common->mode == PCRE2_JIT_COMPLETE #ifdef SUPPORT_UNICODE && !common->utf #endif && type != OP_ANYNL && type != OP_EXTUNI) { OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(exact)); add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_GREATER, TMP1, 0, STR_END, 0)); OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact); label = LABEL(); compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE); OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); JUMPTO(SLJIT_NOT_ZERO, label); } else { OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact); label = LABEL(); compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE); OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); JUMPTO(SLJIT_NOT_ZERO, label); } } else if (exact == 1) { compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE); if (early_fail_type == type_fail_range) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), early_fail_ptr); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), early_fail_ptr + (int)sizeof(sljit_sw)); OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, TMP2, 0); OP2(SLJIT_SUB, TMP2, 0, STR_PTR, 0, TMP2, 0); add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_LESS_EQUAL, TMP2, 0, TMP1, 0)); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr + (int)sizeof(sljit_sw), STR_PTR, 0); } } switch(opcode) { case OP_STAR: case OP_UPTO: SLJIT_ASSERT(early_fail_ptr == 0 || opcode == OP_STAR); if (type == OP_ANYNL || type == OP_EXTUNI) { SLJIT_ASSERT(private_data_ptr == 0); SLJIT_ASSERT(early_fail_ptr == 0); allocate_stack(common, 2); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0); if (opcode == OP_UPTO) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, SLJIT_IMM, max); label = LABEL(); compile_char1_matchingpath(common, type, cc, &BACKTRACK_AS(char_iterator_backtrack)->u.backtracks, TRUE); if (opcode == OP_UPTO) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0); OP2(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, TMP1, 0, SLJIT_IMM, 1); jump = JUMP(SLJIT_ZERO); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, TMP1, 0); } /* We cannot use TMP3 because of allocate_stack. */ allocate_stack(common, 1); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0); JUMPTO(SLJIT_JUMP, label); if (jump != NULL) JUMPHERE(jump); BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); break; } #ifdef SUPPORT_UNICODE else if (type == OP_ALLANY && !common->invalid_utf) #else else if (type == OP_ALLANY) #endif { if (opcode == OP_STAR) { if (private_data_ptr == 0) allocate_stack(common, 2); OP1(SLJIT_MOV, base, offset0, STR_END, 0); OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0); process_partial_match(common); if (early_fail_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_END, 0); BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); break; } #ifdef SUPPORT_UNICODE else if (!common->utf) #else else #endif { if (private_data_ptr == 0) allocate_stack(common, 2); OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(max)); if (common->mode == PCRE2_JIT_COMPLETE) { OP2U(SLJIT_SUB | SLJIT_SET_GREATER, STR_PTR, 0, STR_END, 0); CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0); } else { jump = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, STR_END, 0); process_partial_match(common); JUMPHERE(jump); } OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); if (early_fail_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_PTR, 0); BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); break; } } charpos_enabled = FALSE; charpos_char = 0; charpos_othercasebit = 0; if ((type != OP_CHAR && type != OP_CHARI) && (*end == OP_CHAR || *end == OP_CHARI)) { #ifdef SUPPORT_UNICODE charpos_enabled = !common->utf || !HAS_EXTRALEN(end[1]); #else charpos_enabled = TRUE; #endif if (charpos_enabled && *end == OP_CHARI && char_has_othercase(common, end + 1)) { charpos_othercasebit = char_get_othercase_bit(common, end + 1); if (charpos_othercasebit == 0) charpos_enabled = FALSE; } if (charpos_enabled) { charpos_char = end[1]; /* Consume the OP_CHAR opcode. */ end += 2; #if PCRE2_CODE_UNIT_WIDTH == 8 SLJIT_ASSERT((charpos_othercasebit >> 8) == 0); #elif PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32 SLJIT_ASSERT((charpos_othercasebit >> 9) == 0); if ((charpos_othercasebit & 0x100) != 0) charpos_othercasebit = (charpos_othercasebit & 0xff) << 8; #endif if (charpos_othercasebit != 0) charpos_char |= charpos_othercasebit; BACKTRACK_AS(char_iterator_backtrack)->u.charpos.enabled = TRUE; BACKTRACK_AS(char_iterator_backtrack)->u.charpos.chr = charpos_char; BACKTRACK_AS(char_iterator_backtrack)->u.charpos.othercasebit = charpos_othercasebit; } } if (charpos_enabled) { if (opcode == OP_UPTO) OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max + 1); /* Search the first instance of charpos_char. */ jump = JUMP(SLJIT_JUMP); label = LABEL(); if (opcode == OP_UPTO) { OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_ZERO)); } compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE); if (early_fail_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_PTR, 0); JUMPHERE(jump); detect_partial_match(common, &backtrack->topbacktracks); OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); if (charpos_othercasebit != 0) OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit); CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label); if (private_data_ptr == 0) allocate_stack(common, 2); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); if (opcode == OP_UPTO) { OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); } /* Search the last instance of charpos_char. */ label = LABEL(); compile_char1_matchingpath(common, type, cc, &no_match, FALSE); if (early_fail_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_PTR, 0); detect_partial_match(common, &no_match); OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); if (charpos_othercasebit != 0) OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit); if (opcode == OP_STAR) { CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); JUMPTO(SLJIT_JUMP, label); } else { jump = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); JUMPHERE(jump); OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); JUMPTO(SLJIT_NOT_ZERO, label); } set_jumps(no_match, LABEL()); OP2(SLJIT_ADD, STR_PTR, 0, base, offset0, SLJIT_IMM, IN_UCHARS(1)); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); } else { if (private_data_ptr == 0) allocate_stack(common, 2); OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 use_tmp = (!HAS_VIRTUAL_REGISTERS && opcode == OP_STAR); SLJIT_ASSERT(!use_tmp || tmp_base == TMP3); if (common->utf) OP1(SLJIT_MOV, use_tmp ? TMP3 : base, use_tmp ? 0 : offset0, STR_PTR, 0); #endif if (opcode == OP_UPTO) OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); detect_partial_match(common, &no_match); label = LABEL(); compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 if (common->utf) OP1(SLJIT_MOV, use_tmp ? TMP3 : base, use_tmp ? 0 : offset0, STR_PTR, 0); #endif if (opcode == OP_UPTO) { OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); } detect_partial_match_to(common, label); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); set_jumps(no_char1_match, LABEL()); #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 if (common->utf) { set_jumps(no_match, LABEL()); if (use_tmp) { OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0); OP1(SLJIT_MOV, base, offset0, TMP3, 0); } else OP1(SLJIT_MOV, STR_PTR, 0, base, offset0); } else #endif { OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); set_jumps(no_match, LABEL()); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); } if (early_fail_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_PTR, 0); } BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); break; case OP_MINSTAR: if (private_data_ptr == 0) allocate_stack(common, 1); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); if (early_fail_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_PTR, 0); break; case OP_MINUPTO: SLJIT_ASSERT(early_fail_ptr == 0); if (private_data_ptr == 0) allocate_stack(common, 2); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); OP1(SLJIT_MOV, base, offset1, SLJIT_IMM, max + 1); BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); break; case OP_QUERY: case OP_MINQUERY: SLJIT_ASSERT(early_fail_ptr == 0); if (private_data_ptr == 0) allocate_stack(common, 1); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); if (opcode == OP_QUERY) compile_char1_matchingpath(common, type, cc, &BACKTRACK_AS(char_iterator_backtrack)->u.backtracks, TRUE); BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); break; case OP_EXACT: break; case OP_POSSTAR: #if defined SUPPORT_UNICODE if (type == OP_ALLANY && !common->invalid_utf) #else if (type == OP_ALLANY) #endif { OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0); process_partial_match(common); if (early_fail_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_END, 0); break; } #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 if (common->utf) { OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0); detect_partial_match(common, &no_match); label = LABEL(); compile_char1_matchingpath(common, type, cc, &no_match, FALSE); OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0); detect_partial_match_to(common, label); set_jumps(no_match, LABEL()); OP1(SLJIT_MOV, STR_PTR, 0, tmp_base, tmp_offset); if (early_fail_ptr != 0) { if (!HAS_VIRTUAL_REGISTERS && tmp_base == TMP3) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, TMP3, 0); else OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_PTR, 0); } break; } #endif detect_partial_match(common, &no_match); label = LABEL(); compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); detect_partial_match_to(common, label); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); set_jumps(no_char1_match, LABEL()); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); set_jumps(no_match, LABEL()); if (early_fail_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), early_fail_ptr, STR_PTR, 0); break; case OP_POSUPTO: SLJIT_ASSERT(early_fail_ptr == 0); #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 if (common->utf) { OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0); OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); detect_partial_match(common, &no_match); label = LABEL(); compile_char1_matchingpath(common, type, cc, &no_match, FALSE); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0); OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); detect_partial_match_to(common, label); set_jumps(no_match, LABEL()); OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1); break; } #endif if (type == OP_ALLANY) { OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(max)); if (common->mode == PCRE2_JIT_COMPLETE) { OP2U(SLJIT_SUB | SLJIT_SET_GREATER, STR_PTR, 0, STR_END, 0); CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0); } else { jump = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, STR_END, 0); process_partial_match(common); JUMPHERE(jump); } break; } OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); detect_partial_match(common, &no_match); label = LABEL(); compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); detect_partial_match_to(common, label); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); set_jumps(no_char1_match, LABEL()); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); set_jumps(no_match, LABEL()); break; case OP_POSQUERY: SLJIT_ASSERT(early_fail_ptr == 0); OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0); compile_char1_matchingpath(common, type, cc, &no_match, TRUE); OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0); set_jumps(no_match, LABEL()); OP1(SLJIT_MOV, STR_PTR, 0, tmp_base, tmp_offset); break; default: SLJIT_UNREACHABLE(); break; } count_match(common); return end; }
0
512,631
Item* get_copy(THD *thd) { return 0; }
0
508,381
bool setup_on_expr(THD *thd, TABLE_LIST *table, bool is_update) { uchar buff[STACK_BUFF_ALLOC]; // Max argument in function if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) return TRUE; // Fatal error flag is set! for(; table; table= table->next_local) { TABLE_LIST *embedded; /* The table at the current level of nesting. */ TABLE_LIST *embedding= table; /* The parent nested table reference. */ do { embedded= embedding; if (embedded->on_expr) { thd->where="on clause"; embedded->on_expr->mark_as_condition_AND_part(embedded); if ((!embedded->on_expr->fixed && embedded->on_expr->fix_fields(thd, &embedded->on_expr)) || embedded->on_expr->check_cols(1)) return TRUE; } /* If it's a semi-join nest, fix its "left expression", as it is used by the SJ-Materialization */ if (embedded->sj_subq_pred) { Item **left_expr= &embedded->sj_subq_pred->left_expr; if (!(*left_expr)->fixed && (*left_expr)->fix_fields(thd, left_expr)) return TRUE; } embedding= embedded->embedding; } while (embedding && embedding->nested_join->join_list.head() == embedded); if (table->is_merged_derived()) { SELECT_LEX *select_lex= table->get_single_select(); setup_on_expr(thd, select_lex->get_table_list(), is_update); } /* process CHECK OPTION */ if (is_update) { TABLE_LIST *view= table->top_table(); if (view->effective_with_check) { if (view->prepare_check_option(thd)) return TRUE; thd->change_item_tree(&table->check_option, view->check_option); } } } return FALSE; }
0
357,676
SQInstance *SQClass::CreateInstance() { if(!_locked) Lock(); return SQInstance::Create(_opt_ss(this),this); }
0
463,030
extract_argv (EvDocument *document, gint page) { ComicsDocument *comics_document = COMICS_DOCUMENT (document); char **argv; char *command_line, *quoted_archive, *quoted_filename; GError *err = NULL; if (g_strrstr (comics_document->page_names->pdata[page], "--checkpoint-action=")) { g_warning ("File unsupported\n"); gtk_main_quit (); } if (page >= comics_document->page_names->len) return NULL; if (comics_document->regex_arg) { quoted_archive = g_shell_quote (comics_document->archive); quoted_filename = comics_regex_quote (comics_document->page_names->pdata[page]); } else { quoted_archive = g_shell_quote (comics_document->archive); quoted_filename = g_shell_quote (comics_document->page_names->pdata[page]); } command_line = g_strdup_printf ("%s %s %s", comics_document->extract_command, quoted_archive, quoted_filename); g_free (quoted_archive); g_free (quoted_filename); g_shell_parse_argv (command_line, NULL, &argv, &err); g_free (command_line); if (err) { g_warning (_("Error %s"), err->message); g_error_free (err); return NULL; } return argv; }
0
236,152
GF_Err blnk_box_read(GF_Box *s, GF_BitStream *bs) { GF_TextBlinkBox*ptr = (GF_TextBlinkBox*)s; ISOM_DECREASE_SIZE(ptr, 4) ptr->startcharoffset = gf_bs_read_u16(bs); ptr->endcharoffset = gf_bs_read_u16(bs); return GF_OK; }
0
248,295
DLLIMPORT int cfg_setfloat(cfg_t *cfg, const char *name, double value) { return cfg_setnfloat(cfg, name, value, 0); }
0
272,366
digest_get_signature_oid(cms_context *cms) { int i = cms->selected_digest; return digest_params[i].signature_tag; }
0
329,881
_mono_spans (void *abstract_renderer, int y, int h, const cairo_half_open_span_t *spans, unsigned num_spans) { cairo_image_span_renderer_t *r = abstract_renderer; if (num_spans == 0) return CAIRO_STATUS_SUCCESS; do { if (spans[0].coverage) { pixman_image_composite32 (r->op, r->src, NULL, r->u.composite.dst, spans[0].x + r->u.composite.src_x, y + r->u.composite.src_y, 0, 0, spans[0].x, y, spans[1].x - spans[0].x, h); } spans++; } while (--num_spans > 1); return CAIRO_STATUS_SUCCESS; }
0
500,662
static void sftp_set_error(sftp_session sftp, int errnum) { if (sftp != NULL) { sftp->errnum = errnum; } }
0
410,080
static int hid_debug_rdesc_open(struct inode *inode, struct file *file) { return single_open(file, hid_debug_rdesc_show, inode->i_private); }
0
344,735
opt_array_append2(const char *file, const int line, const char *directive, char ***array, int **iarray, u_int *lp, const char *s, int i) { if (*lp >= INT_MAX) fatal("%s line %d: Too many %s entries", file, line, directive); if (iarray != NULL) { *iarray = xrecallocarray(*iarray, *lp, *lp + 1, sizeof(**iarray)); (*iarray)[*lp] = i; } *array = xrecallocarray(*array, *lp, *lp + 1, sizeof(**array)); (*array)[*lp] = xstrdup(s); (*lp)++; }
0
359,473
bgp_default_update_send (struct peer *peer, struct attr *attr, afi_t afi, safi_t safi, struct peer *from) { struct stream *s; struct stream *packet; struct prefix p; unsigned long pos; bgp_size_t total_attr_len; char attrstr[BUFSIZ]; char buf[BUFSIZ]; #ifdef DISABLE_BGP_ANNOUNCE return; #endif /* DISABLE_BGP_ANNOUNCE */ if (afi == AFI_IP) str2prefix ("0.0.0.0/0", &p); #ifdef HAVE_IPV6 else str2prefix ("::/0", &p); #endif /* HAVE_IPV6 */ /* Logging the attribute. */ if (BGP_DEBUG (update, UPDATE_OUT)) { bgp_dump_attr (peer, attr, attrstr, BUFSIZ); zlog (peer->log, LOG_DEBUG, "%s send UPDATE %s/%d %s", peer->host, inet_ntop(p.family, &(p.u.prefix), buf, BUFSIZ), p.prefixlen, attrstr); } s = stream_new (BGP_MAX_PACKET_SIZE); /* Make BGP update packet. */ bgp_packet_set_marker (s, BGP_MSG_UPDATE); /* Unfeasible Routes Length. */ stream_putw (s, 0); /* Make place for total attribute length. */ pos = stream_get_endp (s); stream_putw (s, 0); total_attr_len = bgp_packet_attribute (NULL, peer, s, attr, &p, afi, safi, from, NULL, NULL); /* Set Total Path Attribute Length. */ stream_putw_at (s, pos, total_attr_len); /* NLRI set. */ if (p.family == AF_INET && safi == SAFI_UNICAST) stream_put_prefix (s, &p); /* Set size. */ bgp_packet_set_size (s); packet = stream_dup (s); stream_free (s); /* Dump packet if debug option is set. */ #ifdef DEBUG /* bgp_packet_dump (packet); */ #endif /* DEBUG */ /* Add packet to the peer. */ bgp_packet_add (peer, packet); BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd); }
0
234,150
get_type_abbrev_from_form (unsigned long form, unsigned long uvalue, dwarf_vma cu_offset, unsigned char *cu_end, const struct dwarf_section *section, unsigned long *abbrev_num_return, unsigned char **data_return, abbrev_map **map_return) { unsigned long abbrev_number; abbrev_map * map; abbrev_entry * entry; unsigned char * data; if (abbrev_num_return != NULL) * abbrev_num_return = 0; if (data_return != NULL) * data_return = NULL; switch (form) { case DW_FORM_GNU_ref_alt: case DW_FORM_ref_sig8: /* FIXME: We are unable to handle this form at the moment. */ return NULL; case DW_FORM_ref_addr: if (uvalue >= section->size) { warn (_("Unable to resolve ref_addr form: uvalue %lx > section size %lx (%s)\n"), uvalue, (long) section->size, section->name); return NULL; } break; case DW_FORM_ref_sup4: case DW_FORM_ref_sup8: break; case DW_FORM_ref1: case DW_FORM_ref2: case DW_FORM_ref4: case DW_FORM_ref8: case DW_FORM_ref_udata: if (uvalue + cu_offset > (size_t) (cu_end - section->start)) { warn (_("Unable to resolve ref form: uvalue %lx + cu_offset %lx > CU size %lx\n"), uvalue, (long) cu_offset, (long) (cu_end - section->start)); return NULL; } uvalue += cu_offset; break; /* FIXME: Are there other DW_FORMs that can be used by types ? */ default: warn (_("Unexpected form %lx encountered whilst finding abbreviation for type\n"), form); return NULL; } data = (unsigned char *) section->start + uvalue; map = find_abbrev_map_by_offset (uvalue); if (map == NULL) { warn (_("Unable to find abbreviations for CU offset %#lx\n"), uvalue); return NULL; } if (map->list == NULL) { warn (_("Empty abbreviation list encountered for CU offset %lx\n"), uvalue); return NULL; } if (map_return != NULL) { if (form == DW_FORM_ref_addr) *map_return = map; else *map_return = NULL; } READ_ULEB (abbrev_number, data, section->start + section->size); for (entry = map->list->first_abbrev; entry != NULL; entry = entry->next) if (entry->number == abbrev_number) break; if (abbrev_num_return != NULL) * abbrev_num_return = abbrev_number; if (data_return != NULL) * data_return = data; if (entry == NULL) warn (_("Unable to find entry for abbreviation %lu\n"), abbrev_number); return entry; }
0
243,982
GF_Err stsz_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GF_SampleSizeBox *ptr = (GF_SampleSizeBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; //in both versions this is still valid if (ptr->type == GF_ISOM_BOX_TYPE_STSZ) { gf_bs_write_u32(bs, ptr->sampleSize); } else { gf_bs_write_u24(bs, 0); gf_bs_write_u8(bs, ptr->sampleSize); } gf_bs_write_u32(bs, ptr->sampleCount); if (ptr->type == GF_ISOM_BOX_TYPE_STSZ) { if (ptr->sampleSize) return GF_OK; for (i = 0; i < ptr->sampleCount; i++) { gf_bs_write_u32(bs, ptr->sizes ? ptr->sizes[i] : 0); } } else { if (!ptr->sizes) return GF_ISOM_INVALID_FILE; for (i = 0; i < ptr->sampleCount; ) { switch (ptr->sampleSize) { case 4: gf_bs_write_int(bs, ptr->sizes[i], 4); if (i+1 < ptr->sampleCount) { gf_bs_write_int(bs, ptr->sizes[i+1], 4); } else { //0 padding in odd sample count gf_bs_write_int(bs, 0, 4); } i += 2; break; default: gf_bs_write_int(bs, ptr->sizes[i], ptr->sampleSize); i += 1; break; } } } return GF_OK; }
0
234,863
void btrfs_commit_device_sizes(struct btrfs_transaction *trans) { struct btrfs_device *curr, *next; ASSERT(trans->state == TRANS_STATE_COMMIT_DOING); if (list_empty(&trans->dev_update_list)) return; /* * We don't need the device_list_mutex here. This list is owned by the * transaction and the transaction must complete before the device is * released. */ mutex_lock(&trans->fs_info->chunk_mutex); list_for_each_entry_safe(curr, next, &trans->dev_update_list, post_commit_list) { list_del_init(&curr->post_commit_list); curr->commit_total_bytes = curr->disk_total_bytes; curr->commit_bytes_used = curr->bytes_used; } mutex_unlock(&trans->fs_info->chunk_mutex); }
0
223,388
static SLJIT_INLINE BOOL fast_forward_first_n_chars(compiler_common *common) { DEFINE_COMPILER; struct sljit_label *start; struct sljit_jump *match; fast_forward_char_data chars[MAX_N_CHARS]; sljit_s32 offset; PCRE2_UCHAR mask; PCRE2_UCHAR *char_set, *char_set_end; int i, max, from; int range_right = -1, range_len; sljit_u8 *update_table = NULL; BOOL in_range; sljit_u32 rec_count; for (i = 0; i < MAX_N_CHARS; i++) { chars[i].count = 0; chars[i].last_count = 0; } rec_count = 10000; max = scan_prefix(common, common->start, chars, MAX_N_CHARS, &rec_count); if (max < 1) return FALSE; /* Convert last_count to priority. */ for (i = 0; i < max; i++) { SLJIT_ASSERT(chars[i].count > 0 && chars[i].last_count <= chars[i].count); if (chars[i].count == 1) { chars[i].last_count = (chars[i].last_count == 1) ? 7 : 5; /* Simplifies algorithms later. */ chars[i].chars[1] = chars[i].chars[0]; } else if (chars[i].count == 2) { SLJIT_ASSERT(chars[i].chars[0] != chars[i].chars[1]); if (is_powerof2(chars[i].chars[0] ^ chars[i].chars[1])) chars[i].last_count = (chars[i].last_count == 2) ? 6 : 4; else chars[i].last_count = (chars[i].last_count == 2) ? 3 : 2; } else chars[i].last_count = (chars[i].count == 255) ? 0 : 1; } #ifdef JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD if (JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD && check_fast_forward_char_pair_simd(common, chars, max)) return TRUE; #endif in_range = FALSE; /* Prevent compiler "uninitialized" warning */ from = 0; range_len = 4 /* minimum length */ - 1; for (i = 0; i <= max; i++) { if (in_range && (i - from) > range_len && (chars[i - 1].count < 255)) { range_len = i - from; range_right = i - 1; } if (i < max && chars[i].count < 255) { SLJIT_ASSERT(chars[i].count > 0); if (!in_range) { in_range = TRUE; from = i; } } else in_range = FALSE; } if (range_right >= 0) { update_table = (sljit_u8 *)allocate_read_only_data(common, 256); if (update_table == NULL) return TRUE; memset(update_table, IN_UCHARS(range_len), 256); for (i = 0; i < range_len; i++) { SLJIT_ASSERT(chars[range_right - i].count > 0 && chars[range_right - i].count < 255); char_set = chars[range_right - i].chars; char_set_end = char_set + chars[range_right - i].count; do { if (update_table[(*char_set) & 0xff] > IN_UCHARS(i)) update_table[(*char_set) & 0xff] = IN_UCHARS(i); char_set++; } while (char_set < char_set_end); } } offset = -1; /* Scan forward. */ for (i = 0; i < max; i++) { if (range_right == i) continue; if (offset == -1) { if (chars[i].last_count >= 2) offset = i; } else if (chars[offset].last_count < chars[i].last_count) offset = i; } SLJIT_ASSERT(offset == -1 || (chars[offset].count >= 1 && chars[offset].count <= 2)); if (range_right < 0) { if (offset < 0) return FALSE; /* Works regardless the value is 1 or 2. */ fast_forward_first_char2(common, chars[offset].chars[0], chars[offset].chars[1], offset); return TRUE; } SLJIT_ASSERT(range_right != offset); if (common->match_end_ptr != 0) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); OP2(SLJIT_SUB | SLJIT_SET_LESS, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max)); add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS)); OP2U(SLJIT_SUB | SLJIT_SET_GREATER, STR_END, 0, TMP1, 0); CMOV(SLJIT_GREATER, STR_END, TMP1, 0); } else { OP2(SLJIT_SUB | SLJIT_SET_LESS, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max)); add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS)); } SLJIT_ASSERT(range_right >= 0); if (!HAS_VIRTUAL_REGISTERS) OP1(SLJIT_MOV, RETURN_ADDR, 0, SLJIT_IMM, (sljit_sw)update_table); start = LABEL(); add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER, STR_PTR, 0, STR_END, 0)); #if PCRE2_CODE_UNIT_WIDTH == 8 || (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN) OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right)); #else OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right + 1) - 1); #endif if (!HAS_VIRTUAL_REGISTERS) OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0); else OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, start); if (offset >= 0) { OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(offset)); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); if (chars[offset].count == 1) CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset].chars[0], start); else { mask = chars[offset].chars[0] ^ chars[offset].chars[1]; if (is_powerof2(mask)) { OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, mask); CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset].chars[0] | mask, start); } else { match = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset].chars[0]); CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[offset].chars[1], start); JUMPHERE(match); } } } #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 if (common->utf && offset != 0) { if (offset < 0) { OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); } else OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1)); jumpto_if_not_utf_char_start(compiler, TMP1, start); if (offset < 0) OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); } #endif if (offset >= 0) OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); if (common->match_end_ptr != 0) OP1(SLJIT_MOV, STR_END, 0, TMP3, 0); else OP2(SLJIT_ADD, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max)); return TRUE; }
0
261,933
njs_encode_base64url(njs_str_t *dst, const njs_str_t *src) { static u_char basis64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; njs_encode_base64_core(dst, src, basis64, 0); }
0
442,819
static char *file2string(FILE *file) { char buffer[256]; char *ptr; char *string=NULL; size_t len=0; size_t stringlen; if(file) { while(fgets(buffer, sizeof(buffer), file)) { ptr= strchr(buffer, '\r'); if(ptr) *ptr=0; ptr= strchr(buffer, '\n'); if(ptr) *ptr=0; stringlen=strlen(buffer); if(string) string = realloc(string, len+stringlen+1); else string = malloc(stringlen+1); strcpy(string+len, buffer); len+=stringlen; } return string; } else return NULL; /* no string */ }
0
387,746
Method* InstanceKlass::lookup_method_in_ordered_interfaces(Symbol* name, Symbol* signature) const { Method* m = NULL; if (default_methods() != NULL) { m = find_method(default_methods(), name, signature); } // Look up interfaces if (m == NULL) { m = lookup_method_in_all_interfaces(name, signature, find_defaults); } return m; }
0
437,675
static int cx23888_ir_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) { struct cx23888_ir_state *state = to_state(sd); u32 addr = CX23888_IR_REG_BASE + (u32) reg->reg; if ((addr & 0x3) != 0) return -EINVAL; if (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG) return -EINVAL; reg->size = 4; reg->val = cx23888_ir_read4(state->dev, addr); return 0; }
0
248,301
DLLIMPORT cfg_bool_t cfg_getnbool(cfg_t *cfg, const char *name, unsigned int index) { return cfg_opt_getnbool(cfg_getopt(cfg, name), index); }
0
262,089
StatsPartitionKey(const int32_t node_id, const int32_t feature_dim, const int32_t bucket_id) : node_id(node_id), feature_dim(feature_dim), bucket_id(bucket_id) {}
0
458,991
HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, hdr_t hdr) { const char *ptr; unsigned l; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(hdr); l = hdr[0]; assert(l > 0); assert(l == strlen(hdr + 1)); assert(hdr[l] == ':'); hdr++; if (hdr[0] == ':') { /* Special cases */ ptr = ObjGetAttr(wrk, oc, OA_HEADERS, NULL); AN(ptr); ptr += 4; /* Skip nhd and status */ /* XXX: should we also have h2_hdr_eq() ? */ if (!strcmp(hdr, ":proto:")) return (ptr); ptr = strchr(ptr, '\0') + 1; if (!strcmp(hdr, ":status:")) return (ptr); ptr = strchr(ptr, '\0') + 1; if (!strcmp(hdr, ":reason:")) return (ptr); WRONG("Unknown magic packed header"); } HTTP_FOREACH_PACK(wrk, oc, ptr) { if (http_hdr_at(ptr, hdr, l)) { ptr += l; while (vct_islws(*ptr)) ptr++; return (ptr); } } return (NULL); }
0
513,142
static void restore_ptr_backup(uint n, st_ptr_backup *backup) { while (n--) (backup++)->restore(); }
0
234,128
range_entry_compar (const void *ap, const void *bp) { const struct range_entry *a_re = (const struct range_entry *) ap; const struct range_entry *b_re = (const struct range_entry *) bp; const dwarf_vma a = a_re->ranges_offset; const dwarf_vma b = b_re->ranges_offset; return (a > b) - (b > a); }
0
221,685
bool Socket::writeChunkTrailer( String &trailer) { std::string hexs ("0\r\n"); #ifdef CHUNKDEBUG std::cerr << thread_id << "writeChunk size=" << hexs << std::endl; #endif if(writeString(hexs.c_str()) && writeToSocket(trailer.c_str(),trailer.length(),0,timeout) && writeString("\r\n")) return true; return false; };
0
244,336
GF_Box *vwid_box_new() { ISOM_DECL_BOX_ALLOC(GF_ViewIdentifierBox, GF_ISOM_BOX_TYPE_VWID); return (GF_Box *)tmp; }
0
90,885
void ClientUsageTracker::AddCachedOrigin( const GURL& origin, int64 usage) { std::string host = net::GetHostOrSpecFromURL(origin); UsageMap::iterator iter = cached_usage_[host]. insert(UsageMap::value_type(origin, 0)).first; int64 old_usage = iter->second; iter->second = usage; int64 delta = usage - old_usage; if (delta) { global_usage_ += delta; if (global_unlimited_usage_is_valid_ && IsStorageUnlimited(origin)) global_unlimited_usage_ += delta; } DCHECK_GE(iter->second, 0); DCHECK_GE(global_usage_, 0); }
0
247,579
TEST_P(SslSocketTest, CertificatesWithPassword) { envoy::config::listener::v3::Listener listener; envoy::config::listener::v3::FilterChain* filter_chain = listener.add_filter_chains(); envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context; envoy::extensions::transport_sockets::tls::v3::TlsCertificate* server_cert = tls_context.mutable_common_tls_context()->add_tls_certificates(); server_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir " "}}/test/extensions/transport_sockets/tls/test_data/password_protected_cert.pem")); server_cert->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir " "}}/test/extensions/transport_sockets/tls/test_data/password_protected_key.pem")); server_cert->mutable_password()->set_filename(TestEnvironment::substitute( "{{ test_rundir " "}}/test/extensions/transport_sockets/tls/test_data/password_protected_password.txt")); envoy::extensions::transport_sockets::tls::v3::CertificateValidationContext* server_validation_ctx = tls_context.mutable_common_tls_context()->mutable_validation_context(); server_validation_ctx->mutable_trusted_ca()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem")); server_validation_ctx->add_verify_certificate_hash( "0000000000000000000000000000000000000000000000000000000000000000"); server_validation_ctx->add_verify_certificate_hash(TEST_PASSWORD_PROTECTED_CERT_256_HASH); updateFilterChain(tls_context, *filter_chain); envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext client; envoy::extensions::transport_sockets::tls::v3::TlsCertificate* client_cert = client.mutable_common_tls_context()->add_tls_certificates(); client_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir " "}}/test/extensions/transport_sockets/tls/test_data/password_protected_cert.pem")); client_cert->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir " "}}/test/extensions/transport_sockets/tls/test_data/password_protected_key.pem")); client_cert->mutable_password()->set_inline_string( TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( "{{ test_rundir " "}}/test/extensions/transport_sockets/tls/test_data/password_protected_password.txt"))); TestUtilOptionsV2 test_options(listener, client, true, GetParam()); testUtilV2(test_options.setExpectedClientCertUri("spiffe://lyft.com/test-team") .setExpectedServerCertDigest(TEST_PASSWORD_PROTECTED_CERT_256_HASH)); // Works even with client renegotiation. client.set_allow_renegotiation(true); testUtilV2(test_options); }
0
484,784
static void xennet_maybe_wake_tx(struct netfront_queue *queue) { struct net_device *dev = queue->info->netdev; struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, queue->id); if (unlikely(netif_tx_queue_stopped(dev_queue)) && netfront_tx_slot_available(queue) && likely(netif_running(dev))) netif_tx_wake_queue(netdev_get_tx_queue(dev, queue->id)); }
0
338,170
void WasmBinaryBuilder::visitUnreachable(Unreachable* curr) { BYN_TRACE("zz node: Unreachable\n"); }
0
231,726
virtual bool getDisableMigration() { return true; }
0
223,413
static void do_getucdtype(compiler_common *common) { /* Search the UCD record for the character comes in TMP1. Returns chartype in TMP1 and UCD offset in TMP2. */ DEFINE_COMPILER; #if PCRE2_CODE_UNIT_WIDTH == 32 struct sljit_jump *jump; #endif #if defined SLJIT_DEBUG && SLJIT_DEBUG /* dummy_ucd_record */ const ucd_record *record = GET_UCD(UNASSIGNED_UTF_CHAR); SLJIT_ASSERT(record->script == ucp_Unknown && record->chartype == ucp_Cn && record->gbprop == ucp_gbOther); SLJIT_ASSERT(record->caseset == 0 && record->other_case == 0); #endif SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && sizeof(ucd_record) == 12); sljit_emit_fast_enter(compiler, RETURN_ADDR, 0); #if PCRE2_CODE_UNIT_WIDTH == 32 if (!common->utf) { jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, MAX_UTF_CODE_POINT + 1); OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, UNASSIGNED_UTF_CHAR); JUMPHERE(jump); } #endif OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 1); OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1)); OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT); OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2)); OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1); /* TMP2 is multiplied by 12. Same as (TMP2 << 2) + ((TMP2 << 2) << 1). */ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype)); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 2); OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0); OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 1); OP_SRC(SLJIT_FAST_RETURN, RETURN_ADDR, 0); }
0
430,442
static bool validate_masked(u8 *data, int len) { u8 *mask = data + len; while (len--) if (*data++ & ~*mask++) return false; return true; }
0
247,763
void RWFunction::AssignFrom(const NameValuePairs &source) { AssignFromHelper(this, source) CRYPTOPP_SET_FUNCTION_ENTRY(Modulus) ; }
0
502,697
long SSL_SESSION_get_time(const SSL_SESSION *s) { if (s == NULL) return (0); return (s->time); }
0
222,529
string FunctionLibraryDefinition::UniqueFunctionName(StringPiece prefix) const { tf_shared_lock l(mu_); int index = 0; string name = strings::StrCat(prefix, index); while (function_defs_.find(name) != function_defs_.end()) { ++index; name = strings::StrCat(prefix, index); } return name; }
0
369,271
static int io_buffer_account_pin(struct io_ring_ctx *ctx, struct page **pages, int nr_pages, struct io_mapped_ubuf *imu, struct page **last_hpage) { int i, ret; imu->acct_pages = 0; for (i = 0; i < nr_pages; i++) { if (!PageCompound(pages[i])) { imu->acct_pages++; } else { struct page *hpage; hpage = compound_head(pages[i]); if (hpage == *last_hpage) continue; *last_hpage = hpage; if (headpage_already_acct(ctx, pages, i, hpage)) continue; imu->acct_pages += page_size(hpage) >> PAGE_SHIFT; } } if (!imu->acct_pages) return 0; ret = io_account_mem(ctx, imu->acct_pages); if (ret) imu->acct_pages = 0; return ret;
0
244,206
void sgpd_del_entry(u32 grouping_type, void *entry) { switch (grouping_type) { case GF_ISOM_SAMPLE_GROUP_SYNC: case GF_ISOM_SAMPLE_GROUP_ROLL: case GF_ISOM_SAMPLE_GROUP_PROL: case GF_ISOM_SAMPLE_GROUP_RAP: case GF_ISOM_SAMPLE_GROUP_TELE: case GF_ISOM_SAMPLE_GROUP_SAP: gf_free(entry); return; case GF_ISOM_SAMPLE_GROUP_SEIG: { GF_CENCSampleEncryptionGroupEntry *seig = (GF_CENCSampleEncryptionGroupEntry *)entry; if (seig->key_info) gf_free(seig->key_info); gf_free(entry); } return; case GF_ISOM_SAMPLE_GROUP_OINF: gf_isom_oinf_del_entry(entry); return; case GF_ISOM_SAMPLE_GROUP_LINF: gf_isom_linf_del_entry(entry); return; case GF_ISOM_SAMPLE_GROUP_SPOR: { GF_SubpictureOrderEntry *spor = (GF_SubpictureOrderEntry *)entry; if (spor->subp_track_ref_idx) gf_free(spor->subp_track_ref_idx); gf_free(spor); } return; case GF_ISOM_SAMPLE_GROUP_SULM: { GF_SubpictureLayoutMapEntry *sulm = (GF_SubpictureLayoutMapEntry *) entry; if (sulm->groupIDs) gf_free(sulm->groupIDs); gf_free(sulm); return; } default: { GF_DefaultSampleGroupDescriptionEntry *ptr = (GF_DefaultSampleGroupDescriptionEntry *)entry; if (ptr->data) gf_free(ptr->data); gf_free(ptr); } } }
0
318,093
static int rsi_usb_load_data_master_write(struct rsi_hw *adapter, u32 base_address, u32 instructions_sz, u16 block_size, u8 *ta_firmware) { u16 num_blocks; u32 cur_indx, i; u8 temp_buf[256]; int status; num_blocks = instructions_sz / block_size; rsi_dbg(INFO_ZONE, "num_blocks: %d\n", num_blocks); for (cur_indx = 0, i = 0; i < num_blocks; i++, cur_indx += block_size) { memcpy(temp_buf, ta_firmware + cur_indx, block_size); status = rsi_usb_write_register_multiple(adapter, base_address, (u8 *)(temp_buf), block_size); if (status < 0) return status; rsi_dbg(INFO_ZONE, "%s: loading block: %d\n", __func__, i); base_address += block_size; } if (instructions_sz % block_size) { memset(temp_buf, 0, block_size); memcpy(temp_buf, ta_firmware + cur_indx, instructions_sz % block_size); status = rsi_usb_write_register_multiple (adapter, base_address, (u8 *)temp_buf, instructions_sz % block_size); if (status < 0) return status; rsi_dbg(INFO_ZONE, "Written Last Block in Address 0x%x Successfully\n", cur_indx); } return 0; }
0