idx
int64
func
string
target
int64
255,739
static void create_layer_surface(struct swaylock_surface *surface) { struct swaylock_state *state = surface->state; surface->image = select_image(state, surface); surface->surface = wl_compositor_create_surface(state->compositor); assert(surface->surface); surface->child = wl_compositor_create_surface(state->compositor); assert(surface->child); surface->subsurface = wl_subcompositor_get_subsurface(state->subcompositor, surface->child, surface->surface); assert(surface->subsurface); wl_subsurface_set_sync(surface->subsurface); surface->layer_surface = zwlr_layer_shell_v1_get_layer_surface( state->layer_shell, surface->surface, surface->output, ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "lockscreen"); assert(surface->layer_surface); zwlr_layer_surface_v1_set_size(surface->layer_surface, 0, 0); zwlr_layer_surface_v1_set_anchor(surface->layer_surface, ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT); zwlr_layer_surface_v1_set_exclusive_zone(surface->layer_surface, -1); zwlr_layer_surface_v1_set_keyboard_interactivity( surface->layer_surface, true); zwlr_layer_surface_v1_add_listener(surface->layer_surface, &layer_surface_listener, surface); if (surface_is_opaque(surface) && surface->state->args.mode != BACKGROUND_MODE_CENTER && surface->state->args.mode != BACKGROUND_MODE_FIT) { struct wl_region *region = wl_compositor_create_region(surface->state->compositor); wl_region_add(region, 0, 0, INT32_MAX, INT32_MAX); wl_surface_set_opaque_region(surface->surface, region); wl_region_destroy(region); } wl_surface_commit(surface->surface); }
1
386,417
*/ void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; CHECK_ARITY(1); if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); cur = valuePop(ctxt); if ((cur == NULL) || (cur->nodesetval == NULL)) valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0)); else if ((cur->type == XPATH_NODESET) || (cur->type == XPATH_XSLT_TREE)) { valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) cur->nodesetval->nodeNr)); } else { if ((cur->nodesetval->nodeNr != 1) || (cur->nodesetval->nodeTab == NULL)) { valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) 0)); } else { xmlNodePtr tmp; int i = 0; tmp = cur->nodesetval->nodeTab[0]; if ((tmp != NULL) && (tmp->type != XML_NAMESPACE_DECL)) { tmp = tmp->children; while (tmp != NULL) { tmp = tmp->next; i++; } } valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, (double) i)); } }
0
217,250
void RenderWidgetHostViewAura::DetachFromInputMethod() { ui::InputMethod* input_method = GetInputMethod(); if (input_method && input_method->GetTextInputClient() == this) input_method->SetFocusedTextInputClient(NULL); }
0
19,085
static void vdpau_h264_set_reference_frames ( AVCodecContext * avctx ) { H264Context * const h = avctx -> priv_data ; AVVDPAUContext * hwctx = avctx -> hwaccel_context ; VdpPictureInfoH264 * info = & hwctx -> info . h264 ; int list ; VdpReferenceFrameH264 * rf = & info -> referenceFrames [ 0 ] ; # define H264_RF_COUNT FF_ARRAY_ELEMS ( info -> referenceFrames ) for ( list = 0 ; list < 2 ; ++ list ) { Picture * * lp = list ? h -> long_ref : h -> short_ref ; int i , ls = list ? 16 : h -> short_ref_count ; for ( i = 0 ; i < ls ; ++ i ) { Picture * pic = lp [ i ] ; VdpReferenceFrameH264 * rf2 ; VdpVideoSurface surface_ref ; int pic_frame_idx ; if ( ! pic || ! pic -> reference ) continue ; pic_frame_idx = pic -> long_ref ? pic -> pic_id : pic -> frame_num ; surface_ref = ff_vdpau_get_surface_id ( pic ) ; rf2 = & info -> referenceFrames [ 0 ] ; while ( rf2 != rf ) { if ( ( rf2 -> surface == surface_ref ) && ( rf2 -> is_long_term == pic -> long_ref ) && ( rf2 -> frame_idx == pic_frame_idx ) ) break ; ++ rf2 ; } if ( rf2 != rf ) { rf2 -> top_is_reference |= ( pic -> reference & PICT_TOP_FIELD ) ? VDP_TRUE : VDP_FALSE ; rf2 -> bottom_is_reference |= ( pic -> reference & PICT_BOTTOM_FIELD ) ? VDP_TRUE : VDP_FALSE ; continue ; } if ( rf >= & info -> referenceFrames [ H264_RF_COUNT ] ) continue ; vdpau_h264_set_rf ( rf , pic , pic -> reference ) ; ++ rf ; } } for ( ; rf < & info -> referenceFrames [ H264_RF_COUNT ] ; ++ rf ) vdpau_h264_clear_rf ( rf ) ; }
0
85,450
static int32_t modplugresamplingmode_to_filterlength(int mode) { if(mode<0){ return 1; } switch(mode){ case MODPLUG_RESAMPLE_NEAREST: return 1; break; case MODPLUG_RESAMPLE_LINEAR: return 2; break; case MODPLUG_RESAMPLE_SPLINE: return 4; break; case MODPLUG_RESAMPLE_FIR: return 8; break; } return 8; }
0
25,684
void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) { int i ; for ( i = 0 ; i < 4 ; ++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ; \ } sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 ) sadMxNx4D ( 16 , 16 ) sadMxN ( 16 , 8 ) sadMxNxK ( 16 , 8 , 3 ) sadMxNxK ( 16 , 8 , 8 ) sadMxNx4D ( 16 , 8 ) sadMxN ( 8 , 16 ) sadMxNxK ( 8 , 16 , 3 ) sadMxNxK ( 8 , 16 , 8 ) sadMxNx4D ( 8 , 16 ) sadMxN ( 8 , 8 ) sadMxNxK ( 8 , 8 , 3 ) sadMxNxK ( 8 , 8 , 8 ) sadMxNx4D ( 8 , 8 )
0
186,408
static struct sc_card_driver *sc_get_driver(void) { struct sc_card_driver *iso_drv = sc_get_iso7816_driver(); setcos_ops = *iso_drv->ops; setcos_ops.match_card = setcos_match_card; setcos_ops.init = setcos_init; if (iso_ops == NULL) iso_ops = iso_drv->ops; setcos_ops.create_file = setcos_create_file; setcos_ops.set_security_env = setcos_set_security_env; setcos_ops.select_file = setcos_select_file; setcos_ops.list_files = setcos_list_files; setcos_ops.process_fci = setcos_process_fci; setcos_ops.construct_fci = setcos_construct_fci; setcos_ops.card_ctl = setcos_card_ctl; return &setcos_drv; }
0
103,650
void ConnectionManagerImpl::onIdleTimeout() { ENVOY_CONN_LOG(debug, "idle timeout", read_callbacks_->connection()); stats_.named_.downstream_cx_idle_timeout_.inc(); if (!codec_) { // No need to delay close after flushing since an idle timeout has already fired. Attempt to // write out buffered data one last time and issue a local close if successful. read_callbacks_->connection().close(Network::ConnectionCloseType::FlushWrite); } else if (drain_state_ == DrainState::NotDraining) { startDrainSequence(); } }
0
15,194
int vp9_bigdia_search ( const MACROBLOCK * x , MV * ref_mv , int search_param , int sad_per_bit , int do_init_search , int * sad_list , const vp9_variance_fn_ptr_t * vfp , int use_mvcost , const MV * center_mv , MV * best_mv ) { static const int bigdia_num_candidates [ MAX_PATTERN_SCALES ] = { 4 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , } ; static const MV bigdia_candidates [ MAX_PATTERN_SCALES ] [ MAX_PATTERN_CANDIDATES ] = { { { 0 , - 1 } , { 1 , 0 } , { 0 , 1 } , { - 1 , 0 } } , { { - 1 , - 1 } , { 0 , - 2 } , { 1 , - 1 } , { 2 , 0 } , { 1 , 1 } , { 0 , 2 } , { - 1 , 1 } , { - 2 , 0 } } , { { - 2 , - 2 } , { 0 , - 4 } , { 2 , - 2 } , { 4 , 0 } , { 2 , 2 } , { 0 , 4 } , { - 2 , 2 } , { - 4 , 0 } } , { { - 4 , - 4 } , { 0 , - 8 } , { 4 , - 4 } , { 8 , 0 } , { 4 , 4 } , { 0 , 8 } , { - 4 , 4 } , { - 8 , 0 } } , { { - 8 , - 8 } , { 0 , - 16 } , { 8 , - 8 } , { 16 , 0 } , { 8 , 8 } , { 0 , 16 } , { - 8 , 8 } , { - 16 , 0 } } , { { - 16 , - 16 } , { 0 , - 32 } , { 16 , - 16 } , { 32 , 0 } , { 16 , 16 } , { 0 , 32 } , { - 16 , 16 } , { - 32 , 0 } } , { { - 32 , - 32 } , { 0 , - 64 } , { 32 , - 32 } , { 64 , 0 } , { 32 , 32 } , { 0 , 64 } , { - 32 , 32 } , { - 64 , 0 } } , { { - 64 , - 64 } , { 0 , - 128 } , { 64 , - 64 } , { 128 , 0 } , { 64 , 64 } , { 0 , 128 } , { - 64 , 64 } , { - 128 , 0 } } , { { - 128 , - 128 } , { 0 , - 256 } , { 128 , - 128 } , { 256 , 0 } , { 128 , 128 } , { 0 , 256 } , { - 128 , 128 } , { - 256 , 0 } } , { { - 256 , - 256 } , { 0 , - 512 } , { 256 , - 256 } , { 512 , 0 } , { 256 , 256 } , { 0 , 512 } , { - 256 , 256 } , { - 512 , 0 } } , { { - 512 , - 512 } , { 0 , - 1024 } , { 512 , - 512 } , { 1024 , 0 } , { 512 , 512 } , { 0 , 1024 } , { - 512 , 512 } , { - 1024 , 0 } } , } ; return vp9_pattern_search_sad ( x , ref_mv , search_param , sad_per_bit , do_init_search , sad_list , vfp , use_mvcost , center_mv , best_mv , bigdia_num_candidates , bigdia_candidates ) ; }
0
283,427
nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_putfh *putfh) { fh_put(&cstate->current_fh); cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen; memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval, putfh->pf_fhlen); return fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_BYPASS_GSS); }
0
9,299
void DevToolsSession::ReceivedBadMessage() { MojoConnectionDestroyed(); if (process_) { bad_message::ReceivedBadMessage( process_, bad_message::RFH_INCONSISTENT_DEVTOOLS_MESSAGE); } }
1
285,854
uint32_t BpMemoryHeap::getOffset() const { assertMapped(); return mOffset; }
0
522,353
void next_row() { if (move) { /* Our cursor is pointing at the first row that was a peer of the previous current row. Or, it was the first row in the partition. */ if (cursor.fetch()) return; // todo: need the following check ? if (!peer_tracker.compare_with_cache()) return; remove_value_from_items(); do { if (cursor.next() || cursor.fetch()) return; if (!peer_tracker.compare_with_cache()) return; remove_value_from_items(); } while (1); } }
0
63,415
static int load_module(struct load_info *info, const char __user *uargs, int flags) { struct module *mod; long err = 0; char *after_dashes; /* * Do the signature check (if any) first. All that * the signature check needs is info->len, it does * not need any of the section info. That can be * set up later. This will minimize the chances * of a corrupt module causing problems before * we even get to the signature check. * * The check will also adjust info->len by stripping * off the sig length at the end of the module, making * checks against info->len more correct. */ err = module_sig_check(info, flags); if (err) goto free_copy; /* * Do basic sanity checks against the ELF header and * sections. */ err = elf_validity_check(info); if (err) { pr_err("Module has invalid ELF structures\n"); goto free_copy; } /* * Everything checks out, so set up the section info * in the info structure. */ err = setup_load_info(info, flags); if (err) goto free_copy; /* * Now that we know we have the correct module name, check * if it's blacklisted. */ if (blacklisted(info->name)) { err = -EPERM; pr_err("Module %s is blacklisted\n", info->name); goto free_copy; } err = rewrite_section_headers(info, flags); if (err) goto free_copy; /* Check module struct version now, before we try to use module. */ if (!check_modstruct_version(info, info->mod)) { err = -ENOEXEC; goto free_copy; } /* Figure out module layout, and allocate all the memory. */ mod = layout_and_allocate(info, flags); if (IS_ERR(mod)) { err = PTR_ERR(mod); goto free_copy; } audit_log_kern_module(mod->name); /* Reserve our place in the list. */ err = add_unformed_module(mod); if (err) goto free_module; #ifdef CONFIG_MODULE_SIG mod->sig_ok = info->sig_ok; if (!mod->sig_ok) { pr_notice_once("%s: module verification failed: signature " "and/or required key missing - tainting " "kernel\n", mod->name); add_taint_module(mod, TAINT_UNSIGNED_MODULE, LOCKDEP_STILL_OK); } #endif /* To avoid stressing percpu allocator, do this once we're unique. */ err = percpu_modalloc(mod, info); if (err) goto unlink_mod; /* Now module is in final location, initialize linked lists, etc. */ err = module_unload_init(mod); if (err) goto unlink_mod; init_param_lock(mod); /* * Now we've got everything in the final locations, we can * find optional sections. */ err = find_module_sections(mod, info); if (err) goto free_unload; err = check_module_license_and_versions(mod); if (err) goto free_unload; /* Set up MODINFO_ATTR fields */ setup_modinfo(mod, info); /* Fix up syms, so that st_value is a pointer to location. */ err = simplify_symbols(mod, info); if (err < 0) goto free_modinfo; err = apply_relocations(mod, info); if (err < 0) goto free_modinfo; err = post_relocation(mod, info); if (err < 0) goto free_modinfo; flush_module_icache(mod); /* Setup CFI for the module. */ cfi_init(mod); /* Now copy in args */ mod->args = strndup_user(uargs, ~0UL >> 1); if (IS_ERR(mod->args)) { err = PTR_ERR(mod->args); goto free_arch_cleanup; } dynamic_debug_setup(mod, info->debug, info->num_debug); /* Ftrace init must be called in the MODULE_STATE_UNFORMED state */ ftrace_module_init(mod); /* Finally it's fully formed, ready to start executing. */ err = complete_formation(mod, info); if (err) goto ddebug_cleanup; err = prepare_coming_module(mod); if (err) goto bug_cleanup; /* Module is ready to execute: parsing args may do that. */ after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, -32768, 32767, mod, unknown_module_param_cb); if (IS_ERR(after_dashes)) { err = PTR_ERR(after_dashes); goto coming_cleanup; } else if (after_dashes) { pr_warn("%s: parameters '%s' after `--' ignored\n", mod->name, after_dashes); } /* Link in to sysfs. */ err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp); if (err < 0) goto coming_cleanup; if (is_livepatch_module(mod)) { err = copy_module_elf(mod, info); if (err < 0) goto sysfs_cleanup; } /* Get rid of temporary copy. */ free_copy(info); /* Done! */ trace_module_load(mod); return do_init_module(mod); sysfs_cleanup: mod_sysfs_teardown(mod); coming_cleanup: mod->state = MODULE_STATE_GOING; destroy_params(mod->kp, mod->num_kp); blocking_notifier_call_chain(&module_notify_list, MODULE_STATE_GOING, mod); klp_module_going(mod); bug_cleanup: mod->state = MODULE_STATE_GOING; /* module_bug_cleanup needs module_mutex protection */ mutex_lock(&module_mutex); module_bug_cleanup(mod); mutex_unlock(&module_mutex); ddebug_cleanup: ftrace_release_mod(mod); dynamic_debug_remove(mod, info->debug); synchronize_rcu(); kfree(mod->args); free_arch_cleanup: cfi_cleanup(mod); module_arch_cleanup(mod); free_modinfo: free_modinfo(mod); free_unload: module_unload_free(mod); unlink_mod: mutex_lock(&module_mutex); /* Unlink carefully: kallsyms could be walking list. */ list_del_rcu(&mod->list); mod_tree_remove(mod); wake_up_all(&module_wq); /* Wait for RCU-sched synchronizing before releasing mod->list. */ synchronize_rcu(); mutex_unlock(&module_mutex); free_module: /* Free lock-classes; relies on the preceding sync_rcu() */ lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size); module_deallocate(mod, info); free_copy: free_copy(info); return err; }
0
28,083
static SchroFrame * CreateSchroFrameFromInputPic ( encoder_t * p_enc , picture_t * p_pic ) { encoder_sys_t * p_sys = p_enc -> p_sys ; SchroFrame * p_schroframe = schro_frame_new ( ) ; struct enc_picture_free_t * p_free ; if ( ! p_schroframe ) return NULL ; if ( ! p_pic ) return NULL ; p_schroframe -> format = SCHRO_FRAME_FORMAT_U8_420 ; if ( p_sys -> p_format -> chroma_format == SCHRO_CHROMA_422 ) { p_schroframe -> format = SCHRO_FRAME_FORMAT_U8_422 ; } else if ( p_sys -> p_format -> chroma_format == SCHRO_CHROMA_444 ) { p_schroframe -> format = SCHRO_FRAME_FORMAT_U8_444 ; } p_schroframe -> width = p_sys -> p_format -> width ; p_schroframe -> height = p_sys -> p_format -> height ; p_free = malloc ( sizeof ( * p_free ) ) ; if ( unlikely ( p_free == NULL ) ) { schro_frame_unref ( p_schroframe ) ; return NULL ; } p_free -> p_pic = p_pic ; p_free -> p_enc = p_enc ; schro_frame_set_free_callback ( p_schroframe , EncSchroFrameFree , p_free ) ; for ( int i = 0 ; i < 3 ; i ++ ) { p_schroframe -> components [ i ] . width = p_pic -> p [ i ] . i_visible_pitch ; p_schroframe -> components [ i ] . stride = p_pic -> p [ i ] . i_pitch ; p_schroframe -> components [ i ] . height = p_pic -> p [ i ] . i_visible_lines ; p_schroframe -> components [ i ] . length = p_pic -> p [ i ] . i_pitch * p_pic -> p [ i ] . i_lines ; p_schroframe -> components [ i ] . data = p_pic -> p [ i ] . p_pixels ; if ( i != 0 ) { p_schroframe -> components [ i ] . v_shift = SCHRO_FRAME_FORMAT_V_SHIFT ( p_schroframe -> format ) ; p_schroframe -> components [ i ] . h_shift = SCHRO_FRAME_FORMAT_H_SHIFT ( p_schroframe -> format ) ; } } return p_schroframe ; }
0
348,352
void base64_encode_xmlrpc(struct buffer_st *b, const char *source, int length) { int i, hiteof = 0; int offset = 0; int olen; olen = 0; buffer_new(b); /* Fill dtable with character encodings. */ for (i = 0; i < 26; i++) { dtable[i] = 'A' + i; dtable[26 + i] = 'a' + i; } for (i = 0; i < 10; i++) { dtable[52 + i] = '0' + i; } dtable[62] = '+'; dtable[63] = '/'; while (!hiteof) { unsigned char igroup[3], ogroup[4]; int c, n; igroup[0] = igroup[1] = igroup[2] = 0; for (n = 0; n < 3; n++) { c = *(source++); offset++; if (offset > length || offset <= 0) { hiteof = 1; break; } igroup[n] = (unsigned char) c; } if (n > 0) { ogroup[0] = dtable[igroup[0] >> 2]; ogroup[1] = dtable[((igroup[0] & 3) << 4) | (igroup[1] >> 4)]; ogroup[2] = dtable[((igroup[1] & 0xF) << 2) | (igroup[2] >> 6)]; ogroup[3] = dtable[igroup[2] & 0x3F]; /* Replace characters in output stream with "=" pad characters if fewer than three characters were read from the end of the input stream. */ if (n < 3) { ogroup[3] = '='; if (n < 2) { ogroup[2] = '='; } } for (i = 0; i < 4; i++) { buffer_add(b, ogroup[i]); if (!(b->offset % 72)) { /* buffer_add(b, '\r'); */ buffer_add(b, '\n'); } } } } /* buffer_add(b, '\r'); */ buffer_add(b, '\n'); }
1
185,285
bool DevToolsDataSource::ShouldAddContentSecurityPolicy() const { return false; }
0
103,252
int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) { const struct ioctl_handler *handler; struct snd_seq_client *client; client = clientptr(clientid); if (client == NULL) return -ENXIO; for (handler = ioctl_handlers; handler->cmd > 0; ++handler) { if (handler->cmd == cmd) return handler->func(client, arg); } pr_debug("ALSA: seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n", cmd, _IOC_TYPE(cmd), _IOC_NR(cmd)); return -ENOTTY; }
0
220,685
void VerifyPrintPreviewCancelled(bool did_cancel) { bool print_preview_cancelled = (render_thread_->sink().GetUniqueMessageMatching( PrintHostMsg_PrintPreviewCancelled::ID) != NULL); EXPECT_EQ(did_cancel, print_preview_cancelled); }
0
303,880
void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, int oif, u32 mark, u8 protocol, int flow_flags) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; struct rtable *rt; if (!mark) mark = IP4_REPLY_MARK(net, skb->mark); __build_flow_key(&fl4, NULL, iph, oif, RT_TOS(iph->tos), protocol, mark, flow_flags); rt = __ip_route_output_key(net, &fl4); if (!IS_ERR(rt)) { __ip_rt_update_pmtu(rt, &fl4, mtu); ip_rt_put(rt); } }
0
469,177
void xfrm_flowi_addr_get(const struct flowi *fl, xfrm_address_t *saddr, xfrm_address_t *daddr, unsigned short family) { switch(family) { case AF_INET: memcpy(&saddr->a4, &fl->u.ip4.saddr, sizeof(saddr->a4)); memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4)); break; case AF_INET6: saddr->in6 = fl->u.ip6.saddr; daddr->in6 = fl->u.ip6.daddr; break; } }
0
138,156
pmcraid_init_ioadls(struct pmcraid_cmd *cmd, int sgcount) { struct pmcraid_ioadl_desc *ioadl; struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; int ioadl_count = 0; if (ioarcb->add_cmd_param_length) ioadl_count = DIV_ROUND_UP(ioarcb->add_cmd_param_length, 16); ioarcb->ioadl_length = sizeof(struct pmcraid_ioadl_desc) * sgcount; if ((sgcount + ioadl_count) > (ARRAY_SIZE(ioarcb->add_data.u.ioadl))) { /* external ioadls start at offset 0x80 from control_block * structure, re-using 24 out of 27 ioadls part of IOARCB. * It is necessary to indicate to firmware that driver is * using ioadls to be treated as external to IOARCB. */ ioarcb->ioarcb_bus_addr &= ~(0x1FULL); ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + offsetof(struct pmcraid_ioarcb, add_data.u.ioadl[3])); ioadl = &ioarcb->add_data.u.ioadl[3]; } else { ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) + offsetof(struct pmcraid_ioarcb, add_data.u.ioadl[ioadl_count])); ioadl = &ioarcb->add_data.u.ioadl[ioadl_count]; ioarcb->ioarcb_bus_addr |= DIV_ROUND_CLOSEST(sgcount + ioadl_count, 8); } return ioadl; }
0
248,570
static bool AllDescendantsAreComplete(Frame* frame) { if (!frame) return true; for (Frame* child = frame->Tree().FirstChild(); child; child = child->Tree().TraverseNext(frame)) { if (child->IsLoading()) return false; } return true; }
0
376,777
HInstruction* HGraphBuilder::PreProcessCall(Instruction* call) { int count = call->argument_count(); ZoneList<HValue*> arguments(count, zone()); for (int i = 0; i < count; ++i) { arguments.Add(Pop(), zone()); } while (!arguments.is_empty()) { AddInstruction(new(zone()) HPushArgument(arguments.RemoveLast())); } return call; }
0
53,317
static size_t ssl_rsa_key_len( void *ctx ) { return ( (rsa_context *) ctx )->len; }
0
415,933
gs_deviceinitialmatrix(gx_device * dev, gs_matrix * pmat) { fill_dev_proc(dev, get_initial_matrix, gx_default_get_initial_matrix); (*dev_proc(dev, get_initial_matrix)) (dev, pmat); }
0
501,873
static bool replmd_recyclebin_enabled(struct ldb_module *module) { bool enabled = false; struct replmd_private *replmd_private = talloc_get_type_abort(ldb_module_get_private(module), struct replmd_private); /* * only lookup the recycle-bin state once per replication, then cache * the result. This can save us 1000s of DB searches */ if (!replmd_private->recyclebin_state_known) { int ret = dsdb_recyclebin_enabled(module, &enabled); if (ret != LDB_SUCCESS) { return false; } replmd_private->recyclebin_enabled = enabled; replmd_private->recyclebin_state_known = true; } return replmd_private->recyclebin_enabled; }
0
344,642
FileDescriptor connectToHelperAgent() { TRACE_POINT(); FileDescriptor conn; try { conn = connectToUnixServer(agentsStarter.getRequestSocketFilename()); writeExact(conn, agentsStarter.getRequestSocketPassword()); } catch (const SystemException &e) { if (e.code() == EPIPE || e.code() == ECONNREFUSED || e.code() == ENOENT) { UPDATE_TRACE_POINT(); bool connected = false; // Maybe the helper agent crashed. First wait 50 ms. usleep(50000); // Then try to reconnect to the helper agent for the // next 5 seconds. time_t deadline = time(NULL) + 5; while (!connected && time(NULL) < deadline) { try { conn = connectToUnixServer(agentsStarter.getRequestSocketFilename()); writeExact(conn, agentsStarter.getRequestSocketPassword()); connected = true; } catch (const SystemException &e) { if (e.code() == EPIPE || e.code() == ECONNREFUSED || e.code() == ENOENT) { // Looks like the helper agent hasn't been // restarted yet. Wait between 20 and 100 ms. usleep(20000 + rand() % 80000); // Don't care about thread-safety of rand() } else { throw; } } } if (!connected) { UPDATE_TRACE_POINT(); throw IOException("Cannot connect to the helper agent"); } } else { throw; } } return conn; }
1
322,004
unsigned ff_els_decode_unsigned(ElsDecCtx *ctx, ElsUnsignedRung *ur) { int i, n, r, bit; ElsRungNode *rung_node; if (ctx->err) return 0; /* decode unary prefix */ for (n = 0; n < ELS_EXPGOLOMB_LEN + 1; n++) if (ff_els_decode_bit(ctx, &ur->prefix_rung[n])) break; /* handle the error/overflow case */ if (ctx->err || n >= ELS_EXPGOLOMB_LEN) { ctx->err = AVERROR(EOVERFLOW); return 0; } /* handle the zero case */ if (!n) return 0; /* initialize probability tree */ if (!ur->rem_rung_list) { ur->rem_rung_list = av_realloc(NULL, RUNG_SPACE); if (!ur->rem_rung_list) { ctx->err = AVERROR(ENOMEM); return 0; } memset(ur->rem_rung_list, 0, RUNG_SPACE); ur->rung_list_size = RUNG_SPACE; ur->avail_index = ELS_EXPGOLOMB_LEN; } /* decode the remainder */ for (i = 0, r = 0, bit = 0; i < n; i++) { if (!i) rung_node = &ur->rem_rung_list[n]; else { if (!rung_node->next_index) { if (ur->rung_list_size <= (ur->avail_index + 2) * sizeof(ElsRungNode)) { // remember rung_node position ptrdiff_t pos = rung_node - ur->rem_rung_list; ur->rem_rung_list = av_realloc(ur->rem_rung_list, ur->rung_list_size + RUNG_SPACE); if (!ur->rem_rung_list) { av_free(ur->rem_rung_list); ctx->err = AVERROR(ENOMEM); return 0; } memset((uint8_t *) ur->rem_rung_list + ur->rung_list_size, 0, RUNG_SPACE); ur->rung_list_size += RUNG_SPACE; // restore rung_node position in the new list rung_node = &ur->rem_rung_list[pos]; } rung_node->next_index = ur->avail_index; ur->avail_index += 2; } rung_node = &ur->rem_rung_list[rung_node->next_index + bit]; } bit = ff_els_decode_bit(ctx, &rung_node->rung); if (ctx->err) return bit; r = (r << 1) + bit; } return (1 << n) - 1 + r; /* make value from exp golomb code */ }
1
118,385
rend_service_poison_new_single_onion_dir(const rend_service_t *s, const or_options_t* options) { /* Passing a NULL service is a bug */ if (BUG(!s)) { return -1; } /* We must only poison directories if we're in Single Onion mode */ tor_assert(rend_service_non_anonymous_mode_enabled(options)); /* Ephemeral services aren't allowed in non-anonymous mode */ if (BUG(rend_service_is_ephemeral(s))) { return -1; } /* Service is expected to have a directory */ if (BUG(!s->directory)) { return -1; } if (!rend_service_private_key_exists(s)) { if (poison_new_single_onion_hidden_service_dir_impl(s, options) < 0) { return -1; } } return 0; }
0
250,237
static int update_stream_output_window(h2o_http2_stream_t *stream, ssize_t delta) { ssize_t cur = h2o_http2_window_get_window(&stream->output_window); if (h2o_http2_window_update(&stream->output_window, delta) != 0) return -1; if (cur <= 0 && h2o_http2_window_get_window(&stream->output_window) > 0 && h2o_http2_stream_has_pending_data(stream)) { assert(!h2o_linklist_is_linked(&stream->_refs.link)); h2o_http2_scheduler_activate(&stream->_refs.scheduler); } return 0; }
0
361,890
bool Server::unregisterUserDB(int id) { if (id <= 0) return false; QMap<int, QString> info = getRegistration(id); if (info.isEmpty()) return false; qhUserIDCache.remove(info.value(ServerDB::User_Name)); qhUserNameCache.remove(id); int res = -2; emit unregisterUserSig(res, id); if (res == 0) { return false; } TransactionHolder th; QSqlQuery &query = *th.qsqQuery; SQLPREP("DELETE FROM `%1users` WHERE `server_id` = ? AND `user_id` = ?"); query.addBindValue(iServerNum); query.addBindValue(id); SQLEXEC(); SQLPREP("DELETE FROM `%1user_info` WHERE `server_id` = ? AND `user_id` = ?"); query.addBindValue(iServerNum); query.addBindValue(id); SQLEXEC(); return true; }
0
253,996
choose_kex(struct kex *k, char *client, char *server) { const struct kexalg *kexalg; k->name = match_list(client, server, NULL); debug("kex: algorithm: %s", k->name ? k->name : "(no match)"); if (k->name == NULL) return SSH_ERR_NO_KEX_ALG_MATCH; if ((kexalg = kex_alg_by_name(k->name)) == NULL) return SSH_ERR_INTERNAL_ERROR; k->kex_type = kexalg->type; k->hash_alg = kexalg->hash_alg; k->ec_nid = kexalg->ec_nid; return 0; }
0
408,326
string_rfind(PyStringObject *self, PyObject *args) { Py_ssize_t result = string_find_internal(self, args, -1); if (result == -2) return NULL; return PyInt_FromSsize_t(result); }
0
426,648
static ssize_t process_output_ssl( pn_transport_t *transport, unsigned int layer, char *buffer, size_t max_len) { pni_ssl_t *ssl = transport->ssl; if (!ssl) return PN_EOS; if (ssl->ssl == NULL && init_ssl_socket(transport, ssl)) return PN_EOS; ssize_t written = 0; bool work_pending; do { work_pending = false; ERR_clear_error(); // first, get any pending application output, if possible if (!ssl->app_output_closed && ssl->out_count < ssl->out_size) { ssize_t app_bytes = transport->io_layers[layer+1]->process_output(transport, layer+1, &ssl->outbuf[ssl->out_count], ssl->out_size - ssl->out_count); if (app_bytes > 0) { ssl->out_count += app_bytes; work_pending = true; ssl_log(transport, "Gathered %d bytes from app to send to peer", app_bytes ); } else { if (app_bytes < 0) { ssl_log(transport, "Application layer closed its output, error=%d (%d bytes pending send)", (int) app_bytes, (int) ssl->out_count); ssl->app_output_closed = app_bytes; } } } // now push any pending app data into the socket if (!ssl->ssl_closed) { char *data = ssl->outbuf; if (ssl->out_count > 0) { int wrote = BIO_write( ssl->bio_ssl, data, ssl->out_count ); if (wrote > 0) { data += wrote; ssl->out_count -= wrote; work_pending = true; ssl_log( transport, "Wrote %d bytes from app to socket", wrote ); } else { if (!BIO_should_retry(ssl->bio_ssl)) { int reason = SSL_get_error( ssl->ssl, wrote ); switch (reason) { case SSL_ERROR_ZERO_RETURN: // SSL closed cleanly ssl_log(transport, "SSL connection has closed"); start_ssl_shutdown(transport); // KAG: not sure - this may not be necessary ssl->out_count = 0; // can no longer write to socket, so erase app output data ssl->ssl_closed = true; break; default: // unexpected error return (ssize_t)ssl_failed(transport); } } else { if (BIO_should_read( ssl->bio_ssl )) { ssl->read_blocked = true; ssl_log(transport, "Detected read-blocked"); } if (BIO_should_write( ssl->bio_ssl )) { ssl->write_blocked = true; ssl_log(transport, "Detected write-blocked"); } } } } if (ssl->out_count == 0) { if (ssl->app_input_closed && ssl->app_output_closed) { // application is done sending/receiving data, and all buffered output data has // been written to the SSL socket start_ssl_shutdown(transport); } } else if (data != ssl->outbuf) { memmove( ssl->outbuf, data, ssl->out_count ); } } // read from the network bio as much as possible, filling the buffer if (max_len) { int available = BIO_read( ssl->bio_net_io, buffer, max_len ); if (available > 0) { max_len -= available; buffer += available; written += available; ssl->write_blocked = false; work_pending = work_pending || max_len > 0; ssl_log(transport, "Read %d bytes from BIO Layer", available ); } } } while (work_pending); //_log(ssl, "written=%d ssl_closed=%d in_count=%d app_input_closed=%d app_output_closed=%d bio_pend=%d", // written, ssl->ssl_closed, ssl->in_count, ssl->app_input_closed, ssl->app_output_closed, BIO_pending(ssl->bio_net_io) ); // PROTON-82: close the output side as soon as we've sent the SSL close_notify. // We're not requiring the response, as some implementations never reply. // ---- // Once no more data is available "below" the SSL socket, tell the transport we are // done. //if (written == 0 && ssl->ssl_closed && BIO_pending(ssl->bio_net_io) == 0) { // written = ssl->app_output_closed ? ssl->app_output_closed : PN_EOS; //} if (written == 0 && (SSL_get_shutdown(ssl->ssl) & SSL_SENT_SHUTDOWN) && BIO_pending(ssl->bio_net_io) == 0) { written = ssl->app_output_closed ? ssl->app_output_closed : PN_EOS; if (transport->io_layers[layer]==&ssl_input_closed_layer) { transport->io_layers[layer] = &ssl_closed_layer; } else { transport->io_layers[layer] = &ssl_output_closed_layer; } } ssl_log(transport, "process_output_ssl() returning %d", (int) written); return written; }
0
320,690
static void e1000_reset(void *opaque) { E1000State *d = opaque; qemu_del_timer(d->autoneg_timer); memset(d->phy_reg, 0, sizeof d->phy_reg); memmove(d->phy_reg, phy_reg_init, sizeof phy_reg_init); memset(d->mac_reg, 0, sizeof d->mac_reg); memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init); d->rxbuf_min_shift = 1; memset(&d->tx, 0, sizeof d->tx); if (d->nic->nc.link_down) { e1000_link_down(d); } /* Some guests expect pre-initialized RAH/RAL (AddrValid flag + MACaddr) */ d->mac_reg[RA] = 0; d->mac_reg[RA + 1] = E1000_RAH_AV; for (i = 0; i < 4; i++) { d->mac_reg[RA] |= macaddr[i] << (8 * i); d->mac_reg[RA + 1] |= (i < 2) ? macaddr[i + 4] << (8 * i) : 0; } }
1
467,806
static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode, int sync, void *key) { struct io_kiocb *req = wait->private; struct io_poll_iocb *poll = io_poll_get_single(req); __poll_t mask = key_to_poll(key); /* for instances that support it check for an event match first: */ if (mask && !(mask & poll->events)) return 0; if (!(poll->events & EPOLLONESHOT)) return poll->wait.func(&poll->wait, mode, sync, key); list_del_init(&wait->entry); if (poll && poll->head) { bool done; spin_lock(&poll->head->lock); done = list_empty(&poll->wait.entry); if (!done) list_del_init(&poll->wait.entry); /* make sure double remove sees this as being gone */ wait->private = NULL; spin_unlock(&poll->head->lock); if (!done) { /* use wait func handler, so it matches the rq type */ poll->wait.func(&poll->wait, mode, sync, key); } } req_ref_put(req); return 1;
0
383,349
checksum( byte *p, unsigned n ) { u16 a; for(a=0; n; n-- ) a += *p++; return a; }
0
67,316
SWFInput_getSInt16(SWFInput input) { int num = SWFInput_getChar(input); num += SWFInput_getChar(input) * 256; return num; }
0
397,172
tta_type_find (GstTypeFind * tf, gpointer unused) { const guint8 *data = gst_type_find_peek (tf, 0, 3); if (data) { if (memcmp (data, "TTA", 3) == 0) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, TTA_CAPS); return; } } }
0
98,318
create_unpeer_node( address_node *addr ) { unpeer_node * my_node; u_int u; char * pch; my_node = emalloc_zero(sizeof(*my_node)); /* * From the parser's perspective an association ID fits into * its generic T_String definition of a name/address "address". * We treat all valid 16-bit numbers as association IDs. */ pch = addr->address; while (*pch && isdigit(*pch)) pch++; if (!*pch && 1 == sscanf(addr->address, "%u", &u) && u <= ASSOCID_MAX) { my_node->assocID = (associd_t)u; destroy_address_node(addr); my_node->addr = NULL; } else { my_node->assocID = 0; my_node->addr = addr; } return my_node; }
0
258,524
static void exsltObjectTypeFunction ( xmlXPathParserContextPtr ctxt , int nargs ) { xmlXPathObjectPtr obj , ret ; if ( nargs != 1 ) { xmlXPathSetArityError ( ctxt ) ; return ; } obj = valuePop ( ctxt ) ; switch ( obj -> type ) { case XPATH_STRING : ret = xmlXPathNewCString ( "string" ) ; break ; case XPATH_NUMBER : ret = xmlXPathNewCString ( "number" ) ; break ; case XPATH_BOOLEAN : ret = xmlXPathNewCString ( "boolean" ) ; break ; case XPATH_NODESET : ret = xmlXPathNewCString ( "node-set" ) ; break ; case XPATH_XSLT_TREE : ret = xmlXPathNewCString ( "RTF" ) ; break ; case XPATH_USERS : ret = xmlXPathNewCString ( "external" ) ; break ; default : xsltGenericError ( xsltGenericErrorContext , "object-type() invalid arg\n" ) ; ctxt -> error = XPATH_INVALID_TYPE ; xmlXPathFreeObject ( obj ) ; return ; } xmlXPathFreeObject ( obj ) ; valuePush ( ctxt , ret ) ; }
0
453,597
fill_boxes (void *_dst, cairo_operator_t op, const cairo_color_t *color, cairo_boxes_t *boxes) { cairo_image_surface_t *dst = _dst; struct _cairo_boxes_chunk *chunk; uint32_t pixel; int i; TRACE ((stderr, "%s x %d\n", __FUNCTION__, boxes->num_boxes)); if (fill_reduces_to_source (op, color, dst) && color_to_pixel (color, dst->pixman_format, &pixel)) { for (chunk = &boxes->chunks; chunk; chunk = chunk->next) { for (i = 0; i < chunk->count; i++) { int x = _cairo_fixed_integer_part (chunk->base[i].p1.x); int y = _cairo_fixed_integer_part (chunk->base[i].p1.y); int w = _cairo_fixed_integer_part (chunk->base[i].p2.x) - x; int h = _cairo_fixed_integer_part (chunk->base[i].p2.y) - y; pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t), PIXMAN_FORMAT_BPP (dst->pixman_format), x, y, w, h, pixel); } } } else { pixman_image_t *src = _pixman_image_for_color (color); op = _pixman_operator (op); for (chunk = &boxes->chunks; chunk; chunk = chunk->next) { for (i = 0; i < chunk->count; i++) { int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x); int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y); int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x); int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y); pixman_image_composite32 (op, src, NULL, dst->pixman_image, 0, 0, 0, 0, x1, y1, x2-x1, y2-y1); } } pixman_image_unref (src); } return CAIRO_STATUS_SUCCESS; }
0
136,067
static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct snd_seq_client *client = file->private_data; /* To use kernel stack for ioctl data. */ union { int pversion; int client_id; struct snd_seq_system_info system_info; struct snd_seq_running_info running_info; struct snd_seq_client_info client_info; struct snd_seq_port_info port_info; struct snd_seq_port_subscribe port_subscribe; struct snd_seq_queue_info queue_info; struct snd_seq_queue_status queue_status; struct snd_seq_queue_tempo tempo; struct snd_seq_queue_timer queue_timer; struct snd_seq_queue_client queue_client; struct snd_seq_client_pool client_pool; struct snd_seq_remove_events remove_events; struct snd_seq_query_subs query_subs; } buf; const struct ioctl_handler *handler; unsigned long size; int err; if (snd_BUG_ON(!client)) return -ENXIO; for (handler = ioctl_handlers; handler->cmd > 0; ++handler) { if (handler->cmd == cmd) break; } if (handler->cmd == 0) return -ENOTTY; memset(&buf, 0, sizeof(buf)); /* * All of ioctl commands for ALSA sequencer get an argument of size * within 13 bits. We can safely pick up the size from the command. */ size = _IOC_SIZE(handler->cmd); if (handler->cmd & IOC_IN) { if (copy_from_user(&buf, (const void __user *)arg, size)) return -EFAULT; } err = handler->func(client, &buf); if (err >= 0) { /* Some commands includes a bug in 'dir' field. */ if (handler->cmd == SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT || handler->cmd == SNDRV_SEQ_IOCTL_SET_CLIENT_POOL || (handler->cmd & IOC_OUT)) if (copy_to_user((void __user *)arg, &buf, size)) return -EFAULT; } return err; }
0
141,981
void NumberFormatTest::TestFormatCurrencyPlural() { UErrorCode status = U_ZERO_ERROR; Locale locale = Locale::createCanonical("en_US"); NumberFormat *fmt = NumberFormat::createInstance(locale, UNUM_CURRENCY_PLURAL, status); if (U_FAILURE(status)) { dataerrln("Error creating NumberFormat - %s", u_errorName(status)); return; } UnicodeString formattedNum; fmt->format(11234.567, formattedNum, NULL, status); assertEquals("", "11,234.57 US dollars", formattedNum); delete fmt; }
0
168,257
smp_fetch_url(const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn; CHECK_HTTP_MESSAGE_FIRST(); txn = smp->strm->txn; smp->data.type = SMP_T_STR; smp->data.u.str.len = txn->req.sl.rq.u_l; smp->data.u.str.str = txn->req.chn->buf->p + txn->req.sl.rq.u; smp->flags = SMP_F_VOL_1ST | SMP_F_CONST; return 1; }
0
215,145
GLvoid StubGLDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) { glDrawElements(mode, count, type, indices); }
0
475,739
static int nf_tables_delflowtable(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr * const nla[]) { const struct nfgenmsg *nfmsg = nlmsg_data(info->nlh); struct netlink_ext_ack *extack = info->extack; u8 genmask = nft_genmask_next(info->net); int family = nfmsg->nfgen_family; struct nft_flowtable *flowtable; struct net *net = info->net; const struct nlattr *attr; struct nft_table *table; struct nft_ctx ctx; if (!nla[NFTA_FLOWTABLE_TABLE] || (!nla[NFTA_FLOWTABLE_NAME] && !nla[NFTA_FLOWTABLE_HANDLE])) return -EINVAL; table = nft_table_lookup(net, nla[NFTA_FLOWTABLE_TABLE], family, genmask, NETLINK_CB(skb).portid); if (IS_ERR(table)) { NL_SET_BAD_ATTR(extack, nla[NFTA_FLOWTABLE_TABLE]); return PTR_ERR(table); } if (nla[NFTA_FLOWTABLE_HANDLE]) { attr = nla[NFTA_FLOWTABLE_HANDLE]; flowtable = nft_flowtable_lookup_byhandle(table, attr, genmask); } else { attr = nla[NFTA_FLOWTABLE_NAME]; flowtable = nft_flowtable_lookup(table, attr, genmask); } if (IS_ERR(flowtable)) { NL_SET_BAD_ATTR(extack, attr); return PTR_ERR(flowtable); } nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla); if (nla[NFTA_FLOWTABLE_HOOK]) return nft_delflowtable_hook(&ctx, flowtable); if (flowtable->use > 0) { NL_SET_BAD_ATTR(extack, attr); return -EBUSY; } return nft_delflowtable(&ctx, flowtable); }
0
138,595
void *UntrustedCacheMalloc::Malloc(size_t size) { // Don't access UnturstedCacheMalloc if not running on normal heap, otherwise // it will cause error when UntrustedCacheMalloc tries to free the memory on // the normal heap. if (is_destroyed_ || (size > kPoolEntrySize) || GetSwitchedHeapNext()) { return primitives::TrustedPrimitives::UntrustedLocalAlloc(size); } return GetBuffer(); }
0
159,976
string_heap_init (MonoDynamicStream *sh) { sh->index = 0; sh->alloc_size = 4096; sh->data = g_malloc (4096); sh->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); string_heap_insert (sh, ""); }
0
201,635
BrowserLauncherItemController::~BrowserLauncherItemController() { tab_model_->RemoveObserver(this); window_->RemoveObserver(this); if (launcher_id() > 0) launcher_controller()->CloseLauncherItem(launcher_id()); }
0
37,535
BasicStringRef( const std::experimental::basic_string_view<Char, std::char_traits<Char>> &s) : data_(s.data()), size_(s.size()) {}
0
141,189
PJ_DEF(pj_xml_attr*) pj_xml_find_attr( const pj_xml_node *node, const pj_str_t *name, const pj_str_t *value) { const pj_xml_attr *attr = node->attr_head.next; while (attr != (void*)&node->attr_head) { if (pj_stricmp(&attr->name, name)==0) { if (value) { if (pj_stricmp(&attr->value, value)==0) return (pj_xml_attr*)attr; } else { return (pj_xml_attr*)attr; } } attr = attr->next; } return NULL; }
0
41,334
static int32_t next_hfs_char(const char **in, size_t *len) { while (*len) { int32_t codepoint; int cp_len = git__utf8_iterate((const uint8_t *)(*in), (int)(*len), &codepoint); if (cp_len < 0) return -1; (*in) += cp_len; (*len) -= cp_len; /* these code points are ignored completely */ switch (codepoint) { case 0x200c: /* ZERO WIDTH NON-JOINER */ case 0x200d: /* ZERO WIDTH JOINER */ case 0x200e: /* LEFT-TO-RIGHT MARK */ case 0x200f: /* RIGHT-TO-LEFT MARK */ case 0x202a: /* LEFT-TO-RIGHT EMBEDDING */ case 0x202b: /* RIGHT-TO-LEFT EMBEDDING */ case 0x202c: /* POP DIRECTIONAL FORMATTING */ case 0x202d: /* LEFT-TO-RIGHT OVERRIDE */ case 0x202e: /* RIGHT-TO-LEFT OVERRIDE */ case 0x206a: /* INHIBIT SYMMETRIC SWAPPING */ case 0x206b: /* ACTIVATE SYMMETRIC SWAPPING */ case 0x206c: /* INHIBIT ARABIC FORM SHAPING */ case 0x206d: /* ACTIVATE ARABIC FORM SHAPING */ case 0x206e: /* NATIONAL DIGIT SHAPES */ case 0x206f: /* NOMINAL DIGIT SHAPES */ case 0xfeff: /* ZERO WIDTH NO-BREAK SPACE */ continue; } /* fold into lowercase -- this will only fold characters in * the ASCII range, which is perfectly fine, because the * git folder name can only be composed of ascii characters */ return git__tolower(codepoint); } return 0; /* NULL byte -- end of string */ }
0
347,093
QPDFObjectHandle::parseInternal(PointerHolder<InputSource> input, std::string const& object_description, QPDFTokenizer& tokenizer, bool& empty, StringDecrypter* decrypter, QPDF* context, bool in_array, bool in_dictionary, bool content_stream) { empty = false; if (in_dictionary && in_array) { // Although dictionaries and arrays arbitrarily nest, these // variables indicate what is at the top of the stack right // now, so they can, by definition, never both be true. throw std::logic_error( "INTERNAL ERROR: parseInternal: in_dict && in_array"); } QPDFObjectHandle object; qpdf_offset_t offset = input->tell(); std::vector<QPDFObjectHandle> olist; bool done = false; while (! done) { object = QPDFObjectHandle(); QPDFTokenizer::Token token = tokenizer.readToken(input, object_description); switch (token.getType()) { case QPDFTokenizer::tt_eof: if (content_stream) { // Return uninitialized object to indicate EOF return object; } else { // When not in content stream mode, EOF is tt_bad and // throws an exception before we get here. throw std::logic_error( "EOF received while not in content stream mode"); } break; case QPDFTokenizer::tt_brace_open: case QPDFTokenizer::tt_brace_close: // Don't know what to do with these for now QTC::TC("qpdf", "QPDFObjectHandle bad brace"); throw QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, input->getLastOffset(), "unexpected brace token"); break; case QPDFTokenizer::tt_array_close: if (in_array) { done = true; } else { QTC::TC("qpdf", "QPDFObjectHandle bad array close"); throw QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, input->getLastOffset(), "unexpected array close token"); } break; case QPDFTokenizer::tt_dict_close: if (in_dictionary) { done = true; } else { QTC::TC("qpdf", "QPDFObjectHandle bad dictionary close"); throw QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, input->getLastOffset(), "unexpected dictionary close token"); } break; case QPDFTokenizer::tt_array_open: object = parseInternal( input, object_description, tokenizer, empty, decrypter, context, true, false, content_stream); break; case QPDFTokenizer::tt_dict_open: object = parseInternal( input, object_description, tokenizer, empty, decrypter, context, false, true, content_stream); break; case QPDFTokenizer::tt_bool: object = newBool((token.getValue() == "true")); break; case QPDFTokenizer::tt_null: object = newNull(); break; case QPDFTokenizer::tt_integer: object = newInteger(QUtil::string_to_ll(token.getValue().c_str())); break; case QPDFTokenizer::tt_real: object = newReal(token.getValue()); break; case QPDFTokenizer::tt_name: object = newName(token.getValue()); break; case QPDFTokenizer::tt_word: { std::string const& value = token.getValue(); if ((value == "R") && (in_array || in_dictionary) && (olist.size() >= 2) && (! olist.at(olist.size() - 1).isIndirect()) && (olist.at(olist.size() - 1).isInteger()) && (! olist.at(olist.size() - 2).isIndirect()) && (olist.at(olist.size() - 2).isInteger())) { if (context == 0) { QTC::TC("qpdf", "QPDFObjectHandle indirect without context"); throw std::logic_error( "QPDFObjectHandle::parse called without context" " on an object with indirect references"); } // Try to resolve indirect objects object = newIndirect( context, olist.at(olist.size() - 2).getIntValue(), olist.at(olist.size() - 1).getIntValue()); olist.pop_back(); olist.pop_back(); } else if ((value == "endobj") && (! (in_array || in_dictionary))) { // We just saw endobj without having read // anything. Treat this as a null and do not move // the input source's offset. object = newNull(); input->seek(input->getLastOffset(), SEEK_SET); empty = true; } else if (content_stream) { object = QPDFObjectHandle::newOperator(token.getValue()); } else { throw QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, input->getLastOffset(), "unknown token while reading object (" + value + ")"); } } break; case QPDFTokenizer::tt_string: { std::string val = token.getValue(); if (decrypter) { decrypter->decryptString(val); } object = QPDFObjectHandle::newString(val); } break; default: throw QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, input->getLastOffset(), "unknown token type while reading object"); break; } if (in_dictionary || in_array) { if (! done) { olist.push_back(object); } } else if (! object.isInitialized()) { throw QPDFExc(qpdf_e_damaged_pdf, input->getName(), object_description, input->getLastOffset(), "parse error while reading object"); } else { done = true; } } if (in_array) { object = newArray(olist); } else if (in_dictionary) { // Convert list to map. Alternating elements are keys. std::map<std::string, QPDFObjectHandle> dict; if (olist.size() % 2) { QTC::TC("qpdf", "QPDFObjectHandle dictionary odd number of elements"); throw QPDFExc( qpdf_e_damaged_pdf, input->getName(), object_description, input->getLastOffset(), "dictionary ending here has an odd number of elements"); } for (unsigned int i = 0; i < olist.size(); i += 2) { QPDFObjectHandle key_obj = olist.at(i); QPDFObjectHandle val = olist.at(i + 1); if (! key_obj.isName()) { throw QPDFExc( qpdf_e_damaged_pdf, input->getName(), object_description, offset, std::string("dictionary key not name (") + key_obj.unparse() + ")"); } dict[key_obj.getName()] = val; } object = newDictionary(dict); } return object; }
1
140,767
set_last_insert(int c) { char_u *s; vim_free(last_insert); last_insert = alloc(MB_MAXBYTES * 3 + 5); if (last_insert != NULL) { s = last_insert; // Use the CTRL-V only when entering a special char if (c < ' ' || c == DEL) *s++ = Ctrl_V; s = add_char2buf(c, s); *s++ = ESC; *s++ = NUL; last_insert_skip = 0; } }
0
70,218
static void xmlrpc_append_char_encode(mowgli_string_t *s, const char *s1) { long unsigned int i; unsigned char c; char buf2[15]; if ((!(s1) || (*(s1) == '\0'))) { return; } for (i = 0; s1[i] != '\0'; i++) { c = s1[i]; if (c > 127) { snprintf(buf2, sizeof buf2, "&#%d;", c); s->append(s, buf2, strlen(buf2)); } else if (c == '&') { s->append(s, "&amp;", 5); } else if (c == '<') { s->append(s, "&lt;", 4); } else if (c == '>') { s->append(s, "&gt;", 4); } else if (c == '"') { s->append(s, "&quot;", 6); } else { s->append_char(s, c); } } }
0
30,518
static tmsize_t _tiffWriteProc ( thandle_t fd , void * buf , tmsize_t size ) { uint8 * ma ; uint64 mb ; DWORD n ; DWORD o ; tmsize_t p ; ma = ( uint8 * ) buf ; mb = size ; p = 0 ; while ( mb > 0 ) { n = 0x80000000UL ; if ( ( uint64 ) n > mb ) n = ( DWORD ) mb ; if ( ! WriteFile ( fd , ( LPVOID ) ma , n , & o , NULL ) ) return ( 0 ) ; ma += o ; mb -= o ; p += o ; if ( o != n ) break ; } return ( p ) ; }
0
471,754
void quicklistInsertAfter(quicklist *quicklist, quicklistEntry *entry, void *value, const size_t sz) { _quicklistInsert(quicklist, entry, value, sz, 1); }
0
148,419
bool HHVM_FUNCTION(imagejpeg, const Resource& image, const String& filename /* = null_string */, int64_t quality /* = -1 */) { return _php_image_output_ctx(image, filename, quality, -1, PHP_GDIMG_TYPE_JPG, "JPEG", (void (*)())gdImageJpegCtx); }
0
135,089
static Image *ReadGROUP4Image(const ImageInfo *image_info, ExceptionInfo *exception) { char filename[MaxTextExtent]; FILE *file; Image *image; ImageInfo *read_info; int c, unique_file; MagickBooleanType status; size_t length; ssize_t offset, strip_offset; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Write raw CCITT Group 4 wrapped as a TIFF image file. */ file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(filename); if (unique_file != -1) file=fdopen(unique_file,"wb"); if ((unique_file == -1) || (file == (FILE *) NULL)) ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile"); length=fwrite("\111\111\052\000\010\000\000\000\016\000",1,10,file); if (length != 10) ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); length=fwrite("\376\000\003\000\001\000\000\000\000\000\000\000",1,12,file); length=fwrite("\000\001\004\000\001\000\000\000",1,8,file); length=WriteLSBLong(file,(unsigned int) image->columns); length=fwrite("\001\001\004\000\001\000\000\000",1,8,file); length=WriteLSBLong(file,(unsigned int) image->rows); length=fwrite("\002\001\003\000\001\000\000\000\001\000\000\000",1,12,file); length=fwrite("\003\001\003\000\001\000\000\000\004\000\000\000",1,12,file); length=fwrite("\006\001\003\000\001\000\000\000\000\000\000\000",1,12,file); length=fwrite("\021\001\003\000\001\000\000\000",1,8,file); strip_offset=10+(12*14)+4+8; length=WriteLSBLong(file,(unsigned int) strip_offset); length=fwrite("\022\001\003\000\001\000\000\000",1,8,file); length=WriteLSBLong(file,(unsigned int) image_info->orientation); length=fwrite("\025\001\003\000\001\000\000\000\001\000\000\000",1,12,file); length=fwrite("\026\001\004\000\001\000\000\000",1,8,file); length=WriteLSBLong(file,(unsigned int) image->rows); length=fwrite("\027\001\004\000\001\000\000\000\000\000\000\000",1,12,file); offset=(ssize_t) ftell(file)-4; length=fwrite("\032\001\005\000\001\000\000\000",1,8,file); length=WriteLSBLong(file,(unsigned int) (strip_offset-8)); length=fwrite("\033\001\005\000\001\000\000\000",1,8,file); length=WriteLSBLong(file,(unsigned int) (strip_offset-8)); length=fwrite("\050\001\003\000\001\000\000\000\002\000\000\000",1,12,file); length=fwrite("\000\000\000\000",1,4,file); length=WriteLSBLong(file,(unsigned int) image->x_resolution); length=WriteLSBLong(file,1); status=MagickTrue; for (length=0; (c=ReadBlobByte(image)) != EOF; length++) if (fputc(c,file) != c) status=MagickFalse; offset=(ssize_t) fseek(file,(ssize_t) offset,SEEK_SET); length=WriteLSBLong(file,(unsigned int) length); if (ferror(file) != 0) { (void) fclose(file); ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile"); } (void) fclose(file); (void) CloseBlob(image); image=DestroyImage(image); /* Read TIFF image. */ read_info=CloneImageInfo((ImageInfo *) NULL); (void) FormatLocaleString(read_info->filename,MaxTextExtent,"%s",filename); image=ReadTIFFImage(read_info,exception); read_info=DestroyImageInfo(read_info); if (image != (Image *) NULL) { (void) CopyMagickString(image->filename,image_info->filename, MaxTextExtent); (void) CopyMagickString(image->magick_filename,image_info->filename, MaxTextExtent); (void) CopyMagickString(image->magick,"GROUP4",MaxTextExtent); } (void) RelinquishUniqueFileResource(filename); if (status == MagickFalse) image=DestroyImage(image); return(image); }
0
411,821
zzip_mem_entry_find_extra_block(ZZIP_MEM_ENTRY * entry, short datatype, zzip_size_t blocksize) { int i = 2; while (1) { char* ext = (char*)( entry->zz_ext[i] ); char* ext_end = ext + entry->zz_extlen[i]; if (ext) { /* * Make sure that * 1) the extra block header * AND * 2) the block we're looking for * fit into the extra block! */ while (ext + zzip_extra_block_headerlength + blocksize <= ext_end) { if (datatype == zzip_extra_block_get_datatype(ext)) { if (blocksize <= zzip_extra_block_get_datasize(ext) + zzip_extra_block_headerlength) { return ((ZZIP_EXTRA_BLOCK*) ext); } } /* skip to start of next extra_block */ ___ zzip_size_t datasize = zzip_extra_block_get_datasize(ext); ext += zzip_extra_block_headerlength; ext += datasize; ____; } } if (! i) return 0; i--; } }
0
115,344
TestUtilOptions& setExpectNoCert() { expect_no_cert_ = true; return *this; }
0
269,594
ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, u8 type, u8 code, int offset, __be32 info) { int rel_msg = 0; u8 rel_type = type; u8 rel_code = code; __u32 rel_info = ntohl(info); int err; struct sk_buff *skb2; struct iphdr *eiph; struct flowi fl; struct rtable *rt; err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code, &rel_msg, &rel_info, offset); if (err < 0) return err; if (rel_msg == 0) return 0; switch (rel_type) { case ICMPV6_DEST_UNREACH: if (rel_code != ICMPV6_ADDR_UNREACH) return 0; rel_type = ICMP_DEST_UNREACH; rel_code = ICMP_HOST_UNREACH; break; case ICMPV6_PKT_TOOBIG: if (rel_code != 0) return 0; rel_type = ICMP_DEST_UNREACH; rel_code = ICMP_FRAG_NEEDED; break; default: return 0; } if (!pskb_may_pull(skb, offset + sizeof(struct iphdr))) return 0; skb2 = skb_clone(skb, GFP_ATOMIC); if (!skb2) return 0; skb_dst_drop(skb2); skb_pull(skb2, offset); skb_reset_network_header(skb2); eiph = ip_hdr(skb2); /* Try to guess incoming interface */ memset(&fl, 0, sizeof(fl)); fl.fl4_dst = eiph->saddr; fl.fl4_tos = RT_TOS(eiph->tos); fl.proto = IPPROTO_IPIP; if (ip_route_output_key(dev_net(skb->dev), &rt, &fl)) goto out; skb2->dev = rt->u.dst.dev; /* route "incoming" packet */ if (rt->rt_flags & RTCF_LOCAL) { ip_rt_put(rt); rt = NULL; fl.fl4_dst = eiph->daddr; fl.fl4_src = eiph->saddr; fl.fl4_tos = eiph->tos; if (ip_route_output_key(dev_net(skb->dev), &rt, &fl) || rt->u.dst.dev->type != ARPHRD_TUNNEL) { ip_rt_put(rt); goto out; } skb_dst_set(skb2, (struct dst_entry *)rt); } else { ip_rt_put(rt); if (ip_route_input(skb2, eiph->daddr, eiph->saddr, eiph->tos, skb2->dev) || skb_dst(skb2)->dev->type != ARPHRD_TUNNEL) goto out; } /* change mtu on this route */ if (rel_type == ICMP_DEST_UNREACH && rel_code == ICMP_FRAG_NEEDED) { if (rel_info > dst_mtu(skb_dst(skb2))) goto out; skb_dst(skb2)->ops->update_pmtu(skb_dst(skb2), rel_info); } icmp_send(skb2, rel_type, rel_code, htonl(rel_info)); out: kfree_skb(skb2); return 0; }
0
130,825
removable(char_u *name) { char_u *p; char_u part[51]; int retval = FALSE; size_t n; name = home_replace_save(NULL, name); if (name != NULL) { for (p = p_viminfo; *p; ) { copy_option_part(&p, part, 51, ", "); if (part[0] == 'r') { n = STRLEN(part + 1); if (MB_STRNICMP(part + 1, name, n) == 0) { retval = TRUE; break; } } } vim_free(name); } return retval; }
0
372,701
void CLASS phase_one_flat_field (int is_float, int nc) { ushort head[8]; unsigned wide, y, x, c, rend, cend, row, col; float *mrow, num, mult[4]; read_shorts (head, 8); wide = head[2] / head[4]; mrow = (float *) calloc (nc*wide, sizeof *mrow); merror (mrow, "phase_one_flat_field()"); for (y=0; y < head[3] / head[5]; y++) { for (x=0; x < wide; x++) for (c=0; c < nc; c+=2) { num = is_float ? getreal(11) : get2()/32768.0; if (y==0) mrow[c*wide+x] = num; else mrow[(c+1)*wide+x] = (num - mrow[c*wide+x]) / head[5]; } if (y==0) continue; rend = head[1]-top_margin + y*head[5]; for (row = rend-head[5]; row < height && row < rend; row++) { for (x=1; x < wide; x++) { for (c=0; c < nc; c+=2) { mult[c] = mrow[c*wide+x-1]; mult[c+1] = (mrow[c*wide+x] - mult[c]) / head[4]; } cend = head[0]-left_margin + x*head[4]; for (col = cend-head[4]; col < width && col < cend; col++) { c = nc > 2 ? FC(row,col) : 0; if (!(c & 1)) { c = BAYER(row,col) * mult[c]; BAYER(row,col) = LIM(c,0,65535); } for (c=0; c < nc; c+=2) mult[c] += mult[c+1]; } } for (x=0; x < wide; x++) for (c=0; c < nc; c+=2) mrow[c*wide+x] += mrow[(c+1)*wide+x]; } } free (mrow); }
0
475,894
void nft_data_release(const struct nft_data *data, enum nft_data_types type) { if (type < NFT_DATA_VERDICT) return; switch (type) { case NFT_DATA_VERDICT: return nft_verdict_uninit(data); default: WARN_ON(1); } }
0
210,592
void HostCache::OnNetworkChange() { ++network_changes_; }
0
378,384
sdap_initgr_store_user_memberships(struct sdap_initgr_nested_state *state) { errno_t ret; int tret; const char *orig_dn; char **sysdb_parent_name_list = NULL; char **ldap_parent_name_list = NULL; int nparents; struct sysdb_attrs **ldap_parentlist; struct ldb_message_element *el; int i, mi; char **add_groups; char **del_groups; TALLOC_CTX *tmp_ctx; bool in_transaction = false; tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { ret = ENOMEM; goto done; } /* Get direct LDAP parents */ ret = sysdb_attrs_get_string(state->user, SYSDB_ORIG_DN, &orig_dn); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, "The user has no original DN\n"); goto done; } ldap_parentlist = talloc_zero_array(tmp_ctx, struct sysdb_attrs *, state->groups_cur + 1); if (!ldap_parentlist) { ret = ENOMEM; goto done; } nparents = 0; for (i=0; i < state->groups_cur ; i++) { ret = sysdb_attrs_get_el(state->groups[i], SYSDB_MEMBER, &el); if (ret) { DEBUG(SSSDBG_MINOR_FAILURE, "A group with no members during initgroups?\n"); goto done; } for (mi = 0; mi < el->num_values; mi++) { if (strcasecmp((const char *) el->values[mi].data, orig_dn) != 0) { continue; } ldap_parentlist[nparents] = state->groups[i]; nparents++; } } DEBUG(SSSDBG_TRACE_LIBS, "The user %s is a direct member of %d LDAP groups\n", state->username, nparents); if (nparents == 0) { ldap_parent_name_list = NULL; } else { ret = sysdb_attrs_primary_name_list(state->sysdb, tmp_ctx, ldap_parentlist, nparents, state->opts->group_map[SDAP_AT_GROUP_NAME].name, &ldap_parent_name_list); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "sysdb_attrs_primary_name_list failed [%d]: %s\n", ret, strerror(ret)); goto done; } } ret = sysdb_get_direct_parents(tmp_ctx, state->sysdb, state->dom, SYSDB_MEMBER_USER, state->username, &sysdb_parent_name_list); if (ret) { DEBUG(SSSDBG_CRIT_FAILURE, "Could not get direct sysdb parents for %s: %d [%s]\n", state->username, ret, strerror(ret)); goto done; } ret = diff_string_lists(tmp_ctx, ldap_parent_name_list, sysdb_parent_name_list, &add_groups, &del_groups, NULL); if (ret != EOK) { goto done; } ret = sysdb_transaction_start(state->sysdb); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n"); goto done; } in_transaction = true; DEBUG(SSSDBG_TRACE_INTERNAL, "Updating memberships for %s\n", state->username); ret = sysdb_update_members(state->sysdb, state->dom, state->username, SYSDB_MEMBER_USER, (const char *const *) add_groups, (const char *const *) del_groups); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "Could not update sysdb memberships for %s: %d [%s]\n", state->username, ret, strerror(ret)); goto done; } ret = sysdb_transaction_commit(state->sysdb); if (ret != EOK) { goto done; } in_transaction = false; ret = EOK; done: if (in_transaction) { tret = sysdb_transaction_cancel(state->sysdb); if (tret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "Failed to cancel transaction\n"); } } talloc_zfree(tmp_ctx); return ret; }
0
165,703
void webkitWebViewBaseInitializeFullScreenClient(WebKitWebViewBase* webkitWebViewBase, const WKFullScreenClientGtk* wkClient) { webkitWebViewBase->priv->fullScreenClient.initialize(wkClient); }
0
237,600
static void virtio_net_instance_init(Object *obj) { VirtIONet *n = VIRTIO_NET(obj); /* * The default config_size is sizeof(struct virtio_net_config). * Can be overriden with virtio_net_set_config_size. */ n->config_size = sizeof(struct virtio_net_config); }
0
208,196
void IPCThreadState::blockUntilThreadAvailable() { pthread_mutex_lock(&mProcess->mThreadCountLock); while (mProcess->mExecutingThreadsCount >= mProcess->mMaxThreads) { ALOGW("Waiting for thread to be free. mExecutingThreadsCount=%lu mMaxThreads=%lu\n", static_cast<unsigned long>(mProcess->mExecutingThreadsCount), static_cast<unsigned long>(mProcess->mMaxThreads)); pthread_cond_wait(&mProcess->mThreadCountDecrement, &mProcess->mThreadCountLock); } pthread_mutex_unlock(&mProcess->mThreadCountLock); }
0
302,802
static inline void paravirt_release_pte(unsigned long pfn) { PVOP_VCALL1(mmu.release_pte, pfn); }
0
210,594
void Element::unregisterNamedFlowContentNode() { if (RuntimeEnabledFeatures::cssRegionsEnabled() && inNamedFlow() && document()->renderView()) document()->renderView()->flowThreadController()->unregisterNamedFlowContentNode(this); }
0
6,308
ConnectClientToUnixSock(const char *sockFile) { #ifdef WIN32 rfbClientErr("Windows doesn't support UNIX sockets\n"); return -1; #else int sock; struct sockaddr_un addr; addr.sun_family = AF_UNIX; strcpy(addr.sun_path, sockFile); sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { rfbClientErr("ConnectToUnixSock: socket (%s)\n",strerror(errno)); return -1; } if (connect(sock, (struct sockaddr *)&addr, sizeof(addr.sun_family) + strlen(addr.sun_path)) < 0) { rfbClientErr("ConnectToUnixSock: connect\n"); close(sock); return -1; } return sock; #endif }
1
200,083
static void addBitsToStream(size_t* bitpointer, ucvector* bitstream, unsigned value, size_t nbits) { size_t i; for(i = 0; i < nbits; i++) addBitToStream(bitpointer, bitstream, (unsigned char)((value >> i) & 1)); }
0
90,914
void VariableUnserializer::addSleepingObject(const Object& o) { m_sleepingObjects.emplace_back(o); }
0
205,258
static MegasasCmd *megasas_enqueue_frame(MegasasState *s, hwaddr frame, uint64_t context, int count) { PCIDevice *pcid = PCI_DEVICE(s); MegasasCmd *cmd = NULL; int frame_size = MFI_FRAME_SIZE * 16; hwaddr frame_size_p = frame_size; unsigned long index; index = 0; while (index < s->fw_cmds) { index = find_next_zero_bit(s->frame_map, s->fw_cmds, index); if (!s->frames[index].pa) break; /* Busy frame found */ trace_megasas_qf_mapped(index); } if (index >= s->fw_cmds) { /* All frames busy */ trace_megasas_qf_busy(frame); return NULL; } cmd = &s->frames[index]; set_bit(index, s->frame_map); trace_megasas_qf_new(index, frame); cmd->pa = frame; /* Map all possible frames */ cmd->frame = pci_dma_map(pcid, frame, &frame_size_p, 0); if (frame_size_p != frame_size) { trace_megasas_qf_map_failed(cmd->index, (unsigned long)frame); if (cmd->frame) { megasas_unmap_frame(s, cmd); } s->event_count++; return NULL; } cmd->pa_size = frame_size_p; cmd->context = context; if (!megasas_use_queue64(s)) { cmd->context &= (uint64_t)0xFFFFFFFF; } cmd->count = count; s->busy++; if (s->consumer_pa) { s->reply_queue_tail = ldl_le_pci_dma(pcid, s->consumer_pa); } trace_megasas_qf_enqueue(cmd->index, cmd->count, cmd->context, s->reply_queue_head, s->reply_queue_tail, s->busy); return cmd; }
0
231,783
SPL_METHOD(FilesystemIterator, __construct) { spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAM_PASSTHRU, DIT_CTOR_FLAGS | SPL_FILE_DIR_SKIPDOTS); }
0
469,953
pa2la(UINT8 *out, const UINT8 *in, int xsize, const UINT8 *palette) { int x; /* FIXME: precalculate greyscale palette? */ for (x = 0; x < xsize; x++, in += 4, out += 4) { out[0] = out[1] = out[2] = L(&palette[in[0] * 4]) / 1000; out[3] = in[3]; } }
0
104,483
sector_t bmap(struct inode *inode, sector_t block) { sector_t res = 0; if (inode->i_mapping->a_ops->bmap) res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block); return res; }
0
105,325
void megaraid_sas_kill_hba(struct megasas_instance *instance) { /* Set critical error to block I/O & ioctls in case caller didn't */ atomic_set(&instance->adprecovery, MEGASAS_HW_CRITICAL_ERROR); /* Wait 1 second to ensure IO or ioctls in build have posted */ msleep(1000); if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || (instance->adapter_type != MFI_SERIES)) { if (!instance->requestorId) { writel(MFI_STOP_ADP, &instance->reg_set->doorbell); /* Flush */ readl(&instance->reg_set->doorbell); } if (instance->requestorId && instance->peerIsPresent) memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS); } else { writel(MFI_STOP_ADP, &instance->reg_set->inbound_doorbell); } /* Complete outstanding ioctls when adapter is killed */ megasas_complete_outstanding_ioctls(instance); }
0
468,953
static int __kvm_write_guest_page(struct kvm *kvm, struct kvm_memory_slot *memslot, gfn_t gfn, const void *data, int offset, int len) { int r; unsigned long addr; addr = gfn_to_hva_memslot(memslot, gfn); if (kvm_is_error_hva(addr)) return -EFAULT; r = __copy_to_user((void __user *)addr + offset, data, len); if (r) return -EFAULT; mark_page_dirty_in_slot(kvm, memslot, gfn); return 0; }
0
50,302
would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr);
0
138,286
explicit BoostedTreesPredictOp(OpKernelConstruction* const context) : OpKernel(context) { OP_REQUIRES_OK(context, context->GetAttr("num_bucketized_features", &num_bucketized_features_)); OP_REQUIRES_OK(context, context->GetAttr("logits_dimension", &logits_dimension_)); }
0
243,351
void HostNPScriptObject::OnSignallingConnected(SignalStrategy* signal_strategy, const std::string& full_jid) { }
0
420,249
initIoQ(void) { DEFiRet; CHKiConcCtrl(pthread_mutex_init(&io_q.mut, NULL)); CHKiConcCtrl(pthread_cond_init(&io_q.wakeup_worker, NULL)); STAILQ_INIT(&io_q.q); io_q.sz = 0; io_q.ctrMaxSz = 0; /* TODO: discuss this and fix potential concurrent read/write issues */ CHKiRet(statsobj.Construct(&io_q.stats)); CHKiRet(statsobj.SetName(io_q.stats, (uchar*) "io-work-q")); CHKiRet(statsobj.SetOrigin(io_q.stats, (uchar*) "imptcp")); STATSCOUNTER_INIT(io_q.ctrEnq, io_q.mutCtrEnq); CHKiRet(statsobj.AddCounter(io_q.stats, UCHAR_CONSTANT("enqueued"), ctrType_IntCtr, CTR_FLAG_RESETTABLE, &io_q.ctrEnq)); CHKiRet(statsobj.AddCounter(io_q.stats, UCHAR_CONSTANT("maxqsize"), ctrType_Int, CTR_FLAG_NONE, &io_q.ctrMaxSz)); CHKiRet(statsobj.ConstructFinalize(io_q.stats)); finalize_it: RETiRet; }
0
3,290
static plist_t parse_bin_node(struct bplist_data *bplist, const char** object) { uint16_t type = 0; uint64_t size = 0; if (!object) return NULL; type = (**object) & BPLIST_MASK; size = (**object) & BPLIST_FILL; (*object)++; if (size == BPLIST_FILL) { switch (type) { case BPLIST_DATA: case BPLIST_STRING: case BPLIST_UNICODE: case BPLIST_ARRAY: case BPLIST_SET: case BPLIST_DICT: { uint16_t next_size = **object & BPLIST_FILL; if ((**object & BPLIST_MASK) != BPLIST_UINT) { PLIST_BIN_ERR("%s: invalid size node type for node type 0x%02x: found 0x%02x, expected 0x%02x\n", __func__, type, **object & BPLIST_MASK, BPLIST_UINT); return NULL; } (*object)++; next_size = 1 << next_size; if (*object + next_size > bplist->offset_table) { PLIST_BIN_ERR("%s: size node data bytes for node type 0x%02x point outside of valid range\n", __func__, type); return NULL; } size = UINT_TO_HOST(*object, next_size); (*object) += next_size; break; } default: break; } } switch (type) { case BPLIST_NULL: switch (size) { case BPLIST_TRUE: { plist_data_t data = plist_new_plist_data(); data->type = PLIST_BOOLEAN; data->boolval = TRUE; data->length = 1; return node_create(NULL, data); } case BPLIST_FALSE: { plist_data_t data = plist_new_plist_data(); data->type = PLIST_BOOLEAN; data->boolval = FALSE; data->length = 1; return node_create(NULL, data); } case BPLIST_NULL: default: return NULL; } case BPLIST_UINT: if (*object + (uint64_t)(1 << size) > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_UINT data bytes point outside of valid range\n", __func__); return NULL; } return parse_uint_node(object, size); case BPLIST_REAL: if (*object + (uint64_t)(1 << size) > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_REAL data bytes point outside of valid range\n", __func__); return NULL; } return parse_real_node(object, size); case BPLIST_DATE: if (3 != size) { PLIST_BIN_ERR("%s: invalid data size for BPLIST_DATE node\n", __func__); return NULL; } if (*object + (uint64_t)(1 << size) > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_DATE data bytes point outside of valid range\n", __func__); return NULL; } return parse_date_node(object, size); case BPLIST_DATA: if (*object + size > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_DATA data bytes point outside of valid range\n", __func__); return NULL; } return parse_data_node(object, size); case BPLIST_STRING: if (*object + size > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_STRING data bytes point outside of valid range\n", __func__); return NULL; } return parse_string_node(object, size); case BPLIST_UNICODE: if (size*2 < size) { PLIST_BIN_ERR("%s: Integer overflow when calculating BPLIST_UNICODE data size.\n", __func__); return NULL; } if (*object + size*2 > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_UNICODE data bytes point outside of valid range\n", __func__); return NULL; } return parse_unicode_node(object, size); case BPLIST_SET: case BPLIST_ARRAY: if (*object + size > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_ARRAY data bytes point outside of valid range\n", __func__); return NULL; } return parse_array_node(bplist, object, size); case BPLIST_UID: if (*object + size+1 > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_UID data bytes point outside of valid range\n", __func__); return NULL; } return parse_uid_node(object, size); case BPLIST_DICT: if (*object + size > bplist->offset_table) { PLIST_BIN_ERR("%s: BPLIST_REAL data bytes point outside of valid range\n", __func__); return NULL; } return parse_dict_node(bplist, object, size); default: PLIST_BIN_ERR("%s: unexpected node type 0x%02x\n", __func__, type); return NULL; } return NULL; }
1
317,222
void RenderWidgetHostImpl::StartInputEventAckTimeout(TimeDelta delay) { if (!input_event_ack_timeout_) return; input_event_ack_timeout_->Start(delay); input_event_ack_start_time_ = clock_->NowTicks(); }
0
112,336
spell_valid_case( int wordflags, // flags for the checked word. int treeflags) // flags for the word in the spell tree { return ((wordflags == WF_ALLCAP && (treeflags & WF_FIXCAP) == 0) || ((treeflags & (WF_ALLCAP | WF_KEEPCAP)) == 0 && ((treeflags & WF_ONECAP) == 0 || (wordflags & WF_ONECAP) != 0))); }
0
72,245
cdf_tole2(uint16_t sv) { return CDF_TOLE2(sv); }
0
40,046
static void cqspi_config_baudrate_div(struct cqspi_st *cqspi) { const unsigned int ref_clk_hz = cqspi->master_ref_clk_hz; void __iomem *reg_base = cqspi->iobase; u32 reg, div; /* Recalculate the baudrate divisor based on QSPI specification. */ div = DIV_ROUND_UP(ref_clk_hz, 2 * cqspi->sclk) - 1; reg = readl(reg_base + CQSPI_REG_CONFIG); reg &= ~(CQSPI_REG_CONFIG_BAUD_MASK << CQSPI_REG_CONFIG_BAUD_LSB); reg |= (div & CQSPI_REG_CONFIG_BAUD_MASK) << CQSPI_REG_CONFIG_BAUD_LSB; writel(reg, reg_base + CQSPI_REG_CONFIG); }
0
436,089
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } *lower = ENC_ISO_8859_15_TO_LOWER_CASE(*p); (*pp)++; return 1; /* return byte length of converted char to lower */ }
0
176,589
void AutoFillManager::OnInfoBarClosed(bool should_save) { if (should_save) personal_data_->SaveImportedCreditCard(); UploadFormData(); }
0
455,389
TEST_F(QueryPlannerTest, SparseIndexCannotSupportEqualsNull) { addIndex(BSON("i" << 1), false, // multikey true // sparse ); runQuery(fromjson("{i: {$eq: null}}")); assertHasOnlyCollscan(); }
0
307,883
void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FocusedNodeChanged(node)); }
0
20,974
void mime_hdr_describe ( HdrHeapObjImpl * raw , bool recurse ) { MIMEFieldBlockImpl * fblock ; MIMEHdrImpl * obj = ( MIMEHdrImpl * ) raw ; Debug ( "http" , "\n\t[PBITS: 0x%08X%08X, SLACC: 0x%04X%04X%04X%04X, HEADBLK: %p, TAILBLK: %p]" , ( uint32_t ) ( ( obj -> m_presence_bits >> 32 ) & ( TOK_64_CONST ( 0xFFFFFFFF ) ) ) , ( uint32_t ) ( ( obj -> m_presence_bits >> 0 ) & ( TOK_64_CONST ( 0xFFFFFFFF ) ) ) , obj -> m_slot_accelerators [ 0 ] , obj -> m_slot_accelerators [ 1 ] , obj -> m_slot_accelerators [ 2 ] , obj -> m_slot_accelerators [ 3 ] , & ( obj -> m_first_fblock ) , obj -> m_fblock_list_tail ) ; Debug ( "http" , "\t[CBITS: 0x%08X, T_MAXAGE: %d, T_SMAXAGE: %d, T_MAXSTALE: %d, T_MINFRESH: %d, PNO$: %d]" , obj -> m_cooked_stuff . m_cache_control . m_mask , obj -> m_cooked_stuff . m_cache_control . m_secs_max_age , obj -> m_cooked_stuff . m_cache_control . m_secs_s_maxage , obj -> m_cooked_stuff . m_cache_control . m_secs_max_stale , obj -> m_cooked_stuff . m_cache_control . m_secs_min_fresh , obj -> m_cooked_stuff . m_pragma . m_no_cache ) ; for ( fblock = & ( obj -> m_first_fblock ) ; fblock != nullptr ; fblock = fblock -> m_next ) { if ( recurse || ( fblock == & ( obj -> m_first_fblock ) ) ) { obj_describe ( ( HdrHeapObjImpl * ) fblock , recurse ) ; } } }
0
217,289
int SSLClientSocketOpenSSL::DoPayloadRead() { crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); int rv; if (pending_read_error_ != kNoPendingReadResult) { rv = pending_read_error_; pending_read_error_ = kNoPendingReadResult; if (rv == 0) { net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_RECEIVED, rv, user_read_buf_->data()); } return rv; } int total_bytes_read = 0; do { rv = SSL_read(ssl_, user_read_buf_->data() + total_bytes_read, user_read_buf_len_ - total_bytes_read); if (rv > 0) total_bytes_read += rv; } while (total_bytes_read < user_read_buf_len_ && rv > 0); if (total_bytes_read == user_read_buf_len_) { rv = total_bytes_read; } else { int *next_result = &rv; if (total_bytes_read > 0) { pending_read_error_ = rv; rv = total_bytes_read; next_result = &pending_read_error_; } if (client_auth_cert_needed_) { *next_result = ERR_SSL_CLIENT_AUTH_CERT_NEEDED; } else if (*next_result < 0) { int err = SSL_get_error(ssl_, *next_result); *next_result = MapOpenSSLError(err, err_tracer); if (rv > 0 && *next_result == ERR_IO_PENDING) { *next_result = kNoPendingReadResult; } } } if (rv >= 0) { net_log_.AddByteTransferEvent(NetLog::TYPE_SSL_SOCKET_BYTES_RECEIVED, rv, user_read_buf_->data()); } return rv; }
0
272,262
static void task_ctx_sched_out(struct perf_cpu_context *cpuctx, struct perf_event_context *ctx, enum event_type_t event_type) { if (!cpuctx->task_ctx) return; if (WARN_ON_ONCE(ctx != cpuctx->task_ctx)) return; ctx_sched_out(ctx, cpuctx, event_type); }
0
125,552
static int __net_init tcpv6_net_init(struct net *net) { return inet_ctl_sock_create(&net->ipv6.tcp_sk, PF_INET6, SOCK_RAW, IPPROTO_TCP, net); }
0