idx
int64
func
string
target
int64
404,742
unsigned long __fdget_pos(unsigned int fd) { unsigned long v = __fdget(fd); struct file *file = (struct file *)(v & ~3); if (file && (file->f_mode & FMODE_ATOMIC_POS)) { if (file_count(file) > 1) { v |= FDPUT_POS_UNLOCK; mutex_lock(&file->f_pos_lock); } } return v; }
0
204,115
issuerAndThisUpdateCheck( struct berval *in, struct berval *is, struct berval *tu, void *ctx ) { int numdquotes = 0; struct berval x = *in; struct berval ni = BER_BVNULL; /* Parse GSER format */ enum { HAVE_NONE = 0x0, HAVE_ISSUER = 0x1, HAVE_THISUPDATE = 0x2, HAVE_ALL = ( HAVE_ISSUER | HAVE_THISUPDATE ) } have = HAVE_NONE; if ( in->bv_len < STRLENOF( "{issuer \"\",thisUpdate \"YYMMDDhhmmssZ\"}" ) ) return LDAP_INVALID_SYNTAX; if ( in->bv_val[0] != '{' || in->bv_val[in->bv_len-1] != '}' ) { return LDAP_INVALID_SYNTAX; } x.bv_val++; x.bv_len -= STRLENOF("{}"); do { /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } /* should be at issuer or thisUpdate */ if ( strncasecmp( x.bv_val, "issuer", STRLENOF("issuer") ) == 0 ) { if ( have & HAVE_ISSUER ) return LDAP_INVALID_SYNTAX; /* parse issuer */ x.bv_val += STRLENOF("issuer"); x.bv_len -= STRLENOF("issuer"); if ( x.bv_val[0] != ' ' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } /* For backward compatibility, this part is optional */ if ( strncasecmp( x.bv_val, "rdnSequence:", STRLENOF("rdnSequence:") ) != 0 ) { return LDAP_INVALID_SYNTAX; } x.bv_val += STRLENOF("rdnSequence:"); x.bv_len -= STRLENOF("rdnSequence:"); if ( x.bv_val[0] != '"' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; is->bv_val = x.bv_val; is->bv_len = 0; for ( ; is->bv_len < x.bv_len; ) { if ( is->bv_val[is->bv_len] != '"' ) { is->bv_len++; continue; } if ( is->bv_val[is->bv_len+1] == '"' ) { /* double dquote */ numdquotes++; is->bv_len += 2; continue; } break; } x.bv_val += is->bv_len + 1; x.bv_len -= is->bv_len + 1; have |= HAVE_ISSUER; } else if ( strncasecmp( x.bv_val, "thisUpdate", STRLENOF("thisUpdate") ) == 0 ) { if ( have & HAVE_THISUPDATE ) return LDAP_INVALID_SYNTAX; /* parse thisUpdate */ x.bv_val += STRLENOF("thisUpdate"); x.bv_len -= STRLENOF("thisUpdate"); if ( x.bv_val[0] != ' ' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( !x.bv_len || x.bv_val[0] != '"' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; tu->bv_val = x.bv_val; tu->bv_len = 0; for ( ; tu->bv_len < x.bv_len; tu->bv_len++ ) { if ( tu->bv_val[tu->bv_len] == '"' ) { break; } } x.bv_val += tu->bv_len + 1; x.bv_len -= tu->bv_len + 1; have |= HAVE_THISUPDATE; } else { return LDAP_INVALID_SYNTAX; } /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( have == HAVE_ALL ) { break; } if ( x.bv_val[0] != ',' ) { return LDAP_INVALID_SYNTAX; } x.bv_val++; x.bv_len--; } while ( 1 ); /* should have no characters left... */ if ( x.bv_len ) return LDAP_INVALID_SYNTAX; if ( numdquotes == 0 ) { ber_dupbv_x( &ni, is, ctx ); } else { ber_len_t src, dst; ni.bv_len = is->bv_len - numdquotes; ni.bv_val = slap_sl_malloc( ni.bv_len + 1, ctx ); for ( src = 0, dst = 0; src < is->bv_len; src++, dst++ ) { if ( is->bv_val[src] == '"' ) { src++; } ni.bv_val[dst] = is->bv_val[src]; } ni.bv_val[dst] = '\0'; } *is = ni; return 0; }
1
219,016
bool ConstantFolding::SimplifyReshape(const GraphProperties& properties, bool use_shape_info, NodeDef* node) { if (!use_shape_info || node->attr().count("T") == 0 || !IsSimplifiableReshape(*node, properties).ok()) { return false; } DataType output_type = node->attr().at("T").type(); node->set_op("Identity"); EraseRegularNodeAttributes(node); (*node->mutable_attr())["T"].set_type(output_type); *node->mutable_input(1) = AsControlDependency(node->input(1)); return true; }
0
333,048
nfa_regexec_nl( regmatch_T *rmp, char_u *line, // string to match against colnr_T col, // column to start looking for match int line_lbr) { rex.reg_match = rmp; rex.reg_mmatch = NULL; rex.reg_maxline = 0; rex.reg_line_lbr = line_lbr; rex.reg_buf = curbuf; rex.reg_win = NULL; rex.reg_ic = rmp->rm_ic; rex.reg_icombine = FALSE; rex.reg_maxcol = 0; return nfa_regexec_both(line, col, NULL, NULL); }
0
514,316
void Multiupdate_prelocking_strategy::reset(THD *thd) { done= false; has_prelocking_list= thd->lex->requires_prelocking(); }
0
282,884
static int rsi_load_radio_caps(struct rsi_common *common) { struct rsi_radio_caps *radio_caps; struct rsi_hw *adapter = common->priv; u16 inx = 0; u8 ii; u8 radio_id = 0; u16 gc[20] = {0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0}; struct sk_buff *skb; u16 frame_len = sizeof(struct rsi_radio_caps); rsi_dbg(INFO_ZONE, "%s: Sending rate symbol req frame\n", __func__); skb = dev_alloc_skb(frame_len); if (!skb) { rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", __func__); return -ENOMEM; } memset(skb->data, 0, frame_len); radio_caps = (struct rsi_radio_caps *)skb->data; radio_caps->desc_dword0.frame_type = RADIO_CAPABILITIES; radio_caps->channel_num = common->channel; radio_caps->rf_model = RSI_RF_TYPE; radio_caps->radio_cfg_info = RSI_LMAC_CLOCK_80MHZ; if (common->channel_width == BW_40MHZ) { radio_caps->radio_cfg_info |= RSI_ENABLE_40MHZ; if (common->fsm_state == FSM_MAC_INIT_DONE) { struct ieee80211_hw *hw = adapter->hw; struct ieee80211_conf *conf = &hw->conf; if (conf_is_ht40_plus(conf)) { radio_caps->ppe_ack_rate = cpu_to_le16(LOWER_20_ENABLE | (LOWER_20_ENABLE >> 12)); } else if (conf_is_ht40_minus(conf)) { radio_caps->ppe_ack_rate = cpu_to_le16(UPPER_20_ENABLE | (UPPER_20_ENABLE >> 12)); } else { radio_caps->ppe_ack_rate = cpu_to_le16((BW_40MHZ << 12) | FULL40M_ENABLE); } } } radio_caps->radio_info |= radio_id; if (adapter->device_model == RSI_DEV_9116 && common->channel_width == BW_20MHZ) radio_caps->radio_cfg_info &= ~0x3; radio_caps->sifs_tx_11n = cpu_to_le16(SIFS_TX_11N_VALUE); radio_caps->sifs_tx_11b = cpu_to_le16(SIFS_TX_11B_VALUE); radio_caps->slot_rx_11n = cpu_to_le16(SHORT_SLOT_VALUE); radio_caps->ofdm_ack_tout = cpu_to_le16(OFDM_ACK_TOUT_VALUE); radio_caps->cck_ack_tout = cpu_to_le16(CCK_ACK_TOUT_VALUE); radio_caps->preamble_type = cpu_to_le16(LONG_PREAMBLE); for (ii = 0; ii < MAX_HW_QUEUES; ii++) { radio_caps->qos_params[ii].cont_win_min_q = cpu_to_le16(3); radio_caps->qos_params[ii].cont_win_max_q = cpu_to_le16(0x3f); radio_caps->qos_params[ii].aifsn_val_q = cpu_to_le16(2); radio_caps->qos_params[ii].txop_q = 0; } for (ii = 0; ii < NUM_EDCA_QUEUES; ii++) { if (common->edca_params[ii].cw_max > 0) { radio_caps->qos_params[ii].cont_win_min_q = cpu_to_le16(common->edca_params[ii].cw_min); radio_caps->qos_params[ii].cont_win_max_q = cpu_to_le16(common->edca_params[ii].cw_max); radio_caps->qos_params[ii].aifsn_val_q = cpu_to_le16(common->edca_params[ii].aifs << 8); radio_caps->qos_params[ii].txop_q = cpu_to_le16(common->edca_params[ii].txop); } } radio_caps->qos_params[BROADCAST_HW_Q].txop_q = cpu_to_le16(0xffff); radio_caps->qos_params[MGMT_HW_Q].txop_q = 0; radio_caps->qos_params[BEACON_HW_Q].txop_q = cpu_to_le16(0xffff); memcpy(&common->rate_pwr[0], &gc[0], 40); for (ii = 0; ii < 20; ii++) radio_caps->gcpd_per_rate[inx++] = cpu_to_le16(common->rate_pwr[ii] & 0x00FF); rsi_set_len_qno(&radio_caps->desc_dword0.len_qno, (frame_len - FRAME_DESC_SZ), RSI_WIFI_MGMT_Q); skb_put(skb, frame_len); return rsi_send_internal_mgmt_frame(common, skb); }
0
225,117
string SummarizeOpDef(const OpDef& op_def) { string ret = strings::StrCat("Op<name=", op_def.name()); strings::StrAppend(&ret, "; signature=", SummarizeArgs(op_def.input_arg()), " -> ", SummarizeArgs(op_def.output_arg())); for (int i = 0; i < op_def.attr_size(); ++i) { strings::StrAppend(&ret, "; attr=", op_def.attr(i).name(), ":", op_def.attr(i).type()); if (op_def.attr(i).has_default_value()) { strings::StrAppend(&ret, ",default=", SummarizeAttrValue(op_def.attr(i).default_value())); } if (op_def.attr(i).has_minimum()) { strings::StrAppend(&ret, ",min=", op_def.attr(i).minimum()); } if (op_def.attr(i).has_allowed_values()) { strings::StrAppend(&ret, ",allowed=", SummarizeAttrValue(op_def.attr(i).allowed_values())); } } if (op_def.is_commutative()) { strings::StrAppend(&ret, "; is_commutative=true"); } if (op_def.is_aggregate()) { strings::StrAppend(&ret, "; is_aggregate=true"); } if (op_def.is_stateful()) { strings::StrAppend(&ret, "; is_stateful=true"); } if (op_def.allows_uninitialized_input()) { strings::StrAppend(&ret, "; allows_uninitialized_input=true"); } if (op_def.is_distributed_communication()) { strings::StrAppend(&ret, "; is_distributed_communication=true"); } strings::StrAppend(&ret, ">"); return ret; }
0
293,754
static void handle_data_sections(RBinSection *sect) { if (strstr (sect->name, "_cstring")) { sect->is_data = true; } else if (strstr (sect->name, "_os_log")) { sect->is_data = true; } else if (strstr (sect->name, "_objc_methname")) { sect->is_data = true; } else if (strstr (sect->name, "_objc_classname")) { sect->is_data = true; } else if (strstr (sect->name, "_objc_methtype")) { sect->is_data = true; } }
0
226,365
GF_Err strk_box_write(GF_Box *s, GF_BitStream *bs) { return gf_isom_box_write_header(s, bs);
0
276,914
static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { uint chip; ulong addr; uint alen; uchar byte; uint count; int ret; #if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; #endif if ((argc < 4) || (argc > 5)) return CMD_RET_USAGE; /* * Chip is always specified. */ chip = hextoul(argv[1], NULL); /* * Address is always specified. */ addr = hextoul(argv[2], NULL); alen = get_alen(argv[2], DEFAULT_ADDR_LEN); if (alen > 3) return CMD_RET_USAGE; #if CONFIG_IS_ENABLED(DM_I2C) ret = i2c_get_cur_bus_chip(chip, &dev); if (!ret && alen != -1) ret = i2c_set_chip_offset_len(dev, alen); if (ret) return i2c_report_err(ret, I2C_ERR_WRITE); #endif /* * Value to write is always specified. */ byte = hextoul(argv[3], NULL); /* * Optional count */ if (argc == 5) count = hextoul(argv[4], NULL); else count = 1; while (count-- > 0) { #if CONFIG_IS_ENABLED(DM_I2C) ret = dm_i2c_write(dev, addr++, &byte, 1); #else ret = i2c_write(chip, addr++, alen, &byte, 1); #endif if (ret) return i2c_report_err(ret, I2C_ERR_WRITE); /* * Wait for the write to complete. The write can take * up to 10mSec (we allow a little more time). */ /* * No write delay with FRAM devices. */ #if !defined(CONFIG_SYS_I2C_FRAM) udelay(11000); #endif } return 0; }
0
386,597
void DL_Dxf::writeControlPoint(DL_WriterA& dw, const DL_ControlPointData& data) { dw.dxfReal(10, data.x); dw.dxfReal(20, data.y); dw.dxfReal(30, data.z); }
0
242,950
void mbedtls_ssl_recv_flight_completed( mbedtls_ssl_context *ssl ) { /* We won't need to resend that one any more */ mbedtls_ssl_flight_free( ssl->handshake->flight ); ssl->handshake->flight = NULL; ssl->handshake->cur_msg = NULL; /* The next incoming flight will start with this msg_seq */ ssl->handshake->in_flight_start_seq = ssl->handshake->in_msg_seq; /* We don't want to remember CCS's across flight boundaries. */ ssl->handshake->buffering.seen_ccs = 0; /* Clear future message buffering structure. */ mbedtls_ssl_buffering_free( ssl ); /* Cancel timer */ mbedtls_ssl_set_timer( ssl, 0 ); if( ssl->in_msgtype == MBEDTLS_SSL_MSG_HANDSHAKE && ssl->in_msg[0] == MBEDTLS_SSL_HS_FINISHED ) { ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_FINISHED; } else ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_PREPARING; }
0
369,413
__must_hold(&ctx->completion_lock) __must_hold(&ctx->timeout_lock) { struct io_kiocb *req = io_timeout_extract(ctx, user_data); if (IS_ERR(req)) return PTR_ERR(req); io_req_task_queue_fail(req, -ECANCELED); return 0;
0
206,262
parse_command_modifiers( exarg_T *eap, char **errormsg, cmdmod_T *cmod, int skip_only) { char_u *orig_cmd = eap->cmd; char_u *cmd_start = NULL; int use_plus_cmd = FALSE; int starts_with_colon = FALSE; int vim9script = in_vim9script(); int has_visual_range = FALSE; CLEAR_POINTER(cmod); cmod->cmod_flags = sticky_cmdmod_flags; if (STRNCMP(eap->cmd, "'<,'>", 5) == 0) { // The automatically inserted Visual area range is skipped, so that // typing ":cmdmod cmd" in Visual mode works without having to move the // range to after the modififiers. The command will be // "'<,'>cmdmod cmd", parse "cmdmod cmd" and then put back "'<,'>" // before "cmd" below. eap->cmd += 5; cmd_start = eap->cmd; has_visual_range = TRUE; } // Repeat until no more command modifiers are found. for (;;) { char_u *p; while (*eap->cmd == ' ' || *eap->cmd == '\t' || *eap->cmd == ':') { if (*eap->cmd == ':') starts_with_colon = TRUE; ++eap->cmd; } // in ex mode, an empty command (after modifiers) works like :+ if (*eap->cmd == NUL && exmode_active && (getline_equal(eap->getline, eap->cookie, getexmodeline) || getline_equal(eap->getline, eap->cookie, getexline)) && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { use_plus_cmd = TRUE; if (!skip_only) ex_pressedreturn = TRUE; break; // no modifiers following } // ignore comment and empty lines if (comment_start(eap->cmd, starts_with_colon)) { // a comment ends at a NL if (eap->nextcmd == NULL) { eap->nextcmd = vim_strchr(eap->cmd, '\n'); if (eap->nextcmd != NULL) ++eap->nextcmd; } if (vim9script && has_cmdmod(cmod, FALSE)) *errormsg = _(e_command_modifier_without_command); return FAIL; } if (*eap->cmd == NUL) { if (!skip_only) { ex_pressedreturn = TRUE; if (vim9script && has_cmdmod(cmod, FALSE)) *errormsg = _(e_command_modifier_without_command); } return FAIL; } p = skip_range(eap->cmd, TRUE, NULL); // In Vim9 script a variable can shadow a command modifier: // verbose = 123 // verbose += 123 // silent! verbose = func() // verbose.member = 2 // verbose[expr] = 2 // But not: // verbose [a, b] = list if (vim9script) { char_u *s, *n; for (s = eap->cmd; ASCII_ISALPHA(*s); ++s) ; n = skipwhite(s); if (*n == '.' || *n == '=' || (*n != NUL && n[1] == '=') || *s == '[') break; } switch (*p) { // When adding an entry, also modify cmd_exists(). case 'a': if (!checkforcmd_noparen(&eap->cmd, "aboveleft", 3)) break; cmod->cmod_split |= WSP_ABOVE; continue; case 'b': if (checkforcmd_noparen(&eap->cmd, "belowright", 3)) { cmod->cmod_split |= WSP_BELOW; continue; } if (checkforcmd_opt(&eap->cmd, "browse", 3, TRUE)) { #ifdef FEAT_BROWSE_CMD cmod->cmod_flags |= CMOD_BROWSE; #endif continue; } if (!checkforcmd_noparen(&eap->cmd, "botright", 2)) break; cmod->cmod_split |= WSP_BOT; continue; case 'c': if (!checkforcmd_opt(&eap->cmd, "confirm", 4, TRUE)) break; #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) cmod->cmod_flags |= CMOD_CONFIRM; #endif continue; case 'k': if (checkforcmd_noparen(&eap->cmd, "keepmarks", 3)) { cmod->cmod_flags |= CMOD_KEEPMARKS; continue; } if (checkforcmd_noparen(&eap->cmd, "keepalt", 5)) { cmod->cmod_flags |= CMOD_KEEPALT; continue; } if (checkforcmd_noparen(&eap->cmd, "keeppatterns", 5)) { cmod->cmod_flags |= CMOD_KEEPPATTERNS; continue; } if (!checkforcmd_noparen(&eap->cmd, "keepjumps", 5)) break; cmod->cmod_flags |= CMOD_KEEPJUMPS; continue; case 'f': // only accept ":filter {pat} cmd" { char_u *reg_pat; char_u *nulp = NULL; int c = 0; if (!checkforcmd_noparen(&p, "filter", 4) || *p == NUL || (ends_excmd(*p) #ifdef FEAT_EVAL // in ":filter #pat# cmd" # does not // start a comment && (!vim9script || VIM_ISWHITE(p[1])) #endif )) break; if (*p == '!') { cmod->cmod_filter_force = TRUE; p = skipwhite(p + 1); if (*p == NUL || ends_excmd(*p)) break; } #ifdef FEAT_EVAL // Avoid that "filter(arg)" is recognized. if (vim9script && !VIM_ISWHITE(p[-1])) break; #endif if (skip_only) p = skip_vimgrep_pat(p, NULL, NULL); else // NOTE: This puts a NUL after the pattern. p = skip_vimgrep_pat_ext(p, &reg_pat, NULL, &nulp, &c); if (p == NULL || *p == NUL) break; if (!skip_only) { cmod->cmod_filter_regmatch.regprog = vim_regcomp(reg_pat, RE_MAGIC); if (cmod->cmod_filter_regmatch.regprog == NULL) break; // restore the character overwritten by NUL if (nulp != NULL) *nulp = c; } eap->cmd = p; continue; } // ":hide" and ":hide | cmd" are not modifiers case 'h': if (p != eap->cmd || !checkforcmd_noparen(&p, "hide", 3) || *p == NUL || ends_excmd(*p)) break; eap->cmd = p; cmod->cmod_flags |= CMOD_HIDE; continue; case 'l': if (checkforcmd_noparen(&eap->cmd, "lockmarks", 3)) { cmod->cmod_flags |= CMOD_LOCKMARKS; continue; } if (checkforcmd_noparen(&eap->cmd, "legacy", 3)) { if (ends_excmd2(p, eap->cmd)) { *errormsg = _(e_legacy_must_be_followed_by_command); return FAIL; } cmod->cmod_flags |= CMOD_LEGACY; continue; } if (!checkforcmd_noparen(&eap->cmd, "leftabove", 5)) break; cmod->cmod_split |= WSP_ABOVE; continue; case 'n': if (checkforcmd_noparen(&eap->cmd, "noautocmd", 3)) { cmod->cmod_flags |= CMOD_NOAUTOCMD; continue; } if (!checkforcmd_noparen(&eap->cmd, "noswapfile", 3)) break; cmod->cmod_flags |= CMOD_NOSWAPFILE; continue; case 'r': if (!checkforcmd_noparen(&eap->cmd, "rightbelow", 6)) break; cmod->cmod_split |= WSP_BELOW; continue; case 's': if (checkforcmd_noparen(&eap->cmd, "sandbox", 3)) { cmod->cmod_flags |= CMOD_SANDBOX; continue; } if (!checkforcmd_noparen(&eap->cmd, "silent", 3)) break; cmod->cmod_flags |= CMOD_SILENT; if (*eap->cmd == '!' && !VIM_ISWHITE(eap->cmd[-1])) { // ":silent!", but not "silent !cmd" eap->cmd = skipwhite(eap->cmd + 1); cmod->cmod_flags |= CMOD_ERRSILENT; } continue; case 't': if (checkforcmd_noparen(&p, "tab", 3)) { if (!skip_only) { long tabnr = get_address(eap, &eap->cmd, ADDR_TABS, eap->skip, skip_only, FALSE, 1); if (tabnr == MAXLNUM) cmod->cmod_tab = tabpage_index(curtab) + 1; else { if (tabnr < 0 || tabnr > LAST_TAB_NR) { *errormsg = _(e_invalid_range); return FAIL; } cmod->cmod_tab = tabnr + 1; } } eap->cmd = p; continue; } if (!checkforcmd_noparen(&eap->cmd, "topleft", 2)) break; cmod->cmod_split |= WSP_TOP; continue; case 'u': if (!checkforcmd_noparen(&eap->cmd, "unsilent", 3)) break; cmod->cmod_flags |= CMOD_UNSILENT; continue; case 'v': if (checkforcmd_noparen(&eap->cmd, "vertical", 4)) { cmod->cmod_split |= WSP_VERT; continue; } if (checkforcmd_noparen(&eap->cmd, "vim9cmd", 4)) { if (ends_excmd2(p, eap->cmd)) { *errormsg = _(e_vim9cmd_must_be_followed_by_command); return FAIL; } cmod->cmod_flags |= CMOD_VIM9CMD; continue; } if (!checkforcmd_noparen(&p, "verbose", 4)) break; if (vim_isdigit(*eap->cmd)) { // zero means not set, one is verbose == 0, etc. cmod->cmod_verbose = atoi((char *)eap->cmd) + 1; } else cmod->cmod_verbose = 2; // default: verbose == 1 eap->cmd = p; continue; } break; } if (has_visual_range) { if (eap->cmd > cmd_start) { // Move the '<,'> range to after the modifiers and insert a colon. // Since the modifiers have been parsed put the colon on top of the // space: "'<,'>mod cmd" -> "mod:'<,'>cmd // Put eap->cmd after the colon. if (use_plus_cmd) { size_t len = STRLEN(cmd_start); // Special case: empty command uses "+": // "'<,'>mods" -> "mods'<,'>+ mch_memmove(orig_cmd, cmd_start, len); STRCPY(orig_cmd + len, "'<,'>+"); } else { mch_memmove(cmd_start - 5, cmd_start, eap->cmd - cmd_start); eap->cmd -= 5; mch_memmove(eap->cmd - 1, ":'<,'>", 6); } } else // No modifiers, move the pointer back. // Special case: change empty command to "+". if (use_plus_cmd) eap->cmd = (char_u *)"'<,'>+"; else eap->cmd = orig_cmd; } else if (use_plus_cmd) eap->cmd = (char_u *)"+"; return OK; }
1
437,002
static void mcba_usb_process_rx(struct mcba_priv *priv, struct mcba_usb_msg *msg) { switch (msg->cmd_id) { case MBCA_CMD_I_AM_ALIVE_FROM_CAN: mcba_usb_process_ka_can(priv, (struct mcba_usb_msg_ka_can *)msg); break; case MBCA_CMD_I_AM_ALIVE_FROM_USB: mcba_usb_process_ka_usb(priv, (struct mcba_usb_msg_ka_usb *)msg); break; case MBCA_CMD_RECEIVE_MESSAGE: mcba_usb_process_can(priv, (struct mcba_usb_msg_can *)msg); break; case MBCA_CMD_NOTHING_TO_SEND: /* Side effect of communication between PIC_USB and PIC_CAN. * PIC_CAN is telling us that it has nothing to send */ break; case MBCA_CMD_TRANSMIT_MESSAGE_RSP: /* Transmission response from the device containing timestamp */ break; default: netdev_warn(priv->netdev, "Unsupported msg (0x%X)", msg->cmd_id); break; } }
0
208,107
static int xfrm_expand_policies(const struct flowi *fl, u16 family, struct xfrm_policy **pols, int *num_pols, int *num_xfrms) { int i; if (*num_pols == 0 || !pols[0]) { *num_pols = 0; *num_xfrms = 0; return 0; } if (IS_ERR(pols[0])) return PTR_ERR(pols[0]); *num_xfrms = pols[0]->xfrm_nr; #ifdef CONFIG_XFRM_SUB_POLICY if (pols[0]->action == XFRM_POLICY_ALLOW && pols[0]->type != XFRM_POLICY_TYPE_MAIN) { pols[1] = xfrm_policy_lookup_bytype(xp_net(pols[0]), XFRM_POLICY_TYPE_MAIN, fl, family, XFRM_POLICY_OUT, pols[0]->if_id); if (pols[1]) { if (IS_ERR(pols[1])) { xfrm_pols_put(pols, *num_pols); return PTR_ERR(pols[1]); } (*num_pols)++; (*num_xfrms) += pols[1]->xfrm_nr; } } #endif for (i = 0; i < *num_pols; i++) { if (pols[i]->action != XFRM_POLICY_ALLOW) { *num_xfrms = -1; break; } } return 0; }
1
398,501
static int expand_info(RzBinDwarfDebugInfo *info) { rz_return_val_if_fail(info && info->capacity == info->count, -1); RzBinDwarfCompUnit *tmp = realloc(info->comp_units, info->capacity * 2 * sizeof(RzBinDwarfCompUnit)); if (!tmp) { return -1; } memset((ut8 *)tmp + info->capacity * sizeof(RzBinDwarfCompUnit), 0, info->capacity * sizeof(RzBinDwarfCompUnit)); info->comp_units = tmp; info->capacity *= 2; return 0; }
0
261,411
static int decode_log2_res_scale_abs_plus1(thread_context* tctx, int cIdxMinus1) { //const int context = (cIdx==0) ? 0 : 1; logtrace(LogSlice,"# log2_res_scale_abs_plus1 (c=%d)\n",cIdxMinus1); int value = 0; int cMax = 4; for (int binIdx=0;binIdx<cMax;binIdx++) { int ctxIdxInc = 4*cIdxMinus1 + binIdx; int bit = decode_CABAC_bit(&tctx->cabac_decoder, &tctx->ctx_model[CONTEXT_MODEL_LOG2_RES_SCALE_ABS_PLUS1+ctxIdxInc]); if (!bit) break; value++; } logtrace(LogSymbols,"$1 log2_res_scale_abs_plus1=%d\n",value); return value; }
0
238,553
static int check_stack_range_initialized( struct bpf_verifier_env *env, int regno, int off, int access_size, bool zero_size_allowed, enum stack_access_src type, struct bpf_call_arg_meta *meta) { struct bpf_reg_state *reg = reg_state(env, regno); struct bpf_func_state *state = func(env, reg); int err, min_off, max_off, i, j, slot, spi; char *err_extra = type == ACCESS_HELPER ? " indirect" : ""; enum bpf_access_type bounds_check_type; /* Some accesses can write anything into the stack, others are * read-only. */ bool clobber = false; if (access_size == 0 && !zero_size_allowed) { verbose(env, "invalid zero-sized read\n"); return -EACCES; } if (type == ACCESS_HELPER) { /* The bounds checks for writes are more permissive than for * reads. However, if raw_mode is not set, we'll do extra * checks below. */ bounds_check_type = BPF_WRITE; clobber = true; } else { bounds_check_type = BPF_READ; } err = check_stack_access_within_bounds(env, regno, off, access_size, type, bounds_check_type); if (err) return err; if (tnum_is_const(reg->var_off)) { min_off = max_off = reg->var_off.value + off; } else { /* Variable offset is prohibited for unprivileged mode for * simplicity since it requires corresponding support in * Spectre masking for stack ALU. * See also retrieve_ptr_limit(). */ if (!env->bypass_spec_v1) { char tn_buf[48]; tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); verbose(env, "R%d%s variable offset stack access prohibited for !root, var_off=%s\n", regno, err_extra, tn_buf); return -EACCES; } /* Only initialized buffer on stack is allowed to be accessed * with variable offset. With uninitialized buffer it's hard to * guarantee that whole memory is marked as initialized on * helper return since specific bounds are unknown what may * cause uninitialized stack leaking. */ if (meta && meta->raw_mode) meta = NULL; min_off = reg->smin_value + off; max_off = reg->smax_value + off; } if (meta && meta->raw_mode) { meta->access_size = access_size; meta->regno = regno; return 0; } for (i = min_off; i < max_off + access_size; i++) { u8 *stype; slot = -i - 1; spi = slot / BPF_REG_SIZE; if (state->allocated_stack <= slot) goto err; stype = &state->stack[spi].slot_type[slot % BPF_REG_SIZE]; if (*stype == STACK_MISC) goto mark; if (*stype == STACK_ZERO) { if (clobber) { /* helper can write anything into the stack */ *stype = STACK_MISC; } goto mark; } if (is_spilled_reg(&state->stack[spi]) && state->stack[spi].spilled_ptr.type == PTR_TO_BTF_ID) goto mark; if (is_spilled_reg(&state->stack[spi]) && (state->stack[spi].spilled_ptr.type == SCALAR_VALUE || env->allow_ptr_leaks)) { if (clobber) { __mark_reg_unknown(env, &state->stack[spi].spilled_ptr); for (j = 0; j < BPF_REG_SIZE; j++) scrub_spilled_slot(&state->stack[spi].slot_type[j]); } goto mark; } err: if (tnum_is_const(reg->var_off)) { verbose(env, "invalid%s read from stack R%d off %d+%d size %d\n", err_extra, regno, min_off, i - min_off, access_size); } else { char tn_buf[48]; tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off); verbose(env, "invalid%s read from stack R%d var_off %s+%d size %d\n", err_extra, regno, tn_buf, i - min_off, access_size); } return -EACCES; mark: /* reading any byte out of 8-byte 'spill_slot' will cause * the whole slot to be marked as 'read' */ mark_reg_read(env, &state->stack[spi].spilled_ptr, state->stack[spi].spilled_ptr.parent, REG_LIVE_READ64); } return update_stack_depth(env, state, min_off); }
0
359,623
DEFUN (bgp_redistribute_ipv6_rmap, bgp_redistribute_ipv6_rmap_cmd, "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", "Redistribute information from another routing protocol\n" "Connected\n" "Kernel routes\n" "Open Shurtest Path First (OSPFv3)\n" "Routing Information Protocol (RIPng)\n" "Static routes\n" "Route map reference\n" "Pointer to route-map entries\n") { int type; type = bgp_str2route_type (AFI_IP6, argv[0]); if (! type) { vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); return CMD_WARNING; } bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); return bgp_redistribute_set (vty->index, AFI_IP6, type); }
0
473,815
st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg) { st_table_entry *ptr, **last, *tmp; enum st_retval retval; st_index_t i; if (table->entries_packed) { for (i = 0; i < table->num_entries; i++) { st_index_t j; st_data_t key, val; key = (st_data_t)table->bins[i*2]; val = (st_data_t)table->bins[i*2+1]; retval = (*func)(key, val, arg); if (!table->entries_packed) goto unpacked; switch (retval) { case ST_CHECK: /* check if hash is modified during iteration */ for (j = 0; j < table->num_entries; j++) { if ((st_data_t)table->bins[j*2] == key) break; } if (j == table->num_entries) { /* call func with error notice */ retval = (*func)(0, 0, arg, 1); return 1; } /* fall through */ case ST_CONTINUE: break; case ST_STOP: return 0; case ST_DELETE: table->num_entries--; memmove(&table->bins[i*2], &table->bins[(i+1)*2], sizeof(struct st_table_entry*) * 2*(table->num_entries-i)); i--; break; } } return 0; unpacked: ptr = table->head; while (i-- > 0) { if (!(ptr = ptr->fore)) return 0; } } else { ptr = table->head; } if (ptr != 0) { do { i = ptr->hash % table->num_bins; retval = (*func)(ptr->key, ptr->record, arg); switch (retval) { case ST_CHECK: /* check if hash is modified during iteration */ for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) { if (!tmp) { /* call func with error notice */ retval = (*func)(0, 0, arg, 1); return 1; } } /* fall through */ case ST_CONTINUE: ptr = ptr->fore; break; case ST_STOP: return 0; case ST_DELETE: last = &table->bins[ptr->hash % table->num_bins]; for (; (tmp = *last) != 0; last = &tmp->next) { if (ptr == tmp) { tmp = ptr->fore; *last = ptr->next; REMOVE_ENTRY(table, ptr); free(ptr); if (ptr == tmp) return 0; ptr = tmp; break; } } } } while (ptr && table->head); } return 0; }
0
328,936
static char *convert_string(const char *bytes, ut32 len) { ut32 idx = 0, pos = 0; ut32 str_sz = 32 * len + 1; char *cpy_buffer = len > 0 ? malloc (str_sz) : NULL; if (!cpy_buffer) { return cpy_buffer; } // 4x is the increase from byte to \xHH where HH represents hexed byte memset (cpy_buffer, 0, str_sz); while (idx < len && pos < len) { if (char_must_be_escaped (bytes[idx])) { if (pos + 2 < len) { free (cpy_buffer); return NULL; } sprintf (cpy_buffer + pos, "\\x%02x", bytes[idx]); pos += 4; } else { cpy_buffer[pos] = bytes[idx]; pos++; } idx++; } return cpy_buffer; }
0
436,079
static int io_unregister_iowq_aff(struct io_ring_ctx *ctx) { struct io_uring_task *tctx = current->io_uring; if (!tctx || !tctx->io_wq) return -EINVAL; return io_wq_cpu_affinity(tctx->io_wq, NULL);
0
482,474
cons_macro(const Macro *head, const MacroList *tail) { MacroList *list = malloc(sizeof(MacroList)); list->head = head; list->tail = tail; return list; }
0
195,410
void MakeDataset(OpKernelContext* ctx, DatasetBase** output) override { // Create a new SparseTensorSliceDatasetOp::Dataset, insert it in // the step container, and return it as the output. const Tensor* indices; OP_REQUIRES_OK(ctx, ctx->input("indices", &indices)); const Tensor* values; OP_REQUIRES_OK(ctx, ctx->input("values", &values)); const Tensor* dense_shape; OP_REQUIRES_OK(ctx, ctx->input("dense_shape", &dense_shape)); OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(indices->shape()), errors::InvalidArgument( "Input indices should be a matrix but received shape ", indices->shape().DebugString())); const auto num_indices = indices->NumElements(); const auto num_values = values->NumElements(); if (num_indices == 0 || num_values == 0) { OP_REQUIRES(ctx, num_indices == num_values, errors::InvalidArgument( "If indices or values are empty, the other one must also " "be. Got indices of shape ", indices->shape().DebugString(), " and values of shape ", values->shape().DebugString())); } OP_REQUIRES(ctx, TensorShapeUtils::IsVector(values->shape()), errors::InvalidArgument( "Input values should be a vector but received shape ", indices->shape().DebugString())); OP_REQUIRES(ctx, TensorShapeUtils::IsVector(dense_shape->shape()), errors::InvalidArgument( "Input shape should be a vector but received shape ", dense_shape->shape().DebugString())); // We currently ensure that `sparse_tensor` is ordered in the // batch dimension. // TODO(mrry): Investigate ways to avoid this unconditional check // if we can be sure that the sparse tensor was produced in an // appropriate order (e.g. by `tf.parse_example()` or a Dataset // that batches elements into rows of a SparseTensor). int64_t previous_batch_index = -1; for (int64_t i = 0; i < indices->dim_size(0); ++i) { int64_t next_batch_index = indices->matrix<int64_t>()(i, 0); OP_REQUIRES( ctx, next_batch_index >= previous_batch_index, errors::Unimplemented("The SparseTensor must be ordered in the batch " "dimension; handling arbitrarily ordered input " "is not currently supported.")); previous_batch_index = next_batch_index; } gtl::InlinedVector<int64_t, 8> std_order(dense_shape->NumElements(), 0); sparse::SparseTensor tensor; OP_REQUIRES_OK( ctx, sparse::SparseTensor::Create( *indices, *values, TensorShape(dense_shape->vec<int64_t>()), std_order, &tensor)); *output = new Dataset<T>(ctx, std::move(tensor)); }
1
513,334
best_access_path(JOIN *join, JOIN_TAB *s, table_map remaining_tables, const POSITION *join_positions, uint idx, bool disable_jbuf, double record_count, POSITION *pos, POSITION *loose_scan_pos) { THD *thd= join->thd; uint use_cond_selectivity= thd->variables.optimizer_use_condition_selectivity; KEYUSE *best_key= 0; uint best_max_key_part= 0; my_bool found_constraint= 0; double best= DBL_MAX; double best_time= DBL_MAX; double records= DBL_MAX; table_map best_ref_depends_map= 0; double tmp; ha_rows rec; bool best_uses_jbuf= FALSE; MY_BITMAP *eq_join_set= &s->table->eq_join_set; KEYUSE *hj_start_key= 0; disable_jbuf= disable_jbuf || idx == join->const_tables; Loose_scan_opt loose_scan_opt; DBUG_ENTER("best_access_path"); bitmap_clear_all(eq_join_set); loose_scan_opt.init(join, s, remaining_tables); if (s->keyuse) { /* Use key if possible */ KEYUSE *keyuse; KEYUSE *start_key=0; TABLE *table= s->table; double best_records= DBL_MAX; uint max_key_part=0; /* Test how we can use keys */ rec= s->records/MATCHING_ROWS_IN_OTHER_TABLE; // Assumed records/key for (keyuse=s->keyuse ; keyuse->table == table ;) { KEY *keyinfo; ulong key_flags; uint key_parts; key_part_map found_part= 0; table_map found_ref= 0; uint key= keyuse->key; bool ft_key= (keyuse->keypart == FT_KEYPART); /* Bitmap of keyparts where the ref access is over 'keypart=const': */ key_part_map const_part= 0; /* The or-null keypart in ref-or-null access: */ key_part_map ref_or_null_part= 0; if (is_hash_join_key_no(key)) { /* Hash join as any join employing join buffer can be used to join only those tables that are joined after the first non const table */ if (!(remaining_tables & keyuse->used_tables) && idx > join->const_tables) { if (!hj_start_key) hj_start_key= keyuse; bitmap_set_bit(eq_join_set, keyuse->keypart); } keyuse++; continue; } keyinfo= table->key_info+key; key_parts= table->actual_n_key_parts(keyinfo); key_flags= table->actual_key_flags(keyinfo); /* Calculate how many key segments of the current key we can use */ start_key= keyuse; loose_scan_opt.next_ref_key(); DBUG_PRINT("info", ("Considering ref access on key %s", keyuse->table->key_info[keyuse->key].name)); do /* For each keypart */ { uint keypart= keyuse->keypart; table_map best_part_found_ref= 0; double best_prev_record_reads= DBL_MAX; do /* For each way to access the keypart */ { /* if 1. expression doesn't refer to forward tables 2. we won't get two ref-or-null's */ if (!(remaining_tables & keyuse->used_tables) && s->access_from_tables_is_allowed(keyuse->used_tables, join->sjm_lookup_tables) && !(ref_or_null_part && (keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL))) { found_part|= keyuse->keypart_map; if (!(keyuse->used_tables & ~join->const_table_map)) const_part|= keyuse->keypart_map; double tmp2= prev_record_reads(join_positions, idx, (found_ref | keyuse->used_tables)); if (tmp2 < best_prev_record_reads) { best_part_found_ref= keyuse->used_tables & ~join->const_table_map; best_prev_record_reads= tmp2; } if (rec > keyuse->ref_table_rows) rec= keyuse->ref_table_rows; /* If there is one 'key_column IS NULL' expression, we can use this ref_or_null optimisation of this field */ if (keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL) ref_or_null_part |= keyuse->keypart_map; } loose_scan_opt.add_keyuse(remaining_tables, keyuse); keyuse++; } while (keyuse->table == table && keyuse->key == key && keyuse->keypart == keypart); found_ref|= best_part_found_ref; } while (keyuse->table == table && keyuse->key == key); /* Assume that that each key matches a proportional part of table. */ if (!found_part && !ft_key && !loose_scan_opt.have_a_case()) continue; // Nothing usable found if (rec < MATCHING_ROWS_IN_OTHER_TABLE) rec= MATCHING_ROWS_IN_OTHER_TABLE; // Fix for small tables /* ft-keys require special treatment */ if (ft_key) { /* Really, there should be records=0.0 (yes!) but 1.0 would be probably safer */ tmp= prev_record_reads(join_positions, idx, found_ref); records= 1.0; } else { found_constraint= MY_TEST(found_part); loose_scan_opt.check_ref_access_part1(s, key, start_key, found_part); /* Check if we found full key */ if (found_part == PREV_BITS(uint, key_parts) && !ref_or_null_part) { /* use eq key */ max_key_part= (uint) ~0; if ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME || MY_TEST(key_flags & HA_EXT_NOSAME)) { tmp = prev_record_reads(join_positions, idx, found_ref); records=1.0; } else { if (!found_ref) { /* We found a const key */ /* ReuseRangeEstimateForRef-1: We get here if we've found a ref(const) (c_i are constants): "(keypart1=c1) AND ... AND (keypartN=cN)" [ref_const_cond] If range optimizer was able to construct a "range" access on this index, then its condition "quick_cond" was eqivalent to ref_const_cond (*), and we can re-use E(#rows) from the range optimizer. Proof of (*): By properties of range and ref optimizers quick_cond will be equal or tighther than ref_const_cond. ref_const_cond already covers "smallest" possible interval - a singlepoint interval over all keyparts. Therefore, quick_cond is equivalent to ref_const_cond (if it was an empty interval we wouldn't have got here). */ if (table->quick_keys.is_set(key)) records= (double) table->quick_rows[key]; else { /* quick_range couldn't use key! */ records= (double) s->records/rec; } } else { if (!(records= keyinfo->actual_rec_per_key(key_parts-1))) { /* Prefer longer keys */ records= ((double) s->records / (double) rec * (1.0 + ((double) (table->s->max_key_length-keyinfo->key_length) / (double) table->s->max_key_length))); if (records < 2.0) records=2.0; /* Can't be as good as a unique */ } /* ReuseRangeEstimateForRef-2: We get here if we could not reuse E(#rows) from range optimizer. Make another try: If range optimizer produced E(#rows) for a prefix of the ref access we're considering, and that E(#rows) is lower then our current estimate, make an adjustment. The criteria of when we can make an adjustment is a special case of the criteria used in ReuseRangeEstimateForRef-3. */ if (table->quick_keys.is_set(key) && (const_part & (((key_part_map)1 << table->quick_key_parts[key])-1)) == (((key_part_map)1 << table->quick_key_parts[key])-1) && table->quick_n_ranges[key] == 1 && records > (double) table->quick_rows[key]) { records= (double) table->quick_rows[key]; } } /* Limit the number of matched rows */ tmp= records; set_if_smaller(tmp, (double) thd->variables.max_seeks_for_key); if (table->covering_keys.is_set(key)) tmp= table->file->keyread_time(key, 1, (ha_rows) tmp); else tmp= table->file->read_time(key, 1, (ha_rows) MY_MIN(tmp,s->worst_seeks)); tmp= COST_MULT(tmp, record_count); } } else { /* Use as much key-parts as possible and a uniq key is better than a not unique key Set tmp to (previous record count) * (records / combination) */ if ((found_part & 1) && (!(table->file->index_flags(key, 0, 0) & HA_ONLY_WHOLE_INDEX) || found_part == PREV_BITS(uint,keyinfo->user_defined_key_parts))) { max_key_part= max_part_bit(found_part); /* ReuseRangeEstimateForRef-3: We're now considering a ref[or_null] access via (t.keypart1=e1 AND ... AND t.keypartK=eK) [ OR (same-as-above but with one cond replaced with "t.keypart_i IS NULL")] (**) Try re-using E(#rows) from "range" optimizer: We can do so if "range" optimizer used the same intervals as in (**). The intervals used by range optimizer may be not available at this point (as "range" access might have choosen to create quick select over another index), so we can't compare them to (**). We'll make indirect judgements instead. The sufficient conditions for re-use are: (C1) All e_i in (**) are constants, i.e. found_ref==FALSE. (if this is not satisfied we have no way to know which ranges will be actually scanned by 'ref' until we execute the join) (C2) max #key parts in 'range' access == K == max_key_part (this is apparently a necessary requirement) We also have a property that "range optimizer produces equal or tighter set of scan intervals than ref(const) optimizer". Each of the intervals in (**) are "tightest possible" intervals when one limits itself to using keyparts 1..K (which we do in #2). From here it follows that range access used either one, or both of the (I1) and (I2) intervals: (t.keypart1=c1 AND ... AND t.keypartK=eK) (I1) (same-as-above but with one cond replaced with "t.keypart_i IS NULL") (I2) The remaining part is to exclude the situation where range optimizer used one interval while we're considering ref-or-null and looking for estimate for two intervals. This is done by last limitation: (C3) "range optimizer used (have ref_or_null?2:1) intervals" */ if (table->quick_keys.is_set(key) && !found_ref && //(C1) table->quick_key_parts[key] == max_key_part && //(C2) table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part)) //(C3) { tmp= records= (double) table->quick_rows[key]; } else { /* Check if we have statistic about the distribution */ if ((records= keyinfo->actual_rec_per_key(max_key_part-1))) { /* Fix for the case where the index statistics is too optimistic: If (1) We're considering ref(const) and there is quick select on the same index, (2) and that quick select uses more keyparts (i.e. it will scan equal/smaller interval then this ref(const)) (3) and E(#rows) for quick select is higher then our estimate, Then We'll use E(#rows) from quick select. Q: Why do we choose to use 'ref'? Won't quick select be cheaper in some cases ? TODO: figure this out and adjust the plan choice if needed. */ if (!found_ref && table->quick_keys.is_set(key) && // (1) table->quick_key_parts[key] > max_key_part && // (2) records < (double)table->quick_rows[key]) // (3) records= (double)table->quick_rows[key]; tmp= records; } else { /* Assume that the first key part matches 1% of the file and that the whole key matches 10 (duplicates) or 1 (unique) records. Assume also that more key matches proportionally more records This gives the formula: records = (x * (b-a) + a*c-b)/(c-1) b = records matched by whole key a = records matched by first key part (1% of all records?) c = number of key parts in key x = used key parts (1 <= x <= c) */ double rec_per_key; if (!(rec_per_key=(double) keyinfo->rec_per_key[keyinfo->user_defined_key_parts-1])) rec_per_key=(double) s->records/rec+1; if (!s->records) tmp = 0; else if (rec_per_key/(double) s->records >= 0.01) tmp = rec_per_key; else { double a=s->records*0.01; if (keyinfo->user_defined_key_parts > 1) tmp= (max_key_part * (rec_per_key - a) + a*keyinfo->user_defined_key_parts - rec_per_key)/ (keyinfo->user_defined_key_parts-1); else tmp= a; set_if_bigger(tmp,1.0); } records = (ulong) tmp; } if (ref_or_null_part) { /* We need to do two key searches to find key */ tmp *= 2.0; records *= 2.0; } /* ReuseRangeEstimateForRef-4: We get here if we could not reuse E(#rows) from range optimizer. Make another try: If range optimizer produced E(#rows) for a prefix of the ref access we're considering, and that E(#rows) is lower then our current estimate, make the adjustment. The decision whether we can re-use the estimate from the range optimizer is the same as in ReuseRangeEstimateForRef-3, applied to first table->quick_key_parts[key] key parts. */ if (table->quick_keys.is_set(key) && table->quick_key_parts[key] <= max_key_part && const_part & ((key_part_map)1 << table->quick_key_parts[key]) && table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part & const_part) && records > (double) table->quick_rows[key]) { tmp= records= (double) table->quick_rows[key]; } } /* Limit the number of matched rows */ set_if_smaller(tmp, (double) thd->variables.max_seeks_for_key); if (table->covering_keys.is_set(key)) tmp= table->file->keyread_time(key, 1, (ha_rows) tmp); else tmp= table->file->read_time(key, 1, (ha_rows) MY_MIN(tmp,s->worst_seeks)); tmp= COST_MULT(tmp, record_count); } else tmp= best_time; // Do nothing } tmp= COST_ADD(tmp, s->startup_cost); loose_scan_opt.check_ref_access_part2(key, start_key, records, tmp, found_ref); } /* not ft_key */ if (tmp + 0.0001 < best_time - records/(double) TIME_FOR_COMPARE) { best_time= COST_ADD(tmp, records/(double) TIME_FOR_COMPARE); best= tmp; best_records= records; best_key= start_key; best_max_key_part= max_key_part; best_ref_depends_map= found_ref; } } /* for each key */ records= best_records; } /* If there is no key to access the table, but there is an equi-join predicate connecting the table with the privious tables then we consider the possibility of using hash join. We need also to check that: (1) s is inner table of semi-join -> join cache is allowed for semijoins (2) s is inner table of outer join -> join cache is allowed for outer joins */ if (idx > join->const_tables && best_key == 0 && (join->allowed_join_cache_types & JOIN_CACHE_HASHED_BIT) && join->max_allowed_join_cache_level > 2 && !bitmap_is_clear_all(eq_join_set) && !disable_jbuf && (!s->emb_sj_nest || join->allowed_semijoin_with_cache) && // (1) (!(s->table->map & join->outer_join) || join->allowed_outer_join_with_cache)) // (2) { double join_sel= 0.1; /* Estimate the cost of the hash join access to the table */ double rnd_records= matching_candidates_in_table(s, found_constraint, use_cond_selectivity); tmp= s->quick ? s->quick->read_time : s->scan_time(); double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE; tmp= COST_ADD(tmp, cmp_time); /* We read the table as many times as join buffer becomes full. */ double refills= (1.0 + floor((double) cache_record_length(join,idx) * record_count / (double) thd->variables.join_buff_size)); tmp= COST_MULT(tmp, refills); best_time= COST_ADD(tmp, COST_MULT((record_count*join_sel) / TIME_FOR_COMPARE, rnd_records)); best= tmp; records= rnd_records; best_key= hj_start_key; best_ref_depends_map= 0; best_uses_jbuf= TRUE; } /* Don't test table scan if it can't be better. Prefer key lookup if we would use the same key for scanning. Don't do a table scan on InnoDB tables, if we can read the used parts of the row from any of the used index. This is because table scans uses index and we would not win anything by using a table scan. A word for word translation of the below if-statement in sergefp's understanding: we check if we should use table scan if: (1) The found 'ref' access produces more records than a table scan (or index scan, or quick select), or 'ref' is more expensive than any of them. (2) This doesn't hold: the best way to perform table scan is to to perform 'range' access using index IDX, and the best way to perform 'ref' access is to use the same index IDX, with the same or more key parts. (note: it is not clear how this rule is/should be extended to index_merge quick selects). Also if we have a hash join we prefer that over a table scan (3) See above note about InnoDB. (4) NOT ("FORCE INDEX(...)" is used for table and there is 'ref' access path, but there is no quick select) If the condition in the above brackets holds, then the only possible "table scan" access method is ALL/index (there is no quick select). Since we have a 'ref' access path, and FORCE INDEX instructs us to choose it over ALL/index, there is no need to consider a full table scan. (5) Non-flattenable semi-joins: don't consider doing a scan of temporary table if we had an option to make lookups into it. In real-world cases, lookups are cheaper than full scans, but when the table is small, they can be [considered to be] more expensive, which causes lookups not to be used for cases with small datasets, which is annoying. */ if ((records >= s->found_records || best > s->read_time) && // (1) !(best_key && best_key->key == MAX_KEY) && // (2) !(s->quick && best_key && s->quick->index == best_key->key && // (2) best_max_key_part >= s->table->quick_key_parts[best_key->key]) &&// (2) !((s->table->file->ha_table_flags() & HA_TABLE_SCAN_ON_INDEX) && // (3) ! s->table->covering_keys.is_clear_all() && best_key && !s->quick) &&// (3) !(s->table->force_index && best_key && !s->quick) && // (4) !(best_key && s->table->pos_in_table_list->jtbm_subselect)) // (5) { // Check full join double rnd_records= matching_candidates_in_table(s, found_constraint, use_cond_selectivity); /* Range optimizer never proposes a RANGE if it isn't better than FULL: so if RANGE is present, it's always preferred to FULL. Here we estimate its cost. */ if (s->quick) { /* For each record we: - read record range through 'quick' - skip rows which does not satisfy WHERE constraints TODO: We take into account possible use of join cache for ALL/index access (see first else-branch below), but we don't take it into account here for range/index_merge access. Find out why this is so. */ double cmp_time= (s->found_records - rnd_records)/(double) TIME_FOR_COMPARE; tmp= COST_MULT(record_count, COST_ADD(s->quick->read_time, cmp_time)); loose_scan_opt.check_range_access(join, idx, s->quick); } else { /* Estimate cost of reading table. */ if (s->table->force_index && !best_key) // index scan tmp= s->table->file->read_time(s->ref.key, 1, s->records); else // table scan tmp= s->scan_time(); if ((s->table->map & join->outer_join) || disable_jbuf) // Can't use join cache { /* For each record we have to: - read the whole table record - skip rows which does not satisfy join condition */ double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE; tmp= COST_MULT(record_count, COST_ADD(tmp,cmp_time)); } else { double refills= (1.0 + floor((double) cache_record_length(join,idx) * (record_count / (double) thd->variables.join_buff_size))); tmp= COST_MULT(tmp, refills); /* We don't make full cartesian product between rows in the scanned table and existing records because we skip all rows from the scanned table, which does not satisfy join condition when we read the table (see flush_cached_records for details). Here we take into account cost to read and skip these records. */ double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE; tmp= COST_ADD(tmp, cmp_time); } } tmp += s->startup_cost; /* We estimate the cost of evaluating WHERE clause for found records as record_count * rnd_records / TIME_FOR_COMPARE. This cost plus tmp give us total cost of using TABLE SCAN */ if (best == DBL_MAX || COST_ADD(tmp, record_count/(double) TIME_FOR_COMPARE*rnd_records) < (best_key->is_for_hash_join() ? best_time : COST_ADD(best, record_count/(double) TIME_FOR_COMPARE*records))) { /* If the table has a range (s->quick is set) make_join_select() will ensure that this will be used */ best= tmp; records= rnd_records; best_key= 0; /* range/index_merge/ALL/index access method are "independent", so: */ best_ref_depends_map= 0; best_uses_jbuf= MY_TEST(!disable_jbuf && !((s->table->map & join->outer_join))); } } /* Update the cost information for the current partial plan */ pos->records_read= records; pos->read_time= best; pos->key= best_key; pos->table= s; pos->ref_depend_map= best_ref_depends_map; pos->loosescan_picker.loosescan_key= MAX_KEY; pos->use_join_buffer= best_uses_jbuf; loose_scan_opt.save_to_position(s, loose_scan_pos); if (!best_key && idx == join->const_tables && s->table == join->sort_by_table && join->unit->select_limit_cnt >= records) join->sort_by_table= (TABLE*) 1; // Must use temporary table DBUG_VOID_RETURN; }
0
224,555
Status AvgPool3DGradShape(shape_inference::InferenceContext* c) { ShapeHandle s; TF_RETURN_IF_ERROR(c->MakeShapeFromShapeTensor(0, &s)); TF_RETURN_IF_ERROR(c->WithRank(s, 5, &s)); c->set_output(0, s); return Status::OK(); }
0
488,400
static noinline int do_no_pfn(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *page_table, pmd_t *pmd, int write_access) { spinlock_t *ptl; pte_t entry; unsigned long pfn; pte_unmap(page_table); BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))); BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags)); pfn = vma->vm_ops->nopfn(vma, address & PAGE_MASK); BUG_ON((vma->vm_flags & VM_MIXEDMAP) && pfn_valid(pfn)); if (unlikely(pfn == NOPFN_OOM)) return VM_FAULT_OOM; else if (unlikely(pfn == NOPFN_SIGBUS)) return VM_FAULT_SIGBUS; else if (unlikely(pfn == NOPFN_REFAULT)) return 0; page_table = pte_offset_map_lock(mm, pmd, address, &ptl); /* Only go through if we didn't race with anybody else... */ if (pte_none(*page_table)) { entry = pfn_pte(pfn, vma->vm_page_prot); if (write_access) entry = maybe_mkwrite(pte_mkdirty(entry), vma); set_pte_at(mm, address, page_table, entry); } pte_unmap_unlock(page_table, ptl); return 0; }
0
359,281
zroute_lookup(u_int zroute) { u_int i; if (zroute >= sizeof(route_types)/sizeof(route_types[0])) { zlog_err("unknown zebra route type: %u", zroute); return &unknown; } if (zroute == route_types[zroute].type) return &route_types[zroute]; for (i = 0; i < sizeof(route_types)/sizeof(route_types[0]); i++) { if (zroute == route_types[i].type) { zlog_warn("internal error: route type table out of order " "while searching for %u, please notify developers", zroute); return &route_types[i]; } } zlog_err("internal error: cannot find route type %u in table!", zroute); return &unknown; }
0
247,107
static GF_DownloadManager *gf_fs_get_download_manager(GF_FilterSession *fs) { if (!fs->download_manager) { fs->download_manager = gf_dm_new(fs); gf_dm_set_auth_callback(fs->download_manager, gf_fsess_get_user_pass, fs); } return fs->download_manager; }
0
231,801
virtual void setupClientReadCodec() { FizzCryptoFactory cryptoFactory; clientReadCodec = std::make_unique<QuicReadCodec>(QuicNodeType::Client); clientReadCodec->setClientConnectionId(*clientConnectionId); clientReadCodec->setInitialReadCipher(cryptoFactory.getServerInitialCipher( *initialDestinationConnectionId, QuicVersion::MVFST)); clientReadCodec->setInitialHeaderCipher( cryptoFactory.makeServerInitialHeaderCipher( *initialDestinationConnectionId, QuicVersion::MVFST)); clientReadCodec->setCodecParameters( CodecParameters(kDefaultAckDelayExponent, QuicVersion::MVFST)); }
0
513,062
void Regexp_processor_pcre::pcre_exec_warn(int rc) const { char buf[64]; const char *errmsg= NULL; THD *thd= current_thd; /* Make a descriptive message only for those pcre_exec() error codes that can actually happen in MariaDB. */ switch (rc) { case PCRE_ERROR_NULL: errmsg= "pcre_exec: null argument passed"; break; case PCRE_ERROR_BADOPTION: errmsg= "pcre_exec: bad option"; break; case PCRE_ERROR_BADMAGIC: errmsg= "pcre_exec: bad magic - not a compiled regex"; break; case PCRE_ERROR_UNKNOWN_OPCODE: errmsg= "pcre_exec: error in compiled regex"; break; case PCRE_ERROR_NOMEMORY: errmsg= "pcre_exec: Out of memory"; break; case PCRE_ERROR_NOSUBSTRING: errmsg= "pcre_exec: no substring"; break; case PCRE_ERROR_MATCHLIMIT: errmsg= "pcre_exec: match limit exceeded"; break; case PCRE_ERROR_CALLOUT: errmsg= "pcre_exec: callout error"; break; case PCRE_ERROR_BADUTF8: errmsg= "pcre_exec: Invalid utf8 byte sequence in the subject string"; break; case PCRE_ERROR_BADUTF8_OFFSET: errmsg= "pcre_exec: Started at invalid location within utf8 byte sequence"; break; case PCRE_ERROR_PARTIAL: errmsg= "pcre_exec: partial match"; break; case PCRE_ERROR_INTERNAL: errmsg= "pcre_exec: internal error"; break; case PCRE_ERROR_BADCOUNT: errmsg= "pcre_exec: ovesize is negative"; break; case PCRE_ERROR_RECURSIONLIMIT: my_snprintf(buf, sizeof(buf), "pcre_exec: recursion limit of %ld exceeded", m_pcre_extra.match_limit_recursion); errmsg= buf; break; case PCRE_ERROR_BADNEWLINE: errmsg= "pcre_exec: bad newline options"; break; case PCRE_ERROR_BADOFFSET: errmsg= "pcre_exec: start offset negative or greater than string length"; break; case PCRE_ERROR_SHORTUTF8: errmsg= "pcre_exec: ended in middle of utf8 sequence"; break; case PCRE_ERROR_JIT_STACKLIMIT: errmsg= "pcre_exec: insufficient stack memory for JIT compile"; break; case PCRE_ERROR_RECURSELOOP: errmsg= "pcre_exec: Recursion loop detected"; break; case PCRE_ERROR_BADMODE: errmsg= "pcre_exec: compiled pattern passed to wrong bit library function"; break; case PCRE_ERROR_BADENDIANNESS: errmsg= "pcre_exec: compiled pattern passed to wrong endianness processor"; break; case PCRE_ERROR_JIT_BADOPTION: errmsg= "pcre_exec: bad jit option"; break; case PCRE_ERROR_BADLENGTH: errmsg= "pcre_exec: negative length"; break; default: /* As other error codes should normally not happen, we just report the error code without textual description of the code. */ my_snprintf(buf, sizeof(buf), "pcre_exec: Internal error (%d)", rc); errmsg= buf; } push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_REGEXP_ERROR, ER_THD(thd, ER_REGEXP_ERROR), errmsg); }
0
261,992
void Curl_conncache_close_all_connections(struct conncache *connc) { struct connectdata *conn; char buffer[READBUFFER_MIN + 1]; SIGPIPE_VARIABLE(pipe_st); if(!connc->closure_handle) return; connc->closure_handle->state.buffer = buffer; connc->closure_handle->set.buffer_size = READBUFFER_MIN; conn = conncache_find_first_connection(connc); while(conn) { sigpipe_ignore(connc->closure_handle, &pipe_st); /* This will remove the connection from the cache */ connclose(conn, "kill all"); Curl_conncache_remove_conn(connc->closure_handle, conn, TRUE); Curl_disconnect(connc->closure_handle, conn, FALSE); sigpipe_restore(&pipe_st); conn = conncache_find_first_connection(connc); } connc->closure_handle->state.buffer = NULL; sigpipe_ignore(connc->closure_handle, &pipe_st); Curl_hostcache_clean(connc->closure_handle, connc->closure_handle->dns.hostcache); Curl_close(&connc->closure_handle); sigpipe_restore(&pipe_st); }
0
484,765
static int xennet_rxidx(RING_IDX idx) { return idx & (NET_RX_RING_SIZE - 1); }
0
369,212
static ssize_t __io_iov_buffer_select(struct io_kiocb *req, struct iovec *iov, unsigned int issue_flags) { struct iovec __user *uiov = u64_to_user_ptr(req->rw.addr); void __user *buf; ssize_t len; if (copy_from_user(iov, uiov, sizeof(*uiov))) return -EFAULT; len = iov[0].iov_len; if (len < 0) return -EINVAL; buf = io_rw_buffer_select(req, &len, issue_flags); if (IS_ERR(buf)) return PTR_ERR(buf); iov[0].iov_base = buf; iov[0].iov_len = len; return 0; }
0
500,680
sftp_attributes sftp_fstat(sftp_file file) { sftp_status_message status = NULL; sftp_message msg = NULL; ssh_buffer buffer; uint32_t id; buffer = ssh_buffer_new(); if (buffer == NULL) { ssh_set_error_oom(file->sftp->session); return NULL; } id = sftp_get_new_id(file->sftp); if (buffer_add_u32(buffer, id) < 0 || buffer_add_ssh_string(buffer, file->handle) < 0) { ssh_set_error_oom(file->sftp->session); ssh_buffer_free(buffer); return NULL; } if (sftp_packet_write(file->sftp, SSH_FXP_FSTAT, buffer) < 0) { ssh_buffer_free(buffer); return NULL; } ssh_buffer_free(buffer); while (msg == NULL) { if (sftp_read_and_dispatch(file->sftp) < 0) { return NULL; } msg = sftp_dequeue(file->sftp, id); } if (msg->packet_type == SSH_FXP_ATTRS){ return sftp_parse_attr(file->sftp, msg->payload, 0); } else if (msg->packet_type == SSH_FXP_STATUS) { status = parse_status_msg(msg); sftp_message_free(msg); if (status == NULL) { return NULL; } ssh_set_error(file->sftp->session, SSH_REQUEST_DENIED, "SFTP server: %s", status->errormsg); status_msg_free(status); return NULL; } ssh_set_error(file->sftp->session, SSH_FATAL, "Received msg %d during fstat()", msg->packet_type); sftp_message_free(msg); return NULL; }
0
225,468
bool IsTensorIdRegular(const TensorId& tensor_id) { return tensor_id.index() > Graph::kControlSlot; }
0
473,858
static int backref_match_at_nested_level(regex_t* reg , OnigStackType* top, OnigStackType* stk_base , int ignore_case, int case_fold_flag , int nest, int mem_num, UChar* memp, UChar** s, const UChar* send) { UChar *ss, *p, *pstart, *pend = NULL_UCHARP; int level; OnigStackType* k; level = 0; k = top; k--; while (k >= stk_base) { if (k->type == STK_CALL_FRAME) { level--; } else if (k->type == STK_RETURN) { level++; } else if (level == nest) { if (k->type == STK_MEM_START) { if (mem_is_in_memp(k->u.mem.num, mem_num, memp)) { pstart = k->u.mem.pstr; if (pend != NULL_UCHARP) { if (pend - pstart > send - *s) return 0; /* or goto next_mem; */ p = pstart; ss = *s; if (ignore_case != 0) { if (string_cmp_ic(reg->enc, case_fold_flag, pstart, &ss, (int )(pend - pstart), send) == 0) return 0; /* or goto next_mem; */ } else { while (p < pend) { if (*p++ != *ss++) return 0; /* or goto next_mem; */ } } *s = ss; return 1; } } } else if (k->type == STK_MEM_END) { if (mem_is_in_memp(k->u.mem.num, mem_num, memp)) { pend = k->u.mem.pstr; } } } k--; } return 0; }
0
447,056
size_t RemoteIo::Impl::populateBlocks(size_t lowBlock, size_t highBlock) { assert(isMalloced_); // optimize: ignore all true blocks on left & right sides. while(!blocksMap_[lowBlock].isNone() && lowBlock < highBlock) lowBlock++; while(!blocksMap_[highBlock].isNone() && highBlock > lowBlock) highBlock--; size_t rcount = 0; if (blocksMap_[highBlock].isNone()) { std::string data; getDataByRange( (long) lowBlock, (long) highBlock, data); rcount = (size_t)data.length(); if (rcount == 0) { throw Error(1, "Data By Range is empty. Please check the permission."); } byte* source = (byte*)data.c_str(); size_t remain = rcount, totalRead = 0; size_t iBlock = (rcount == size_) ? 0 : lowBlock; while (remain) { size_t allow = EXV_MIN(remain, blockSize_); blocksMap_[iBlock].populate(&source[totalRead], allow); remain -= allow; totalRead += allow; iBlock++; } } return rcount; }
0
238,428
static bool is_spilled_reg(const struct bpf_stack_state *stack) { return stack->slot_type[BPF_REG_SIZE - 1] == STACK_SPILL; }
0
301,417
static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp) { int result; START_PROFILE(syscall_close); result = fd_close_posix(fsp); END_PROFILE(syscall_close); return result; }
0
261,998
bool Curl_conncache_foreach(struct Curl_easy *data, struct conncache *connc, void *param, int (*func)(struct Curl_easy *data, struct connectdata *conn, void *param)) { struct Curl_hash_iterator iter; struct Curl_llist_element *curr; struct Curl_hash_element *he; if(!connc) return FALSE; CONNCACHE_LOCK(data); Curl_hash_start_iterate(&connc->hash, &iter); he = Curl_hash_next_element(&iter); while(he) { struct connectbundle *bundle; bundle = he->ptr; he = Curl_hash_next_element(&iter); curr = bundle->conn_list.head; while(curr) { /* Yes, we need to update curr before calling func(), because func() might decide to remove the connection */ struct connectdata *conn = curr->ptr; curr = curr->next; if(1 == func(data, conn, param)) { CONNCACHE_UNLOCK(data); return TRUE; } } } CONNCACHE_UNLOCK(data); return FALSE; }
0
413,702
static int cmpnbbs(const void *_a, const void *_b) { const RAnalFunction *a = _a, *b = _b; ut64 as = r_list_length (a->bbs); ut64 bs = r_list_length (b->bbs); return (as> bs)? 1: (as< bs)? -1: 0; }
0
279,908
ex_drop(exarg_T *eap) { int split = FALSE; win_T *wp; buf_T *buf; tabpage_T *tp; if (ERROR_IF_POPUP_WINDOW || ERROR_IF_TERM_POPUP_WINDOW) return; /* * Check if the first argument is already being edited in a window. If * so, jump to that window. * We would actually need to check all arguments, but that's complicated * and mostly only one file is dropped. * This also ignores wildcards, since it is very unlikely the user is * editing a file name with a wildcard character. */ set_arglist(eap->arg); /* * Expanding wildcards may result in an empty argument list. E.g. when * editing "foo.pyc" and ".pyc" is in 'wildignore'. Assume that we * already did an error message for this. */ if (ARGCOUNT == 0) return; if (cmdmod.cmod_tab) { // ":tab drop file ...": open a tab for each argument that isn't // edited in a window yet. It's like ":tab all" but without closing // windows or tabs. ex_all(eap); } else { // ":drop file ...": Edit the first argument. Jump to an existing // window if possible, edit in current window if the current buffer // can be abandoned, otherwise open a new window. buf = buflist_findnr(ARGLIST[0].ae_fnum); FOR_ALL_TAB_WINDOWS(tp, wp) { if (wp->w_buffer == buf) { goto_tabpage_win(tp, wp); curwin->w_arg_idx = 0; if (!bufIsChanged(curbuf)) { int save_ar = curbuf->b_p_ar; // reload the file if it is newer curbuf->b_p_ar = TRUE; buf_check_timestamp(curbuf, FALSE); curbuf->b_p_ar = save_ar; } return; } } /* * Check whether the current buffer is changed. If so, we will need * to split the current window or data could be lost. * Skip the check if the 'hidden' option is set, as in this case the * buffer won't be lost. */ if (!buf_hide(curbuf)) { ++emsg_off; split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD); --emsg_off; } // Fake a ":sfirst" or ":first" command edit the first argument. if (split) { eap->cmdidx = CMD_sfirst; eap->cmd[0] = 's'; } else eap->cmdidx = CMD_first; ex_rewind(eap); } }
0
369,416
static inline bool io_req_ffs_set(struct io_kiocb *req) { return req->flags & REQ_F_FIXED_FILE; }
0
276,992
mrb_mruby_fiber_gem_init(mrb_state* mrb) { struct RClass *c; c = mrb_define_class(mrb, "Fiber", mrb->object_class); MRB_SET_INSTANCE_TT(c, MRB_TT_FIBER); mrb_define_method(mrb, c, "initialize", fiber_init, MRB_ARGS_NONE()|MRB_ARGS_BLOCK()); mrb_define_method(mrb, c, "resume", fiber_resume, MRB_ARGS_ANY()); mrb_define_method(mrb, c, "transfer", fiber_transfer, MRB_ARGS_ANY()); mrb_define_method(mrb, c, "alive?", fiber_alive_p, MRB_ARGS_NONE()); mrb_define_method(mrb, c, "==", fiber_eq, MRB_ARGS_REQ(1)); mrb_define_class_method(mrb, c, "yield", fiber_yield, MRB_ARGS_ANY()); mrb_define_class_method(mrb, c, "current", fiber_current, MRB_ARGS_NONE()); mrb_define_class(mrb, "FiberError", mrb->eStandardError_class); }
0
228,445
static TypedValue* add_vars_helper(ActRec* ar) { int start_index = 1; Resource packet_id{getArg<KindOfResource>(ar, 0)}; auto wddxPacket = cast<WddxPacket>(packet_id); for (int i = start_index; i < ar->numArgs(); i++) { auto const tv = getArg(ar, i); find_var_recursive(tv, wddxPacket); } return arReturn(ar, true); }
0
226,406
GF_Err tims_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_TSHintEntryBox *ptr = (GF_TSHintEntryBox *)s; if (ptr == NULL) return GF_BAD_PARAM; e = gf_isom_box_write_header(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->timeScale); return GF_OK; }
0
273,901
static void ftp_command(ctrl_t *ctrl) { uev_t sigterm_watcher; ctrl->bufsz = BUFFER_SIZE * sizeof(char); ctrl->buf = malloc(ctrl->bufsz); if (!ctrl->buf) { WARN(errno, "FTP session failed allocating buffer"); exit(1); } snprintf(ctrl->buf, ctrl->bufsz, "220 %s (%s) ready.\r\n", prognm, VERSION); send_msg(ctrl->sd, ctrl->buf); uev_signal_init(ctrl->ctx, &sigterm_watcher, child_exit, NULL, SIGTERM); uev_io_init(ctrl->ctx, &ctrl->io_watcher, read_client_command, ctrl, ctrl->sd, UEV_READ); uev_run(ctrl->ctx, 0); }
0
414,926
*/ void xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { #ifdef XPATH_STREAMING xmlXPathCompExprPtr comp; #endif if (ctxt == NULL) return; #ifdef XPATH_STREAMING comp = xmlXPathTryStreamCompile(ctxt->context, ctxt->base); if (comp != NULL) { if (ctxt->comp != NULL) xmlXPathFreeCompExpr(ctxt->comp); ctxt->comp = comp; if (ctxt->cur != NULL) while (*ctxt->cur != 0) ctxt->cur++; } else #endif { xmlXPathCompileExpr(ctxt, 1); if ((ctxt->error == XPATH_EXPRESSION_OK) && (ctxt->comp != NULL) && (ctxt->comp->nbStep > 1) && (ctxt->comp->last >= 0)) { xmlXPathOptimizeExpression(ctxt->comp, &ctxt->comp->steps[ctxt->comp->last]); } } CHECK_ERROR;
0
317,054
static inline int opt_len(const char *s) { bool open_quote = false; int len; char c; for (len = 0; (c = s[len]) != '\0'; len++) { if (c == '"') open_quote = !open_quote; if (c == ',' && !open_quote) break; } return len; }
0
198,476
njs_await_fulfilled(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, njs_index_t unused) { njs_int_t ret; njs_value_t **cur_local, **cur_closures, **cur_temp, *value; njs_frame_t *frame, *async_frame; njs_function_t *function; njs_async_ctx_t *ctx; njs_native_frame_t *top, *async; ctx = vm->top_frame->function->context; value = njs_arg(args, nargs, 1); if (njs_is_error(value)) { goto failed; } async_frame = ctx->await; async = &async_frame->native; async->previous = vm->top_frame; function = async->function; cur_local = vm->levels[NJS_LEVEL_LOCAL]; cur_closures = vm->levels[NJS_LEVEL_CLOSURE]; cur_temp = vm->levels[NJS_LEVEL_TEMP]; top = vm->top_frame; frame = vm->active_frame; vm->levels[NJS_LEVEL_LOCAL] = async->local; vm->levels[NJS_LEVEL_CLOSURE] = njs_function_closures(async->function); vm->levels[NJS_LEVEL_TEMP] = async->temp; vm->top_frame = async; vm->active_frame = async_frame; *njs_scope_value(vm, ctx->index) = *value; vm->retval = *value; vm->top_frame->retval = &vm->retval; function->context = ctx->capability; function->await = ctx; ret = njs_vmcode_interpreter(vm, ctx->pc); function->context = NULL; function->await = NULL; vm->levels[NJS_LEVEL_LOCAL] = cur_local; vm->levels[NJS_LEVEL_CLOSURE] = cur_closures; vm->levels[NJS_LEVEL_TEMP] = cur_temp; vm->top_frame = top; vm->active_frame = frame; if (ret == NJS_OK) { ret = njs_function_call(vm, njs_function(&ctx->capability->resolve), &njs_value_undefined, &vm->retval, 1, &vm->retval); njs_async_context_free(vm, ctx); } else if (ret == NJS_AGAIN) { ret = NJS_OK; } else if (ret == NJS_ERROR) { if (njs_is_memory_error(vm, &vm->retval)) { return NJS_ERROR; } value = &vm->retval; goto failed; } return ret; failed: (void) njs_function_call(vm, njs_function(&ctx->capability->reject), &njs_value_undefined, value, 1, &vm->retval); njs_async_context_free(vm, ctx); return NJS_ERROR; }
1
261,386
static int decode_cu_qp_delta_abs(thread_context* tctx) { logtrace(LogSlice,"# cu_qp_delta_abs\n"); int bit = decode_CABAC_bit(&tctx->cabac_decoder, &tctx->ctx_model[CONTEXT_MODEL_CU_QP_DELTA_ABS + 0]); if (bit==0) { logtrace(LogSymbols,"$1 cu_qp_delta_abs=%d\n",0); return 0; } int prefix=1; for (int i=0;i<4;i++) { bit = decode_CABAC_bit(&tctx->cabac_decoder, &tctx->ctx_model[CONTEXT_MODEL_CU_QP_DELTA_ABS + 1]); if (bit==0) { break; } else { prefix++; } } if (prefix==5) { int value = decode_CABAC_EGk_bypass(&tctx->cabac_decoder, 0); logtrace(LogSymbols,"$1 cu_qp_delta_abs=%d\n",value+5); return value + 5; } else { logtrace(LogSymbols,"$1 cu_qp_delta_abs=%d\n",prefix); return prefix; } }
0
244,121
void pcmC_box_del(GF_Box *s) { gf_free(s); }
0
359,588
DEFUN (clear_ip_bgp_external, clear_ip_bgp_external_cmd, "clear ip bgp external", CLEAR_STR IP_STR BGP_STR "Clear all external peers\n") { return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); }
0
512,687
virtual Item_func *get_item_func() { return NULL; }
0
452,391
static Image *ReadTIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define MaxPixelChannels 32 #define ThrowTIFFException(severity,message) \ { \ if (pixel_info != (MemoryInfo *) NULL) \ pixel_info=RelinquishVirtualMemory(pixel_info); \ if (quantum_info != (QuantumInfo *) NULL) \ quantum_info=DestroyQuantumInfo(quantum_info); \ TIFFClose(tiff); \ ThrowReaderException(severity,message); \ } const char *option; float *chromaticity = (float *) NULL, x_position, y_position, x_resolution, y_resolution; Image *image; int tiff_status = 0; MagickBooleanType more_frames; MagickStatusType status; MemoryInfo *pixel_info = (MemoryInfo *) NULL; QuantumInfo *quantum_info; QuantumType quantum_type; size_t number_pixels; ssize_t i, scanline_size, y; TIFF *tiff; TIFFMethodType method; uint16 compress_tag = 0, bits_per_sample = 0, endian = 0, extra_samples = 0, interlace = 0, max_sample_value = 0, min_sample_value = 0, orientation = 0, pages = 0, photometric = 0, *sample_info = NULL, sample_format = 0, samples_per_pixel = 0, units = 0, value = 0; uint32 height, rows_per_strip, width; unsigned char *pixels; void *sans[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; /* Open image. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); if (IsEventLogging() != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } (void) SetMagickThreadValue(tiff_exception,exception); tiff=TIFFClientOpen(image->filename,"rb",(thandle_t) image,TIFFReadBlob, TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob, TIFFUnmapBlob); if (tiff == (TIFF *) NULL) { if (exception->severity == UndefinedException) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); image=DestroyImageList(image); return((Image *) NULL); } if (exception->severity > ErrorException) { TIFFClose(tiff); image=DestroyImageList(image); return((Image *) NULL); } if (image_info->number_scenes != 0) { /* Generate blank images for subimage specification (e.g. image.tif[4]. We need to check the number of directores because it is possible that the subimage(s) are stored in the photoshop profile. */ if (image_info->scene < (size_t)TIFFNumberOfDirectories(tiff)) { for (i=0; i < (ssize_t) image_info->scene; i++) { status=TIFFReadDirectory(tiff) != 0 ? MagickTrue : MagickFalse; if (status == MagickFalse) { TIFFClose(tiff); image=DestroyImageList(image); return((Image *) NULL); } AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { TIFFClose(tiff); image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); } } } more_frames=MagickTrue; do { /* TIFFPrintDirectory(tiff,stdout,MagickFalse); */ photometric=PHOTOMETRIC_RGB; if ((TIFFGetField(tiff,TIFFTAG_IMAGEWIDTH,&width) != 1) || (TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&height) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_PHOTOMETRIC,&photometric,sans) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_COMPRESSION,&compress_tag,sans) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian,sans) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_PLANARCONFIG,&interlace,sans) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,&samples_per_pixel,sans) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,&bits_per_sample,sans) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLEFORMAT,&sample_format,sans) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_MINSAMPLEVALUE,&min_sample_value,sans) != 1) || (TIFFGetFieldDefaulted(tiff,TIFFTAG_MAXSAMPLEVALUE,&max_sample_value,sans) != 1)) { TIFFClose(tiff); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } if (((sample_format != SAMPLEFORMAT_IEEEFP) || (bits_per_sample != 64)) && ((bits_per_sample <= 0) || (bits_per_sample > 32))) { TIFFClose(tiff); ThrowReaderException(CorruptImageError,"UnsupportedBitsPerPixel"); } if (samples_per_pixel > MaxPixelChannels) { TIFFClose(tiff); ThrowReaderException(CorruptImageError,"MaximumChannelsExceeded"); } if (sample_format == SAMPLEFORMAT_IEEEFP) (void) SetImageProperty(image,"quantum:format","floating-point"); switch (photometric) { case PHOTOMETRIC_MINISBLACK: { (void) SetImageProperty(image,"tiff:photometric","min-is-black"); break; } case PHOTOMETRIC_MINISWHITE: { (void) SetImageProperty(image,"tiff:photometric","min-is-white"); break; } case PHOTOMETRIC_PALETTE: { (void) SetImageProperty(image,"tiff:photometric","palette"); break; } case PHOTOMETRIC_RGB: { (void) SetImageProperty(image,"tiff:photometric","RGB"); break; } case PHOTOMETRIC_CIELAB: { (void) SetImageProperty(image,"tiff:photometric","CIELAB"); break; } case PHOTOMETRIC_LOGL: { (void) SetImageProperty(image,"tiff:photometric","CIE Log2(L)"); break; } case PHOTOMETRIC_LOGLUV: { (void) SetImageProperty(image,"tiff:photometric","LOGLUV"); break; } #if defined(PHOTOMETRIC_MASK) case PHOTOMETRIC_MASK: { (void) SetImageProperty(image,"tiff:photometric","MASK"); break; } #endif case PHOTOMETRIC_SEPARATED: { (void) SetImageProperty(image,"tiff:photometric","separated"); break; } case PHOTOMETRIC_YCBCR: { (void) SetImageProperty(image,"tiff:photometric","YCBCR"); break; } default: { (void) SetImageProperty(image,"tiff:photometric","unknown"); break; } } if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Geometry: %ux%u", (unsigned int) width,(unsigned int) height); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Interlace: %u", interlace); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Bits per sample: %u",bits_per_sample); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Min sample value: %u",min_sample_value); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Max sample value: %u",max_sample_value); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Photometric " "interpretation: %s",GetImageProperty(image,"tiff:photometric")); } image->columns=(size_t) width; image->rows=(size_t) height; image->depth=(size_t) bits_per_sample; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Image depth: %.20g", (double) image->depth); image->endian=MSBEndian; if (endian == FILLORDER_LSB2MSB) image->endian=LSBEndian; #if defined(MAGICKCORE_HAVE_TIFFISBIGENDIAN) if (TIFFIsBigEndian(tiff) == 0) { (void) SetImageProperty(image,"tiff:endian","lsb"); image->endian=LSBEndian; } else { (void) SetImageProperty(image,"tiff:endian","msb"); image->endian=MSBEndian; } #endif if ((photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) image->colorspace=GRAYColorspace; if (photometric == PHOTOMETRIC_SEPARATED) image->colorspace=CMYKColorspace; if (photometric == PHOTOMETRIC_CIELAB) image->colorspace=LabColorspace; if ((photometric == PHOTOMETRIC_YCBCR) && (compress_tag != COMPRESSION_OJPEG) && (compress_tag != COMPRESSION_JPEG)) image->colorspace=YCbCrColorspace; status=TIFFGetProfiles(tiff,image); if (status == MagickFalse) { TIFFClose(tiff); InheritException(exception,&image->exception); return(DestroyImageList(image)); } status=TIFFGetProperties(tiff,image); if (status == MagickFalse) { TIFFClose(tiff); InheritException(exception,&image->exception); return(DestroyImageList(image)); } option=GetImageOption(image_info,"tiff:exif-properties"); if ((option == (const char *) NULL) || (IsMagickTrue(option) != MagickFalse)) (void) TIFFGetEXIFProperties(tiff,image); option=GetImageOption(image_info,"tiff:gps-properties"); if ((option == (const char *) NULL) || (IsMagickTrue(option) != MagickFalse)) (void) TIFFGetGPSProperties(tiff,image); if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XRESOLUTION,&x_resolution,sans) == 1) && (TIFFGetFieldDefaulted(tiff,TIFFTAG_YRESOLUTION,&y_resolution,sans) == 1)) { image->x_resolution=x_resolution; image->y_resolution=y_resolution; } if (TIFFGetFieldDefaulted(tiff,TIFFTAG_RESOLUTIONUNIT,&units,sans,sans) == 1) { if (units == RESUNIT_INCH) image->units=PixelsPerInchResolution; if (units == RESUNIT_CENTIMETER) image->units=PixelsPerCentimeterResolution; } if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XPOSITION,&x_position,sans) == 1) && (TIFFGetFieldDefaulted(tiff,TIFFTAG_YPOSITION,&y_position,sans) == 1)) { image->page.x=CastDoubleToLong(ceil(x_position* image->x_resolution-0.5)); image->page.y=CastDoubleToLong(ceil(y_position* image->y_resolution-0.5)); } if (TIFFGetFieldDefaulted(tiff,TIFFTAG_ORIENTATION,&orientation,sans) == 1) image->orientation=(OrientationType) orientation; if (TIFFGetField(tiff,TIFFTAG_WHITEPOINT,&chromaticity) == 1) { if ((chromaticity != (float *) NULL) && (*chromaticity != 0.0)) { image->chromaticity.white_point.x=chromaticity[0]; image->chromaticity.white_point.y=chromaticity[1]; } } if (TIFFGetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,&chromaticity) == 1) { if ((chromaticity != (float *) NULL) && (*chromaticity != 0.0)) { image->chromaticity.red_primary.x=chromaticity[0]; image->chromaticity.red_primary.y=chromaticity[1]; image->chromaticity.green_primary.x=chromaticity[2]; image->chromaticity.green_primary.y=chromaticity[3]; image->chromaticity.blue_primary.x=chromaticity[4]; image->chromaticity.blue_primary.y=chromaticity[5]; } } #if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919) if ((compress_tag != COMPRESSION_NONE) && (TIFFIsCODECConfigured(compress_tag) == 0)) { TIFFClose(tiff); ThrowReaderException(CoderError,"CompressNotSupported"); } #endif switch (compress_tag) { case COMPRESSION_NONE: image->compression=NoCompression; break; case COMPRESSION_CCITTFAX3: image->compression=FaxCompression; break; case COMPRESSION_CCITTFAX4: image->compression=Group4Compression; break; case COMPRESSION_JPEG: { image->compression=JPEGCompression; #if defined(JPEG_SUPPORT) { char sampling_factor[MaxTextExtent]; int tiff_status; uint16 horizontal, vertical; tiff_status=TIFFGetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,&horizontal, &vertical); if (tiff_status == 1) { (void) FormatLocaleString(sampling_factor,MaxTextExtent,"%dx%d", horizontal,vertical); (void) SetImageProperty(image,"jpeg:sampling-factor", sampling_factor); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Sampling Factors: %s",sampling_factor); } } #endif break; } case COMPRESSION_OJPEG: image->compression=JPEGCompression; break; #if defined(COMPRESSION_LZMA) case COMPRESSION_LZMA: image->compression=LZMACompression; break; #endif case COMPRESSION_LZW: image->compression=LZWCompression; break; case COMPRESSION_DEFLATE: image->compression=ZipCompression; break; case COMPRESSION_ADOBE_DEFLATE: image->compression=ZipCompression; break; #if defined(COMPRESSION_WEBP) case COMPRESSION_WEBP: image->compression=WebPCompression; break; #endif #if defined(COMPRESSION_ZSTD) case COMPRESSION_ZSTD: image->compression=ZstdCompression; break; #endif default: image->compression=RLECompression; break; } quantum_info=(QuantumInfo *) NULL; if ((photometric == PHOTOMETRIC_PALETTE) && (pow(2.0,1.0*bits_per_sample) <= MaxColormapSize)) { size_t colors; colors=(size_t) GetQuantumRange(bits_per_sample)+1; if (AcquireImageColormap(image,colors) == MagickFalse) { TIFFClose(tiff); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } } if (TIFFGetFieldDefaulted(tiff,TIFFTAG_PAGENUMBER,&value,&pages,sans) == 1) image->scene=value; if (image->storage_class == PseudoClass) { int tiff_status; size_t range; uint16 *blue_colormap = (uint16 *) NULL, *green_colormap = (uint16 *) NULL, *red_colormap = (uint16 *) NULL; /* Initialize colormap. */ tiff_status=TIFFGetField(tiff,TIFFTAG_COLORMAP,&red_colormap, &green_colormap,&blue_colormap); if (tiff_status == 1) { if ((red_colormap != (uint16 *) NULL) && (green_colormap != (uint16 *) NULL) && (blue_colormap != (uint16 *) NULL)) { range=255; /* might be old style 8-bit colormap */ for (i=0; i < (ssize_t) image->colors; i++) if ((red_colormap[i] >= 256) || (green_colormap[i] >= 256) || (blue_colormap[i] >= 256)) { range=65535; break; } for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=ClampToQuantum(((double) QuantumRange*red_colormap[i])/range); image->colormap[i].green=ClampToQuantum(((double) QuantumRange*green_colormap[i])/range); image->colormap[i].blue=ClampToQuantum(((double) QuantumRange*blue_colormap[i])/range); } } } } if (image_info->ping != MagickFalse) { if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; goto next_tiff_frame; } status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { TIFFClose(tiff); InheritException(exception,&image->exception); return(DestroyImageList(image)); } status=SetImageColorspace(image,image->colorspace); status&=ResetImagePixels(image,exception); if (status == MagickFalse) { TIFFClose(tiff); InheritException(exception,&image->exception); return(DestroyImageList(image)); } /* Allocate memory for the image and pixel buffer. */ quantum_info=AcquireQuantumInfo(image_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); if (sample_format == SAMPLEFORMAT_UINT) status=SetQuantumFormat(image,quantum_info,UnsignedQuantumFormat); if (sample_format == SAMPLEFORMAT_INT) status=SetQuantumFormat(image,quantum_info,SignedQuantumFormat); if (sample_format == SAMPLEFORMAT_IEEEFP) status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); if (status == MagickFalse) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); status=MagickTrue; switch (photometric) { case PHOTOMETRIC_MINISBLACK: { quantum_info->min_is_white=MagickFalse; break; } case PHOTOMETRIC_MINISWHITE: { quantum_info->min_is_white=MagickTrue; break; } default: break; } extra_samples=0; tiff_status=TIFFGetFieldDefaulted(tiff,TIFFTAG_EXTRASAMPLES,&extra_samples, &sample_info,sans); if (tiff_status == 1) { (void) SetImageProperty(image,"tiff:alpha","unspecified"); if (extra_samples == 0) { if ((samples_per_pixel == 4) && (photometric == PHOTOMETRIC_RGB)) image->matte=MagickTrue; } else for (i=0; i < extra_samples; i++) { image->matte=MagickTrue; if (sample_info[i] == EXTRASAMPLE_ASSOCALPHA) { SetQuantumAlphaType(quantum_info,AssociatedQuantumAlpha); (void) SetImageProperty(image,"tiff:alpha","associated"); } else if (sample_info[i] == EXTRASAMPLE_UNASSALPHA) { SetQuantumAlphaType(quantum_info,DisassociatedQuantumAlpha); (void) SetImageProperty(image,"tiff:alpha","unassociated"); } } } if (image->matte != MagickFalse) (void) SetImageAlphaChannel(image,OpaqueAlphaChannel); method=ReadGenericMethod; rows_per_strip=(uint32) image->rows; if (TIFFGetField(tiff,TIFFTAG_ROWSPERSTRIP,&rows_per_strip) == 1) { char value[MaxTextExtent]; (void) FormatLocaleString(value,MaxTextExtent,"%u",(unsigned int) rows_per_strip); (void) SetImageProperty(image,"tiff:rows-per-strip",value); method=ReadStripMethod; if (rows_per_strip > (uint32) image->rows) rows_per_strip=(uint32) image->rows; } if (TIFFIsTiled(tiff) != MagickFalse) { uint32 columns, rows; if ((TIFFGetField(tiff,TIFFTAG_TILEWIDTH,&columns) != 1) || (TIFFGetField(tiff,TIFFTAG_TILELENGTH,&rows) != 1)) ThrowTIFFException(CoderError,"ImageIsNotTiled"); if ((AcquireMagickResource(WidthResource,columns) == MagickFalse) || (AcquireMagickResource(HeightResource,rows) == MagickFalse)) ThrowTIFFException(ImageError,"WidthOrHeightExceedsLimit"); method=ReadTileMethod; } if ((photometric == PHOTOMETRIC_LOGLUV) || (compress_tag == COMPRESSION_CCITTFAX3)) method=ReadGenericMethod; if (image->compression == JPEGCompression) method=GetJPEGMethod(image,tiff,photometric,bits_per_sample, samples_per_pixel); quantum_info->endian=LSBEndian; scanline_size=TIFFScanlineSize(tiff); if (scanline_size <= 0) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); number_pixels=MagickMax((MagickSizeType) image->columns*samples_per_pixel* pow(2.0,ceil(log(bits_per_sample)/log(2.0))),image->columns* rows_per_strip); if ((double) scanline_size > 1.5*number_pixels) ThrowTIFFException(CorruptImageError,"CorruptImage"); number_pixels=MagickMax((MagickSizeType) scanline_size,number_pixels); pixel_info=AcquireVirtualMemory(number_pixels,sizeof(uint32)); if (pixel_info == (MemoryInfo *) NULL) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); (void) ResetMagickMemory(pixels,0,number_pixels*sizeof(uint32)); quantum_type=GrayQuantum; if (image->storage_class == PseudoClass) quantum_type=IndexQuantum; if (interlace != PLANARCONFIG_SEPARATE) { size_t pad; pad=(size_t) MagickMax((ssize_t) samples_per_pixel-1,0); if (image->matte != MagickFalse) { if (image->storage_class == PseudoClass) quantum_type=IndexAlphaQuantum; else quantum_type=samples_per_pixel == 1 ? AlphaQuantum : GrayAlphaQuantum; } if ((samples_per_pixel > 2) && (interlace != PLANARCONFIG_SEPARATE)) { quantum_type=RGBQuantum; pad=(size_t) MagickMax((ssize_t) samples_per_pixel+ extra_samples-3,0); if (image->matte != MagickFalse) { quantum_type=RGBAQuantum; pad=(size_t) MagickMax((ssize_t) samples_per_pixel+ extra_samples-4,0); } if (image->colorspace == CMYKColorspace) { quantum_type=CMYKQuantum; pad=(size_t) MagickMax((ssize_t) samples_per_pixel+ extra_samples-4,0); if (image->matte != MagickFalse) { quantum_type=CMYKAQuantum; pad=(size_t) MagickMax((ssize_t) samples_per_pixel+ extra_samples-5,0); } } status=SetQuantumPad(image,quantum_info,pad*((bits_per_sample+7) >> 3)); if (status == MagickFalse) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); } } switch (method) { case ReadYCCKMethod: { /* Convert YCC TIFF image. */ for (y=0; y < (ssize_t) image->rows; y++) { int status; IndexPacket *indexes; PixelPacket *magick_restrict q; ssize_t x; unsigned char *p; status=TIFFReadPixels(tiff,0,y,(char *) pixels); if (status == -1) break; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); p=pixels; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(q,ScaleCharToQuantum(ClampYCC((double) *p+ (1.402*(double) *(p+2))-179.456))); SetPixelMagenta(q,ScaleCharToQuantum(ClampYCC((double) *p- (0.34414*(double) *(p+1))-(0.71414*(double ) *(p+2))+ 135.45984))); SetPixelYellow(q,ScaleCharToQuantum(ClampYCC((double) *p+ (1.772*(double) *(p+1))-226.816))); SetPixelBlack(indexes+x,ScaleCharToQuantum((unsigned char)*(p+3))); q++; p+=4; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } break; } case ReadStripMethod: { unsigned char *p; size_t extent; ssize_t stride, strip_id; tsize_t strip_size; unsigned char *strip_pixels; /* Convert stripped TIFF image. */ extent=4*((image->depth+7)/8)*(samples_per_pixel+1)*TIFFStripSize(tiff); strip_pixels=(unsigned char *) AcquireQuantumMemory(extent, sizeof(*strip_pixels)); if (strip_pixels == (unsigned char *) NULL) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); (void) memset(strip_pixels,0,extent*sizeof(*strip_pixels)); stride=TIFFVStripSize(tiff,1); strip_id=0; p=strip_pixels; for (i=0; i < (ssize_t) samples_per_pixel; i++) { size_t rows_remaining; switch (i) { case 0: break; case 1: quantum_type=GreenQuantum; break; case 2: quantum_type=BlueQuantum; break; case 3: { quantum_type=AlphaQuantum; if (image->colorspace == CMYKColorspace) quantum_type=BlackQuantum; break; } case 4: quantum_type=AlphaQuantum; break; default: break; } rows_remaining=0; for (y=0; y < (ssize_t) image->rows; y++) { PixelPacket *magick_restrict q; q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; if (rows_remaining == 0) { strip_size=TIFFReadEncodedStrip(tiff,strip_id,strip_pixels, TIFFStripSize(tiff)); if (strip_size == -1) break; rows_remaining=rows_per_strip; if ((y+rows_per_strip) > (ssize_t) image->rows) rows_remaining=(rows_per_strip-(y+rows_per_strip- image->rows)); p=strip_pixels; strip_id++; } (void) ImportQuantumPixels(image,(CacheView *) NULL, quantum_info,quantum_type,p,exception); p+=stride; rows_remaining--; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } if ((samples_per_pixel > 1) && (interlace != PLANARCONFIG_SEPARATE)) break; } strip_pixels=(unsigned char *) RelinquishMagickMemory(strip_pixels); break; } case ReadTileMethod: { unsigned char *p; size_t extent; uint32 columns, rows; unsigned char *tile_pixels; /* Convert tiled TIFF image. */ if ((TIFFGetField(tiff,TIFFTAG_TILEWIDTH,&columns) != 1) || (TIFFGetField(tiff,TIFFTAG_TILELENGTH,&rows) != 1)) ThrowTIFFException(CoderError,"ImageIsNotTiled"); number_pixels=(MagickSizeType) columns*rows; if (HeapOverflowSanityCheck(rows,sizeof(*tile_pixels)) != MagickFalse) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); extent=4*(samples_per_pixel+1)*MagickMax(rows*TIFFTileRowSize(tiff), TIFFTileSize(tiff)); tile_pixels=(unsigned char *) AcquireQuantumMemory(extent, sizeof(*tile_pixels)); if (tile_pixels == (unsigned char *) NULL) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); (void) memset(tile_pixels,0,extent*sizeof(*tile_pixels)); for (i=0; i < (ssize_t) samples_per_pixel; i++) { switch (i) { case 0: break; case 1: quantum_type=GreenQuantum; break; case 2: quantum_type=BlueQuantum; break; case 3: { quantum_type=AlphaQuantum; if (image->colorspace == CMYKColorspace) quantum_type=BlackQuantum; break; } case 4: quantum_type=AlphaQuantum; break; default: break; } for (y=0; y < (ssize_t) image->rows; y+=rows) { ssize_t x; size_t rows_remaining; rows_remaining=image->rows-y; if ((ssize_t) (y+rows) < (ssize_t) image->rows) rows_remaining=rows; for (x=0; x < (ssize_t) image->columns; x+=columns) { size_t columns_remaining, row; columns_remaining=image->columns-x; if ((ssize_t) (x+columns) < (ssize_t) image->columns) columns_remaining=columns; tiff_status=TIFFReadTile(tiff,tile_pixels,(uint32) x,(uint32) y, 0,i); if (tiff_status == -1) break; p=tile_pixels; for (row=0; row < rows_remaining; row++) { PixelPacket *magick_restrict q; q=GetAuthenticPixels(image,x,y+row,columns_remaining,1, exception); if (q == (PixelPacket *) NULL) break; (void) ImportQuantumPixels(image,(CacheView *) NULL, quantum_info,quantum_type,p,exception); p+=TIFFTileRowSize(tiff); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } } } if ((samples_per_pixel > 1) && (interlace != PLANARCONFIG_SEPARATE)) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) i, samples_per_pixel); if (status == MagickFalse) break; } } tile_pixels=(unsigned char *) RelinquishMagickMemory(tile_pixels); break; } case ReadGenericMethod: default: { MemoryInfo *generic_info = (MemoryInfo *) NULL; uint32 *p; uint32 *pixels; /* Convert generic TIFF image. */ if (HeapOverflowSanityCheck(image->rows,sizeof(*pixels)) != MagickFalse) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); number_pixels=(MagickSizeType) image->columns*image->rows; generic_info=AcquireVirtualMemory(number_pixels,sizeof(*pixels)); if (generic_info == (MemoryInfo *) NULL) ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed"); pixels=(uint32 *) GetVirtualMemoryBlob(generic_info); tiff_status=TIFFReadRGBAImage(tiff,(uint32) image->columns,(uint32) image->rows,(uint32 *) pixels,0); if (tiff_status == -1) { generic_info=RelinquishVirtualMemory(generic_info); break; } p=pixels+(image->columns*image->rows)-1; for (y=0; y < (ssize_t) image->rows; y++) { ssize_t x; PixelPacket *magick_restrict q; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; q+=image->columns-1; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ScaleCharToQuantum((unsigned char) TIFFGetR(*p))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) TIFFGetG(*p))); SetPixelBlue(q,ScaleCharToQuantum((unsigned char) TIFFGetB(*p))); if (image->matte == MagickFalse) SetPixelOpacity(q,OpaqueOpacity); else SetPixelAlpha(q,ScaleCharToQuantum((unsigned char) TIFFGetA(*p))); p--; q--; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } generic_info=RelinquishVirtualMemory(generic_info); break; } } pixel_info=RelinquishVirtualMemory(pixel_info); SetQuantumImageType(image,quantum_type); next_tiff_frame: if (quantum_info != (QuantumInfo *) NULL) quantum_info=DestroyQuantumInfo(quantum_info); if (tiff_status == -1) { status=MagickFalse; break; } if (photometric == PHOTOMETRIC_CIELAB) DecodeLabImage(image,exception); if ((photometric == PHOTOMETRIC_LOGL) || (photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_MINISWHITE)) { image->type=GrayscaleType; if (bits_per_sample == 1) image->type=BilevelType; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; more_frames=TIFFReadDirectory(tiff) != 0 ? MagickTrue : MagickFalse; if (more_frames != MagickFalse) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { status=MagickFalse; break; } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,image->scene-1, image->scene); if (status == MagickFalse) break; } } while ((status != MagickFalse) && (more_frames != MagickFalse)); TIFFClose(tiff); if ((image_info->number_scenes != 0) && (image_info->scene >= GetImageListLength(image))) status=MagickFalse; if (status == MagickFalse) return(DestroyImageList(image)); TIFFReadPhotoshopLayers(image_info,image,exception); return(GetFirstImageInList(image)); }
0
338,226
Name WasmBinaryBuilder::getNextLabel() { requireFunctionContext("getting a label"); return Name("label$" + std::to_string(nextLabel++)); }
0
274,876
TEST(ComparisonsTest, LessEqualBroadcast) { ComparisonOpModel model({1, 1, 1, 4}, {1, 1, 1, 1}, TensorType_INT32, BuiltinOperator_LESS_EQUAL); model.PopulateTensor<int>(model.input1(), {-1, 9, 7, 3}); model.PopulateTensor<int>(model.input2(), {7}); model.Invoke(); EXPECT_THAT(model.GetOutput(), ElementsAre(true, false, true, true)); EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 1, 4)); }
0
513,326
JOIN::destroy() { DBUG_ENTER("JOIN::destroy"); select_lex->join= 0; cond_equal= 0; having_equal= 0; cleanup(1); if (join_tab) { for (JOIN_TAB *tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITH_CONST_TABLES); tab; tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS)) { if (tab->aggr) { free_tmp_table(thd, tab->table); delete tab->tmp_table_param; tab->tmp_table_param= NULL; tab->aggr= NULL; } tab->table= NULL; } } /* Cleanup items referencing temporary table columns */ cleanup_item_list(tmp_all_fields1); cleanup_item_list(tmp_all_fields3); destroy_sj_tmp_tables(this); delete_dynamic(&keyuse); delete procedure; DBUG_RETURN(error); }
0
211,773
cookedprint( int datatype, int length, const char *data, int status, int quiet, FILE *fp ) { char *name; char *value; char output_raw; int fmt; l_fp lfp; sockaddr_u hval; u_long uval; int narr; size_t len; l_fp lfparr[8]; char b[12]; char bn[2 * MAXVARLEN]; char bv[2 * MAXVALLEN]; UNUSED_ARG(datatype); if (!quiet) fprintf(fp, "status=%04x %s,\n", status, statustoa(datatype, status)); startoutput(); while (nextvar(&length, &data, &name, &value)) { fmt = varfmt(name); output_raw = 0; switch (fmt) { case PADDING: output_raw = '*'; break; case TS: if (!decodets(value, &lfp)) output_raw = '?'; else output(fp, name, prettydate(&lfp)); break; case HA: /* fallthru */ case NA: if (!decodenetnum(value, &hval)) { output_raw = '?'; } else if (fmt == HA){ output(fp, name, nntohost(&hval)); } else { output(fp, name, stoa(&hval)); } break; case RF: if (decodenetnum(value, &hval)) { if (ISREFCLOCKADR(&hval)) output(fp, name, refnumtoa(&hval)); else output(fp, name, stoa(&hval)); } else if (strlen(value) <= 4) { output(fp, name, value); } else { output_raw = '?'; } break; case LP: if (!decodeuint(value, &uval) || uval > 3) { output_raw = '?'; } else { b[0] = (0x2 & uval) ? '1' : '0'; b[1] = (0x1 & uval) ? '1' : '0'; b[2] = '\0'; output(fp, name, b); } break; case OC: if (!decodeuint(value, &uval)) { output_raw = '?'; } else { snprintf(b, sizeof(b), "%03lo", uval); output(fp, name, b); } break; case AR: if (!decodearr(value, &narr, lfparr)) output_raw = '?'; else outputarr(fp, name, narr, lfparr); break; case FX: if (!decodeuint(value, &uval)) output_raw = '?'; else output(fp, name, tstflags(uval)); break; default: fprintf(stderr, "Internal error in cookedprint, %s=%s, fmt %d\n", name, value, fmt); output_raw = '?'; break; } if (output_raw != 0) { atoascii(name, MAXVARLEN, bn, sizeof(bn)); atoascii(value, MAXVALLEN, bv, sizeof(bv)); if (output_raw != '*') { len = strlen(bv); bv[len] = output_raw; bv[len+1] = '\0'; } output(fp, bn, bv); } } endoutput(fp); }
1
230,113
int user_auth_scheme_module_unload(struct config_module * config) { UNUSED(config); return G_OK; }
0
430,350
void seq_put_decimal_ull(struct seq_file *m, const char *delimiter, unsigned long long num) { return seq_put_decimal_ull_width(m, delimiter, num, 0); }
0
222,876
Status Merge(DimensionHandle d1, DimensionHandle d2) { if (!d1.IsSet() || !d2.IsSet()) { return Status::OK(); } return dims_.Merge(d1, d2); }
0
309,937
sysmouse_server(SCREEN *sp) { struct mouse_info the_mouse; MEVENT *work; the_mouse.operation = MOUSE_GETINFO; if (sp != 0 && sp->_mouse_fd >= 0 && sp->_sysmouse_tail < FIFO_SIZE && ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) { if (sp->_sysmouse_head > sp->_sysmouse_tail) { sp->_sysmouse_tail = 0; sp->_sysmouse_head = 0; } work = &(sp->_sysmouse_fifo[sp->_sysmouse_tail]); memset(work, 0, sizeof(*work)); work->id = NORMAL_EVENT; /* there's only one mouse... */ sp->_sysmouse_old_buttons = sp->_sysmouse_new_buttons; sp->_sysmouse_new_buttons = the_mouse.u.data.buttons & 0x7; if (sp->_sysmouse_new_buttons) { if (sp->_sysmouse_new_buttons & 1) work->bstate |= BUTTON1_PRESSED; if (sp->_sysmouse_new_buttons & 2) work->bstate |= BUTTON2_PRESSED; if (sp->_sysmouse_new_buttons & 4) work->bstate |= BUTTON3_PRESSED; } else { if (sp->_sysmouse_old_buttons & 1) work->bstate |= BUTTON1_RELEASED; if (sp->_sysmouse_old_buttons & 2) work->bstate |= BUTTON2_RELEASED; if (sp->_sysmouse_old_buttons & 4) work->bstate |= BUTTON3_RELEASED; } /* for cosmetic bug in syscons.c on FreeBSD 3.[34] */ the_mouse.operation = MOUSE_HIDE; ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse); the_mouse.operation = MOUSE_SHOW; ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse); /* * We're only interested if the button is pressed or released. * FIXME: implement continuous event-tracking. */ if (sp->_sysmouse_new_buttons != sp->_sysmouse_old_buttons) { sp->_sysmouse_tail += 1; } work->x = the_mouse.u.data.x / sp->_sysmouse_char_width; work->y = the_mouse.u.data.y / sp->_sysmouse_char_height; } }
0
411,784
get_schema (const gchar *name) { const char * const *schemas = NULL; gint i; schemas = g_settings_list_schemas (); for (i = 0; schemas[i]; i++) { if (!strcmp (schemas[i], name)) return g_settings_new (schemas[i]); } return NULL; }
0
289,235
snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames) { struct snd_pcm_runtime *runtime = substream->runtime; int ret; while (1) { if (runtime->status->state == SNDRV_PCM_STATE_XRUN || runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { #ifdef OSS_DEBUG pcm_dbg(substream->pcm, "pcm_oss: writev: recovering from %s\n", runtime->status->state == SNDRV_PCM_STATE_XRUN ? "XRUN" : "SUSPEND"); #endif ret = snd_pcm_oss_prepare(substream); if (ret < 0) break; } ret = snd_pcm_kernel_writev(substream, bufs, frames); if (ret != -EPIPE && ret != -ESTRPIPE) break; /* test, if we can't store new data, because the stream */ /* has not been started */ if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) return -EAGAIN; } return ret; }
0
442,573
void memslot_info_init(RedMemSlotInfo *info, uint32_t num_groups, uint32_t num_slots, uint8_t generation_bits, uint8_t id_bits, uint8_t internal_groupslot_id) { uint32_t i; spice_assert(num_slots > 0); spice_assert(num_groups > 0); info->num_memslots_groups = num_groups; info->num_memslots = num_slots; info->generation_bits = generation_bits; info->mem_slot_bits = id_bits; info->internal_groupslot_id = internal_groupslot_id; info->mem_slots = g_new(MemSlot *, num_groups); for (i = 0; i < num_groups; ++i) { info->mem_slots[i] = g_new0(MemSlot, num_slots); } /* TODO: use QXLPHYSICAL_BITS */ info->memslot_id_shift = 64 - info->mem_slot_bits; info->memslot_gen_shift = 64 - (info->mem_slot_bits + info->generation_bits); info->memslot_gen_mask = ~((QXLPHYSICAL)-1 << info->generation_bits); info->memslot_clean_virt_mask = (((QXLPHYSICAL)(-1)) >> (info->mem_slot_bits + info->generation_bits)); }
0
442,580
int memslot_validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id, uint32_t add_size, uint32_t group_id) { MemSlot *slot; slot = &info->mem_slots[group_id][slot_id]; if ((virt + add_size) < virt) { spice_critical("virtual address overlap"); return 0; } if (virt < slot->virt_start_addr || (virt + add_size) > slot->virt_end_addr) { print_memslots(info); spice_warning("virtual address out of range" " virt=0x%lx+0x%x slot_id=%d group_id=%d\n" " slot=0x%lx-0x%lx delta=0x%lx", virt, add_size, slot_id, group_id, slot->virt_start_addr, slot->virt_end_addr, slot->address_delta); return 0; } return 1; }
0
512,943
Item_null(THD *thd, const char *name_par=0, CHARSET_INFO *cs= &my_charset_bin): Item_basic_constant(thd) { maybe_null= null_value= TRUE; max_length= 0; name.str= name_par ? name_par : "NULL"; name.length= strlen(name.str); collation.set(cs, DERIVATION_IGNORABLE, MY_REPERTOIRE_ASCII); }
0
234,156
frame_display_row (Frame_Chunk *fc, int *need_col_headers, unsigned int *max_regs) { unsigned int r; char tmp[100]; if (*max_regs != fc->ncols) *max_regs = fc->ncols; if (*need_col_headers) { *need_col_headers = 0; printf ("%-*s CFA ", eh_addr_size * 2, " LOC"); for (r = 0; r < *max_regs; r++) if (fc->col_type[r] != DW_CFA_unreferenced) { if (r == fc->ra) printf ("ra "); else printf ("%-5s ", regname (r, 1)); } printf ("\n"); } print_dwarf_vma (fc->pc_begin, eh_addr_size); if (fc->cfa_exp) strcpy (tmp, "exp"); else sprintf (tmp, "%s%+d", regname (fc->cfa_reg, 1), (int) fc->cfa_offset); printf ("%-8s ", tmp); for (r = 0; r < fc->ncols; r++) { if (fc->col_type[r] != DW_CFA_unreferenced) { switch (fc->col_type[r]) { case DW_CFA_undefined: strcpy (tmp, "u"); break; case DW_CFA_same_value: strcpy (tmp, "s"); break; case DW_CFA_offset: sprintf (tmp, "c%+d", fc->col_offset[r]); break; case DW_CFA_val_offset: sprintf (tmp, "v%+d", fc->col_offset[r]); break; case DW_CFA_register: sprintf (tmp, "%s", regname (fc->col_offset[r], 0)); break; case DW_CFA_expression: strcpy (tmp, "exp"); break; case DW_CFA_val_expression: strcpy (tmp, "vexp"); break; default: strcpy (tmp, "n/a"); break; } printf ("%-5s ", tmp); } } printf ("\n"); }
0
317,074
static int smk_ptrace_rule_check(struct task_struct *tracer, struct smack_known *tracee_known, unsigned int mode, const char *func) { int rc; struct smk_audit_info ad, *saip = NULL; struct task_smack *tsp; struct smack_known *tracer_known; const struct cred *tracercred; if ((mode & PTRACE_MODE_NOAUDIT) == 0) { smk_ad_init(&ad, func, LSM_AUDIT_DATA_TASK); smk_ad_setfield_u_tsk(&ad, tracer); saip = &ad; } rcu_read_lock(); tracercred = __task_cred(tracer); tsp = smack_cred(tracercred); tracer_known = smk_of_task(tsp); if ((mode & PTRACE_MODE_ATTACH) && (smack_ptrace_rule == SMACK_PTRACE_EXACT || smack_ptrace_rule == SMACK_PTRACE_DRACONIAN)) { if (tracer_known->smk_known == tracee_known->smk_known) rc = 0; else if (smack_ptrace_rule == SMACK_PTRACE_DRACONIAN) rc = -EACCES; else if (smack_privileged_cred(CAP_SYS_PTRACE, tracercred)) rc = 0; else rc = -EACCES; if (saip) smack_log(tracer_known->smk_known, tracee_known->smk_known, 0, rc, saip); rcu_read_unlock(); return rc; } /* In case of rule==SMACK_PTRACE_DEFAULT or mode==PTRACE_MODE_READ */ rc = smk_tskacc(tsp, tracee_known, smk_ptrace_mode(mode), saip); rcu_read_unlock(); return rc; }
0
247,653
TEST_P(SslSocketTest, OverrideRequestedServerNameWithoutSniInUpstreamTlsContext) { 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/san_dns_cert.pem")); server_cert->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem")); updateFilterChain(tls_context, *filter_chain); envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext client; Network::TransportSocketOptionsConstSharedPtr transport_socket_options( new Network::TransportSocketOptionsImpl("example.com")); TestUtilOptionsV2 test_options(listener, client, true, GetParam()); testUtilV2(test_options.setExpectedRequestedServerName("example.com") .setTransportSocketOptions(transport_socket_options)); }
0
331,760
void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &inPen) { #ifdef QT_DEBUG_DRAW qDebug() << "QPaintEngineEx::stroke()" << pen; #endif Q_D(QPaintEngineEx); if (path.isEmpty()) return; if (!d->strokeHandler) { d->strokeHandler = new StrokeHandler(path.elementCount()+4); d->stroker.setMoveToHook(qpaintengineex_moveTo); d->stroker.setLineToHook(qpaintengineex_lineTo); d->stroker.setCubicToHook(qpaintengineex_cubicTo); } QRectF clipRect; QPen pen = inPen; if (pen.style() > Qt::SolidLine) { QRectF cpRect = path.controlPointRect(); const QTransform &xf = state()->matrix; if (pen.isCosmetic()) { clipRect = d->exDeviceRect; cpRect.translate(xf.dx(), xf.dy()); } else { clipRect = xf.inverted().mapRect(QRectF(d->exDeviceRect)); } // Check to avoid generating unwieldy amount of dashes that will not be visible anyway QRectF extentRect = cpRect & clipRect; qreal extent = qMax(extentRect.width(), extentRect.height()); qreal patternLength = 0; const QList<qreal> pattern = pen.dashPattern(); const int patternSize = qMin(pattern.size(), 32); for (int i = 0; i < patternSize; i++) patternLength += qMax(pattern.at(i), qreal(0)); if (pen.widthF()) patternLength *= pen.widthF(); if (qFuzzyIsNull(patternLength)) { pen.setStyle(Qt::NoPen); } else if (qFuzzyIsNull(extent) || extent / patternLength > 10000) { // approximate stream of tiny dashes with semi-transparent solid line pen.setStyle(Qt::SolidLine); QColor color(pen.color()); color.setAlpha(color.alpha() / 2); pen.setColor(color); } } if (!qpen_fast_equals(pen, d->strokerPen)) { d->strokerPen = pen; d->stroker.setJoinStyle(pen.joinStyle()); d->stroker.setCapStyle(pen.capStyle()); d->stroker.setMiterLimit(pen.miterLimit()); qreal penWidth = pen.widthF(); if (penWidth == 0) d->stroker.setStrokeWidth(1); else d->stroker.setStrokeWidth(penWidth); Qt::PenStyle style = pen.style(); if (style == Qt::SolidLine) { d->activeStroker = &d->stroker; } else if (style == Qt::NoPen) { d->activeStroker = nullptr; } else { d->dasher.setDashPattern(pen.dashPattern()); d->dasher.setDashOffset(pen.dashOffset()); d->activeStroker = &d->dasher; } } if (!d->activeStroker) { return; } if (!clipRect.isNull()) d->activeStroker->setClipRect(clipRect); if (d->activeStroker == &d->stroker) d->stroker.setForceOpen(path.hasExplicitOpen()); const QPainterPath::ElementType *types = path.elements(); const qreal *points = path.points(); int pointCount = path.elementCount(); const qreal *lastPoint = points + (pointCount<<1); d->strokeHandler->types.reset(); d->strokeHandler->pts.reset(); // Some engines might decide to optimize for the non-shape hint later on... uint flags = QVectorPath::WindingFill; if (path.elementCount() > 2) flags |= QVectorPath::NonConvexShapeMask; if (d->stroker.capStyle() == Qt::RoundCap || d->stroker.joinStyle() == Qt::RoundJoin) flags |= QVectorPath::CurvedShapeMask; // ### Perspective Xforms are currently not supported... if (!pen.isCosmetic()) { // We include cosmetic pens in this case to avoid having to // change the current transform. Normal transformed, // non-cosmetic pens will be transformed as part of fill // later, so they are also covered here.. d->activeStroker->setCurveThresholdFromTransform(state()->matrix); d->activeStroker->begin(d->strokeHandler); if (types) { while (points < lastPoint) { switch (*types) { case QPainterPath::MoveToElement: d->activeStroker->moveTo(points[0], points[1]); points += 2; ++types; break; case QPainterPath::LineToElement: d->activeStroker->lineTo(points[0], points[1]); points += 2; ++types; break; case QPainterPath::CurveToElement: d->activeStroker->cubicTo(points[0], points[1], points[2], points[3], points[4], points[5]); points += 6; types += 3; flags |= QVectorPath::CurvedShapeMask; break; default: break; } } if (path.hasImplicitClose()) d->activeStroker->lineTo(path.points()[0], path.points()[1]); } else { d->activeStroker->moveTo(points[0], points[1]); points += 2; while (points < lastPoint) { d->activeStroker->lineTo(points[0], points[1]); points += 2; } if (path.hasImplicitClose()) d->activeStroker->lineTo(path.points()[0], path.points()[1]); } d->activeStroker->end(); if (!d->strokeHandler->types.size()) // an empty path... return; QVectorPath strokePath(d->strokeHandler->pts.data(), d->strokeHandler->types.size(), d->strokeHandler->types.data(), flags); fill(strokePath, pen.brush()); } else { // For cosmetic pens we need a bit of trickery... We to process xform the input points if (state()->matrix.type() >= QTransform::TxProject) { QPainterPath painterPath = state()->matrix.map(path.convertToPainterPath()); d->activeStroker->strokePath(painterPath, d->strokeHandler, QTransform()); } else { d->activeStroker->setCurveThresholdFromTransform(QTransform()); d->activeStroker->begin(d->strokeHandler); if (types) { while (points < lastPoint) { switch (*types) { case QPainterPath::MoveToElement: { QPointF pt = (*(const QPointF *) points) * state()->matrix; d->activeStroker->moveTo(pt.x(), pt.y()); points += 2; ++types; break; } case QPainterPath::LineToElement: { QPointF pt = (*(const QPointF *) points) * state()->matrix; d->activeStroker->lineTo(pt.x(), pt.y()); points += 2; ++types; break; } case QPainterPath::CurveToElement: { QPointF c1 = ((const QPointF *) points)[0] * state()->matrix; QPointF c2 = ((const QPointF *) points)[1] * state()->matrix; QPointF e = ((const QPointF *) points)[2] * state()->matrix; d->activeStroker->cubicTo(c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y()); points += 6; types += 3; flags |= QVectorPath::CurvedShapeMask; break; } default: break; } } if (path.hasImplicitClose()) { QPointF pt = * ((const QPointF *) path.points()) * state()->matrix; d->activeStroker->lineTo(pt.x(), pt.y()); } } else { QPointF p = ((const QPointF *)points)[0] * state()->matrix; d->activeStroker->moveTo(p.x(), p.y()); points += 2; while (points < lastPoint) { QPointF p = ((const QPointF *)points)[0] * state()->matrix; d->activeStroker->lineTo(p.x(), p.y()); points += 2; } if (path.hasImplicitClose()) d->activeStroker->lineTo(p.x(), p.y()); } d->activeStroker->end(); } QVectorPath strokePath(d->strokeHandler->pts.data(), d->strokeHandler->types.size(), d->strokeHandler->types.data(), flags); QTransform xform = state()->matrix; state()->matrix = QTransform(); transformChanged(); QBrush brush = pen.brush(); if (qbrush_style(brush) != Qt::SolidPattern) brush.setTransform(brush.transform() * xform); fill(strokePath, brush); state()->matrix = xform; transformChanged(); } }
0
221,644
bool hermes::evalIsTrue(IRBuilder &builder, Literal *operand) { if (auto *lit = evalToBoolean(builder, operand)) return lit->getValue(); return false; }
0
427,714
cdf_grow_info(cdf_property_info_t **info, size_t *maxcount, size_t incr) { cdf_property_info_t *inp; size_t newcount = *maxcount + incr; if (newcount > CDF_PROP_LIMIT) { DPRINTF(("exceeded property limit %" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", newcount, CDF_PROP_LIMIT)); goto out; } inp = CAST(cdf_property_info_t *, CDF_REALLOC(*info, newcount * sizeof(*inp))); if (inp == NULL) goto out; *info = inp; *maxcount = newcount; return inp; out: free(*info); *maxcount = 0; *info = NULL; return NULL; }
0
512,807
const Item_const *get_item_const() const { switch (state) { case SHORT_DATA_VALUE: case LONG_DATA_VALUE: case NULL_VALUE: return this; case IGNORE_VALUE: case DEFAULT_VALUE: case NO_VALUE: break; } return NULL; }
0
293,943
get_breakindent_win( win_T *wp, char_u *line) // start of the line { static int prev_indent = 0; // cached indent value static long prev_ts = 0L; // cached tabstop value static char_u *prev_line = NULL; // cached pointer to line static varnumber_T prev_tick = 0; // changedtick of cached value # ifdef FEAT_VARTABS static int *prev_vts = NULL; // cached vartabs values # endif static int prev_list = 0; // cached list value static int prev_listopt = 0; // cached w_p_briopt_list value // cached formatlistpat value static char_u *prev_flp = NULL; int bri = 0; // window width minus window margin space, i.e. what rests for text const int eff_wwidth = wp->w_width - ((wp->w_p_nu || wp->w_p_rnu) && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL) ? number_width(wp) + 1 : 0); // used cached indent, unless // - line pointer changed // - 'tabstop' changed // - 'briopt_list changed' changed or // - 'formatlistpattern' changed if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts || prev_tick != CHANGEDTICK(wp->w_buffer) || prev_listopt != wp->w_briopt_list || (prev_flp == NULL || (STRCMP(prev_flp, get_flp_value(wp->w_buffer)) != 0)) # ifdef FEAT_VARTABS || prev_vts != wp->w_buffer->b_p_vts_array # endif ) { prev_line = line; prev_ts = wp->w_buffer->b_p_ts; prev_tick = CHANGEDTICK(wp->w_buffer); # ifdef FEAT_VARTABS prev_vts = wp->w_buffer->b_p_vts_array; prev_indent = get_indent_str_vtab(line, (int)wp->w_buffer->b_p_ts, wp->w_buffer->b_p_vts_array, wp->w_p_list); # else prev_indent = get_indent_str(line, (int)wp->w_buffer->b_p_ts, wp->w_p_list); # endif prev_listopt = wp->w_briopt_list; prev_list = 0; vim_free(prev_flp); prev_flp = vim_strsave(get_flp_value(wp->w_buffer)); // add additional indent for numbered lists if (wp->w_briopt_list != 0) { regmatch_T regmatch; regmatch.regprog = vim_regcomp(prev_flp, RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT); if (regmatch.regprog != NULL) { regmatch.rm_ic = FALSE; if (vim_regexec(&regmatch, line, 0)) { if (wp->w_briopt_list > 0) prev_list = wp->w_briopt_list; else prev_list = (*regmatch.endp - *regmatch.startp); } vim_regfree(regmatch.regprog); } } } bri = prev_indent + wp->w_briopt_shift; // Add offset for number column, if 'n' is in 'cpoptions' bri += win_col_off2(wp); // add additional indent for numbered lists if (wp->w_briopt_list != 0) { if (wp->w_briopt_list > 0) bri += prev_list; else bri = prev_list; } // indent minus the length of the showbreak string if (wp->w_briopt_sbr) bri -= vim_strsize(get_showbreak_value(wp)); // never indent past left window margin if (bri < 0) bri = 0; // always leave at least bri_min characters on the left, // if text width is sufficient else if (bri > eff_wwidth - wp->w_briopt_min) bri = (eff_wwidth - wp->w_briopt_min < 0) ? 0 : eff_wwidth - wp->w_briopt_min; return bri; }
0
366,183
static void free_vfsmnt(struct mount *mnt) { struct user_namespace *mnt_userns; mnt_userns = mnt_user_ns(&mnt->mnt); if (mnt_userns != &init_user_ns) put_user_ns(mnt_userns); kfree_const(mnt->mnt_devname); #ifdef CONFIG_SMP free_percpu(mnt->mnt_pcp); #endif kmem_cache_free(mnt_cache, mnt); }
0
269,316
static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref, const BlockNode *left, const BlockNode *top, const BlockNode *tr){ if(s->ref_frames == 1){ *mx = mid_pred(left->mx, top->mx, tr->mx); *my = mid_pred(left->my, top->my, tr->my); }else{ const int *scale = ff_scale_mv_ref[ref]; *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8, (top ->mx * scale[top ->ref] + 128) >>8, (tr ->mx * scale[tr ->ref] + 128) >>8); *my = mid_pred((left->my * scale[left->ref] + 128) >>8, (top ->my * scale[top ->ref] + 128) >>8, (tr ->my * scale[tr ->ref] + 128) >>8); } }
0
473,899
code_to_mbc(OnigCodePoint code, UChar *buf, OnigEncoding enc ARG_UNUSED) { #define UTF8_TRAILS(code, shift) (UChar )((((code) >> (shift)) & 0x3f) | 0x80) #define UTF8_TRAIL0(code) (UChar )(((code) & 0x3f) | 0x80) if ((code & 0xffffff80) == 0) { *buf = (UChar )code; return 1; } else { UChar *p = buf; if ((code & 0xfffff800) == 0) { *p++ = (UChar )(((code>>6)& 0x1f) | 0xc0); } else if ((code & 0xffff0000) == 0) { *p++ = (UChar )(((code>>12) & 0x0f) | 0xe0); *p++ = UTF8_TRAILS(code, 6); } else if ((code & 0xffe00000) == 0) { *p++ = (UChar )(((code>>18) & 0x07) | 0xf0); *p++ = UTF8_TRAILS(code, 12); *p++ = UTF8_TRAILS(code, 6); } else if ((code & 0xfc000000) == 0) { *p++ = (UChar )(((code>>24) & 0x03) | 0xf8); *p++ = UTF8_TRAILS(code, 18); *p++ = UTF8_TRAILS(code, 12); *p++ = UTF8_TRAILS(code, 6); } else if ((code & 0x80000000) == 0) { *p++ = (UChar )(((code>>30) & 0x01) | 0xfc); *p++ = UTF8_TRAILS(code, 24); *p++ = UTF8_TRAILS(code, 18); *p++ = UTF8_TRAILS(code, 12); *p++ = UTF8_TRAILS(code, 6); } #ifdef USE_INVALID_CODE_SCHEME else if (code == INVALID_CODE_FE) { *p = 0xfe; return 1; } else if (code == INVALID_CODE_FF) { *p = 0xff; return 1; } #endif else { return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE; } *p++ = UTF8_TRAIL0(code); return (int)(p - buf); } }
0
294,403
d_lite_marshal_dump(VALUE self) { VALUE a; get_d1(self); a = rb_ary_new3(6, m_nth(dat), INT2FIX(m_jd(dat)), INT2FIX(m_df(dat)), m_sf(dat), INT2FIX(m_of(dat)), DBL2NUM(m_sg(dat))); if (FL_TEST(self, FL_EXIVAR)) { rb_copy_generic_ivar(a, self); FL_SET(a, FL_EXIVAR); } return a; }
0
466,143
static int em_or(struct x86_emulate_ctxt *ctxt) { emulate_2op_SrcV(ctxt, "or"); return X86EMUL_CONTINUE; }
0
500,096
kssl_krb5_kt_resolve(krb5_context con, krb5_const char * sz, krb5_keytab * kt) { if (!krb5_loaded) load_krb5_dll(); if ( p_krb5_kt_resolve ) return(p_krb5_kt_resolve(con,sz,kt)); else return KRB5KRB_ERR_GENERIC; }
0
277,676
get_scaled_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading raw-byte-format PPM files with any maxval */ { ppm_source_ptr source = (ppm_source_ptr) sinfo; register JSAMPROW ptr; register U_CHAR * bufferptr; register JSAMPLE *rescale = source->rescale; JDIMENSION col; if (! ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width)) ERREXIT(cinfo, JERR_INPUT_EOF); ptr = source->pub.buffer[0]; bufferptr = source->iobuffer; for (col = cinfo->image_width; col > 0; col--) { *ptr++ = rescale[UCH(*bufferptr++)]; *ptr++ = rescale[UCH(*bufferptr++)]; *ptr++ = rescale[UCH(*bufferptr++)]; } return 1; }
0
227,032
IRC_PROTOCOL_CALLBACK(008) { IRC_PROTOCOL_MIN_ARGS(4); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, argv[2], command, NULL, NULL), date, irc_protocol_tags (command, "irc_numeric", NULL, address), _("%sServer notice mask for %s%s%s: %s"), weechat_prefix ("network"), irc_nick_color_for_msg (server, 1, NULL, argv[2]), argv[2], IRC_COLOR_RESET, (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]); return WEECHAT_RC_OK; }
0
139,221
ui::Layer* OverlayWindowViews::GetLayer() { return views::Widget::GetLayer(); }
0
500,084
static struct tm *k_gmtime(ASN1_GENERALIZEDTIME *gtime, struct tm *k_tm) { char c, *p; if (!k_tm) return NULL; if (gtime == NULL || gtime->length < 14) return NULL; if (gtime->data == NULL) return NULL; p = (char *)&gtime->data[14]; c = *p; *p = '\0'; p -= 2; k_tm->tm_sec = atoi(p); *(p+2) = c; c = *p; *p = '\0'; p -= 2; k_tm->tm_min = atoi(p); *(p+2) = c; c = *p; *p = '\0'; p -= 2; k_tm->tm_hour = atoi(p); *(p+2) = c; c = *p; *p = '\0'; p -= 2; k_tm->tm_mday = atoi(p); *(p+2) = c; c = *p; *p = '\0'; p -= 2; k_tm->tm_mon = atoi(p)-1; *(p+2) = c; c = *p; *p = '\0'; p -= 4; k_tm->tm_year = atoi(p)-1900; *(p+4) = c; return k_tm; }
0
301,374
static int vfswrap_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname) { int result = -1; START_PROFILE(syscall_lstat); if (smb_fname->stream_name) { errno = ENOENT; goto out; } result = sys_lstat(smb_fname->base_name, &smb_fname->st, lp_fake_dir_create_times(SNUM(handle->conn))); out: END_PROFILE(syscall_lstat); return result; }
0
317,156
static int inode_has_perm(const struct cred *cred, struct inode *inode, u32 perms, struct common_audit_data *adp) { struct inode_security_struct *isec; u32 sid; validate_creds(cred); if (unlikely(IS_PRIVATE(inode))) return 0; sid = cred_sid(cred); isec = selinux_inode(inode); return avc_has_perm(&selinux_state, sid, isec->sid, isec->sclass, perms, adp); }
0
300,821
int tipc_nl_sk_dump(struct sk_buff *skb, struct netlink_callback *cb) { return tipc_nl_sk_walk(skb, cb, __tipc_nl_add_sk); }
0
413,620
R_API void r_core_anal_callgraph(RCore *core, ut64 addr, int fmt) { const char *font = r_config_get (core->config, "graph.font"); int is_html = r_cons_context ()->is_html; bool refgraph = r_config_get_i (core->config, "graph.refs"); RListIter *iter, *iter2; int usenames = r_config_get_i (core->config, "graph.json.usenames");; RAnalFunction *fcni; RAnalRef *fcnr; PJ *pj = NULL; ut64 from = r_config_get_i (core->config, "graph.from"); ut64 to = r_config_get_i (core->config, "graph.to"); switch (fmt) { case R_GRAPH_FORMAT_JSON: pj = pj_new (); if (!pj) { return; } pj_a (pj); break; case R_GRAPH_FORMAT_GML: case R_GRAPH_FORMAT_GMLFCN: r_cons_printf ("graph\n[\n" "hierarchic 1\n" "label \"\"\n" "directed 1\n"); break; case R_GRAPH_FORMAT_DOT: if (!is_html) { const char * gv_edge = r_config_get (core->config, "graph.gv.edge"); char * gv_node = strdup (r_config_get (core->config, "graph.gv.node")); const char * gv_grph = r_config_get (core->config, "graph.gv.graph"); const char * gv_spline = r_config_get (core->config, "graph.gv.spline"); if (!gv_edge || !*gv_edge) { gv_edge = "arrowhead=\"normal\" style=bold weight=2"; } if (!gv_node || !*gv_node) { const char *font = r_config_get (core->config, "graph.font"); free (gv_node); gv_node = r_str_newf ("penwidth=4 fillcolor=white style=filled fontname=\"%s Bold\" fontsize=14 shape=box", font); } if (!gv_grph || !*gv_grph) { gv_grph = "bgcolor=azure"; } if (!gv_spline || !*gv_spline) { // ortho for bbgraph and curved for callgraph gv_spline = "splines=\"curved\""; } r_cons_printf ("digraph code {\n" "rankdir=LR;\n" "outputorder=edgesfirst;\n" "graph [%s fontname=\"%s\" %s];\n" "node [%s];\n" "edge [%s];\n", gv_grph, font, gv_spline, gv_node, gv_edge); free (gv_node); } break; } ut64 base = UT64_MAX; int iteration = 0; repeat: r_list_foreach (core->anal->fcns, iter, fcni) { if (base == UT64_MAX) { base = fcni->addr; } if (from != UT64_MAX && fcni->addr < from) { continue; } if (to != UT64_MAX && fcni->addr > to) { continue; } if (addr != UT64_MAX && addr != fcni->addr) { continue; } RList *refs = r_anal_function_get_refs (fcni); RList *calls = r_list_new (); // TODO: maybe fcni->calls instead ? r_list_foreach (refs, iter2, fcnr) { // TODO: tail calll jumps are also calls if (fcnr->type == 'C' && r_list_find(calls, fcnr, (RListComparator)RAnalRef_cmp) == NULL) { r_list_append (calls, fcnr); } } if (r_list_empty(calls)) { r_list_free (refs); r_list_free (calls); continue; } switch (fmt) { case R_GRAPH_FORMAT_NO: r_cons_printf ("0x%08"PFMT64x"\n", fcni->addr); break; case R_GRAPH_FORMAT_GML: case R_GRAPH_FORMAT_GMLFCN: { RFlagItem *flag = r_flag_get_i (core->flags, fcni->addr); if (iteration == 0) { char *msg = flag? strdup (flag->name): r_str_newf ("0x%08"PFMT64x, fcni->addr); r_cons_printf (" node [\n" " id %"PFMT64d"\n" " label \"%s\"\n" " ]\n", fcni->addr - base, msg); free (msg); } break; } case R_GRAPH_FORMAT_JSON: pj_o (pj); if (usenames) { pj_ks (pj, "name", fcni->name); } else { char fcni_addr[20]; snprintf (fcni_addr, sizeof (fcni_addr) - 1, "0x%08" PFMT64x, fcni->addr); pj_ks (pj, "name", fcni_addr); } pj_kn (pj, "size", r_anal_function_linear_size (fcni)); pj_ka (pj, "imports"); break; case R_GRAPH_FORMAT_DOT: r_cons_printf (" \"0x%08"PFMT64x"\" " "[label=\"%s\"" " URL=\"%s/0x%08"PFMT64x"\"];\n", fcni->addr, fcni->name, fcni->name, fcni->addr); } r_list_foreach (calls, iter2, fcnr) { // TODO: display only code or data refs? RFlagItem *flag = r_flag_get_i (core->flags, fcnr->addr); char *fcnr_name = (flag && flag->name) ? flag->name : r_str_newf ("unk.0x%"PFMT64x, fcnr->addr); switch (fmt) { case R_GRAPH_FORMAT_GMLFCN: if (iteration == 0) { r_cons_printf (" node [\n" " id %"PFMT64d"\n" " label \"%s\"\n" " ]\n", fcnr->addr - base, fcnr_name); r_cons_printf (" edge [\n" " source %"PFMT64d"\n" " target %"PFMT64d"\n" " ]\n", fcni->addr-base, fcnr->addr-base); } case R_GRAPH_FORMAT_GML: if (iteration != 0) { r_cons_printf (" edge [\n" " source %"PFMT64d"\n" " target %"PFMT64d"\n" " ]\n", fcni->addr-base, fcnr->addr-base); //, "#000000" } break; case R_GRAPH_FORMAT_DOT: r_cons_printf (" \"0x%08"PFMT64x"\" -> \"0x%08"PFMT64x"\" " "[color=\"%s\" URL=\"%s/0x%08"PFMT64x"\"];\n", //"[label=\"%s\" color=\"%s\" URL=\"%s/0x%08"PFMT64x"\"];\n", fcni->addr, fcnr->addr, //, fcnr_name, "#61afef", fcnr_name, fcnr->addr); r_cons_printf (" \"0x%08"PFMT64x"\" " "[label=\"%s\"" " URL=\"%s/0x%08"PFMT64x"\"];\n", fcnr->addr, fcnr_name, fcnr_name, fcnr->addr); break; case R_GRAPH_FORMAT_JSON: if (usenames) { pj_s (pj, fcnr_name); } else { char fcnr_addr[20]; snprintf (fcnr_addr, sizeof (fcnr_addr) - 1, "0x%08" PFMT64x, fcnr->addr); pj_s (pj, fcnr_addr); } break; default: if (refgraph || fcnr->type == R_ANAL_REF_TYPE_CALL) { // TODO: avoid recreating nodes unnecessarily r_cons_printf ("agn %s\n", fcni->name); r_cons_printf ("agn %s\n", fcnr_name); r_cons_printf ("age %s %s\n", fcni->name, fcnr_name); } else { r_cons_printf ("# - 0x%08"PFMT64x" (%c)\n", fcnr->addr, fcnr->type); } } if (!(flag && flag->name)) { free(fcnr_name); } } r_list_free (refs); r_list_free (calls); if (fmt == R_GRAPH_FORMAT_JSON) { pj_end (pj); pj_end (pj); } } if (iteration == 0 && fmt == R_GRAPH_FORMAT_GML) { iteration++; goto repeat; } if (iteration == 0 && fmt == R_GRAPH_FORMAT_GMLFCN) { iteration++; } switch (fmt) { case R_GRAPH_FORMAT_GML: case R_GRAPH_FORMAT_GMLFCN: case R_GRAPH_FORMAT_JSON: pj_end (pj); r_cons_println (pj_string (pj)); pj_free (pj); break; case R_GRAPH_FORMAT_DOT: r_cons_printf ("}\n"); break; } }
0
244,024
void xtra_box_del(GF_Box *s) { GF_XtraBox *ptr = (GF_XtraBox *)s; while (gf_list_count(ptr->tags)) { GF_XtraTag *tag = gf_list_pop_back(ptr->tags); if (tag->name) gf_free(tag->name); if (tag->prop_value) gf_free(tag->prop_value); gf_free(tag); } gf_list_del(ptr->tags); gf_free(s); }
0
275,512
njs_vm_array_alloc(njs_vm_t *vm, njs_value_t *retval, uint32_t spare) { njs_array_t *array; array = njs_array_alloc(vm, 1, 0, spare); if (njs_slow_path(array == NULL)) { return NJS_ERROR; } njs_set_array(retval, array); return NJS_OK; }
0
436,102
static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr) { struct io_uring_task *tctx; int submitted = 0; /* make sure SQ entry isn't read before tail */ nr = min3(nr, ctx->sq_entries, io_sqring_entries(ctx)); if (!percpu_ref_tryget_many(&ctx->refs, nr)) return -EAGAIN; tctx = current->io_uring; tctx->cached_refs -= nr; if (unlikely(tctx->cached_refs < 0)) { unsigned int refill = -tctx->cached_refs + IO_TCTX_REFS_CACHE_NR; percpu_counter_add(&tctx->inflight, refill); refcount_add(refill, &current->usage); tctx->cached_refs += refill; } io_submit_state_start(&ctx->submit_state, nr); while (submitted < nr) { const struct io_uring_sqe *sqe; struct io_kiocb *req; req = io_alloc_req(ctx); if (unlikely(!req)) { if (!submitted) submitted = -EAGAIN; break; } sqe = io_get_sqe(ctx); if (unlikely(!sqe)) { kmem_cache_free(req_cachep, req); break; } /* will complete beyond this point, count as submitted */ submitted++; if (io_submit_sqe(ctx, req, sqe)) break; } if (unlikely(submitted != nr)) { int ref_used = (submitted == -EAGAIN) ? 0 : submitted; int unused = nr - ref_used; current->io_uring->cached_refs += unused; percpu_ref_put_many(&ctx->refs, unused); } io_submit_state_end(&ctx->submit_state, ctx); /* Commit SQ ring head once we've consumed and submitted all SQEs */ io_commit_sqring(ctx); return submitted;
0
445,866
paste_from_archive_list_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { FrWindow *window = user_data; GError *error = NULL; if (! fr_archive_operation_finish (FR_ARCHIVE (source_object), result, &error)) { _paste_from_archive_operation_completed (window, FR_ACTION_PASTING_FILES, error); g_error_free (error); return; } fr_archive_action_started (window->priv->copy_from_archive, FR_ACTION_EXTRACTING_FILES); fr_archive_extract (window->priv->copy_from_archive, window->priv->clipboard_data->files, window->priv->clipboard_data->tmp_dir, NULL, FALSE, TRUE, FALSE, window->priv->clipboard_data->password, window->priv->cancellable, paste_from_archive_extract_ready_cb, window); }
0
402,610
can_prompt_again(secuPWData *pwdata) { if (pwdata->orig_source == PW_PROMPT) return true; if (pwdata->source == PW_DEVICE) return true; return false; }
0
430,345
int single_release(struct inode *inode, struct file *file) { const struct seq_operations *op = ((struct seq_file *)file->private_data)->op; int res = seq_release(inode, file); kfree(op); return res; }
0
312,481
qf_free(qf_list_T *qfl) { qf_free_items(qfl); VIM_CLEAR(qfl->qf_title); free_tv(qfl->qf_ctx); qfl->qf_ctx = NULL; free_callback(&qfl->qf_qftf_cb); qfl->qf_id = 0; qfl->qf_changedtick = 0L; }
0
430,445
static int sample_action_to_attr(const struct nlattr *attr, struct sk_buff *skb) { struct nlattr *start, *ac_start = NULL, *sample_arg; int err = 0, rem = nla_len(attr); const struct sample_arg *arg; struct nlattr *actions; start = nla_nest_start_noflag(skb, OVS_ACTION_ATTR_SAMPLE); if (!start) return -EMSGSIZE; sample_arg = nla_data(attr); arg = nla_data(sample_arg); actions = nla_next(sample_arg, &rem); if (nla_put_u32(skb, OVS_SAMPLE_ATTR_PROBABILITY, arg->probability)) { err = -EMSGSIZE; goto out; } ac_start = nla_nest_start_noflag(skb, OVS_SAMPLE_ATTR_ACTIONS); if (!ac_start) { err = -EMSGSIZE; goto out; } err = ovs_nla_put_actions(actions, rem, skb); out: if (err) { nla_nest_cancel(skb, ac_start); nla_nest_cancel(skb, start); } else { nla_nest_end(skb, ac_start); nla_nest_end(skb, start); } return err; }
0