idx
int64
func
string
target
int64
281,077
static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir, const struct flowi *fl, u16 family) { struct xfrm_policy *pol; rcu_read_lock(); again: pol = rcu_dereference(sk->sk_policy[dir]); if (pol != NULL) { bool match = xfrm_selector_match(&pol->selector, fl, family); int err = 0; if (match) { if ((sk->sk_mark & pol->mark.m) != pol->mark.v) { pol = NULL; goto out; } err = security_xfrm_policy_lookup(pol->security, fl->flowi_secid, policy_to_flow_dir(dir)); if (!err) { if (!xfrm_pol_hold_rcu(pol)) goto again; } else if (err == -ESRCH) { pol = NULL; } else { pol = ERR_PTR(err); } } else pol = NULL; } out: rcu_read_unlock(); return pol; }
0
248,306
static void cfg_handle_deprecated(cfg_t *cfg, cfg_opt_t *opt) { if (is_set(CFGF_DROP, opt->flags)) { cfg_error(cfg, _("dropping deprecated configuration option '%s'"), opt->name); cfg_free_value(opt); } else { cfg_error(cfg, _("found deprecated option '%s', please update configuration file."), opt->name); } }
0
473,957
koi8_u_get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc ARG_UNUSED) { return onigenc_get_case_fold_codes_by_str_with_map( sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0, flag, p, end, items); }
0
244,292
GF_Box *emsg_box_new() { ISOM_DECL_BOX_ALLOC(GF_EventMessageBox, GF_ISOM_BOX_TYPE_EMSG); return (GF_Box *)tmp; }
0
477,272
void tipc_crypto_msg_rcv(struct net *net, struct sk_buff *skb) { struct tipc_crypto *rx; struct tipc_msg *hdr; if (unlikely(skb_linearize(skb))) goto exit; hdr = buf_msg(skb); rx = tipc_node_crypto_rx_by_addr(net, msg_prevnode(hdr)); if (unlikely(!rx)) goto exit; switch (msg_type(hdr)) { case KEY_DISTR_MSG: if (tipc_crypto_key_rcv(rx, hdr)) goto exit; break; default: break; } tipc_node_put(rx->node); exit: kfree_skb(skb); }
0
336,491
static void reds_mig_target_client_disconnect_all(RedsState *reds) { RedsMigTargetClient *mig_client; GLIST_FOREACH(reds->mig_target_clients, RedsMigTargetClient, mig_client) { reds_client_disconnect(reds, mig_client->client); } }
0
413,841
void CallInfo::set_resolved_method_name(TRAPS) { assert(_resolved_method() != NULL, "Should already have a Method*"); oop rmethod_name = java_lang_invoke_ResolvedMethodName::find_resolved_method(_resolved_method, CHECK); _resolved_method_name = Handle(THREAD, rmethod_name); }
0
261,442
static inline int decode_coeff_abs_level_greater1(thread_context* tctx, int cIdx, int i, bool firstCoeffInSubblock, bool firstSubblock, int lastSubblock_greater1Ctx, int* lastInvocation_greater1Ctx, int* lastInvocation_coeff_abs_level_greater1_flag, int* lastInvocation_ctxSet, int c1) { logtrace(LogSlice,"# coeff_abs_level_greater1\n"); logtrace(LogSlice," cIdx:%d i:%d firstCoeffInSB:%d firstSB:%d lastSB>1:%d last>1Ctx:%d lastLev>1:%d lastCtxSet:%d\n", cIdx,i,firstCoeffInSubblock,firstSubblock,lastSubblock_greater1Ctx, *lastInvocation_greater1Ctx, *lastInvocation_coeff_abs_level_greater1_flag, *lastInvocation_ctxSet); int lastGreater1Ctx; int greater1Ctx; int ctxSet; logtrace(LogSlice,"c1: %d\n",c1); if (firstCoeffInSubblock) { // block with real DC -> ctx 0 if (i==0 || cIdx>0) { ctxSet=0; } else { ctxSet=2; } if (firstSubblock) { lastGreater1Ctx=1; } else { lastGreater1Ctx = lastSubblock_greater1Ctx; } if (lastGreater1Ctx==0) { ctxSet++; } logtrace(LogSlice,"ctxSet: %d\n",ctxSet); greater1Ctx=1; } else { // !firstCoeffInSubblock ctxSet = *lastInvocation_ctxSet; logtrace(LogSlice,"ctxSet (old): %d\n",ctxSet); greater1Ctx = *lastInvocation_greater1Ctx; if (greater1Ctx>0) { int lastGreater1Flag=*lastInvocation_coeff_abs_level_greater1_flag; if (lastGreater1Flag==1) greater1Ctx=0; else { /*if (greater1Ctx>0)*/ greater1Ctx++; } } } ctxSet = c1; // use HM algo int ctxIdxInc = (ctxSet*4) + (greater1Ctx>=3 ? 3 : greater1Ctx); if (cIdx>0) { ctxIdxInc+=16; } int bit = decode_CABAC_bit(&tctx->cabac_decoder, &tctx->ctx_model[CONTEXT_MODEL_COEFF_ABS_LEVEL_GREATER1_FLAG + ctxIdxInc]); *lastInvocation_greater1Ctx = greater1Ctx; *lastInvocation_coeff_abs_level_greater1_flag = bit; *lastInvocation_ctxSet = ctxSet; //logtrace(LogSymbols,"$1 coeff_abs_level_greater1=%d\n",bit); return bit; }
0
279,941
do_sub_msg( int count_only) // used 'n' flag for ":s" { /* * Only report substitutions when: * - more than 'report' substitutions * - command was typed by user, or number of changed lines > 'report' * - giving messages is not disabled by 'lazyredraw' */ if (((sub_nsubs > p_report && (KeyTyped || sub_nlines > 1 || p_report < 1)) || count_only) && messaging()) { char *msg_single; char *msg_plural; if (got_int) STRCPY(msg_buf, _("(Interrupted) ")); else *msg_buf = NUL; msg_single = count_only ? NGETTEXT("%ld match on %ld line", "%ld matches on %ld line", sub_nsubs) : NGETTEXT("%ld substitution on %ld line", "%ld substitutions on %ld line", sub_nsubs); msg_plural = count_only ? NGETTEXT("%ld match on %ld lines", "%ld matches on %ld lines", sub_nsubs) : NGETTEXT("%ld substitution on %ld lines", "%ld substitutions on %ld lines", sub_nsubs); vim_snprintf_add(msg_buf, sizeof(msg_buf), NGETTEXT(msg_single, msg_plural, sub_nlines), sub_nsubs, (long)sub_nlines); if (msg(msg_buf)) // save message to display it after redraw set_keep_msg((char_u *)msg_buf, 0); return TRUE; } if (got_int) { emsg(_(e_interrupted)); return TRUE; } return FALSE; }
0
224,235
R_API bool r_io_bank_update_map_boundaries(RIO *io, const ut32 bankid, const ut32 mapid, ut64 ofrom, ut64 oto) { RIOBank *bank = r_io_bank_get (io, bankid); r_return_val_if_fail (io && bank, false); RListIter *iter; RIOMapRef *mapref; r_list_foreach_prev (bank->maprefs, iter, mapref) { if (mapref->id == mapid) { goto found; } } // map is not referenced by this map return false; found: ;RIOMap *map = r_io_map_get_by_ref (io, mapref); if (!map) { // inconsistent mapref // mapref should be deleted from bank here return false; } if (r_io_map_from (map) == ofrom && r_io_map_to (map) == oto) { // nothing todo here return true; } // allocate sm here to avoid deleting things without ensuring // that this code could at least insert 1 submap RIOSubMap *sm = r_io_submap_new (io, mapref); if (!sm) { return false; } bank->last_used = NULL; // this problem can be divided in 2 steps: // 1. delete corresponding submaps and insert intersecting submaps with lower priority // 2. adjust addr and insert submaps at new addr respecting priority RIOMap fake_map; memcpy (&fake_map, map, sizeof (RIOMap)); fake_map.itv.addr = ofrom; fake_map.itv.size = oto - ofrom + 1; _delete_submaps_from_bank_tree (io, bank, iter, &fake_map); RRBNode *entry = _find_entry_submap_node (bank, sm); if (!entry) { // no intersection here, so just insert sm into the tree and we're done r_crbtree_insert (bank->submaps, sm, _find_sm_by_from_vaddr_cb, NULL); // assumption here is that there is no need to check for return value of r_crbtree_insert, // since it only fails, if allocation fails and a delete was performed before, so it should just be fine return true; } RIOSubMap *bd = (RIOSubMap *)entry->data; // check if sm has higher priority than bd by comparing their maprefs if (_mapref_priority_cmp (bank, &sm->mapref, &bd->mapref) == 1) { // sm has higher priority that bd => adjust bd if (r_io_submap_to (bd) == r_io_submap_to (sm)) { if (r_io_submap_from (bd) >= r_io_submap_from (sm)) { // bc of _find_entry_submap_node, we can be sure, that there is no // lower submap that intersects with sm // // instead of deleting and inserting, just replace the mapref, // similar to r_io_bank_map_priorize memcpy (bd, sm, sizeof (RIOSubMap)); free (sm); } else { r_io_submap_set_to (bd, r_io_submap_from (sm) - 1); r_crbtree_insert (bank->submaps, sm, _find_sm_by_from_vaddr_cb, NULL); } return true; } if (r_io_submap_from (bd) < r_io_submap_from (sm) && r_io_submap_to (sm) < r_io_submap_to (bd)) { RIOSubMap *bdsm = R_NEWCOPY (RIOSubMap, bd); // allocating bdsm here is fine, bc bd is already in the tree r_io_submap_set_from (bdsm, r_io_submap_to (sm) + 1); r_io_submap_set_to (bd, r_io_submap_from (sm) - 1); // What do if this fails? r_crbtree_insert (bank->submaps, sm, _find_sm_by_from_vaddr_cb, NULL); r_crbtree_insert (bank->submaps, bdsm, _find_sm_by_from_vaddr_cb, NULL); return true; } if (r_io_submap_from (bd) < r_io_submap_from (sm)) { r_io_submap_set_to (bd, r_io_submap_from (sm) - 1); entry = r_rbnode_next (entry); } } else { // _mapref_priority_cmp cannot return 0 in this scenario, // since all submaps with the same mapref as sm were deleted from // the submap tree previously. so _mapref_priority_cmp can only return 1 or -1 // bd has higher priority than sm => adjust sm if (r_io_submap_from (bd) <= r_io_submap_from (sm)) { if (r_io_submap_to (sm) <= r_io_submap_to (bd)) { // bd completly overlaps sm => nothing to do free (sm); return true; } // else // adjust sm // r_io_submap_set_from (sm, r_io_submap_to (bd) + 1); } else { if (r_io_submap_to (sm) <= r_io_submap_to (bd)) { r_io_submap_set_to (sm, r_io_submap_from (bd) - 1); if (!r_crbtree_insert (bank->submaps, sm, _find_sm_by_from_vaddr_cb, NULL)) { free (sm); return false; } return true; } RIOSubMap *bdsm = R_NEWCOPY (RIOSubMap, sm); if (!bdsm) { free (sm); return false; } r_io_submap_set_to (bdsm, r_io_submap_from (bd) - 1); // r_io_submap_set_from (sm, r_io_submap_to (bd) + 1); if (!r_crbtree_insert (bank->submaps, bdsm, _find_sm_by_from_vaddr_cb, NULL)) { free (bdsm); free (sm); return false; } // r_io_submap_set_from (sm, r_io_submap_to (bd) + 1); entry = r_rbnode_next (entry); } r_io_submap_set_from (sm, r_io_submap_to (bd) + 1); } // entry = r_rbnode_next (entry); // it is given that entry->data->from >= sm->from on every iteration // so only check for upper boundary of sm for intersection with entry->data while (entry && r_io_submap_to (((RIOSubMap *)entry->data)) <= r_io_submap_to (sm)) { // iterate forwards starting at entry, while entry->data and sm overlap bd = (RIOSubMap *)entry->data; entry = r_rbnode_next (entry); // check if sm has higher priority than bd by comparing their maprefs if (_mapref_priority_cmp (bank, &sm->mapref, &bd->mapref) == 1) { // delete bd r_crbtree_delete (bank->submaps, bd, _find_sm_by_from_vaddr_cb, NULL); } else { // _mapref_priority_cmp cannot return 0 in this scenario, // since all submaps with the same mapref as sm were deleted from // the submap tree previously. so _mapref_priority_cmp can only return 1 or -1 // bd has higher priority than sm => adjust sm if (r_io_submap_from (bd) > r_io_submap_from (sm)) { RIOSubMap *bdsm = R_NEWCOPY (RIOSubMap, sm); r_io_submap_set_to (bdsm, r_io_submap_from (bd) - 1); r_crbtree_insert (bank->submaps, bdsm, _find_sm_by_from_vaddr_cb, NULL); } if (r_io_submap_to (bd) == r_io_submap_to (sm)) { // in this case the size of sm would be 0, // but since empty maps are not allowed free sm and return free (sm); return true; } r_io_submap_set_from (sm, r_io_submap_to (bd) + 1); } } if (!entry) { return r_crbtree_insert (bank->submaps, sm, _find_sm_by_from_vaddr_cb, NULL); } bd = (RIOSubMap *)entry->data; if (_mapref_priority_cmp (bank, &sm->mapref, &bd->mapref) == 1) { if (r_io_submap_from (bd) <= r_io_submap_to (sm)) { r_io_submap_set_from (bd, r_io_submap_to (sm) + 1); } r_crbtree_insert (bank->submaps, sm, _find_sm_by_from_vaddr_cb, NULL); } else { if (r_io_submap_from (sm) < r_io_submap_from (bd)) { if (r_io_submap_from (bd) <= r_io_submap_to (sm)) { r_io_submap_set_to (sm, r_io_submap_from (bd) - 1); } r_crbtree_insert (bank->submaps, sm, _find_sm_by_from_vaddr_cb, NULL); } else { // can this happen? free (sm); } } return true; }
0
413,343
static int netsnmp_session_init(php_snmp_session **session_p, int version, char *hostname, char *community, int timeout, int retries TSRMLS_DC) { php_snmp_session *session; char *pptr, *host_ptr; int force_ipv6 = FALSE; int n; struct sockaddr **psal; struct sockaddr **res; *session_p = (php_snmp_session *)emalloc(sizeof(php_snmp_session)); session = *session_p; if (session == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() failed allocating session"); return (-1); } memset(session, 0, sizeof(php_snmp_session)); snmp_sess_init(session); session->version = version; session->remote_port = SNMP_PORT; session->peername = emalloc(MAX_NAME_LEN); if (session->peername == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "emalloc() failed while copying hostname"); return (-1); } /* we copy original hostname for further processing */ strlcpy(session->peername, hostname, MAX_NAME_LEN); host_ptr = session->peername; /* Reading the hostname and its optional non-default port number */ if (*host_ptr == '[') { /* IPv6 address */ force_ipv6 = TRUE; host_ptr++; if ((pptr = strchr(host_ptr, ']'))) { if (pptr[1] == ':') { session->remote_port = atoi(pptr + 2); } *pptr = '\0'; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "malformed IPv6 address, closing square bracket missing"); return (-1); } } else { /* IPv4 address */ if ((pptr = strchr(host_ptr, ':'))) { session->remote_port = atoi(pptr + 1); *pptr = '\0'; } } /* since Net-SNMP library requires 'udp6:' prefix for all IPv6 addresses (in FQDN form too) we need to perform possible name resolution before running any SNMP queries */ if ((n = php_network_getaddresses(host_ptr, SOCK_DGRAM, &psal, NULL TSRMLS_CC)) == 0) { /* some resolver error */ /* warnings sent, bailing out */ return (-1); } /* we have everything we need in psal, flush peername and fill it properly */ *(session->peername) = '\0'; res = psal; while (n-- > 0) { pptr = session->peername; #if HAVE_GETADDRINFO && HAVE_IPV6 && HAVE_INET_NTOP if (force_ipv6 && (*res)->sa_family != AF_INET6) { res++; continue; } if ((*res)->sa_family == AF_INET6) { strcpy(session->peername, "udp6:["); pptr = session->peername + strlen(session->peername); inet_ntop((*res)->sa_family, &(((struct sockaddr_in6*)(*res))->sin6_addr), pptr, MAX_NAME_LEN); strcat(pptr, "]"); } else if ((*res)->sa_family == AF_INET) { inet_ntop((*res)->sa_family, &(((struct sockaddr_in*)(*res))->sin_addr), pptr, MAX_NAME_LEN); } else { res++; continue; } #else if ((*res)->sa_family != AF_INET) { res++; continue; } strcat(pptr, inet_ntoa(((struct sockaddr_in*)(*res))->sin_addr)); #endif break; } if (strlen(session->peername) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown failure while resolving '%s'", hostname); return (-1); } /* XXX FIXME There should be check for non-empty session->peername! */ /* put back non-standard SNMP port */ if (session->remote_port != SNMP_PORT) { pptr = session->peername + strlen(session->peername); sprintf(pptr, ":%d", session->remote_port); } php_network_freeaddresses(psal); if (version == SNMP_VERSION_3) { /* Setting the security name. */ session->securityName = estrdup(community); session->securityNameLen = strlen(session->securityName); } else { session->authenticator = NULL; session->community = (u_char *)estrdup(community); session->community_len = strlen(community); } session->retries = retries; session->timeout = timeout; return (0); }
0
463,114
static void annotation_get_freespace_total(annotate_state_t *state, struct annotate_entry_list *entry) { uint64_t tavail = 0; uint64_t ttotal = 0; struct buf value = BUF_INITIALIZER; (void) partlist_local_find_freespace_most(0, NULL, NULL, &tavail, &ttotal); buf_printf(&value, "%" PRIuMAX ";%" PRIuMAX, (uintmax_t)tavail, (uintmax_t)ttotal); output_entryatt(state, entry->name, "", &value); buf_free(&value); }
0
249,957
__old_realpath (const char *name, char *resolved) { if (resolved == NULL) { __set_errno (EINVAL); return NULL; } return __realpath (name, resolved); }
0
450,420
static void audio_capture(void *opaque, void *buf, int size) { VncState *vs = opaque; assert(vs->magic == VNC_MAGIC); vnc_lock_output(vs); if (vs->output.offset < vs->throttle_output_offset) { vnc_write_u8(vs, VNC_MSG_SERVER_QEMU); vnc_write_u8(vs, VNC_MSG_SERVER_QEMU_AUDIO); vnc_write_u16(vs, VNC_MSG_SERVER_QEMU_AUDIO_DATA); vnc_write_u32(vs, size); vnc_write(vs, buf, size); } else { trace_vnc_client_throttle_audio(vs, vs->ioc, vs->output.offset); } vnc_unlock_output(vs); vnc_flush(vs); }
0
222,522
Status AddDefaultAttrs(const string& op, const GetFunctionSignature& get_function, AttrValueMap* attrs) { const OpDef* op_def = nullptr; TF_RETURN_IF_ERROR(get_function(op, &op_def)); AttrSlice attr_slice(attrs); for (const auto& attr_def : op_def->attr()) { if (attr_def.has_default_value() && !attr_slice.Find(attr_def.name())) { if (!attrs->insert({attr_def.name(), attr_def.default_value()}).second) { return errors::Internal("Somehow duplicated: ", attr_def.name()); } } } return Status::OK(); }
0
366,285
static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) { if (mnt->mnt.mnt_sb->s_flags & SB_NOUSER) return -EINVAL; if (d_is_dir(mp->m_dentry) != d_is_dir(mnt->mnt.mnt_root)) return -ENOTDIR; return attach_recursive_mnt(mnt, p, mp, false); }
0
462,434
destructSess(ptcpsess_t *pSess) { free(pSess->pMsg); free(pSess->epd); prop.Destruct(&pSess->peerName); prop.Destruct(&pSess->peerIP); /* TODO: make these inits compile-time switch depending: */ pSess->pMsg = NULL; pSess->epd = NULL; free(pSess); }
0
376,349
camel_gpg_context_set_always_trust (CamelGpgContext *context, gboolean always_trust) { g_return_if_fail (CAMEL_IS_GPG_CONTEXT (context)); if (context->priv->always_trust == always_trust) return; context->priv->always_trust = always_trust; g_object_notify (G_OBJECT (context), "always-trust"); }
0
369,127
static void ctx_flush_and_put(struct io_ring_ctx *ctx, bool *locked) { if (!ctx) return; if (*locked) { io_submit_flush_completions(ctx); mutex_unlock(&ctx->uring_lock); *locked = false; } percpu_ref_put(&ctx->refs); }
0
343,313
void doestp(void) { struct sockaddr_storage dataconn; socklen_t socksize; char hbuf[NI_MAXHOST]; char pbuf[NI_MAXSERV]; if (passive == 0 || datafd == -1) { addreply_noformat(520, MSG_CANT_PASSIVE); return; } if (xferfd == -1) { opendata(); if (xferfd == -1) { addreply_noformat(425, MSG_CANT_CREATE_DATA_SOCKET); return; } } socksize = (socklen_t) sizeof dataconn; if (getpeername(xferfd, (struct sockaddr *) &dataconn, &socksize) < 0 || getnameinfo((struct sockaddr *) &dataconn, STORAGE_LEN(dataconn), hbuf, sizeof hbuf, pbuf, sizeof pbuf, NI_NUMERICHOST | NI_NUMERICSERV) != 0) { addreply_noformat(425, MSG_GETSOCKNAME_DATA); closedata(); return; } addreply(225, "Connected to (|%c|%s|%s|)", STORAGE_FAMILY(dataconn) == AF_INET6 ? '2' : '1', hbuf, pbuf); }
0
344,260
l_noret luaG_callerror (lua_State *L, const TValue *o) { CallInfo *ci = L->ci; const char *name = NULL; /* to avoid warnings */ const char *kind = funcnamefromcall(L, ci, &name); const char *extra = kind ? formatvarinfo(L, kind, name) : varinfo(L, o); typeerror(L, o, "call", extra); }
0
512,677
Print(Item *item, enum_query_type type) { item->print(this, type); }
0
195,391
void Compute(tensorflow::OpKernelContext* context) override { for (int ngram_width : ngram_widths_) { OP_REQUIRES( context, ngram_width > 0, errors::InvalidArgument("ngram_widths must contain positive values")); } const tensorflow::Tensor* data; OP_REQUIRES_OK(context, context->input("data", &data)); const auto& input_data = data->flat<tstring>().data(); const tensorflow::Tensor* splits; OP_REQUIRES_OK(context, context->input("data_splits", &splits)); const auto& splits_vec = splits->flat<SPLITS_TYPE>(); // Validate that the splits are valid indices into data, only if there are // splits specified. const int input_data_size = data->flat<tstring>().size(); const int splits_vec_size = splits_vec.size(); if (splits_vec_size > 0) { int prev_split = splits_vec(0); OP_REQUIRES(context, prev_split == 0, errors::InvalidArgument("First split value must be 0, got ", prev_split)); for (int i = 1; i < splits_vec_size; ++i) { bool valid_splits = splits_vec(i) >= prev_split; valid_splits = valid_splits && (splits_vec(i) <= input_data_size); OP_REQUIRES(context, valid_splits, errors::InvalidArgument( "Invalid split value ", splits_vec(i), ", must be in [", prev_split, ", ", input_data_size, "]")); prev_split = splits_vec(i); } OP_REQUIRES(context, prev_split == input_data_size, errors::InvalidArgument( "Last split value must be data size. Expected ", input_data_size, ", got ", prev_split)); } int num_batch_items = splits_vec.size() - 1; tensorflow::Tensor* ngrams_splits; OP_REQUIRES_OK( context, context->allocate_output(1, splits->shape(), &ngrams_splits)); auto ngrams_splits_data = ngrams_splits->flat<SPLITS_TYPE>().data(); // If there is no data or size, return an empty RT. if (data->flat<tstring>().size() == 0 || splits_vec.size() == 0) { tensorflow::Tensor* empty; OP_REQUIRES_OK(context, context->allocate_output(0, data->shape(), &empty)); for (int i = 0; i <= num_batch_items; ++i) { ngrams_splits_data[i] = 0; } return; } ngrams_splits_data[0] = 0; for (int i = 1; i <= num_batch_items; ++i) { int length = splits_vec(i) - splits_vec(i - 1); int num_ngrams = 0; for (int ngram_width : ngram_widths_) num_ngrams += get_num_ngrams(length, ngram_width); if (preserve_short_ && length > 0 && num_ngrams == 0) { num_ngrams = 1; } ngrams_splits_data[i] = ngrams_splits_data[i - 1] + num_ngrams; } tensorflow::Tensor* ngrams; OP_REQUIRES_OK( context, context->allocate_output( 0, TensorShape({ngrams_splits_data[num_batch_items]}), &ngrams)); auto ngrams_data = ngrams->flat<tstring>().data(); for (int i = 0; i < num_batch_items; ++i) { auto data_start = &input_data[splits_vec(i)]; int output_start_idx = ngrams_splits_data[i]; for (int ngram_width : ngram_widths_) { auto output_start = &ngrams_data[output_start_idx]; int length = splits_vec(i + 1) - splits_vec(i); int num_ngrams = get_num_ngrams(length, ngram_width); CreateNgrams(data_start, output_start, num_ngrams, ngram_width); output_start_idx += num_ngrams; } // If we're preserving short sequences, check to see if no sequence was // generated by comparing the current output start idx to the original // one (ngram_splits_data). If no ngrams were generated, then they will // be equal (since we increment output_start_idx by num_ngrams every // time we create a set of ngrams.) if (preserve_short_ && output_start_idx == ngrams_splits_data[i]) { int data_length = splits_vec(i + 1) - splits_vec(i); // One legitimate reason to not have any ngrams when preserve_short_ // is true is if the sequence itself is empty. In that case, move on. if (data_length == 0) { continue; } // We don't have to worry about dynamic padding sizes here: if padding // was dynamic, every sequence would have had sufficient padding to // generate at least one ngram. int ngram_width = data_length + 2 * pad_width_; auto output_start = &ngrams_data[output_start_idx]; int num_ngrams = 1; CreateNgrams(data_start, output_start, num_ngrams, ngram_width); } } }
1
289,237
static int snd_pcm_oss_get_rate(struct snd_pcm_oss_file *pcm_oss_file) { struct snd_pcm_substream *substream; int err; err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); if (err < 0) return err; return substream->runtime->oss.rate; }
0
328,953
R_API RBinJavaCPTypeObj *r_bin_java_clone_cp_item(RBinJavaCPTypeObj *obj) { RBinJavaCPTypeObj *clone_obj = NULL; if (!obj) { return clone_obj; } clone_obj = R_NEW0 (RBinJavaCPTypeObj); if (clone_obj) { memcpy (clone_obj, obj, sizeof (RBinJavaCPTypeObj)); clone_obj->metas = (RBinJavaMetaInfo *) R_NEW0 (RBinJavaMetaInfo); clone_obj->metas->type_info = (void *) &R_BIN_JAVA_CP_METAS[clone_obj->tag]; clone_obj->name = strdup (obj->name? obj->name: "unk"); if (obj->tag == R_BIN_JAVA_CP_UTF8) { clone_obj->info.cp_utf8.bytes = (ut8 *) malloc (obj->info.cp_utf8.length + 1); if (clone_obj->info.cp_utf8.bytes) { memcpy (clone_obj->info.cp_utf8.bytes, obj->info.cp_utf8.bytes, clone_obj->info.cp_utf8.length); } else { // TODO: eprintf allocation error } } } return clone_obj; }
0
459,016
http_TimeHeader(struct http *to, const char *fmt, vtim_real now) { char *p; CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); if (to->nhd >= to->shd) { VSLbs(to->vsl, SLT_LostHeader, TOSTRAND(fmt)); http_fail(to); return; } p = WS_Alloc(to->ws, strlen(fmt) + VTIM_FORMAT_SIZE); if (p == NULL) { http_fail(to); VSLbs(to->vsl, SLT_LostHeader, TOSTRAND(fmt)); return; } strcpy(p, fmt); VTIM_format(now, strchr(p, '\0')); http_SetH(to, to->nhd++, p); }
0
252,420
static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, const EXRVersion *version, std::string *err, const unsigned char *buf, size_t size) { const char *marker = reinterpret_cast<const char *>(&buf[0]); if (empty_header) { (*empty_header) = false; } if (version->multipart) { if (size > 0 && marker[0] == '\0') { // End of header list. if (empty_header) { (*empty_header) = true; } return TINYEXR_SUCCESS; } } // According to the spec, the header of every OpenEXR file must contain at // least the following attributes: // // channels chlist // compression compression // dataWindow box2i // displayWindow box2i // lineOrder lineOrder // pixelAspectRatio float // screenWindowCenter v2f // screenWindowWidth float bool has_channels = false; bool has_compression = false; bool has_data_window = false; bool has_display_window = false; bool has_line_order = false; bool has_pixel_aspect_ratio = false; bool has_screen_window_center = false; bool has_screen_window_width = false; info->data_window[0] = 0; info->data_window[1] = 0; info->data_window[2] = 0; info->data_window[3] = 0; info->line_order = 0; // @fixme info->display_window[0] = 0; info->display_window[1] = 0; info->display_window[2] = 0; info->display_window[3] = 0; info->screen_window_center[0] = 0.0f; info->screen_window_center[1] = 0.0f; info->screen_window_width = -1.0f; info->pixel_aspect_ratio = -1.0f; info->tile_size_x = -1; info->tile_size_y = -1; info->tile_level_mode = -1; info->tile_rounding_mode = -1; info->attributes.clear(); // Read attributes size_t orig_size = size; for (size_t nattr = 0; nattr < TINYEXR_MAX_HEADER_ATTRIBUTES; nattr++) { if (0 == size) { if (err) { (*err) += "Insufficient data size for attributes.\n"; } return TINYEXR_ERROR_INVALID_DATA; } else if (marker[0] == '\0') { size--; break; } std::string attr_name; std::string attr_type; std::vector<unsigned char> data; size_t marker_size; if (!tinyexr::ReadAttribute(&attr_name, &attr_type, &data, &marker_size, marker, size)) { if (err) { (*err) += "Failed to read attribute.\n"; } return TINYEXR_ERROR_INVALID_DATA; } marker += marker_size; size -= marker_size; if (version->tiled && attr_name.compare("tiles") == 0) { unsigned int x_size, y_size; unsigned char tile_mode; assert(data.size() == 9); memcpy(&x_size, &data.at(0), sizeof(int)); memcpy(&y_size, &data.at(4), sizeof(int)); tile_mode = data[8]; tinyexr::swap4(&x_size); tinyexr::swap4(&y_size); info->tile_size_x = static_cast<int>(x_size); info->tile_size_y = static_cast<int>(y_size); // mode = levelMode + roundingMode * 16 info->tile_level_mode = tile_mode & 0x3; info->tile_rounding_mode = (tile_mode >> 4) & 0x1; } else if (attr_name.compare("compression") == 0) { bool ok = false; if (data[0] < TINYEXR_COMPRESSIONTYPE_PIZ) { ok = true; } if (data[0] == TINYEXR_COMPRESSIONTYPE_PIZ) { #if TINYEXR_USE_PIZ ok = true; #else if (err) { (*err) = "PIZ compression is not supported."; } return TINYEXR_ERROR_UNSUPPORTED_FORMAT; #endif } if (data[0] == TINYEXR_COMPRESSIONTYPE_ZFP) { #if TINYEXR_USE_ZFP ok = true; #else if (err) { (*err) = "ZFP compression is not supported."; } return TINYEXR_ERROR_UNSUPPORTED_FORMAT; #endif } if (!ok) { if (err) { (*err) = "Unknown compression type."; } return TINYEXR_ERROR_UNSUPPORTED_FORMAT; } info->compression_type = static_cast<int>(data[0]); has_compression = true; } else if (attr_name.compare("channels") == 0) { // name: zero-terminated string, from 1 to 255 bytes long // pixel type: int, possible values are: UINT = 0 HALF = 1 FLOAT = 2 // pLinear: unsigned char, possible values are 0 and 1 // reserved: three chars, should be zero // xSampling: int // ySampling: int if (!ReadChannelInfo(info->channels, data)) { if (err) { (*err) += "Failed to parse channel info.\n"; } return TINYEXR_ERROR_INVALID_DATA; } if (info->channels.size() < 1) { if (err) { (*err) += "# of channels is zero.\n"; } return TINYEXR_ERROR_INVALID_DATA; } has_channels = true; } else if (attr_name.compare("dataWindow") == 0) { if (data.size() >= 16) { memcpy(&info->data_window[0], &data.at(0), sizeof(int)); memcpy(&info->data_window[1], &data.at(4), sizeof(int)); memcpy(&info->data_window[2], &data.at(8), sizeof(int)); memcpy(&info->data_window[3], &data.at(12), sizeof(int)); tinyexr::swap4(reinterpret_cast<unsigned int *>(&info->data_window[0])); tinyexr::swap4(reinterpret_cast<unsigned int *>(&info->data_window[1])); tinyexr::swap4(reinterpret_cast<unsigned int *>(&info->data_window[2])); tinyexr::swap4(reinterpret_cast<unsigned int *>(&info->data_window[3])); has_data_window = true; } } else if (attr_name.compare("displayWindow") == 0) { if (data.size() >= 16) { memcpy(&info->display_window[0], &data.at(0), sizeof(int)); memcpy(&info->display_window[1], &data.at(4), sizeof(int)); memcpy(&info->display_window[2], &data.at(8), sizeof(int)); memcpy(&info->display_window[3], &data.at(12), sizeof(int)); tinyexr::swap4( reinterpret_cast<unsigned int *>(&info->display_window[0])); tinyexr::swap4( reinterpret_cast<unsigned int *>(&info->display_window[1])); tinyexr::swap4( reinterpret_cast<unsigned int *>(&info->display_window[2])); tinyexr::swap4( reinterpret_cast<unsigned int *>(&info->display_window[3])); has_display_window = true; } } else if (attr_name.compare("lineOrder") == 0) { if (data.size() >= 1) { info->line_order = static_cast<int>(data[0]); has_line_order = true; } } else if (attr_name.compare("pixelAspectRatio") == 0) { if (data.size() >= sizeof(float)) { memcpy(&info->pixel_aspect_ratio, &data.at(0), sizeof(float)); tinyexr::swap4( reinterpret_cast<unsigned int *>(&info->pixel_aspect_ratio)); has_pixel_aspect_ratio = true; } } else if (attr_name.compare("screenWindowCenter") == 0) { if (data.size() >= 8) { memcpy(&info->screen_window_center[0], &data.at(0), sizeof(float)); memcpy(&info->screen_window_center[1], &data.at(4), sizeof(float)); tinyexr::swap4( reinterpret_cast<unsigned int *>(&info->screen_window_center[0])); tinyexr::swap4( reinterpret_cast<unsigned int *>(&info->screen_window_center[1])); has_screen_window_center = true; } } else if (attr_name.compare("screenWindowWidth") == 0) { if (data.size() >= sizeof(float)) { memcpy(&info->screen_window_width, &data.at(0), sizeof(float)); tinyexr::swap4( reinterpret_cast<unsigned int *>(&info->screen_window_width)); has_screen_window_width = true; } } else if (attr_name.compare("chunkCount") == 0) { if (data.size() >= sizeof(int)) { memcpy(&info->chunk_count, &data.at(0), sizeof(int)); tinyexr::swap4(reinterpret_cast<unsigned int *>(&info->chunk_count)); } } else { // Custom attribute(up to TINYEXR_MAX_CUSTOM_ATTRIBUTES) if (info->attributes.size() < TINYEXR_MAX_CUSTOM_ATTRIBUTES) { EXRAttribute attrib; #ifdef _MSC_VER strncpy_s(attrib.name, attr_name.c_str(), 255); strncpy_s(attrib.type, attr_type.c_str(), 255); #else strncpy(attrib.name, attr_name.c_str(), 255); strncpy(attrib.type, attr_type.c_str(), 255); #endif attrib.name[255] = '\0'; attrib.type[255] = '\0'; attrib.size = static_cast<int>(data.size()); attrib.value = static_cast<unsigned char *>(malloc(data.size())); memcpy(reinterpret_cast<char *>(attrib.value), &data.at(0), data.size()); info->attributes.push_back(attrib); } } } // Check if required attributes exist { std::stringstream ss_err; if (!has_compression) { ss_err << "\"compression\" attribute not found in the header." << std::endl; } if (!has_channels) { ss_err << "\"channels\" attribute not found in the header." << std::endl; } if (!has_line_order) { ss_err << "\"lineOrder\" attribute not found in the header." << std::endl; } if (!has_display_window) { ss_err << "\"displayWindow\" attribute not found in the header." << std::endl; } if (!has_data_window) { ss_err << "\"dataWindow\" attribute not found in the header or invalid." << std::endl; } if (!has_pixel_aspect_ratio) { ss_err << "\"pixelAspectRatio\" attribute not found in the header." << std::endl; } if (!has_screen_window_width) { ss_err << "\"screenWindowWidth\" attribute not found in the header." << std::endl; } if (!has_screen_window_center) { ss_err << "\"screenWindowCenter\" attribute not found in the header." << std::endl; } if (!(ss_err.str().empty())) { if (err) { (*err) += ss_err.str(); } return TINYEXR_ERROR_INVALID_HEADER; } } info->header_len = static_cast<unsigned int>(orig_size - size); return TINYEXR_SUCCESS; }
0
512,786
uint32 max_display_length() const { return field->max_display_length(); }
0
301,420
static bool vfswrap_is_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname, SMB_STRUCT_STAT *sbuf) { NTSTATUS status; char *path; bool offline = false; if (ISDOT(fname->base_name) || ISDOTDOT(fname->base_name)) { return false; } if (!lp_dmapi_support(SNUM(handle->conn)) || !dmapi_have_session()) { #if defined(ENOTSUP) errno = ENOTSUP; #endif return false; } status = get_full_smb_filename(talloc_tos(), fname, &path); if (!NT_STATUS_IS_OK(status)) { errno = map_errno_from_nt_status(status); return false; } offline = (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0; TALLOC_FREE(path); return offline; }
0
482,504
compileString(const char *inString, TranslationTableHeader **table, DisplayTableHeader **displayTable) { /* This function can be used to make changes to tables on the fly. */ int k; FileInfo file; if (inString == NULL) return 0; memset(&file, 0, sizeof(file)); file.fileName = inString; file.encoding = noEncoding; file.lineNumber = 1; file.status = 0; file.linepos = 0; for (k = 0; inString[k]; k++) file.line[k] = inString[k]; file.line[k] = 0; file.linelen = k; if (table && *table && (*table)->finalized) { compileError(&file, "Table is finalized"); return 0; } return compileRule(&file, table, displayTable, NULL); }
0
274,862
TEST(ComparisonsTest, LessFloat) { ComparisonOpModel model({1, 1, 1, 4}, {1, 1, 1, 4}, TensorType_FLOAT32, BuiltinOperator_LESS); model.PopulateTensor<float>(model.input1(), {0.1, 0.9, 0.7, 0.3}); model.PopulateTensor<float>(model.input2(), {0.1, 0.2, 0.6, 0.5}); model.Invoke(); EXPECT_THAT(model.GetOutput(), ElementsAre(false, false, false, true)); EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 1, 4)); }
0
274,651
callbacks_drawingarea_button_press_event (GtkWidget *widget, GdkEventButton *event) { GdkWindow *drawing_area_window = screen.drawing_area->window; GdkCursor *cursor; switch (event->button) { case 1 : if (screen.tool == POINTER) { /* select */ /* selection will only work with cairo, so do nothing if it's not compiled */ screen.state = IN_SELECTION_DRAG; screen.start_x = event->x; screen.start_y = event->y; } else if (screen.tool == PAN) { /* Plain panning */ screen.state = IN_MOVE; screen.last_x = event->x; screen.last_y = event->y; } else if (screen.tool == ZOOM) { screen.state = IN_ZOOM_OUTLINE; /* Zoom outline mode initiated */ screen.start_x = event->x; screen.start_y = event->y; screen.centered_outline_zoom = event->state; } else if (screen.tool == MEASURE) { screen.state = IN_MEASURE; callbacks_screen2board(&(screen.measure_start_x), &(screen.measure_start_y), event->x, event->y); screen.measure_stop_x = screen.measure_start_x; screen.measure_stop_y = screen.measure_start_y; /* force an expose event to clear any previous measure lines */ callbacks_force_expose_event_for_screen (); } break; case 2 : screen.state = IN_MOVE; screen.last_x = event->x; screen.last_y = event->y; cursor = gdk_cursor_new(GDK_FLEUR); gdk_window_set_cursor(drawing_area_window, cursor); gdk_cursor_destroy(cursor); break; case 3 : if (screen.tool == POINTER) { /* if no items are selected, try and find the item the user is pointing at */ if (selection_length (&screen.selectionInfo) == 0) { gint index=callbacks_get_selected_row_index(); if ((index >= 0) && (index <= mainProject->last_loaded) && (mainProject->file[index]->isVisible)) { render_fill_selection_buffer_from_mouse_click( event->x, event->y, index, SELECTION_REPLACE); } else { selection_clear (&screen.selectionInfo); update_selected_object_message (FALSE); render_refresh_rendered_image_on_screen (); } } /* only show the popup if we actually have something selected now */ if (selection_length (&screen.selectionInfo) != 0) { update_selected_object_message (TRUE); gtk_menu_popup(GTK_MENU(screen.win.drawWindowPopupMenu), NULL, NULL, NULL, NULL, event->button, event->time); } } else { /* Zoom outline mode initiated */ screen.state = IN_ZOOM_OUTLINE; screen.start_x = event->x; screen.start_y = event->y; screen.centered_outline_zoom = event->state & GDK_SHIFT_MASK; cursor = gdk_cursor_new(GDK_SIZING); gdk_window_set_cursor(drawing_area_window, cursor); gdk_cursor_destroy(cursor); } break; case 4 : /* Scroll wheel */ render_zoom_display (ZOOM_IN_CMOUSE, 0, event->x, event->y); break; case 5 : /* Scroll wheel */ render_zoom_display (ZOOM_OUT_CMOUSE, 0, event->x, event->y); break; default: break; } callbacks_switch_to_correct_cursor (); return TRUE; }
0
195,741
bool SingleComponentLSScan::ParseMCU(void) { #if ACCUSOFT_CODE int lines = m_ulRemaining[0]; // total number of MCU lines processed. UBYTE preshift = m_ucLowBit + FractionalColorBitsOf(); struct Line *line = CurrentLine(0); // // If a DNL marker is present, the number of remaining lines is zero. Fix it. if (m_pFrame->HeightOf() == 0) { assert(lines == 0); lines = 8; } assert(m_ucCount == 1); // // A "MCU" in respect to the code organization is eight lines. if (lines > 8) { lines = 8; } if (m_pFrame->HeightOf() > 0) m_ulRemaining[0] -= lines; assert(lines > 0); // Loop over lines and columns do { LONG length = m_ulWidth[0]; LONG *lp = line->m_pData; #ifdef DEBUG_LS int xpos = 0; static int linenumber = 0; printf("\n%4d : ",++linenumber); #endif StartLine(0); if (BeginReadMCU(m_Stream.ByteStreamOf())) { // No error handling strategy. No RST in scans. Bummer! do { LONG a,b,c,d; // neighbouring values. LONG d1,d2,d3; // local gradients. GetContext(0,a,b,c,d); d1 = d - b; // compute local gradients d2 = b - c; d3 = c - a; if (isRunMode(d1,d2,d3)) { LONG run = DecodeRun(length,m_lRunIndex[0]); // // Now fill the data. while(run) { // Update so that the next process gets the correct value. UpdateContext(0,a); // And insert the value into the target line as well. *lp++ = a << preshift; #ifdef DEBUG_LS printf("%4d:<%2x> ",xpos++,a); #endif run--,length--; // As long as there are pixels on the line. } // // More data on the line? I.e. the run did not cover the full m_lJ samples? // Now decode the run interruption sample. if (length) { bool negative; // the sign variable bool rtype; // run interruption type LONG errval; // the prediction error LONG merr; // the mapped error (symbol) LONG rx; // the reconstructed value UBYTE k; // golomb parameter // Get the neighbourhood. GetContext(0,a,b,c,d); // Get the prediction mode. rtype = InterruptedPredictionMode(negative,a,b); // Get the golomb parameter for run interruption coding. k = GolombParameter(rtype); // Golomb-decode the error symbol. merr = GolombDecode(k,m_lLimit - m_lJ[m_lRunIndex[0]] - 1); // Inverse the error mapping procedure. errval = InverseErrorMapping(merr + rtype,ErrorMappingOffset(rtype,rtype || merr,k)); // Compute the reconstructed value. rx = Reconstruct(negative,rtype?a:b,errval); // Update so that the next process gets the correct value. UpdateContext(0,rx); // Fill in the value into the line *lp = rx << preshift; #ifdef DEBUG_LS printf("%4d:<%2x> ",xpos++,*lp); #endif // Update the variables of the run mode. UpdateState(rtype,errval); // Update the run index now. This is not part of // EncodeRun because the non-reduced run-index is // required for the golomb coder length limit. if (m_lRunIndex[0] > 0) m_lRunIndex[0]--; } else break; // end of line. } else { UWORD ctxt; bool negative; // the sign variable. LONG px; // the predicted variable. LONG rx; // the reconstructed value. LONG errval; // the error value. LONG merr; // the mapped error value. UBYTE k; // the Golomb parameter. // Quantize the gradients. d1 = QuantizedGradient(d1); d2 = QuantizedGradient(d2); d3 = QuantizedGradient(d3); // Compute the context. ctxt = Context(negative,d1,d2,d3); // Compute the predicted value. px = Predict(a,b,c); // Correct the prediction. px = CorrectPrediction(ctxt,negative,px); // Compute the golomb parameter k from the context. k = GolombParameter(ctxt); // Decode the error symbol. merr = GolombDecode(k,m_lLimit); // Inverse the error symbol into an error value. errval = InverseErrorMapping(merr,ErrorMappingOffset(ctxt,k)); // Update the variables. UpdateState(ctxt,errval); // Compute the reconstructed value. rx = Reconstruct(negative,px,errval); // Update so that the next process gets the correct value. UpdateContext(0,rx); // And insert the value into the target line as well. *lp = rx << preshift; #ifdef DEBUG_LS printf("%4d:<%2x> ",xpos++,*lp); #endif } } while(++lp,--length); } // No error handling here. EndLine(0); line = line->m_pNext; } while(--lines); // // If this is the last line, gobble up all the // bits from bitstuffing the last byte may have left. // As SkipStuffing is idempotent, we can also do that // all the time. m_Stream.SkipStuffing(); #endif return false; }
1
385,818
int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) { struct inode *inode = file_inode(file); long ret; if (offset < 0 || len <= 0) return -EINVAL; /* Return error if mode is not supported */ if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP; /* Punch hole must have keep size set */ if ((mode & FALLOC_FL_PUNCH_HOLE) && !(mode & FALLOC_FL_KEEP_SIZE)) return -EOPNOTSUPP; if (!(file->f_mode & FMODE_WRITE)) return -EBADF; /* It's not possible punch hole on append only file */ if (mode & FALLOC_FL_PUNCH_HOLE && IS_APPEND(inode)) return -EPERM; if (IS_IMMUTABLE(inode)) return -EPERM; /* * Revalidate the write permissions, in case security policy has * changed since the files were opened. */ ret = security_file_permission(file, MAY_WRITE); if (ret) return ret; if (S_ISFIFO(inode->i_mode)) return -ESPIPE; /* * Let individual file system decide if it supports preallocation * for directories or not. */ if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) return -ENODEV; /* Check for wrap through zero too */ if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0)) return -EFBIG; if (!file->f_op->fallocate) return -EOPNOTSUPP; sb_start_write(inode->i_sb); ret = file->f_op->fallocate(file, mode, offset, len); sb_end_write(inode->i_sb); return ret; }
0
329,920
_cairo_image_scaled_glyph_fini (cairo_scaled_font_t *scaled_font, cairo_scaled_glyph_t *scaled_glyph) { }
0
503,989
auth_request_get_var_expand_table(const struct auth_request *auth_request, auth_request_escape_func_t *escape_func) { unsigned int count = 0; return auth_request_get_var_expand_table_full(auth_request, escape_func, &count); }
0
312,437
qf_entry_on_or_before_pos(qfline_T *qfp, pos_T *pos, int linewise) { if (linewise) return qfp->qf_lnum <= pos->lnum; else return (qfp->qf_lnum < pos->lnum || (qfp->qf_lnum == pos->lnum && qfp->qf_col <= pos->col)); }
0
252,463
mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32) { mz_uint16 method = 0, dos_time = 0, dos_date = 0; mz_uint level, ext_attributes = 0, num_alignment_padding_bytes; mz_uint64 local_dir_header_ofs = pZip->m_archive_size, cur_archive_file_ofs = pZip->m_archive_size, comp_size = 0; size_t archive_name_size; mz_uint8 local_dir_header[MZ_ZIP_LOCAL_DIR_HEADER_SIZE]; tdefl_compressor *pComp = NULL; mz_bool store_data_uncompressed; mz_zip_internal_state *pState; if ((int)level_and_flags < 0) level_and_flags = MZ_DEFAULT_LEVEL; level = level_and_flags & 0xF; store_data_uncompressed = ((!level) || (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)); if ((!pZip) || (!pZip->m_pState) || (pZip->m_zip_mode != MZ_ZIP_MODE_WRITING) || ((buf_size) && (!pBuf)) || (!pArchive_name) || ((comment_size) && (!pComment)) || (pZip->m_total_files == 0xFFFF) || (level > MZ_UBER_COMPRESSION)) return MZ_FALSE; pState = pZip->m_pState; if ((!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) && (uncomp_size)) return MZ_FALSE; // No zip64 support yet if ((buf_size > 0xFFFFFFFF) || (uncomp_size > 0xFFFFFFFF)) return MZ_FALSE; if (!mz_zip_writer_validate_archive_name(pArchive_name)) return MZ_FALSE; #ifndef MINIZ_NO_TIME { time_t cur_time; time(&cur_time); mz_zip_time_to_dos_time(cur_time, &dos_time, &dos_date); } #endif // #ifndef MINIZ_NO_TIME archive_name_size = strlen(pArchive_name); if (archive_name_size > 0xFFFF) return MZ_FALSE; num_alignment_padding_bytes = mz_zip_writer_compute_padding_needed_for_file_alignment(pZip); // no zip64 support yet if ((pZip->m_total_files == 0xFFFF) || ((pZip->m_archive_size + num_alignment_padding_bytes + MZ_ZIP_LOCAL_DIR_HEADER_SIZE + MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + comment_size + archive_name_size) > 0xFFFFFFFF)) return MZ_FALSE; if ((archive_name_size) && (pArchive_name[archive_name_size - 1] == '/')) { // Set DOS Subdirectory attribute bit. ext_attributes |= 0x10; // Subdirectories cannot contain data. if ((buf_size) || (uncomp_size)) return MZ_FALSE; } // Try to do any allocations before writing to the archive, so if an // allocation fails the file remains unmodified. (A good idea if we're doing // an in-place modification.) if ((!mz_zip_array_ensure_room( pZip, &pState->m_central_dir, MZ_ZIP_CENTRAL_DIR_HEADER_SIZE + archive_name_size + comment_size)) || (!mz_zip_array_ensure_room(pZip, &pState->m_central_dir_offsets, 1))) return MZ_FALSE; if ((!store_data_uncompressed) && (buf_size)) { if (NULL == (pComp = (tdefl_compressor *)pZip->m_pAlloc( pZip->m_pAlloc_opaque, 1, sizeof(tdefl_compressor)))) return MZ_FALSE; } if (!mz_zip_writer_write_zeros( pZip, cur_archive_file_ofs, num_alignment_padding_bytes + sizeof(local_dir_header))) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); return MZ_FALSE; } local_dir_header_ofs += num_alignment_padding_bytes; if (pZip->m_file_offset_alignment) { MZ_ASSERT((local_dir_header_ofs & (pZip->m_file_offset_alignment - 1)) == 0); } cur_archive_file_ofs += num_alignment_padding_bytes + sizeof(local_dir_header); MZ_CLEAR_OBJ(local_dir_header); if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pArchive_name, archive_name_size) != archive_name_size) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); return MZ_FALSE; } cur_archive_file_ofs += archive_name_size; if (!(level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA)) { uncomp_crc32 = (mz_uint32)mz_crc32(MZ_CRC32_INIT, (const mz_uint8 *)pBuf, buf_size); uncomp_size = buf_size; if (uncomp_size <= 3) { level = 0; store_data_uncompressed = MZ_TRUE; } } if (store_data_uncompressed) { if (pZip->m_pWrite(pZip->m_pIO_opaque, cur_archive_file_ofs, pBuf, buf_size) != buf_size) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); return MZ_FALSE; } cur_archive_file_ofs += buf_size; comp_size = buf_size; if (level_and_flags & MZ_ZIP_FLAG_COMPRESSED_DATA) method = MZ_DEFLATED; } else if (buf_size) { mz_zip_writer_add_state state; state.m_pZip = pZip; state.m_cur_archive_file_ofs = cur_archive_file_ofs; state.m_comp_size = 0; if ((tdefl_init(pComp, mz_zip_writer_add_put_buf_callback, &state, tdefl_create_comp_flags_from_zip_params( level, -15, MZ_DEFAULT_STRATEGY)) != TDEFL_STATUS_OKAY) || (tdefl_compress_buffer(pComp, pBuf, buf_size, TDEFL_FINISH) != TDEFL_STATUS_DONE)) { pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); return MZ_FALSE; } comp_size = state.m_comp_size; cur_archive_file_ofs = state.m_cur_archive_file_ofs; method = MZ_DEFLATED; } pZip->m_pFree(pZip->m_pAlloc_opaque, pComp); pComp = NULL; // no zip64 support yet if ((comp_size > 0xFFFFFFFF) || (cur_archive_file_ofs > 0xFFFFFFFF)) return MZ_FALSE; if (!mz_zip_writer_create_local_dir_header( pZip, local_dir_header, (mz_uint16)archive_name_size, 0, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date)) return MZ_FALSE; if (pZip->m_pWrite(pZip->m_pIO_opaque, local_dir_header_ofs, local_dir_header, sizeof(local_dir_header)) != sizeof(local_dir_header)) return MZ_FALSE; if (!mz_zip_writer_add_to_central_dir( pZip, pArchive_name, (mz_uint16)archive_name_size, NULL, 0, pComment, comment_size, uncomp_size, comp_size, uncomp_crc32, method, 0, dos_time, dos_date, local_dir_header_ofs, ext_attributes)) return MZ_FALSE; pZip->m_total_files++; pZip->m_archive_size = cur_archive_file_ofs; return MZ_TRUE; }
0
348,434
static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, const char *fp, int count) { struct mkiss *ax = mkiss_get(tty); if (!ax) return; /* * Argh! mtu change time! - costs us the packet part received * at the change */ if (ax->mtu != ax->dev->mtu + 73) ax_changedmtu(ax); /* Read the characters out of the buffer */ while (count--) { if (fp != NULL && *fp++) { if (!test_and_set_bit(AXF_ERROR, &ax->flags)) ax->dev->stats.rx_errors++; cp++; continue; } kiss_unesc(ax, *cp++); } mkiss_put(ax); tty_unthrottle(tty); }
0
359,289
DEFUN (clear_ip_bgp_peer, clear_ip_bgp_peer_cmd, "clear ip bgp (A.B.C.D|X:X::X:X)", CLEAR_STR IP_STR BGP_STR "BGP neighbor IP address to clear\n" "BGP IPv6 neighbor to clear\n") { return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); }
0
210,896
void *memslot_get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size, int group_id) { int slot_id; int generation; unsigned long h_virt; MemSlot *slot; if (group_id > info->num_memslots_groups) { spice_critical("group_id too big"); return NULL; } slot_id = memslot_get_id(info, addr); if (slot_id > info->num_memslots) { print_memslots(info); spice_critical("slot_id %d too big, addr=%" PRIx64, slot_id, addr); return NULL; } slot = &info->mem_slots[group_id][slot_id]; generation = memslot_get_generation(info, addr); if (generation != slot->generation) { print_memslots(info); spice_critical("address generation is not valid, group_id %d, slot_id %d, " "gen %d, slot_gen %d", group_id, slot_id, generation, slot->generation); return NULL; } h_virt = __get_clean_virt(info, addr); h_virt += slot->address_delta; if (!memslot_validate_virt(info, h_virt, slot_id, add_size, group_id)) { return NULL; } return (void*)(uintptr_t)h_virt; }
1
234,797
void btrfs_close_devices(struct btrfs_fs_devices *fs_devices) { LIST_HEAD(list); struct btrfs_fs_devices *tmp; mutex_lock(&uuid_mutex); close_fs_devices(fs_devices); if (!fs_devices->opened) list_splice_init(&fs_devices->seed_list, &list); list_for_each_entry_safe(fs_devices, tmp, &list, seed_list) { close_fs_devices(fs_devices); list_del(&fs_devices->seed_list); free_fs_devices(fs_devices); } mutex_unlock(&uuid_mutex); }
0
226,322
GF_Err gnrm_box_read(GF_Box *s, GF_BitStream *bs) { return GF_OK; }
0
225,630
GF_Err pcmC_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_PCMConfigBox *ptr = (GF_PCMConfigBox *) s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u8(bs, ptr->format_flags); gf_bs_write_u8(bs, ptr->PCM_sample_size); return GF_OK;
0
405,396
xfrm_pol_inexact_node_alloc(const xfrm_address_t *addr, u8 prefixlen) { struct xfrm_pol_inexact_node *node; node = kzalloc(sizeof(*node), GFP_ATOMIC); if (node) xfrm_pol_inexact_node_init(node, addr, prefixlen); return node; }
0
336,506
static void reds_handle_ssl_accept(int fd, int event, void *data) { RedLinkInfo *link = (RedLinkInfo *)data; RedStreamSslStatus return_code = red_stream_ssl_accept(link->stream); switch (return_code) { case RED_STREAM_SSL_STATUS_ERROR: reds_link_free(link); return; case RED_STREAM_SSL_STATUS_WAIT_FOR_READ: red_watch_update_mask(link->stream->watch, SPICE_WATCH_EVENT_READ); return; case RED_STREAM_SSL_STATUS_WAIT_FOR_WRITE: red_watch_update_mask(link->stream->watch, SPICE_WATCH_EVENT_WRITE); return; case RED_STREAM_SSL_STATUS_OK: red_stream_remove_watch(link->stream); reds_handle_new_link(link); } }
0
332,392
set_ref_in_opfunc(int copyID UNUSED) { int abort = FALSE; abort = set_ref_in_callback(&opfunc_cb, copyID); return abort; }
0
314,776
cdf_read_sector(const cdf_info_t *info, void *buf, size_t offs, size_t len, const cdf_header_t *h, cdf_secid_t id) { size_t ss = CDF_SEC_SIZE(h); size_t pos = CDF_SEC_POS(h, id); assert(ss == len); return cdf_read(info, (off_t)pos, ((char *)buf) + offs, len); }
0
369,210
static struct file *io_file_get_normal(struct io_kiocb *req, int fd) { struct file *file = fget(fd); trace_io_uring_file_get(req->ctx, req, req->user_data, fd); /* we don't allow fixed io_uring files */ if (file && file->f_op == &io_uring_fops) req->flags |= REQ_F_INFLIGHT; return file;
0
205,570
RList *r_bin_ne_get_relocs(r_bin_ne_obj_t *bin) { RList *segments = bin->segments; if (!segments) { return NULL; } RList *entries = bin->entries; if (!entries) { return NULL; } RList *symbols = bin->symbols; if (!symbols) { return NULL; } ut16 *modref = calloc (bin->ne_header->ModRefs, sizeof (ut16)); if (!modref) { return NULL; } r_buf_read_at (bin->buf, (ut64)bin->ne_header->ModRefTable + bin->header_offset, (ut8 *)modref, bin->ne_header->ModRefs * sizeof (ut16)); RList *relocs = r_list_newf (free); if (!relocs) { free (modref); return NULL; } RListIter *it; RBinSection *seg; int index = -1; r_list_foreach (segments, it, seg) { index++; if (!(bin->segment_entries[index].flags & RELOCINFO)) { continue; } ut32 off = seg->paddr + seg->size; ut32 start = off; ut16 length = r_buf_read_le16_at (bin->buf, off); if (!length) { continue; } off += 2; // size_t buf_size = r_buf_size (bin->buf); while (off < start + length * sizeof (NE_image_reloc_item)) { // && off + sizeof (NE_image_reloc_item) < buf_size) NE_image_reloc_item rel = {0}; if (r_buf_read_at (bin->buf, off, (ut8 *)&rel, sizeof (rel)) < 1) { return NULL; } RBinReloc *reloc = R_NEW0 (RBinReloc); if (!reloc) { return NULL; } reloc->paddr = seg->paddr + rel.offset; switch (rel.type) { case LOBYTE: reloc->type = R_BIN_RELOC_8; break; case SEL_16: case OFF_16: reloc->type = R_BIN_RELOC_16; break; case POI_32: case OFF_32: reloc->type = R_BIN_RELOC_32; break; case POI_48: reloc->type = R_BIN_RELOC_64; break; } ut32 offset; if (rel.flags & (IMPORTED_ORD | IMPORTED_NAME)) { RBinImport *imp = R_NEW0 (RBinImport); if (!imp) { free (reloc); break; } char *name; #if NE_BUG if (rel.index > 0 && rel.index < bin->ne_header->ModRefs) { offset = modref[rel.index - 1] + bin->header_offset + bin->ne_header->ImportNameTable; name = __read_nonnull_str_at (bin->buf, offset); } else { name = r_str_newf ("UnknownModule%d_%x", rel.index, off); // ???? } #else if (rel.index > bin->ne_header->ModRefs) { name = r_str_newf ("UnknownModule%d_%x", rel.index, off); // ???? } else { offset = modref[rel.index - 1] + bin->header_offset + bin->ne_header->ImportNameTable; name = __read_nonnull_str_at (bin->buf, offset); } #endif if (rel.flags & IMPORTED_ORD) { imp->ordinal = rel.func_ord; imp->name = r_str_newf ("%s.%s", name, __func_name_from_ord(name, rel.func_ord)); } else { offset = bin->header_offset + bin->ne_header->ImportNameTable + rel.name_off; char *func = __read_nonnull_str_at (bin->buf, offset); imp->name = r_str_newf ("%s.%s", name, func); free (func); } free (name); reloc->import = imp; } else if (rel.flags & OSFIXUP) { // TODO } else { if (strstr (seg->name, "FIXED")) { RBinSection *s = r_list_get_n (segments, rel.segnum - 1); if (s) { offset = s->paddr + rel.segoff; } else { offset = -1; } } else { RBinAddr *entry = r_list_get_n (entries, rel.entry_ordinal - 1); if (entry) { offset = entry->paddr; } else { offset = -1; } } reloc->addend = offset; RBinSymbol *sym = NULL; RListIter *sit; r_list_foreach (symbols, sit, sym) { if (sym->paddr == reloc->addend) { reloc->symbol = sym; break; } } } if (rel.flags & ADDITIVE) { reloc->additive = 1; r_list_append (relocs, reloc); } else { do { #if NE_BUG if (reloc->paddr + 4 < r_buf_size (bin->buf)) { break; } #endif r_list_append (relocs, reloc); offset = r_buf_read_le16_at (bin->buf, reloc->paddr); RBinReloc *tmp = reloc; reloc = R_NEW0 (RBinReloc); if (!reloc) { break; } *reloc = *tmp; reloc->paddr = seg->paddr + offset; } while (offset != 0xFFFF); free (reloc); } off += sizeof (NE_image_reloc_item); } } free (modref); return relocs; }
1
259,601
void HierarchicalBitmapRequester::PostImageHeight(ULONG lines) { BitmapCtrl::PostImageHeight(lines); #if ACCUSOFT_CODE assert(m_pulHeight); if (m_pLargestScale) m_pLargestScale->PostImageHeight(lines); for(UBYTE i = 0;i < m_ucCount;i++) { class Component *comp = m_pFrame->ComponentOf(i); UBYTE suby = comp->SubYOf(); m_pulHeight[i] = (m_ulPixelHeight + suby - 1) / suby; } #endif }
0
226,258
GF_Err fdpa_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GF_FDpacketBox *ptr = (GF_FDpacketBox *) s; if (!s) return GF_BAD_PARAM; e = gf_isom_box_write_header(s, bs); if (e) return e; gf_bs_write_int(bs, ptr->info.sender_current_time_present, 1); gf_bs_write_int(bs, ptr->info.expected_residual_time_present, 1); gf_bs_write_int(bs, ptr->info.session_close_bit, 1); gf_bs_write_int(bs, ptr->info.object_close_bit, 1); gf_bs_write_int(bs, 0, 4); gf_bs_write_u16(bs, ptr->info.transport_object_identifier); gf_bs_write_u16(bs, ptr->header_ext_count); for (i=0; i<ptr->header_ext_count; i++) { gf_bs_write_u8(bs, ptr->headers[i].header_extension_type); if (ptr->headers[i].header_extension_type > 127) { gf_bs_write_data(bs, (const char *) ptr->headers[i].content, 3); } else { gf_bs_write_u8(bs, ptr->headers[i].data_length ? (ptr->headers[i].data_length+2)/4 : 0); if (ptr->headers[i].data_length) { gf_bs_write_data(bs, ptr->headers[i].data, ptr->headers[i].data_length); } } } return GF_OK;
0
474,065
st_insert(register st_table *table, register st_data_t key, st_data_t value) { st_index_t hash_val, bin_pos; register st_table_entry *ptr; if (table->entries_packed) { st_index_t i; for (i = 0; i < table->num_entries; i++) { if ((st_data_t)table->bins[i*2] == key) { table->bins[i*2+1] = (struct st_table_entry*)value; return 1; } } if (MORE_PACKABLE_P(table)) { i = table->num_entries++; table->bins[i*2] = (struct st_table_entry*)key; table->bins[i*2+1] = (struct st_table_entry*)value; return 0; } else { unpack_entries(table); } } hash_val = do_hash(key, table); FIND_ENTRY(table, ptr, hash_val, bin_pos); if (ptr == 0) { ADD_DIRECT(table, key, value, hash_val, bin_pos); return 0; } else { ptr->record = value; return 1; } }
0
225,115
void AddComma(string* s, bool* add_comma) { if (*add_comma) { strings::StrAppend(s, ", "); } else { *add_comma = true; } }
0
309,824
NCURSES_SP_NAME(vid_attr) (NCURSES_SP_DCLx attr_t newmode, NCURSES_PAIRS_T pair_arg, void *opts) { T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), (int) pair_arg)); returnCode(NCURSES_SP_NAME(vid_puts) (NCURSES_SP_ARGx newmode, pair_arg, opts, NCURSES_SP_NAME(_nc_putchar))); }
0
512,703
virtual const char *full_name() const { return name.str ? name.str : "???"; }
0
437,364
setup_tree(Node* node, regex_t* reg, int state, ScanEnv* env) { int r = 0; switch (NODE_TYPE(node)) { case NODE_LIST: { Node* prev = NULL_NODE; do { r = setup_tree(NODE_CAR(node), reg, state, env); if (IS_NOT_NULL(prev) && r == 0) { r = next_setup(prev, NODE_CAR(node), reg); } prev = NODE_CAR(node); } while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node))); } break; case NODE_ALT: do { r = setup_tree(NODE_CAR(node), reg, (state | IN_ALT), env); } while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node))); break; case NODE_STRING: if (IS_IGNORECASE(reg->options) && !NODE_STRING_IS_RAW(node)) { r = expand_case_fold_string(node, reg); } break; case NODE_BACKREF: { int i; int* p; BackRefNode* br = BACKREF_(node); p = BACKREFS_P(br); for (i = 0; i < br->back_num; i++) { if (p[i] > env->num_mem) return ONIGERR_INVALID_BACKREF; MEM_STATUS_ON(env->backrefed_mem, p[i]); MEM_STATUS_ON(env->bt_mem_start, p[i]); #ifdef USE_BACKREF_WITH_LEVEL if (NODE_IS_NEST_LEVEL(node)) { MEM_STATUS_ON(env->bt_mem_end, p[i]); } #endif } } break; case NODE_ENCLOSURE: { EnclosureNode* en = ENCLOSURE_(node); switch (en->type) { case ENCLOSURE_OPTION: { OnigOptionType options = reg->options; reg->options = ENCLOSURE_(node)->o.options; r = setup_tree(NODE_BODY(node), reg, state, env); reg->options = options; } break; case ENCLOSURE_MEMORY: #ifdef USE_CALL state |= en->m.called_state; #endif if ((state & (IN_ALT | IN_NOT | IN_VAR_REPEAT | IN_MULTI_ENTRY)) != 0 || NODE_IS_RECURSION(node)) { MEM_STATUS_ON(env->bt_mem_start, en->m.regnum); } r = setup_tree(NODE_BODY(node), reg, state, env); break; case ENCLOSURE_STOP_BACKTRACK: { Node* target = NODE_BODY(node); r = setup_tree(target, reg, state, env); if (NODE_TYPE(target) == NODE_QUANT) { QuantNode* tqn = QUANT_(target); if (IS_REPEAT_INFINITE(tqn->upper) && tqn->lower <= 1 && tqn->greedy != 0) { /* (?>a*), a*+ etc... */ if (NODE_IS_SIMPLE_TYPE(NODE_BODY(target))) NODE_STATUS_ADD(node, STOP_BT_SIMPLE_REPEAT); } } } break; case ENCLOSURE_IF_ELSE: r = setup_tree(NODE_BODY(node), reg, (state | IN_ALT), env); if (r != 0) return r; if (IS_NOT_NULL(en->te.Then)) { r = setup_tree(en->te.Then, reg, (state | IN_ALT), env); if (r != 0) return r; } if (IS_NOT_NULL(en->te.Else)) r = setup_tree(en->te.Else, reg, (state | IN_ALT), env); break; } } break; case NODE_QUANT: r = setup_quant(node, reg, state, env); break; case NODE_ANCHOR: r = setup_anchor(node, reg, state, env); break; #ifdef USE_CALL case NODE_CALL: #endif case NODE_CTYPE: case NODE_CCLASS: case NODE_GIMMICK: default: break; } return r; }
0
459,213
int tcf_qevent_validate_change(struct tcf_qevent *qe, struct nlattr *block_index_attr, struct netlink_ext_ack *extack) { u32 block_index; int err; if (!block_index_attr) return 0; err = tcf_qevent_parse_block_index(block_index_attr, &block_index, extack); if (err) return err; /* Bounce newly-configured block or change in block. */ if (block_index != qe->info.block_index) { NL_SET_ERR_MSG(extack, "Change of blocks is not supported"); return -EINVAL; } return 0; }
0
335,098
static int skcipher_accept_parent_nokey(void *private, struct sock *sk) { struct skcipher_ctx *ctx; struct alg_sock *ask = alg_sk(sk); struct skcipher_tfm *tfm = private; struct crypto_ablkcipher *skcipher = tfm->skcipher; unsigned int len = sizeof(*ctx) + crypto_ablkcipher_reqsize(skcipher); ctx = sock_kmalloc(sk, len, GFP_KERNEL); if (!ctx) return -ENOMEM; ctx->iv = sock_kmalloc(sk, crypto_ablkcipher_ivsize(skcipher), GFP_KERNEL); if (!ctx->iv) { sock_kfree_s(sk, ctx, len); return -ENOMEM; } memset(ctx->iv, 0, crypto_ablkcipher_ivsize(skcipher)); INIT_LIST_HEAD(&ctx->tsgl); ctx->len = len; ctx->used = 0; ctx->more = 0; ctx->merge = 0; ctx->enc = 0; af_alg_init_completion(&ctx->completion); ask->private = ctx; ablkcipher_request_set_tfm(&ctx->req, skcipher); ablkcipher_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG, af_alg_complete, &ctx->completion); sk->sk_destruct = skcipher_sock_destruct; return 0; }
0
344,256
static int l_strcmp (const TString *ls, const TString *rs) { const char *l = getstr(ls); size_t ll = tsslen(ls); const char *r = getstr(rs); size_t lr = tsslen(rs); for (;;) { /* for each segment */ int temp = strcoll(l, r); if (temp != 0) /* not equal? */ return temp; /* done */ else { /* strings are equal up to a '\0' */ size_t len = strlen(l); /* index of first '\0' in both strings */ if (len == lr) /* 'rs' is finished? */ return (len == ll) ? 0 : 1; /* check 'ls' */ else if (len == ll) /* 'ls' is finished? */ return -1; /* 'ls' is less than 'rs' ('rs' is not finished) */ /* both strings longer than 'len'; go on comparing after the '\0' */ len++; l += len; ll -= len; r += len; lr -= len; } } }
0
500,685
static sftp_message sftp_get_message(sftp_packet packet) { sftp_session sftp = packet->sftp; sftp_message msg = NULL; sftp_enter_function(); msg = sftp_message_new(sftp); if (msg == NULL) { sftp_leave_function(); return NULL; } msg->sftp = packet->sftp; msg->packet_type = packet->type; if ((packet->type != SSH_FXP_STATUS) && (packet->type!=SSH_FXP_HANDLE) && (packet->type != SSH_FXP_DATA) && (packet->type != SSH_FXP_ATTRS) && (packet->type != SSH_FXP_NAME) && (packet->type != SSH_FXP_EXTENDED_REPLY)) { ssh_set_error(packet->sftp->session, SSH_FATAL, "Unknown packet type %d", packet->type); sftp_message_free(msg); sftp_leave_function(); return NULL; } if (buffer_get_u32(packet->payload, &msg->id) != sizeof(uint32_t)) { ssh_set_error(packet->sftp->session, SSH_FATAL, "Invalid packet %d: no ID", packet->type); sftp_message_free(msg); sftp_leave_function(); return NULL; } ssh_log(packet->sftp->session, SSH_LOG_PACKET, "Packet with id %d type %d", msg->id, msg->packet_type); if (buffer_add_data(msg->payload, buffer_get_rest(packet->payload), buffer_get_rest_len(packet->payload)) < 0) { ssh_set_error_oom(sftp->session); sftp_message_free(msg); sftp_leave_function(); return NULL; } sftp_leave_function(); return msg; }
0
310,154
wrap_cursor(NCURSES_SP_DCL0) { if (eat_newline_glitch) { /* * xenl can manifest two different ways. The vt100 way is that, when * you'd expect the cursor to wrap, it stays hung at the right margin * (on top of the character just emitted) and doesn't wrap until the * *next* graphic char is emitted. The c100 way is to ignore LF * received just after an am wrap. * * An aggressive way to handle this would be to emit CR/LF after the * char and then assume the wrap is done, you're on the first position * of the next line, and the terminal out of its weird state. Here * it's safe to just tell the code that the cursor is in hyperspace and * let the next mvcur() call straighten things out. */ SP_PARM->_curscol = -1; SP_PARM->_cursrow = -1; } else if (auto_right_margin) { SP_PARM->_curscol = 0; SP_PARM->_cursrow++; /* * We've actually moved - but may have to work around problems with * video attributes not working. */ if (!move_standout_mode && AttrOf(SCREEN_ATTRS(SP_PARM))) { TR(TRACE_CHARPUT, ("turning off (%#lx) %s before wrapping", (unsigned long) AttrOf(SCREEN_ATTRS(SP_PARM)), _traceattr(AttrOf(SCREEN_ATTRS(SP_PARM))))); VIDPUTS(SP_PARM, A_NORMAL, 0); } } else { SP_PARM->_curscol--; } position_check(NCURSES_SP_ARGx SP_PARM->_cursrow, SP_PARM->_curscol, "wrap_cursor"); }
0
262,022
Proto_RequestNameToType(const gchar *name) { int i; for (i = 0; i < G_N_ELEMENTS(reqNameList); i++) { if (g_strcmp0(name, reqNameList[i].reqName) == 0) { return reqNameList[i].type; } } return PROTO_REQUEST_UNKNOWN; }
0
259,603
void HierarchicalBitmapRequester::AddImageScale(class Frame *frame,bool expandh,bool expandv) { #if ACCUSOFT_CODE if (m_pLargestScale == NULL) { assert(m_pSmallestScale == NULL); assert(expandh == false && expandv == false); // Actually, this is the smallest scale... as it is the first we build. m_pLargestScale = frame->BuildLineAdapter(); m_pSmallestScale = m_pLargestScale; frame->SetImageBuffer(m_pLargestScale); } else { class LineMerger *merger; // Two things need to be build: The adapter to the new band, and the merger // that merges this band with the output and scales the result // apropriately. assert(m_pTempAdapter == NULL); // This object will pull out lines from the new high-pass... m_pTempAdapter = frame->BuildLineAdapter(); // ...and this guy will merge them with what we currently have. merger = new(m_pEnviron) class LineMerger(frame,m_pLargestScale,m_pTempAdapter, expandh,expandv); // // And this becomes the next largest scale. m_pLargestScale = merger; // and controls now the life-time of its children. frame->SetImageBuffer(m_pTempAdapter); m_pTempAdapter = NULL; } #else NOREF(frame); NOREF(expandh); NOREF(expandv); #endif }
0
264,673
lexer_token_is_identifier (parser_context_t *context_p, /**< context */ const char *identifier_p, /**< identifier */ size_t identifier_length) /**< identifier length */ { /* Checking has_escape is unnecessary because memcmp will fail if escape sequences are present. */ return (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL && context_p->token.lit_location.length == identifier_length && memcmp (context_p->token.lit_location.char_p, identifier_p, identifier_length) == 0); } /* lexer_token_is_identifier */
0
492,672
_vte_terminal_clear_above_current (VteTerminal *terminal) { VteRowData *rowdata; long i; VteScreen *screen; screen = terminal->pvt->screen; /* If the cursor is actually on the screen, clear data in the row * which corresponds to the cursor. */ for (i = screen->insert_delta; i < screen->cursor_current.row; i++) { if (_vte_ring_next(screen->row_data) > i) { /* Get the data for the row we're erasing. */ rowdata = _vte_ring_index_writable (screen->row_data, i); g_assert(rowdata != NULL); /* Remove it. */ _vte_row_data_shrink (rowdata, 0); /* Add new cells until we fill the row. */ _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count); rowdata->attr.soft_wrapped = 0; /* Repaint the row. */ _vte_invalidate_cells(terminal, 0, terminal->column_count, i, 1); } } /* We've modified the display. Make a note of it. */ terminal->pvt->text_deleted_flag = TRUE; }
0
221,515
flatpak_run_get_pulse_runtime_dir (void) { const char *val = NULL; val = g_getenv ("PULSE_RUNTIME_PATH"); if (val != NULL) return realpath (val, NULL); { const char *user_runtime_dir = g_get_user_runtime_dir (); if (user_runtime_dir != NULL) { g_autofree char *dir = g_build_filename (user_runtime_dir, "pulse", NULL); if (g_file_test (dir, G_FILE_TEST_IS_DIR)) return realpath (dir, NULL); } } { g_autofree char *pulse_home = flatpak_run_get_pulse_home (); g_autofree char *machine_id = flatpak_run_get_pulse_machine_id (); if (pulse_home != NULL && machine_id != NULL) { /* This is usually a symlink, but we take its realpath() anyway */ g_autofree char *dir = g_strdup_printf ("%s/%s-runtime", pulse_home, machine_id); if (g_file_test (dir, G_FILE_TEST_IS_DIR)) return realpath (dir, NULL); } } return NULL; }
0
301,500
prof_init(void) { for (int i = 0; i <= STATE_FINAL; ++i) { profile_zero(&times[i]); counts[i] = 0; } profile_start(&current); profile_start(&total); }
0
366,204
static bool check_for_nsfs_mounts(struct mount *subtree) { struct mount *p; bool ret = false; lock_mount_hash(); for (p = subtree; p; p = next_mnt(p, subtree)) if (mnt_ns_loop(p->mnt.mnt_root)) goto out; ret = true; out: unlock_mount_hash(); return ret; }
0
231,635
auto& idleTimeout() { return idleTimeout_; }
0
211,522
parse_cmd_address(exarg_T *eap, char **errormsg, int silent) { int address_count = 1; linenr_T lnum; // Repeat for all ',' or ';' separated addresses. for (;;) { eap->line1 = eap->line2; eap->line2 = default_address(eap); eap->cmd = skipwhite(eap->cmd); lnum = get_address(eap, &eap->cmd, eap->addr_type, eap->skip, silent, eap->addr_count == 0, address_count++); if (eap->cmd == NULL) // error detected return FAIL; if (lnum == MAXLNUM) { if (*eap->cmd == '%') // '%' - all lines { ++eap->cmd; switch (eap->addr_type) { case ADDR_LINES: case ADDR_OTHER: eap->line1 = 1; eap->line2 = curbuf->b_ml.ml_line_count; break; case ADDR_LOADED_BUFFERS: { buf_T *buf = firstbuf; while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL) buf = buf->b_next; eap->line1 = buf->b_fnum; buf = lastbuf; while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL) buf = buf->b_prev; eap->line2 = buf->b_fnum; break; } case ADDR_BUFFERS: eap->line1 = firstbuf->b_fnum; eap->line2 = lastbuf->b_fnum; break; case ADDR_WINDOWS: case ADDR_TABS: if (IS_USER_CMDIDX(eap->cmdidx)) { eap->line1 = 1; eap->line2 = eap->addr_type == ADDR_WINDOWS ? LAST_WIN_NR : LAST_TAB_NR; } else { // there is no Vim command which uses '%' and // ADDR_WINDOWS or ADDR_TABS *errormsg = _(e_invalid_range); return FAIL; } break; case ADDR_TABS_RELATIVE: case ADDR_UNSIGNED: case ADDR_QUICKFIX: *errormsg = _(e_invalid_range); return FAIL; case ADDR_ARGUMENTS: if (ARGCOUNT == 0) eap->line1 = eap->line2 = 0; else { eap->line1 = 1; eap->line2 = ARGCOUNT; } break; case ADDR_QUICKFIX_VALID: #ifdef FEAT_QUICKFIX eap->line1 = 1; eap->line2 = qf_get_valid_size(eap); if (eap->line2 == 0) eap->line2 = 1; #endif break; case ADDR_NONE: // Will give an error later if a range is found. break; } ++eap->addr_count; } else if (*eap->cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) { pos_T *fp; // '*' - visual area if (eap->addr_type != ADDR_LINES) { *errormsg = _(e_invalid_range); return FAIL; } ++eap->cmd; if (!eap->skip) { fp = getmark('<', FALSE); if (check_mark(fp) == FAIL) return FAIL; eap->line1 = fp->lnum; fp = getmark('>', FALSE); if (check_mark(fp) == FAIL) return FAIL; eap->line2 = fp->lnum; ++eap->addr_count; } } } else eap->line2 = lnum; eap->addr_count++; if (*eap->cmd == ';') { if (!eap->skip) { curwin->w_cursor.lnum = eap->line2; // Don't leave the cursor on an illegal line or column, but do // accept zero as address, so 0;/PATTERN/ works correctly. if (eap->line2 > 0) check_cursor(); } } else if (*eap->cmd != ',') break; ++eap->cmd; } // One address given: set start and end lines. if (eap->addr_count == 1) { eap->line1 = eap->line2; // ... but only implicit: really no address given if (lnum == MAXLNUM) eap->addr_count = 0; } return OK; }
1
254,064
char* pop(const std::string& name) { char* ret = get(name); if (ret != nullptr) { for (unsigned int i = 0; i < key_value_pairs_.size(); i++) { std::string str_item(key_value_pairs_[i]); if (str_item.substr(0, name.size() + 1) == name + '=') { key_value_pairs_.erase(key_value_pairs_.begin() + i); break; } } } return ret; }
0
219,922
GF_Err gf_isom_hint_sample_description_data(GF_ISOFile *the_file, u32 trackNumber, GF_ISOTrackID SourceTrackID, u32 StreamDescriptionIndex, u16 DataLength, u32 offsetInDescription, u8 AtBegin) { GF_TrackBox *trak; GF_HintSampleEntryBox *entry; u32 count; u16 refIndex; GF_HintPacket *pck; GF_StreamDescDTE *dte; GF_Err e; GF_TrackReferenceTypeBox *hint; trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak || !IsHintTrack(trak)) return GF_BAD_PARAM; e = Media_GetSampleDesc(trak->Media, trak->Media->information->sampleTable->currentEntryIndex, (GF_SampleEntryBox **) &entry, &count); if (e) return e; if (!entry->hint_sample) return GF_BAD_PARAM; count = gf_list_count(entry->hint_sample->packetTable); if (!count) return GF_BAD_PARAM; pck = (GF_HintPacket *)gf_list_get(entry->hint_sample->packetTable, count - 1); dte = (GF_StreamDescDTE *) NewDTE(3); dte->byteOffset = offsetInDescription; dte->dataLength = DataLength; dte->streamDescIndex = StreamDescriptionIndex; if (SourceTrackID == trak->Header->trackID) { dte->trackRefIndex = (s8) -1; } else { //get (or set) the track reference index e = Track_FindRef(trak, GF_ISOM_REF_HINT, &hint); if (e) return e; e = reftype_AddRefTrack(hint, SourceTrackID, &refIndex); if (e) return e; //WARNING: IN QT, MUST BE 0-based !!! dte->trackRefIndex = (u8) (refIndex - 1); } return gf_isom_hint_pck_add_dte(pck, (GF_GenericDTE *)dte, AtBegin); }
0
359,458
DEFUN (clear_bgp_all_rsclient, clear_bgp_all_rsclient_cmd, "clear bgp * rsclient", CLEAR_STR BGP_STR "Clear all peers\n" "Soft reconfig for rsclient RIB\n") { if (argc == 1) return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_RSCLIENT, NULL); return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_RSCLIENT, NULL); }
0
492,678
vte_sequence_handler_cs (VteTerminal *terminal, GValueArray *params) { long start=-1, end=-1, rows; GValue *value; VteScreen *screen; _vte_terminal_home_cursor (terminal); /* We require two parameters. Anything less is a reset. */ screen = terminal->pvt->screen; if ((params == NULL) || (params->n_values < 2)) { screen->scrolling_restricted = FALSE; return; } /* Extract the two values. */ value = g_value_array_get_nth(params, 0); if (G_VALUE_HOLDS_LONG(value)) { start = g_value_get_long(value); } value = g_value_array_get_nth(params, 1); if (G_VALUE_HOLDS_LONG(value)) { end = g_value_get_long(value); } /* Catch garbage. */ rows = terminal->row_count; if (start <= 0 || start >= rows) { start = 0; } if (end <= 0 || end >= rows) { end = rows - 1; } /* Set the right values. */ screen->scrolling_region.start = start; screen->scrolling_region.end = end; screen->scrolling_restricted = TRUE; /* Special case -- run wild, run free. */ if (screen->scrolling_region.start == 0 && screen->scrolling_region.end == rows - 1) { screen->scrolling_restricted = FALSE; } }
0
437,293
print_anchor(FILE* f, int anchor) { int q = 0; fprintf(f, "["); if (anchor & ANCHOR_BEGIN_BUF) { fprintf(f, "begin-buf"); q = 1; } if (anchor & ANCHOR_BEGIN_LINE) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "begin-line"); } if (anchor & ANCHOR_BEGIN_POSITION) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "begin-pos"); } if (anchor & ANCHOR_END_BUF) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "end-buf"); } if (anchor & ANCHOR_SEMI_END_BUF) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "semi-end-buf"); } if (anchor & ANCHOR_END_LINE) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "end-line"); } if (anchor & ANCHOR_ANYCHAR_INF) { if (q) fprintf(f, ", "); q = 1; fprintf(f, "anychar-inf"); } if (anchor & ANCHOR_ANYCHAR_INF_ML) { if (q) fprintf(f, ", "); fprintf(f, "anychar-inf-ml"); } fprintf(f, "]"); }
0
513,106
const Type_handler *type_handler() const { return (*ref)->type_handler(); }
0
474,436
GetQualifiedName( TPMI_DH_OBJECT handle, // IN: handle of the object TPM2B_NAME *qualifiedName // OUT: qualified name of the object ) { OBJECT *object; switch(HandleGetType(handle)) { case TPM_HT_PERMANENT: qualifiedName->t.size = sizeof(TPM_HANDLE); UINT32_TO_BYTE_ARRAY(handle, qualifiedName->t.name); break; case TPM_HT_TRANSIENT: object = HandleToObject(handle); if(object == NULL || object->publicArea.nameAlg == TPM_ALG_NULL) qualifiedName->t.size = 0; else // Copy the name *qualifiedName = object->qualifiedName; break; default: FAIL(FATAL_ERROR_INTERNAL); } return; }
0
512,364
Item_bool(THD *thd, bool i) :Item_int(thd, (longlong) i, 1) { }
0
482,553
putChar(const FileInfo *file, widechar c, TranslationTableHeader **table, TranslationTableOffset *characterOffset) { /* See if a character is in the appropriate table. If not, insert it. In either case, * return a pointer to it. */ TranslationTableCharacter *character; TranslationTableOffset offset; if ((character = getChar(c, *table, characterOffset))) return character; if (!allocateSpaceInTranslationTable(file, &offset, sizeof(*character), table)) return NULL; character = (TranslationTableCharacter *)&(*table)->ruleArea[offset]; memset(character, 0, sizeof(*character)); character->sourceFile = file->sourceFile; character->sourceLine = file->lineNumber; character->value = c; const unsigned long int charHash = _lou_charHash(c); const TranslationTableOffset bucket = (*table)->characters[charHash]; if (!bucket) (*table)->characters[charHash] = offset; else { TranslationTableCharacter *oldchar = (TranslationTableCharacter *)&(*table)->ruleArea[bucket]; while (oldchar->next) oldchar = (TranslationTableCharacter *)&(*table)->ruleArea[oldchar->next]; oldchar->next = offset; } if (characterOffset) *characterOffset = offset; return character; }
0
393,470
static SQInteger get_slice_params(HSQUIRRELVM v,SQInteger &sidx,SQInteger &eidx,SQObjectPtr &o) { SQInteger top = sq_gettop(v); sidx=0; eidx=0; o=stack_get(v,1); if(top>1){ SQObjectPtr &start=stack_get(v,2); if(sq_type(start)!=OT_NULL && sq_isnumeric(start)){ sidx=tointeger(start); } } if(top>2){ SQObjectPtr &end=stack_get(v,3); if(sq_isnumeric(end)){ eidx=tointeger(end); } } else { eidx = sq_getsize(v,1); } return 1; }
0
264,675
lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */ const lexer_lit_location_t *literal_p, /**< literal location */ uint8_t *local_byte_array_p, /**< local byte array to store chars */ lexer_string_options_t opts) /**< options */ { JERRY_ASSERT (context_p->u.allocated_buffer_p == NULL); if (!(literal_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)) { return literal_p->char_p; } uint8_t *destination_start_p; if (literal_p->length > LEXER_MAX_LITERAL_LOCAL_BUFFER_SIZE) { context_p->u.allocated_buffer_p = (uint8_t *) parser_malloc_local (context_p, literal_p->length); context_p->allocated_buffer_size = literal_p->length; destination_start_p = context_p->u.allocated_buffer_p; } else { destination_start_p = local_byte_array_p; } if (literal_p->type == LEXER_IDENT_LITERAL) { lexer_convert_ident_to_cesu8 (destination_start_p, literal_p->char_p, literal_p->length); return destination_start_p; } const uint8_t *source_p = literal_p->char_p; uint8_t *destination_p = destination_start_p; uint8_t str_end_character = source_p[-1]; #if JERRY_ESNEXT if (str_end_character == LIT_CHAR_RIGHT_BRACE) { str_end_character = LIT_CHAR_GRAVE_ACCENT; } bool is_raw = (opts & LEXER_STRING_RAW) != 0; #else /* !JERRY_ESNEXT */ JERRY_UNUSED (opts); bool is_raw = false; #endif /* JERRY_ESNEXT */ while (true) { if (*source_p == str_end_character) { break; } if (*source_p == LIT_CHAR_BACKSLASH && !is_raw) { uint8_t conv_character; source_p++; JERRY_ASSERT (source_p < context_p->source_end_p); /* Newline is ignored. */ if (*source_p == LIT_CHAR_CR) { source_p++; JERRY_ASSERT (source_p < context_p->source_end_p); if (*source_p == LIT_CHAR_LF) { source_p++; } continue; } else if (*source_p == LIT_CHAR_LF) { source_p++; continue; } else if (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p)) { source_p += 3; continue; } if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_3) { lit_code_point_t octal_number = (uint32_t) (*source_p - LIT_CHAR_0); source_p++; JERRY_ASSERT (source_p < context_p->source_end_p); if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7) { octal_number = octal_number * 8 + (uint32_t) (*source_p - LIT_CHAR_0); source_p++; JERRY_ASSERT (source_p < context_p->source_end_p); if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7) { octal_number = octal_number * 8 + (uint32_t) (*source_p - LIT_CHAR_0); source_p++; JERRY_ASSERT (source_p < context_p->source_end_p); } } destination_p += lit_code_point_to_cesu8_bytes (destination_p, octal_number); continue; } if (*source_p >= LIT_CHAR_4 && *source_p <= LIT_CHAR_7) { uint32_t octal_number = (uint32_t) (*source_p - LIT_CHAR_0); source_p++; JERRY_ASSERT (source_p < context_p->source_end_p); if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7) { octal_number = octal_number * 8 + (uint32_t) (*source_p - LIT_CHAR_0); source_p++; JERRY_ASSERT (source_p < context_p->source_end_p); } *destination_p++ = (uint8_t) octal_number; continue; } if (*source_p == LIT_CHAR_LOWERCASE_X || *source_p == LIT_CHAR_LOWERCASE_U) { source_p++; destination_p += lit_code_point_to_cesu8_bytes (destination_p, lexer_unchecked_hex_to_character (&source_p)); continue; } conv_character = *source_p; switch (*source_p) { case LIT_CHAR_LOWERCASE_B: { conv_character = 0x08; break; } case LIT_CHAR_LOWERCASE_T: { conv_character = 0x09; break; } case LIT_CHAR_LOWERCASE_N: { conv_character = 0x0a; break; } case LIT_CHAR_LOWERCASE_V: { conv_character = 0x0b; break; } case LIT_CHAR_LOWERCASE_F: { conv_character = 0x0c; break; } case LIT_CHAR_LOWERCASE_R: { conv_character = 0x0d; break; } } if (conv_character != *source_p) { *destination_p++ = conv_character; source_p++; continue; } } #if JERRY_ESNEXT else if (str_end_character == LIT_CHAR_GRAVE_ACCENT) { if (source_p[0] == LIT_CHAR_DOLLAR_SIGN && source_p[1] == LIT_CHAR_LEFT_BRACE) { source_p++; JERRY_ASSERT (source_p < context_p->source_end_p); break; } if (*source_p == LIT_CHAR_CR) { *destination_p++ = LIT_CHAR_LF; source_p++; if (*source_p != str_end_character && *source_p == LIT_CHAR_LF) { source_p++; } continue; } if ((*source_p == LIT_CHAR_BACKSLASH) && is_raw) { JERRY_ASSERT (source_p + 1 < context_p->source_end_p); if ((*(source_p + 1) == LIT_CHAR_GRAVE_ACCENT) || (*(source_p + 1) == LIT_CHAR_BACKSLASH)) { *destination_p++ = *source_p++; *destination_p++ = *source_p++; continue; } } } #endif /* JERRY_ESNEXT */ if (*source_p >= LIT_UTF8_4_BYTE_MARKER) { /* Processing 4 byte unicode sequence (even if it is * after a backslash). Always converted to two 3 byte * long sequence. */ lit_four_byte_utf8_char_to_cesu8 (destination_p, source_p); destination_p += 6; source_p += 4; continue; } *destination_p++ = *source_p++; /* There is no need to check the source_end_p * since the string is terminated by a quotation mark. */ while (IS_UTF8_INTERMEDIATE_OCTET (*source_p)) { *destination_p++ = *source_p++; } } JERRY_ASSERT (destination_p == destination_start_p + literal_p->length); return destination_start_p; } /* lexer_convert_literal_to_chars */
0
508,908
void LEX::cleanup_lex_after_parse_error(THD *thd) { /* Delete sphead for the side effect of restoring of the original LEX state, thd->lex, thd->mem_root and thd->free_list if they were replaced when parsing stored procedure statements. We will never use sphead object after a parse error, so it's okay to delete it only for the sake of the side effect. TODO: make this functionality explicit in sp_head class. Sic: we must nullify the member of the main lex, not the current one that will be thrown away */ if (thd->lex->sphead) { thd->lex->sphead->restore_thd_mem_root(thd); sp_head::destroy(thd->lex->sphead); thd->lex->sphead= NULL; } }
0
221,498
add_ld_so_conf (FlatpakBwrap *bwrap, GError **error) { const char *contents = "include /run/flatpak/ld.so.conf.d/app-*.conf\n" "include /app/etc/ld.so.conf\n" "/app/lib\n" "include /run/flatpak/ld.so.conf.d/runtime-*.conf\n"; return flatpak_bwrap_add_args_data (bwrap, "ld-so-conf", contents, -1, "/etc/ld.so.conf", error); }
0
226,027
GF_Err void_box_write(GF_Box *s, GF_BitStream *bs) { gf_bs_write_u32(bs, 0); return GF_OK;
0
226,361
GF_Box *tsro_box_new() { ISOM_DECL_BOX_ALLOC(GF_TimeOffHintEntryBox, GF_ISOM_BOX_TYPE_TSRO); return (GF_Box *)tmp;
0
209,802
get_address( exarg_T *eap UNUSED, char_u **ptr, cmd_addr_T addr_type, int skip, // only skip the address, don't use it int silent, // no errors or side effects int to_other_file, // flag: may jump to other file int address_count UNUSED) // 1 for first address, >1 after comma { int c; int i; long n; char_u *cmd; pos_T pos; pos_T *fp; linenr_T lnum; buf_T *buf; cmd = skipwhite(*ptr); lnum = MAXLNUM; do { switch (*cmd) { case '.': // '.' - Cursor position ++cmd; switch (addr_type) { case ADDR_LINES: case ADDR_OTHER: lnum = curwin->w_cursor.lnum; break; case ADDR_WINDOWS: lnum = CURRENT_WIN_NR; break; case ADDR_ARGUMENTS: lnum = curwin->w_arg_idx + 1; break; case ADDR_LOADED_BUFFERS: case ADDR_BUFFERS: lnum = curbuf->b_fnum; break; case ADDR_TABS: lnum = CURRENT_TAB_NR; break; case ADDR_NONE: case ADDR_TABS_RELATIVE: case ADDR_UNSIGNED: addr_error(addr_type); cmd = NULL; goto error; break; case ADDR_QUICKFIX: #ifdef FEAT_QUICKFIX lnum = qf_get_cur_idx(eap); #endif break; case ADDR_QUICKFIX_VALID: #ifdef FEAT_QUICKFIX lnum = qf_get_cur_valid_idx(eap); #endif break; } break; case '$': // '$' - last line ++cmd; switch (addr_type) { case ADDR_LINES: case ADDR_OTHER: lnum = curbuf->b_ml.ml_line_count; break; case ADDR_WINDOWS: lnum = LAST_WIN_NR; break; case ADDR_ARGUMENTS: lnum = ARGCOUNT; break; case ADDR_LOADED_BUFFERS: buf = lastbuf; while (buf->b_ml.ml_mfp == NULL) { if (buf->b_prev == NULL) break; buf = buf->b_prev; } lnum = buf->b_fnum; break; case ADDR_BUFFERS: lnum = lastbuf->b_fnum; break; case ADDR_TABS: lnum = LAST_TAB_NR; break; case ADDR_NONE: case ADDR_TABS_RELATIVE: case ADDR_UNSIGNED: addr_error(addr_type); cmd = NULL; goto error; break; case ADDR_QUICKFIX: #ifdef FEAT_QUICKFIX lnum = qf_get_size(eap); if (lnum == 0) lnum = 1; #endif break; case ADDR_QUICKFIX_VALID: #ifdef FEAT_QUICKFIX lnum = qf_get_valid_size(eap); if (lnum == 0) lnum = 1; #endif break; } break; case '\'': // ''' - mark if (*++cmd == NUL) { cmd = NULL; goto error; } if (addr_type != ADDR_LINES) { addr_error(addr_type); cmd = NULL; goto error; } if (skip) ++cmd; else { // Only accept a mark in another file when it is // used by itself: ":'M". fp = getmark(*cmd, to_other_file && cmd[1] == NUL); ++cmd; if (fp == (pos_T *)-1) // Jumped to another file. lnum = curwin->w_cursor.lnum; else { if (check_mark(fp) == FAIL) { cmd = NULL; goto error; } lnum = fp->lnum; } } break; case '/': case '?': // '/' or '?' - search c = *cmd++; if (addr_type != ADDR_LINES) { addr_error(addr_type); cmd = NULL; goto error; } if (skip) // skip "/pat/" { cmd = skip_regexp(cmd, c, magic_isset()); if (*cmd == c) ++cmd; } else { int flags; pos = curwin->w_cursor; // save curwin->w_cursor // When '/' or '?' follows another address, start from // there. if (lnum != MAXLNUM) curwin->w_cursor.lnum = lnum; // Start a forward search at the end of the line (unless // before the first line). // Start a backward search at the start of the line. // This makes sure we never match in the current // line, and can match anywhere in the // next/previous line. if (c == '/' && curwin->w_cursor.lnum > 0) curwin->w_cursor.col = MAXCOL; else curwin->w_cursor.col = 0; searchcmdlen = 0; flags = silent ? 0 : SEARCH_HIS | SEARCH_MSG; if (!do_search(NULL, c, c, cmd, 1L, flags, NULL)) { curwin->w_cursor = pos; cmd = NULL; goto error; } lnum = curwin->w_cursor.lnum; curwin->w_cursor = pos; // adjust command string pointer cmd += searchcmdlen; } break; case '\\': // "\?", "\/" or "\&", repeat search ++cmd; if (addr_type != ADDR_LINES) { addr_error(addr_type); cmd = NULL; goto error; } if (*cmd == '&') i = RE_SUBST; else if (*cmd == '?' || *cmd == '/') i = RE_SEARCH; else { emsg(_(e_backslash_should_be_followed_by)); cmd = NULL; goto error; } if (!skip) { /* * When search follows another address, start from * there. */ if (lnum != MAXLNUM) pos.lnum = lnum; else pos.lnum = curwin->w_cursor.lnum; /* * Start the search just like for the above * do_search(). */ if (*cmd != '?') pos.col = MAXCOL; else pos.col = 0; pos.coladd = 0; if (searchit(curwin, curbuf, &pos, NULL, *cmd == '?' ? BACKWARD : FORWARD, (char_u *)"", 1L, SEARCH_MSG, i, NULL) != FAIL) lnum = pos.lnum; else { cmd = NULL; goto error; } } ++cmd; break; default: if (VIM_ISDIGIT(*cmd)) // absolute line number lnum = getdigits(&cmd); } for (;;) { cmd = skipwhite(cmd); if (*cmd != '-' && *cmd != '+' && !VIM_ISDIGIT(*cmd)) break; if (lnum == MAXLNUM) { switch (addr_type) { case ADDR_LINES: case ADDR_OTHER: // "+1" is same as ".+1" lnum = curwin->w_cursor.lnum; break; case ADDR_WINDOWS: lnum = CURRENT_WIN_NR; break; case ADDR_ARGUMENTS: lnum = curwin->w_arg_idx + 1; break; case ADDR_LOADED_BUFFERS: case ADDR_BUFFERS: lnum = curbuf->b_fnum; break; case ADDR_TABS: lnum = CURRENT_TAB_NR; break; case ADDR_TABS_RELATIVE: lnum = 1; break; case ADDR_QUICKFIX: #ifdef FEAT_QUICKFIX lnum = qf_get_cur_idx(eap); #endif break; case ADDR_QUICKFIX_VALID: #ifdef FEAT_QUICKFIX lnum = qf_get_cur_valid_idx(eap); #endif break; case ADDR_NONE: case ADDR_UNSIGNED: lnum = 0; break; } } if (VIM_ISDIGIT(*cmd)) i = '+'; // "number" is same as "+number" else i = *cmd++; if (!VIM_ISDIGIT(*cmd)) // '+' is '+1', but '+0' is not '+1' n = 1; else n = getdigits(&cmd); if (addr_type == ADDR_TABS_RELATIVE) { emsg(_(e_invalid_range)); cmd = NULL; goto error; } else if (addr_type == ADDR_LOADED_BUFFERS || addr_type == ADDR_BUFFERS) lnum = compute_buffer_local_count( addr_type, lnum, (i == '-') ? -1 * n : n); else { #ifdef FEAT_FOLDING // Relative line addressing, need to adjust for folded lines // now, but only do it after the first address. if (addr_type == ADDR_LINES && (i == '-' || i == '+') && address_count >= 2) (void)hasFolding(lnum, NULL, &lnum); #endif if (i == '-') lnum -= n; else lnum += n; } } } while (*cmd == '/' || *cmd == '?'); error: *ptr = cmd; return lnum; }
1
448,560
static uint8_t *bgp_notify_encapsulate_hard_reset(uint8_t code, uint8_t subcode, uint8_t *data, size_t datalen) { uint8_t *message = XCALLOC(MTYPE_BGP_NOTIFICATION, datalen + 2); /* ErrCode */ message[0] = code; /* Subcode */ message[1] = subcode; /* Data */ if (datalen) memcpy(message + 2, data, datalen); return message; }
0
255,928
ShapeRefiner::~ShapeRefiner() { // The lifetime of the tensors are bound to the GraphRunner, so the tensors // should be deleted before it. const_tensor_map_.clear(); }
0
484,724
void mobi_buffer_getraw(void *data, MOBIBuffer *buf, const size_t len) { if (!data) { buf->error = MOBI_PARAM_ERR; return; } if (buf->offset + len > buf->maxlen) { debug_print("%s", "End of buffer\n"); buf->error = MOBI_BUFFER_END; return; } memcpy(data, buf->data + buf->offset, len); buf->offset += len; }
0
238,635
int check_ptr_off_reg(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, int regno) { return __check_ptr_off_reg(env, reg, regno, false); }
0
512,945
void fix_charset_and_length(CHARSET_INFO *cs, Derivation dv, Metadata metadata) { /* We have to have a different max_length than 'length' here to ensure that we get the right length if we do use the item to create a new table. In this case max_length must be the maximum number of chars for a string of this type because we in Create_field:: divide the max_length with mbmaxlen). */ collation.set(cs, dv, metadata.repertoire()); fix_char_length(metadata.char_length()); decimals= NOT_FIXED_DEC; }
0
386,560
void DL_Dxf::addMText(DL_CreationInterface* creationInterface) { double angle = 0.0; if (hasValue(50)) { if (libVersion<=0x02000200) { // wrong but compatible with dxflib <=2.0.2.0 (angle stored in rad): angle = getRealValue(50, 0.0); } else { angle = (getRealValue(50, 0.0)*2*M_PI)/360.0; } } else if (hasValue(11) && hasValue(21)) { double x = getRealValue(11, 0.0); double y = getRealValue(21, 0.0); if (fabs(x)<1.0e-6) { if (y>0.0) { angle = M_PI/2.0; } else { angle = M_PI/2.0*3.0; } } else { angle = atan(y/x); } } DL_MTextData d( // insertion point getRealValue(10, 0.0), getRealValue(20, 0.0), getRealValue(30, 0.0), // X direction vector getRealValue(11, 0.0), getRealValue(21, 0.0), getRealValue(31, 0.0), // height getRealValue(40, 2.5), // width getRealValue(41, 0.0), // attachment point getIntValue(71, 1), // drawing direction getIntValue(72, 1), // line spacing style getIntValue(73, 1), // line spacing factor getRealValue(44, 1.0), // text getStringValue(1, ""), // style getStringValue(7, ""), // angle angle); creationInterface->addMText(d); }
0
502,724
SSL_SESSION *SSL_get1_session(SSL *ssl) /* variant of SSL_get_session: caller really gets something */ { SSL_SESSION *sess; /* * Need to lock this all up rather than just use CRYPTO_add so that * somebody doesn't free ssl->session between when we check it's non-null * and when we up the reference count. */ CRYPTO_w_lock(CRYPTO_LOCK_SSL_SESSION); sess = ssl->session; if (sess) sess->references++; CRYPTO_w_unlock(CRYPTO_LOCK_SSL_SESSION); return (sess); }
0
512,371
Item_int(THD *thd, longlong i,size_t length= MY_INT64_NUM_DECIMAL_DIGITS): Item_num(thd), value(i) { max_length=(uint32)length; }
0
390,559
_XkbFindNamedIndicatorMap(XkbSrvLedInfoPtr sli, Atom indicator, int *led_return) { XkbIndicatorMapPtr map; int led; /* search for the right indicator */ map = NULL; if (sli->names && sli->maps) { for (led = 0; (led < XkbNumIndicators) && (map == NULL); led++) { if (sli->names[led] == indicator) { map= &sli->maps[led]; break; } } } *led_return = led; return map; }
0
503,857
SCM_DEFINE (scm_open_fdes, "open-fdes", 2, 1, 0, (SCM path, SCM flags, SCM mode), "Similar to @code{open} but return a file descriptor instead of\n" "a port.") #define FUNC_NAME s_scm_open_fdes { int fd; int iflags; int imode; iflags = SCM_NUM2INT (2, flags); imode = SCM_NUM2INT_DEF (3, mode, 0666); STRING_SYSCALL (path, c_path, fd = open_or_open64 (c_path, iflags, imode)); if (fd == -1) SCM_SYSERROR; return scm_from_int (fd); }
0
477,972
void simplestring_clear(simplestring* string) { if(string->str) { string->str[0] = 0; } string->len = 0; }
0
214,335
int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) { const char *content_type = NULL; string content_type_str; map<string, string> response_attrs; map<string, string>::iterator riter; bufferlist metadata_bl; string expires = get_s3_expiration_header(s, lastmod); if (sent_header) goto send_data; if (custom_http_ret) { set_req_state_err(s, 0); dump_errno(s, custom_http_ret); } else { set_req_state_err(s, (partial_content && !op_ret) ? STATUS_PARTIAL_CONTENT : op_ret); dump_errno(s); } if (op_ret) goto done; if (range_str) dump_range(s, start, end, s->obj_size); if (s->system_request && s->info.args.exists(RGW_SYS_PARAM_PREFIX "prepend-metadata")) { dump_header(s, "Rgwx-Object-Size", (long long)total_len); if (rgwx_stat) { /* * in this case, we're not returning the object's content, only the prepended * extra metadata */ total_len = 0; } /* JSON encode object metadata */ JSONFormatter jf; jf.open_object_section("obj_metadata"); encode_json("attrs", attrs, &jf); utime_t ut(lastmod); encode_json("mtime", ut, &jf); jf.close_section(); stringstream ss; jf.flush(ss); metadata_bl.append(ss.str()); dump_header(s, "Rgwx-Embedded-Metadata-Len", metadata_bl.length()); total_len += metadata_bl.length(); } if (s->system_request && !real_clock::is_zero(lastmod)) { /* we end up dumping mtime in two different methods, a bit redundant */ dump_epoch_header(s, "Rgwx-Mtime", lastmod); uint64_t pg_ver = 0; int r = decode_attr_bl_single_value(attrs, RGW_ATTR_PG_VER, &pg_ver, (uint64_t)0); if (r < 0) { ldpp_dout(this, 0) << "ERROR: failed to decode pg ver attr, ignoring" << dendl; } dump_header(s, "Rgwx-Obj-PG-Ver", pg_ver); uint32_t source_zone_short_id = 0; r = decode_attr_bl_single_value(attrs, RGW_ATTR_SOURCE_ZONE, &source_zone_short_id, (uint32_t)0); if (r < 0) { ldpp_dout(this, 0) << "ERROR: failed to decode pg ver attr, ignoring" << dendl; } if (source_zone_short_id != 0) { dump_header(s, "Rgwx-Source-Zone-Short-Id", source_zone_short_id); } } for (auto &it : crypt_http_responses) dump_header(s, it.first, it.second); dump_content_length(s, total_len); dump_last_modified(s, lastmod); dump_header_if_nonempty(s, "x-amz-version-id", version_id); dump_header_if_nonempty(s, "x-amz-expiration", expires); if (attrs.find(RGW_ATTR_APPEND_PART_NUM) != attrs.end()) { dump_header(s, "x-rgw-object-type", "Appendable"); dump_header(s, "x-rgw-next-append-position", s->obj_size); } else { dump_header(s, "x-rgw-object-type", "Normal"); } if (! op_ret) { if (! lo_etag.empty()) { /* Handle etag of Swift API's large objects (DLO/SLO). It's entirerly * legit to perform GET on them through S3 API. In such situation, * a client should receive the composited content with corresponding * etag value. */ dump_etag(s, lo_etag); } else { auto iter = attrs.find(RGW_ATTR_ETAG); if (iter != attrs.end()) { dump_etag(s, iter->second.to_str()); } } for (struct response_attr_param *p = resp_attr_params; p->param; p++) { bool exists; string val = s->info.args.get(p->param, &exists); if (exists) { /* reject unauthenticated response header manipulation, see * https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html */ if (s->auth.identity->is_anonymous()) { return -ERR_INVALID_REQUEST; } if (strcmp(p->param, "response-content-type") != 0) { response_attrs[p->http_attr] = val; } else { content_type_str = val; content_type = content_type_str.c_str(); } } } for (auto iter = attrs.begin(); iter != attrs.end(); ++iter) { const char *name = iter->first.c_str(); map<string, string>::iterator aiter = rgw_to_http_attrs.find(name); if (aiter != rgw_to_http_attrs.end()) { if (response_attrs.count(aiter->second) == 0) { /* Was not already overridden by a response param. */ size_t len = iter->second.length(); string s(iter->second.c_str(), len); while (len && !s[len - 1]) { --len; s.resize(len); } response_attrs[aiter->second] = s; } } else if (iter->first.compare(RGW_ATTR_CONTENT_TYPE) == 0) { /* Special handling for content_type. */ if (!content_type) { content_type_str = rgw_bl_str(iter->second); content_type = content_type_str.c_str(); } } else if (strcmp(name, RGW_ATTR_SLO_UINDICATOR) == 0) { // this attr has an extra length prefix from encode() in prior versions dump_header(s, "X-Object-Meta-Static-Large-Object", "True"); } else if (strncmp(name, RGW_ATTR_META_PREFIX, sizeof(RGW_ATTR_META_PREFIX)-1) == 0) { /* User custom metadata. */ name += sizeof(RGW_ATTR_PREFIX) - 1; dump_header(s, name, iter->second); } else if (iter->first.compare(RGW_ATTR_TAGS) == 0) { RGWObjTags obj_tags; try{ auto it = iter->second.cbegin(); obj_tags.decode(it); } catch (buffer::error &err) { ldpp_dout(this,0) << "Error caught buffer::error couldn't decode TagSet " << dendl; } dump_header(s, RGW_AMZ_TAG_COUNT, obj_tags.count()); } else if (iter->first.compare(RGW_ATTR_OBJECT_RETENTION) == 0 && get_retention){ RGWObjectRetention retention; try { decode(retention, iter->second); dump_header(s, "x-amz-object-lock-mode", retention.get_mode()); dump_time_header(s, "x-amz-object-lock-retain-until-date", retention.get_retain_until_date()); } catch (buffer::error& err) { ldpp_dout(this, 0) << "ERROR: failed to decode RGWObjectRetention" << dendl; } } else if (iter->first.compare(RGW_ATTR_OBJECT_LEGAL_HOLD) == 0 && get_legal_hold) { RGWObjectLegalHold legal_hold; try { decode(legal_hold, iter->second); dump_header(s, "x-amz-object-lock-legal-hold",legal_hold.get_status()); } catch (buffer::error& err) { ldpp_dout(this, 0) << "ERROR: failed to decode RGWObjectLegalHold" << dendl; } } } } done: for (riter = response_attrs.begin(); riter != response_attrs.end(); ++riter) { dump_header(s, riter->first, riter->second); } if (op_ret == -ERR_NOT_MODIFIED) { end_header(s, this); } else { if (!content_type) content_type = "binary/octet-stream"; end_header(s, this, content_type); } if (metadata_bl.length()) { dump_body(s, metadata_bl); } sent_header = true; send_data: if (get_data && !op_ret) { int r = dump_body(s, bl.c_str() + bl_ofs, bl_len); if (r < 0) return r; } return 0; }
1
413,586
static void hint_node_print(HintNode *node, int mode, PJ *pj) { switch (mode) { case '*': #define HINTCMD_ADDR(hint,fmt,x) r_cons_printf (fmt" @ 0x%"PFMT64x"\n", x, (hint)->addr) switch (node->type) { case HINT_NODE_ADDR: { const RAnalAddrHintRecord *record; r_vector_foreach (node->addr_hints, record) { switch (record->type) { case R_ANAL_ADDR_HINT_TYPE_IMMBASE: HINTCMD_ADDR (node, "ahi %d", record->immbase); break; case R_ANAL_ADDR_HINT_TYPE_JUMP: HINTCMD_ADDR (node, "ahc 0x%"PFMT64x, record->jump); break; case R_ANAL_ADDR_HINT_TYPE_FAIL: HINTCMD_ADDR (node, "ahf 0x%"PFMT64x, record->fail); break; case R_ANAL_ADDR_HINT_TYPE_STACKFRAME: HINTCMD_ADDR (node, "ahF 0x%"PFMT64x, record->stackframe); break; case R_ANAL_ADDR_HINT_TYPE_PTR: HINTCMD_ADDR (node, "ahp 0x%"PFMT64x, record->ptr); break; case R_ANAL_ADDR_HINT_TYPE_NWORD: // no command for this break; case R_ANAL_ADDR_HINT_TYPE_RET: HINTCMD_ADDR (node, "ahr 0x%"PFMT64x, record->retval); break; case R_ANAL_ADDR_HINT_TYPE_NEW_BITS: // no command for this break; case R_ANAL_ADDR_HINT_TYPE_SIZE: HINTCMD_ADDR (node, "ahs 0x%"PFMT64x, record->size); break; case R_ANAL_ADDR_HINT_TYPE_SYNTAX: HINTCMD_ADDR (node, "ahS %s", record->syntax); // TODO: escape for newcmd break; case R_ANAL_ADDR_HINT_TYPE_OPTYPE: { const char *type = r_anal_optype_to_string (record->optype); if (type) { HINTCMD_ADDR (node, "aho %s", type); // TODO: escape for newcmd } break; } case R_ANAL_ADDR_HINT_TYPE_OPCODE: HINTCMD_ADDR (node, "ahd %s", record->opcode); break; case R_ANAL_ADDR_HINT_TYPE_TYPE_OFFSET: HINTCMD_ADDR (node, "aht %s", record->type_offset); // TODO: escape for newcmd break; case R_ANAL_ADDR_HINT_TYPE_ESIL: HINTCMD_ADDR (node, "ahe %s", record->esil); // TODO: escape for newcmd break; case R_ANAL_ADDR_HINT_TYPE_HIGH: r_cons_printf ("ahh @ 0x%"PFMT64x"\n", node->addr); break; case R_ANAL_ADDR_HINT_TYPE_VAL: // no command for this break; } } break; } case HINT_NODE_ARCH: HINTCMD_ADDR (node, "aha %s", r_str_get_fail (node->arch, "0")); break; case HINT_NODE_BITS: HINTCMD_ADDR (node, "ahb %d", node->bits); break; } #undef HINTCMD_ADDR break; case 'j': switch (node->type) { case HINT_NODE_ADDR: { const RAnalAddrHintRecord *record; r_vector_foreach (node->addr_hints, record) { switch (record->type) { case R_ANAL_ADDR_HINT_TYPE_IMMBASE: pj_ki (pj, "immbase", record->immbase); break; case R_ANAL_ADDR_HINT_TYPE_JUMP: pj_kn (pj, "jump", record->jump); break; case R_ANAL_ADDR_HINT_TYPE_FAIL: pj_kn (pj, "fail", record->fail); break; case R_ANAL_ADDR_HINT_TYPE_STACKFRAME: pj_kn (pj, "stackframe", record->stackframe); break; case R_ANAL_ADDR_HINT_TYPE_PTR: pj_kn (pj, "ptr", record->ptr); break; case R_ANAL_ADDR_HINT_TYPE_NWORD: pj_ki (pj, "nword", record->nword); break; case R_ANAL_ADDR_HINT_TYPE_RET: pj_kn (pj, "ret", record->retval); break; case R_ANAL_ADDR_HINT_TYPE_NEW_BITS: pj_ki (pj, "newbits", record->newbits); break; case R_ANAL_ADDR_HINT_TYPE_SIZE: pj_kn (pj, "size", record->size); break; case R_ANAL_ADDR_HINT_TYPE_SYNTAX: pj_ks (pj, "syntax", record->syntax); break; case R_ANAL_ADDR_HINT_TYPE_OPTYPE: { const char *type = r_anal_optype_to_string (record->optype); if (type) { pj_ks (pj, "type", type); } break; } case R_ANAL_ADDR_HINT_TYPE_OPCODE: pj_ks (pj, "opcode", record->opcode); break; case R_ANAL_ADDR_HINT_TYPE_TYPE_OFFSET: pj_ks (pj, "offset", record->type_offset); break; case R_ANAL_ADDR_HINT_TYPE_ESIL: pj_ks (pj, "esil", record->esil); break; case R_ANAL_ADDR_HINT_TYPE_HIGH: pj_kb (pj, "high", true); break; case R_ANAL_ADDR_HINT_TYPE_VAL: pj_kn (pj, "val", record->val); break; } } break; } case HINT_NODE_ARCH: if (node->arch) { pj_ks (pj, "arch", node->arch); } else { pj_knull (pj, "arch"); } break; case HINT_NODE_BITS: pj_ki (pj, "bits", node->bits); break; } break; default: print_hint_h_format (node); break; } }
0